5 * SourceForge: Breaking Down the Barriers to Open Source Development
6 * Copyright 1999-2001 (c) VA Linux Systems
7 * http://sourceforge.net
13 * reports_quick_graph() - Show a quick graph of data.
15 * @param string Graph title
16 * @param int First query resource ID
17 * @param int Second query resource ID
18 * @param string The bar colors
20 function reports_quick_graph($title,$qpa1,$qpa2,$bar_colors) {
21 $result1=db_query_qpa($qpa1);
22 $result2=db_query_qpa($qpa2);
23 if ($result1 && $result2 && db_numrows($result2) > 0) {
25 $assoc_open=util_result_columns_to_assoc($result1);
26 $assoc_all=util_result_columns_to_assoc($result2);
27 while (list($key,$val)=each($assoc_all)) {
30 if ($assoc_open[$key]) $open[]=$assoc_open[$key];
34 /* for ($i=0; $i<db_numrows($result1); $i++) {
35 echo "$titles[$i]=>$opened[$i]/$all[$i]<br />";
38 $scale=graph_calculate_scale(array($opened,$all),400);
39 $props["scale"]=$scale;
40 $props["cellspacing"]=5;
41 $props = hv_graph_defaults($props);
42 start_graph($props, $titles);
44 horizontal_multisection_graph(
52 print '<table cellspacing="0" border="0"><tr align="center"><td width="15%">'._('Key').':</td><td width="5%">(</td><td width="35%" style="background-color:'.$bar_colors[0].'">'._('Open').'</td>'.
53 '<td width="5%">/</td><td width="35%" style="background-color:'.$bar_colors[1].'">'._('All').' </td><td width="5%">)</td></tr></table>';
55 // GraphResult($result,$title);
57 echo "<h2>"._('No data found to report')."</h2>";
63 * reports_header() - Show the reports header
65 * @param int The group ID
66 * @param array Array of select box values
67 * @param string The select box title
68 * @param string Any additional HTML
70 function reports_header($group_id, $vals, $titles, $html='') {
75 print '<form method="get" action="'.getStringFromServer('PHP_SELF').'#b">';
79 print html_build_select_box_from_arrays ($vals,$titles,
82 $periods=array('day'=>'Last day','week'=>'Last week');
83 $vals=array('day','week','month','year','lifespan');
89 _('Project lifespan'));
91 if (!$period) $period="lifespan";
94 print html_build_select_box_from_arrays (
95 array('','1','4','7','12','14','30','52'),
96 array('','1','4','7','12','14','30','52'),
98 print html_build_select_box_from_arrays ($vals,$texts,'period',$period,false);
100 print "<input type=\"hidden\" name=\"group_id\" value=\"$group_id\" />";
101 print ' <input type="submit" value="'._('Show').'" />';
107 // c-file-style: "bsd"