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