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.
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
26 require_once('../env.inc.php');
27 require_once $gfcommon.'include/pre.php';
28 require_once $gfcommon.'reporting/report_utils.php';
29 require_once $gfcommon.'reporting/ReportSiteTime.class.php';
31 session_require_global_perm ('forge_stats', 'read') ;
34 if ($report->isError()) {
35 exit_error($report->getErrorMessage());
38 $typ = getStringFromRequest('typ');
39 $type = getStringFromRequest('type');
40 $start = getIntFromRequest('start');
41 $end = getIntFromRequest('end');
43 if (!$start || !$end) $z =& $report->getMonthStartArr();
49 $end = $z[count($z)-1];
51 if ($end < $start) list($start, $end) = array($end, $start);
53 if ($typ != 'r' && $start == $end) {
54 $error_msg .= _('Start and end dates must be different');
57 report_header(_('Site-Wide Time Tracking'));
60 $a[]=_('By Category');
61 $a[]=_('By Subproject');
71 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="get">
73 <td><strong><?php echo _('Type'); ?>:</strong><br /><?php echo html_build_select_box_from_arrays($a2,$a,'type',$type,false); ?></td>
74 <td><strong><?php echo _('Start'); ?>:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
75 <td><strong><?php echo _('End'); ?>:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
77 <input type="hidden" name="typ" value="<?php echo $typ; ?>" />
78 <input type="submit" name="submit" value="<?php echo _('Refresh'); ?>" />
85 $report=new ReportSiteTime($type,$start,$end);
86 $labels = $report->labels;
87 $data = $report->getData();
89 echo $HTML->listTableTop (array(_('Type'), _('Time')));
91 for ($i=0; $i<count($labels); $i++) {
92 echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>'.
93 '<td>'. $labels[$i] .'</td><td>'. $data[$i] .'</td></tr>';
96 echo $HTML->listTableBottom ();
97 } elseif ($start != $end) { ?>
99 <img src="sitetime_graph.php?<?php echo "start=$start&end=$end&type=$type"; ?>" width="640" height="480" alt="" />
107 // c-file-style: "bsd"