X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=week.php;h=f1dc7889342fd7a6e9260b77162259312387df97;hb=e60508fb73602f118d17c06a9103532da05306c5;hp=6bd2d492c7fc1a9ec4fc90f878d60971fa2b47b3;hpb=ae00c14ac2999773e17a761542932cb95420430a;p=timetracker.git diff --git a/week.php b/week.php index 6bd2d492..f1dc7889 100644 --- a/week.php +++ b/week.php @@ -38,11 +38,15 @@ import('ttClientHelper'); import('ttTimeHelper'); import('DateAndTime'); -// Access check. -if (!ttAccessAllowed('track_own_time') || !$user->isPluginEnabled('wv')) { +// Access checks. +if (!(ttAccessAllowed('track_own_time') || ttAccessAllowed('track_time'))) { header('Location: access_denied.php'); exit(); } +if (!$user->isPluginEnabled('wv')) { + header('Location: feature_disabled.php'); + exit(); +} // Initialize and store date in session. $cl_date = $request->getParameter('date', @$_SESSION['date']); @@ -198,7 +202,7 @@ class WeekViewCellRenderer extends DefaultCellRenderer { // Elements of weekTimeForm. $form = new Form('weekTimeForm'); -if ($user->canManageTeam()) { +if ($user->can('track_time')) { $user_list = ttTeamHelper::getActiveUsers(array('putSelfFirst'=>true)); if (count($user_list) > 1) { $form->addInput(array('type'=>'combobox', @@ -235,7 +239,7 @@ if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { 'value'=>$cl_client, 'data'=>$active_clients, 'datakeys'=>array('id', 'name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); // Note: in other modes the client list is filtered to relevant clients only. See below. } @@ -249,7 +253,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'value'=>$cl_project, 'data'=>$project_list, 'datakeys'=>array('id','name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { @@ -276,7 +280,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'value'=>$cl_client, 'data'=>$client_list, 'datakeys'=>array('id', 'name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); } } @@ -288,7 +292,7 @@ if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) { 'value'=>$cl_task, 'data'=>$task_list, 'datakeys'=>array('id','name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); } if (!defined('NOTE_INPUT_HEIGHT')) define('NOTE_INPUT_HEIGHT', 40); @@ -299,7 +303,7 @@ $form->addInput(array('type'=>'calendar','name'=>'date','value'=>$cl_date)); // if ($user->isPluginEnabled('iv')) $form->addInput(array('type'=>'checkbox','name'=>'billable','value'=>$cl_billable)); $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'get_date()')); // User current date, which gets filled in on btn_submit click. -$form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.submit'))); +$form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_today.value=get_date()','value'=>$i18n->get('button.submit'))); // If we have custom fields - add controls for them. if ($custom_fields && $custom_fields->fields[0]) { @@ -311,7 +315,7 @@ if ($custom_fields && $custom_fields->fields[0]) { 'style'=>'width: 250px;', 'value'=>$cl_cf_1, 'data'=>$custom_fields->options, - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); } } @@ -330,15 +334,15 @@ if ($request->isPost()) { } if ($newEntryPosted) { if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client) - $err->add($i18n->getKey('error.client')); + $err->add($i18n->get('error.client')); if ($custom_fields) { - if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']); + if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']); } if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) { - if (!$cl_project) $err->add($i18n->getKey('error.project')); + if (!$cl_project) $err->add($i18n->get('error.project')); } if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode && $user->task_required) { - if (!$cl_task) $err->add($i18n->getKey('error.task')); + if (!$cl_task) $err->add($i18n->get('error.task')); } } // Finished validating user input for row 0. @@ -369,7 +373,7 @@ if ($request->isPost()) { // If posted value is not null, check and normalize it. if ($postedDuration) { if (false === ttTimeHelper::postedDurationToMinutes($postedDuration)) { - $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration')); + $err->add($i18n->get('error.field'), $i18n->get('label.duration')); $result = false; break; // Break out. Stop any further processing. } else { $minutes = ttTimeHelper::postedDurationToMinutes($postedDuration); @@ -433,7 +437,7 @@ if ($request->isPost()) { $existingComment = $dataArray[$rowNumber][$dayHeader]['note']; // If posted value is not null, check it. if ($postedComment && !ttValidString($postedComment, true)) { - $err->add($i18n->getKey('error.field'), $i18n->getKey('label.note')); + $err->add($i18n->get('error.field'), $i18n->get('label.note')); $result = false; break; // Break out. Stop any further processing. } // Do not process if value has not changed. @@ -463,7 +467,7 @@ if ($request->isPost()) { } } elseif ($request->getParameter('onBehalfUser')) { - if($user->canManageTeam()) { + if($user->can('track_time')) { unset($_SESSION['behalf_id']); unset($_SESSION['behalf_name']); @@ -490,6 +494,6 @@ $smarty->assign('onload', 'onLoad="fillDropdowns()"'); $smarty->assign('timestring', $startDate->toString($user->date_format).' - '.$endDate->toString($user->date_format)); $smarty->assign('time_records', $records); -$smarty->assign('title', $i18n->getKey('title.time')); +$smarty->assign('title', $i18n->get('title.time')); $smarty->assign('content_page_name', 'week.tpl'); $smarty->display('index.tpl');