X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=time.php;h=013f15ca69898c575062c2ac84010406ef2976c5;hb=e489a39d1dd1ad0293c45d887433d47b7734979f;hp=b85cad0efdc8a66eac88d89aae0d0f4713e42447;hpb=06f5163f4a234e89b5d761e7f537160f40d4a2e8;p=timetracker.git diff --git a/time.php b/time.php index b85cad0e..013f15ca 100644 --- a/time.php +++ b/time.php @@ -48,11 +48,6 @@ if (!$user->behalf_id && !$user->can('track_own_time') && !$user->adjustBehalfId exit(); } if ($request->isPost()) { - $groupChanged = $request->getParameter('group_changed'); // Reused in multiple places below. - if ($groupChanged && !($user->can('manage_subgroups') && $user->isGroupValid($request->getParameter('group')))) { - header('Location: access_denied.php'); // Group changed, but no rght or wrong group id. - exit(); - } $userChanged = $request->getParameter('user_changed'); // Reused in multiple places below. if ($userChanged && !($user->can('track_time') && $user->isUserValid($request->getParameter('user')))) { header('Location: access_denied.php'); // Group changed, but no rght or wrong user id. @@ -61,13 +56,6 @@ if ($request->isPost()) { } // End of access checks. -// Determine group for which we display this page. -if ($request->isPost() && $groupChanged) { - $group_id = $request->getParameter('group'); - $user->setOnBehalfGroup($group_id); -} else { - $group_id = $user->getGroup(); -} // Determine user for which we display this page. if ($request->isPost() && $userChanged) { $user_id = $request->getParameter('user'); @@ -76,6 +64,8 @@ if ($request->isPost() && $userChanged) { $user_id = $user->getUser(); } +$group_id = $user->getGroup(); + // Initialize and store date in session. $cl_date = $request->getParameter('date', @$_SESSION['date']); $selected_date = new DateAndTime(DB_DATEFORMAT, $cl_date); @@ -96,7 +86,7 @@ if ($user->isPluginEnabled('mq')){ require_once('plugins/MonthlyQuota.class.php'); $quota = new MonthlyQuota(); $month_quota_minutes = $quota->get($selected_date->mYear, $selected_date->mMonth); - $month_total = ttTimeHelper::getTimeForMonth($user_id, $selected_date); + $month_total = ttTimeHelper::getTimeForMonth($selected_date); $minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total); $smarty->assign('month_total', $month_total); @@ -132,21 +122,6 @@ $_SESSION['task'] = $cl_task; // Elements of timeRecordForm. $form = new Form('timeRecordForm'); -// Group dropdown. -if ($user->can('manage_subgroups')) { - $groups = $user->getGroupsForDropdown(); - if (count($groups) > 1) { - $form->addInput(array('type'=>'combobox', - 'onchange'=>'document.timeRecordForm.group_changed.value=1;document.timeRecordForm.submit();', - 'name'=>'group', - 'style'=>'width: 250px;', - 'value'=>$group_id, - 'data'=>$groups, - 'datakeys'=>array('id','name'))); - $form->addInput(array('type'=>'hidden','name'=>'group_changed')); - $smarty->assign('group_dropdown', 1); - } -} if ($user->can('track_time')) { $rank = $user->getMaxRankForGroup($group_id); if ($user->can('track_own_time')) @@ -394,7 +369,7 @@ if ($request->isPost()) { } } // isPost -$week_total = ttTimeHelper::getTimeForWeek($user_id, $selected_date); +$week_total = ttTimeHelper::getTimeForWeek($selected_date); $smarty->assign('selected_date', $selected_date); $smarty->assign('week_total', $week_total); @@ -405,7 +380,7 @@ $smarty->assign('project_list', $project_list); $smarty->assign('task_list', $task_list); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="fillDropdowns()"'); -$smarty->assign('timestring', $selected_date->toString($user->date_format)); +$smarty->assign('timestring', $selected_date->toString($user->getDateFormat())); $smarty->assign('title', $i18n->get('title.time')); $smarty->assign('content_page_name', 'time.tpl'); $smarty->display('index.tpl');