X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=week.php;h=879d960ea06bdcc6686c840efcaf603f1f5075c4;hb=0f0438db0b69e54af6173e2a73f0434d243ecdf6;hp=c1c76f9ded0d37d492c7a7940bd7cd0784be8ab8;hpb=54bb71ed8e6b7f79e3b26bc1c8a70a95793950c8;p=timetracker.git diff --git a/week.php b/week.php index c1c76f9d..879d960e 100644 --- a/week.php +++ b/week.php @@ -57,6 +57,8 @@ if (!$user->behalf_id && !$user->can('track_own_time') && !$user->adjustBehalfId } // End of access checks. +$showFiles = $user->isPluginEnabled('at'); + // Initialize and store date in session. $cl_date = $request->getParameter('date', @$_SESSION['date']); $selected_date = new DateAndTime(DB_DATEFORMAT, $cl_date); @@ -91,9 +93,9 @@ if ($user->isPluginEnabled('cf')) { if ($user->isPluginEnabled('mq')){ require_once('plugins/MonthlyQuota.class.php'); $quota = new MonthlyQuota(); - $month_quota = $quota->get($selected_date->mYear, $selected_date->mMonth); + $month_quota_minutes = $quota->getUserQuota($selected_date->mYear, $selected_date->mMonth); $month_total = ttTimeHelper::getTimeForMonth($selected_date); - $minutes_left = round(60*$month_quota) - ttTimeHelper::toMinutes($month_total); + $minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total); $smarty->assign('month_total', $month_total); $smarty->assign('over_quota', $minutes_left < 0); @@ -128,7 +130,7 @@ $_SESSION['note'] = $cl_note; $dayHeaders = ttWeekViewHelper::getDayHeadersForWeek($startDate->toString(DB_DATEFORMAT)); $lockedDays = ttWeekViewHelper::getLockedDaysForWeek($startDate->toString(DB_DATEFORMAT)); // Get already existing records. -$records = ttWeekViewHelper::getRecordsForInterval($user->getUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT)); +$records = ttWeekViewHelper::getRecordsForInterval($startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT), $showFiles); // Build data array for the table. Format is described in ttWeekViewHelper::getDataForWeekView function. if ($records) $dataArray = ttWeekViewHelper::getDataForWeekView($records, $dayHeaders); @@ -506,7 +508,7 @@ $smarty->assign('forms', array($form->getName()=>$form->toArray())); $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('show_files', $showFiles); $smarty->assign('title', $i18n->get('title.time')); $smarty->assign('content_page_name', 'week.tpl'); $smarty->display('index.tpl');