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/ReportSetup.class.php';
30 session_require_global_perm ('forge_stats', 'admin') ;
32 $time_code = getIntFromRequest('time_code');
33 $category_name = trim(getStringFromRequest('category_name'));
35 if (getStringFromRequest('submit')) {
36 if (getStringFromRequest('add')) {
38 $r = new ReportSetup();
39 if (!$r->addTimeCode($category_name)) {
40 exit_error($r->getErrorMessage());
42 $feedback=_('Successful');
45 } elseif (getStringFromRequest('update')) {
47 $r = new ReportSetup();
49 if (!$r->updateTimeCode($time_code,$category_name)) {
50 exit_error($r->getErrorMessage());
52 $feedback=_('Successful');
61 report_header(_('Manage Time Tracker Categories'));
64 $res1=db_query_params ('SELECT * FROM rep_time_category WHERE time_code=$1',
66 $category_name=db_result($res1,0,'category_name');
68 $res=db_query_params ('SELECT * FROM rep_time_category',
71 $arr[]=_('Time Code');
72 $arr[]=_('Category Name');
74 echo $HTML->listTableTop($arr);
76 for ($i=0; $i<db_numrows($res); $i++) {
77 echo '<tr '.$HTML->boxGetAltRowStyle($i).'><td>'.db_result($res,$i,'time_code').'</td>
78 <td><a href="timecategory.php?time_code='.db_result($res,$i,'time_code').'">'.db_result($res,$i,'category_name').'</a></td></tr>';
81 echo $HTML->listTableBottom();
85 <?php echo _('You can create categories for how time might be spent when completing a particular task. Examples of categories include "Meeting", "Coding", "Testing".'); ?>
87 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
89 <input type="hidden" name="submit" value="1" />
90 <input type="hidden" name="time_code" value="<?php echo $time_code; ?>" />
91 <strong><?php echo _('Category Name')._(':'); ?></strong><br />
92 <input type="text" name="category_name" value="<?php echo $category_name; ?>" />
98 echo '<input type="submit" name="update" value="'._('Update').'" />';
100 echo '<input type="submit" name="add" value="'._('Add').'" />';
113 // c-file-style: "bsd"