5 * Copyright 2004 (c) GForge LLC
7 * @author Tim Perdue tim@gforge.org
10 * This file is part of GForge.
12 * GForge is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * GForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with GForge; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 require_once('../env.inc.php');
28 require_once $gfwww.'include/pre.php';
29 require_once $gfcommon.'reporting/report_utils.php';
30 require_once $gfcommon.'reporting/ReportSetup.class.php';
32 session_require( array('group'=>forge_get_config('stats_group'),'A') );
34 $time_code = getIntFromRequest('time_code');
35 $category_name = trim(getStringFromRequest('category_name'));
37 if (getStringFromRequest('submit')) {
38 if (getStringFromRequest('add')) {
40 $r = new ReportSetup();
41 if (!$r->addTimeCode($category_name)) {
42 exit_error('Error',$r->getErrorMessage());
44 $feedback=_('Successful');
47 } elseif (getStringFromRequest('update')) {
49 $r = new ReportSetup();
51 if (!$r->updateTimeCode($time_code,$category_name)) {
52 exit_error('Error',$r->getErrorMessage());
54 $feedback=_('Successful');
63 echo report_header(_('Main Page'));
66 $res1=db_query_params ('SELECT * FROM rep_time_category WHERE time_code=$1',
68 $category_name=db_result($res1,0,'category_name');
70 $res=db_query_params ('SELECT * FROM rep_time_category',
73 $arr[]=_('Time Code');
74 $arr[]=_('Category Name');
76 echo $HTML->listTableTop($arr);
78 for ($i=0; $i<db_numrows($res); $i++) {
79 echo '<tr '.$HTML->boxGetAltRowStyle($i).'><td>'.db_result($res,$i,'time_code').'</td>
80 <td><a href="timecategory.php?time_code='.db_result($res,$i,'time_code').'">'.db_result($res,$i,'category_name').'</a></td></tr>';
83 echo $HTML->listTableBottom();
86 <h2><?php echo _('Manage Time Tracker Categories'); ?></h2>
88 <?php echo _('You can create categories for how time might be spent when completing a particular task. Examples of categories include "Meeting", "Coding", "Testing".'); ?>
90 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
91 <input type="hidden" name="submit" value="1" />
92 <input type="hidden" name="time_code" value="<?php echo $time_code; ?>" />
93 <strong><?php echo _('Category Name'); ?>:</strong><br />
94 <input type="text" name="category_name" value="<?php echo $category_name; ?>" />
99 echo '<input type="submit" name="update" value="'._('Update').'" />';
101 echo '<input type="submit" name="add" value="'._('Add').'" />';
110 echo report_footer();
114 // c-file-style: "bsd"