4 * Copyright 1999-2001 (c) VA Linux Systems
5 * Copyright 2010, FusionForge Team
6 * Copyright (C) 2010-2011 Alain Peyrat - Alcatel-Lucent
7 * http://fusionforge.org
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * reports_quick_graph() - Show a quick graph of data.
28 * @param string Graph title
29 * @param int First query resource ID
30 * @param int Second query resource ID
31 * @param string The bar colors
33 function reports_quick_graph($title,$qpa1,$qpa2,$bar_colors) {
34 $result1=db_query_qpa($qpa1);
35 $result2=db_query_qpa($qpa2);
36 if ($result1 && $result2 && db_numrows($result2) > 0) {
38 $assoc_open=util_result_columns_to_assoc($result1);
39 $assoc_all=util_result_columns_to_assoc($result2);
40 while (list($key,$val)=each($assoc_all)) {
43 if ($assoc_open[$key]) $open[]=$assoc_open[$key];
47 /* for ($i=0; $i<db_numrows($result1); $i++) {
48 echo "$titles[$i]=>$opened[$i]/$all[$i]<br />";
51 $scale=graph_calculate_scale(array($open,$all),400);
52 $props["scale"]=$scale;
53 $props["cellspacing"]=5;
54 $props = hv_graph_defaults($props);
55 start_graph($props, $titles);
57 horizontal_multisection_graph(
65 print '<table><tr class="align-center"><td width="15%">'._('Key').':</td><td width="5%">(</td><td width="35%" style="background-color:'.$bar_colors[0].'">'._('Open').'</td>'.
66 '<td width="5%">/</td><td width="35%" style="background-color:'.$bar_colors[1].'">'._('All').' </td><td width="5%">)</td></tr></table>';
68 // GraphResult($result,$title);
70 echo "<p class='information'>"._('No data found to report')."</p>";
76 * reports_header() - Show the reports header
78 * @param int The group ID
79 * @param array Array of select box values
80 * @param string The select box title
81 * @param string Any additional HTML
83 function reports_header($group_id, $vals, $titles, $html='') {
88 print '<form method="get" action="'.getStringFromServer('PHP_SELF').'#b">';
92 print html_build_select_box_from_arrays ($vals,$titles,
95 $periods=array('day'=>'Last day','week'=>'Last week');
96 $vals=array('day','week','month','year','lifespan');
102 _('Project lifespan'));
104 if (!$period) $period="lifespan";
107 print html_build_select_box_from_arrays (
108 array('','1','4','7','12','14','30','52'),
109 array('','1','4','7','12','14','30','52'),
111 print html_build_select_box_from_arrays ($vals,$texts,'period',$period,false);
113 print "<input type=\"hidden\" name=\"group_id\" value=\"$group_id\" />";
114 print ' <input type="submit" value="'._('Show').'" />';
120 // c-file-style: "bsd"