5 * Copyright 2003-2004 (c) GForge LLC
6 * Copyright (C) 2010 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.
25 require_once('../env.inc.php');
26 require_once $gfcommon.'include/pre.php';
27 require_once $gfcommon.'reporting/report_utils.php';
28 require_once $gfcommon.'reporting/ReportSiteTime.class.php';
30 session_require_global_perm ('forge_stats', 'read') ;
33 if ($report->isError()) {
34 exit_error($report->getErrorMessage());
37 $typ = getStringFromRequest('typ');
38 $type = getStringFromRequest('type');
39 $start = getIntFromRequest('start');
40 $end = getIntFromRequest('end');
42 if (!$start || !$end) $z =& $report->getMonthStartArr();
48 $end = $z[count($z)-1];
50 if ($end < $start) list($start, $end) = array($end, $start);
52 if ($typ != 'r' && $start == $end) {
53 $error_msg .= _('Start and end dates must be different');
56 report_header(_('Site-Wide Time Tracking'));
59 $a[]=_('By Category');
60 $a[]=_('By Subproject');
70 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="get">
72 <td><strong><?php echo _('Type'); ?>:</strong><br /><?php echo html_build_select_box_from_arrays($a2,$a,'type',$type,false); ?></td>
73 <td><strong><?php echo _('Start'); ?>:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
74 <td><strong><?php echo _('End'); ?>:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
76 <input type="hidden" name="typ" value="<?php echo $typ; ?>" />
77 <input type="submit" name="submit" value="<?php echo _('Refresh'); ?>" />
84 $report=new ReportSiteTime($type,$start,$end);
85 $labels = $report->labels;
86 $data = $report->getData();
88 echo $HTML->listTableTop (array(_('Type'), _('Time')));
90 for ($i=0; $i<count($labels); $i++) {
91 echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>'.
92 '<td>'. $labels[$i] .'</td><td>'. $data[$i] .'</td></tr>';
95 echo $HTML->listTableBottom ();
96 } elseif ($start != $end) { ?>
98 <img src="sitetime_graph.php?<?php echo "start=$start&end=$end&type=$type"; ?>" width="640" height="480" alt="" />
106 // c-file-style: "bsd"