X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/a3ec528f0b31400a9cdda44211ae495a6512c648..14a6ab5e563acb66d090c6c291b5d51b1a31fae7:/timesheets.php diff --git a/timesheets.php b/timesheets.php index 0a926d91..546a7b63 100644 --- a/timesheets.php +++ b/timesheets.php @@ -32,7 +32,7 @@ import('ttGroupHelper'); import('ttTimesheetHelper'); // Access checks. -if (!(ttAccessAllowed('view_own_timesheets') || ttAccessAllowed('view_timesheets') || ttAccessAllowed('view_all_timesheets') || ttAccessAllowed('view_client_timesheets'))) { +if (!(ttAccessAllowed('view_own_timesheets') || ttAccessAllowed('view_timesheets') || ttAccessAllowed('view_all_timesheets'))) { header('Location: access_denied.php'); exit(); } @@ -71,7 +71,7 @@ $group_id = $user->getGroup(); // Elements of timesheetsForm. $form = new Form('timesheetsForm'); -if ($user->can('view_timesheets') || $user->can('view_all_timesheets') || $user->can('view_client_timesheets')) { +if ($user->can('view_timesheets') || $user->can('view_all_timesheets')) { // Prepare user list for dropdown. if ($notClient) { $rank = $user->can('view_all_timesheets') ? MAX_RANK : $user->getMaxRankForGroup($group_id); @@ -96,20 +96,19 @@ if ($user->can('view_timesheets') || $user->can('view_all_timesheets') || $user- } } - - - -// TODO: fix this for client access. $active_timesheets = ttTimesheetHelper::getActiveTimesheets($user_id); -$inactive_timesheets = ttTimesheetHelper::getInactiveTimesheets($user_id); -$show_client = $user->isPluginEnabled('cl') && $notClient; +if ($notClient) + $inactive_timesheets = ttTimesheetHelper::getInactiveTimesheets($user_id); + +$showClient = $user->isPluginEnabled('cl') && $notClient; +$canEdit = $notClient && ($user->can('manage_own_timesheets') || + $user->can('manage_timesheets') || $user->can('manage_all_timesheets')); $smarty->assign('active_timesheets', $active_timesheets); $smarty->assign('inactive_timesheets', $inactive_timesheets); -$smarty->assign('show_client', $show_client); -$smarty->assign('show_hint', $notClient); -$smarty->assign('show_submit_status', $notClient); -$smarty->assign('show_approval_status', $notClient); +$smarty->assign('show_client', $showClient); +$smarty->assign('not_client', $notClient); +$smarty->assign('can_edit', $canEdit); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('title', $i18n->get('title.timesheets')); $smarty->assign('content_page_name', 'timesheets.tpl');