// Initialize and store date in session.
$cl_date = $request->getParameter('date', @$_SESSION['date']);
$selected_date = new DateAndTime(DB_DATEFORMAT, $cl_date);
// Initialize and store date in session.
$cl_date = $request->getParameter('date', @$_SESSION['date']);
$selected_date = new DateAndTime(DB_DATEFORMAT, $cl_date);
// Use custom fields plugin if it is enabled.
if ($user->isPluginEnabled('cf')) {
require_once('plugins/CustomFields.class.php');
// Use custom fields plugin if it is enabled.
if ($user->isPluginEnabled('cf')) {
require_once('plugins/CustomFields.class.php');
if ($user->isPluginEnabled('mq')){
require_once('plugins/MonthlyQuota.class.php');
$quota = new MonthlyQuota();
if ($user->isPluginEnabled('mq')){
require_once('plugins/MonthlyQuota.class.php');
$quota = new MonthlyQuota();
- $month_quota = $quota->get($selected_date->mYear, $selected_date->mMonth);
- $month_total = ttTimeHelper::getTimeForMonth($user->getUser(), $selected_date);
- $minutes_left = round(60*$month_quota) - ttTimeHelper::toMinutes($month_total);
+ $month_quota_minutes = $quota->getUserQuota($selected_date->mYear, $selected_date->mMonth);
+ $month_total = ttTimeHelper::getTimeForMonth($selected_date);
+ $minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total);
$smarty->assign('month_total', $month_total);
$smarty->assign('over_quota', $minutes_left < 0);
$smarty->assign('month_total', $month_total);
$smarty->assign('over_quota', $minutes_left < 0);
$dayHeaders = ttWeekViewHelper::getDayHeadersForWeek($startDate->toString(DB_DATEFORMAT));
$lockedDays = ttWeekViewHelper::getLockedDaysForWeek($startDate->toString(DB_DATEFORMAT));
// Get already existing records.
$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);
// Build data array for the table. Format is described in ttWeekViewHelper::getDataForWeekView function.
if ($records)
$dataArray = ttWeekViewHelper::getDataForWeekView($records, $dayHeaders);
// Dropdown for clients in MODE_TIME. Use all active clients.
if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) {
// Dropdown for clients in MODE_TIME. Use all active clients.
if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) {
$form->addInput(array('type'=>'combobox',
'onchange'=>'fillProjectDropdown(this.value);',
'name'=>'client',
$form->addInput(array('type'=>'combobox',
'onchange'=>'fillProjectDropdown(this.value);',
'name'=>'client',
// We need an array of assigned project ids to do some trimming.
foreach($project_list as $project)
$projects_assigned_to_user[] = $project['id'];
// We need an array of assigned project ids to do some trimming.
foreach($project_list as $project)
$projects_assigned_to_user[] = $project['id'];
$form->addInput(array('type'=>'combobox',
'name'=>'task',
'style'=>'width: 250px;',
$form->addInput(array('type'=>'combobox',
'name'=>'task',
'style'=>'width: 250px;',
$smarty->assign('selected_date', $selected_date);
$smarty->assign('week_total', $week_total);
$smarty->assign('selected_date', $selected_date);
$smarty->assign('week_total', $week_total);
$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('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->get('title.time'));
$smarty->assign('content_page_name', 'week.tpl');
$smarty->display('index.tpl');
$smarty->assign('title', $i18n->get('title.time'));
$smarty->assign('content_page_name', 'week.tpl');
$smarty->display('index.tpl');