4 * Copyright 1999-2001 (c) VA Linux Systems
5 * Copyright 2010, FusionForge Team
6 * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
7 * http://fusionforge.org
9 * This file is part of FusionForge.
11 * FusionForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
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
22 * along with FusionForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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($opened,$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 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>'.
67 '<td width="5%">/</td><td width="35%" style="background-color:'.$bar_colors[1].'">'._('All').' </td><td width="5%">)</td></tr></table>';
69 // GraphResult($result,$title);
71 echo "<p class='warning_msg'>"._('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"