function _getActiveDates($start, $end) {
global $user;
- $user_id = $user->getActiveUser();
+ $user_id = $user->getUser();
$table = ($this->highlight == 'expenses') ? 'tt_expense_items' : 'tt_log';
static function getClientsForUser()
{
global $user;
- $user_id = $user->getActiveUser();
+ $user_id = $user->getUser();
$result = array();
$mdb2 = getConnection();
global $user;
$mdb2 = getConnection();
- $user_id = $user->getActiveUser();
+ $user_id = $user->getUser();
$group_id = $user->getGroup();
$org_id = $user->org_id;
}
}
+ // The getUser returns user id on behalf of whom the current user is operating.
+ function getUser() {
+ return ($this->behalf_id ? $this->behalf_id : $this->id);
+ }
+
// The getGroup returns group id on behalf of which the current user is operating.
- function getGroup() {
+ function getGroup() {
return ($this->behalfGroup ? $this->behalfGroup->id : $this->group_id);
}
return ($this->behalfGroup ? $this->behalfGroup->config : $this->config);
}
- // The getActiveUser returns user id on behalf of whom the current user is operating.
- function getActiveUser() {
- return ($this->behalf_id ? $this->behalf_id : $this->id);
- }
-
// can - determines whether user has a right to do something.
function can($do_something) {
return in_array($do_something, $this->rights);
$group_id = $this->behalf_group_id ? $this->behalf_group_id : $this->group_id;
// Do a query with inner join to get assigned projects.
$sql = "select p.id, p.name, p.description, p.tasks, upb.rate from tt_projects p
- inner join tt_user_project_binds upb on (upb.user_id = ".$this->getActiveUser()." and upb.project_id = p.id and upb.status = 1)
+ inner join tt_user_project_binds upb on (upb.user_id = ".$this->getUser()." and upb.project_id = p.id and upb.status = 1)
where p.group_id = $group_id and p.status = 1 order by p.name";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
unset($objDate);
// Obtain past week(s) records.
- $records = ttWeekViewHelper::getRecordsForInterval($user->getActiveUser(), $pastWeekStartDate, $pastWeekEndDate);
+ $records = ttWeekViewHelper::getRecordsForInterval($user->getUser(), $pastWeekStartDate, $pastWeekEndDate);
// Handle potential situation of no records by re-trying for up to 4 more previous weeks (after a long vacation, etc.).
if (!$records) {
for ($i = 0; $i < 4; $i++) {
$pastWeekEndDate = $objDate->toString(DB_DATEFORMAT);
unset($objDate);
- $records = ttWeekViewHelper::getRecordsForInterval($user->getActiveUser(), $pastWeekStartDate, $pastWeekEndDate);
+ $records = ttWeekViewHelper::getRecordsForInterval($user->getUser(), $pastWeekStartDate, $pastWeekEndDate);
// Break out of the loop if we found something.
if ($records) break;
}
// Prepare an array of fields for regular insert function.
$fields4insert = array();
- $fields4insert['user_id'] = $user->getActiveUser();
+ $fields4insert['user_id'] = $user->getUser();
$fields4insert['group_id'] = $user->getGroup();
$fields4insert['org_id'] = $user->org_id;
$fields4insert['date'] = $entry_date;
$mdb2 = getConnection();
$duration = $fields['duration'];
$tt_log_id = $fields['tt_log_id'];
- $user_id = $user->getActiveUser();
+ $user_id = $user->getUser();
$sql = "update tt_log set duration = '$duration' where id = $tt_log_id and user_id = $user_id";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
$mdb2 = getConnection();
$tt_log_id = $fields['tt_log_id'];
$comment = $fields['comment'];
- $user_id = $user->getActiveUser();
+ $user_id = $user->getUser();
$sql = "update tt_log set comment = ".$mdb2->quote($fields['comment'])." where id = $tt_log_id and user_id = $user_id";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.28.4531 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.28.4532 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
<td>{$u.name|escape}</td>
<td>{$u.login|escape}</td>
<td>{$u.role_name|escape}</td>
- {if $u.rank < $user->rank || $u.group_id != $user->group_id}
+ {if $u.group_id != $user->group_id || $u.rank < $user->rank}
<td><a href="user_edit.php?id={$u.id}">{$i18n.label.edit}</a></td>
<td><a href="user_delete.php?id={$u.id}">{$i18n.label.delete}</a></td>
{else}
}
$cl_id = (int)$request->getParameter('id');
// Get the expense item we are deleting.
-$expense_item = ttExpenseHelper::getItem($cl_id, $user->getActiveUser());
+$expense_item = ttExpenseHelper::getItem($cl_id, $user->getUser());
if (!$expense_item || $expense_item['invoice_id']) {
// Prohibit deleting not ours or invoiced items.
header('Location: access_denied.php');
if ($err->no()) {
// Mark the record as deleted.
- if (ttExpenseHelper::markDeleted($cl_id, $user->getActiveUser())) {
+ if (ttExpenseHelper::markDeleted($cl_id, $user->getUser())) {
header('Location: expenses.php');
exit();
} else
}
$cl_id = (int)$request->getParameter('id');
// Get the expense item we are editing.
-$expense_item = ttExpenseHelper::getItem($cl_id, $user->getActiveUser());
+$expense_item = ttExpenseHelper::getItem($cl_id, $user->getUser());
if (!$expense_item || $expense_item['invoice_id']) {
// Prohibit editing not ours or invoiced items.
header('Location: access_denied.php');
// Now, an update.
if ($err->no()) {
- if (ttExpenseHelper::update(array('id'=>$cl_id,'date'=>$new_date->toString(DB_DATEFORMAT),'user_id'=>$user->getActiveUser(),
+ if (ttExpenseHelper::update(array('id'=>$cl_id,'date'=>$new_date->toString(DB_DATEFORMAT),'user_id'=>$user->getUser(),
'client_id'=>$cl_client,'project_id'=>$cl_project,'name'=>$cl_item_name,'cost'=>$cl_cost,'paid'=>$cl_paid))) {
header('Location: expenses.php?date='.$new_date->toString(DB_DATEFORMAT));
exit();
}
}
-$smarty->assign('day_total', ttExpenseHelper::getTotalForDay($user->getActiveUser(), $cl_date));
-$smarty->assign('expense_items', ttExpenseHelper::getItems($user->getActiveUser(), $cl_date));
+$smarty->assign('day_total', ttExpenseHelper::getTotalForDay($user->getUser(), $cl_date));
+$smarty->assign('expense_items', ttExpenseHelper::getItems($user->getUser(), $cl_date));
$smarty->assign('predefined_expenses', $predefined_expenses);
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);
}
$cl_id = (int)$request->getParameter('id');
// Get the expense item we are deleting.
-$expense_item = ttExpenseHelper::getItem($cl_id, $user->getActiveUser());
+$expense_item = ttExpenseHelper::getItem($cl_id, $user->getUser());
if (!$expense_item || $expense_item['invoice_id']) {
// Prohibit deleting not ours or invoiced items.
header('Location: access_denied.php');
if ($err->no()) {
// Mark the record as deleted.
- if (ttExpenseHelper::markDeleted($cl_id, $user->getActiveUser())) {
+ if (ttExpenseHelper::markDeleted($cl_id, $user->getUser())) {
header('Location: expenses.php');
exit();
} else
}
$cl_id = (int)$request->getParameter('id');
// Get the expense item we are editing.
-$expense_item = ttExpenseHelper::getItem($cl_id, $user->getActiveUser());
+$expense_item = ttExpenseHelper::getItem($cl_id, $user->getUser());
if (!$expense_item || $expense_item['invoice_id']) {
// Prohibit editing not ours or invoiced items.
header('Location: access_denied.php');
// Now, an update.
if ($err->no()) {
- if (ttExpenseHelper::update(array('id'=>$cl_id,'date'=>$new_date->toString(DB_DATEFORMAT),'user_id'=>$user->getActiveUser(),
+ if (ttExpenseHelper::update(array('id'=>$cl_id,'date'=>$new_date->toString(DB_DATEFORMAT),'user_id'=>$user->getUser(),
'client_id'=>$cl_client,'project_id'=>$cl_project,'name'=>$cl_item_name,'cost'=>$cl_cost))) {
header('Location: expenses.php?date='.$new_date->toString(DB_DATEFORMAT));
exit();
$smarty->assign('next_date', $next_date);
$smarty->assign('prev_date', $prev_date);
-$smarty->assign('day_total', ttExpenseHelper::getTotalForDay($user->getActiveUser(), $cl_date));
-$smarty->assign('expense_items', ttExpenseHelper::getItems($user->getActiveUser(), $cl_date));
+$smarty->assign('day_total', ttExpenseHelper::getTotalForDay($user->getUser(), $cl_date));
+$smarty->assign('expense_items', ttExpenseHelper::getItems($user->getUser(), $cl_date));
$smarty->assign('predefined_expenses', $predefined_expenses);
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);
// Prohibit creating another uncompleted record.
if ($err->no()) {
- if (($not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser())) && (($cl_finish == '') && ($cl_duration == '')))
+ if (($not_completed_rec = ttTimeHelper::getUncompleted($user->getUser())) && (($cl_finish == '') && ($cl_duration == '')))
$err->add($i18n->get('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->get('error.goto_uncompleted')."</a>");
}
// Prohibit creating an overlapping record.
if ($err->no()) {
- if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
+ if (ttTimeHelper::overlaps($user->getUser(), $cl_date, $cl_start, $cl_finish))
$err->add($i18n->get('error.overlap'));
}
if ($err->no()) {
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
- 'user_id' => $user->getActiveUser(),
+ 'user_id' => $user->getUser(),
'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'client' => $cl_client,
$smarty->assign('next_date', $next_date);
$smarty->assign('prev_date', $prev_date);
-$smarty->assign('time_records', ttTimeHelper::getRecords($user->getActiveUser(), $cl_date));
-$smarty->assign('day_total', ttTimeHelper::getTimeForDay($user->getActiveUser(), $cl_date));
+$smarty->assign('time_records', ttTimeHelper::getRecords($user->getUser(), $cl_date));
+$smarty->assign('day_total', ttTimeHelper::getTimeForDay($user->getUser(), $cl_date));
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);
$smarty->assign('task_list', $task_list);
exit();
}
$cl_id = (int)$request->getParameter('id');
-$time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser());
+$time_rec = ttTimeHelper::getRecord($cl_id, $user->getUser());
if (!$time_rec || $time_rec['invoice_id']) {
// Prohibit deleting not ours or invoiced records.
header('Location: access_denied.php');
if ($err->no()) {
// Delete the record.
- $result = ttTimeHelper::delete($cl_id, $user->getActiveUser());
+ $result = ttTimeHelper::delete($cl_id, $user->getUser());
if ($result) {
header('Location: time.php');
exit();
}
$cl_id = (int)$request->getParameter('id');
-$time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser());
+$time_rec = ttTimeHelper::getRecord($cl_id, $user->getUser());
if (!$time_rec || $time_rec['invoice_id']) {
// Prohibit editing not ours or invoiced records.
header('Location: access_denied.php');
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
$uncompleted = ($cl_finish == '' && $cl_duration == '');
if ($uncompleted) {
- $not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser());
+ $not_completed_rec = ttTimeHelper::getUncompleted($user->getUser());
if ($not_completed_rec && ($time_rec['id'] <> $not_completed_rec['id'])) {
// We have another not completed record.
$err->add($i18n->get('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->get('error.goto_uncompleted')."</a>");
// Prohibit creating an overlapping record.
if ($err->no()) {
- if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish, $cl_id))
+ if (ttTimeHelper::overlaps($user->getUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish, $cl_id))
$err->add($i18n->get('error.overlap'));
}
$res = ttTimeHelper::update(array(
'id'=>$cl_id,
'date'=>$new_date->toString(DB_DATEFORMAT),
- 'user_id'=>$user->getActiveUser(),
+ 'user_id'=>$user->getUser(),
'client'=>$cl_client,
'project'=>$cl_project,
'task'=>$cl_task,
$_SESSION['task'] = $cl_task;
// Obtain uncompleted record. Assumtion is that only 1 uncompleted record is allowed.
-$uncompleted = ttTimeHelper::getUncompleted($user->getActiveUser());
+$uncompleted = ttTimeHelper::getUncompleted($user->getUser());
$enable_controls = ($uncompleted == null);
// Elements of timeRecordForm.
// Prohibit creating an overlapping record.
if ($err->no()) {
- if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
+ if (ttTimeHelper::overlaps($user->getUser(), $cl_date, $cl_start, $cl_finish))
$err->add($i18n->get('error.overlap'));
}
if ($err->no()) {
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
- 'user_id' => $user->getActiveUser(),
+ 'user_id' => $user->getUser(),
'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'client' => $cl_client,
}
if ($request->getParameter('btn_stop')) {
// Stop button clicked. We need to finish an uncompleted record in progress.
- $record = ttTimeHelper::getRecord($uncompleted['id'], $user->getActiveUser());
+ $record = ttTimeHelper::getRecord($uncompleted['id'], $user->getUser());
// Can we complete this record?
if (ttTimeHelper::isValidInterval($record['start'], $cl_finish) // finish time is greater than start time
- && !ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $record['start'], $cl_finish)) { // no overlap
+ && !ttTimeHelper::overlaps($user->getUser(), $cl_date, $record['start'], $cl_finish)) { // no overlap
$res = ttTimeHelper::update(array(
'id'=>$record['id'],
'date'=>$cl_date,
- 'user_id'=>$user->getActiveUser(),
+ 'user_id'=>$user->getUser(),
'client'=>$record['client_id'],
'project'=>$record['project_id'],
'task'=>$record['task_id'],
}
} // isPost
-$week_total = ttTimeHelper::getTimeForWeek($user->getActiveUser(), $cl_date);
+$week_total = ttTimeHelper::getTimeForWeek($user->getUser(), $cl_date);
$smarty->assign('week_total', $week_total);
$smarty->assign('uncompleted', $uncompleted);
-$smarty->assign('time_records', ttTimeHelper::getRecords($user->getActiveUser(), $cl_date));
-$smarty->assign('day_total', ttTimeHelper::getTimeForDay($user->getActiveUser(), $cl_date));
+$smarty->assign('time_records', ttTimeHelper::getRecords($user->getUser(), $cl_date));
+$smarty->assign('day_total', ttTimeHelper::getTimeForDay($user->getUser(), $cl_date));
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);
$smarty->assign('task_list', $task_list);
$user_id = $request->getParameter('user');
$user->setOnBehalfUser($user_id);
} else {
- $user_id = $user->getActiveUser();
+ $user_id = $user->getUser();
}
// Initialize and store date in session.
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->getActiveUser(), $selected_date);
+ $month_total = ttTimeHelper::getTimeForMonth($user->getUser(), $selected_date);
$minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total);
$smarty->assign('month_total', $month_total);
// Prohibit creating another uncompleted record.
if ($err->no()) {
- if (($not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser())) && (($cl_finish == '') && ($cl_duration == '')))
+ if (($not_completed_rec = ttTimeHelper::getUncompleted($user->getUser())) && (($cl_finish == '') && ($cl_duration == '')))
$err->add($i18n->get('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->get('error.goto_uncompleted')."</a>");
}
// Prohibit creating an overlapping record.
if ($err->no()) {
- if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
+ if (ttTimeHelper::overlaps($user->getUser(), $cl_date, $cl_start, $cl_finish))
$err->add($i18n->get('error.overlap'));
}
if ($err->no()) {
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
- 'user_id' => $user->getActiveUser(),
+ 'user_id' => $user->getUser(),
'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'client' => $cl_client,
} elseif ($request->getParameter('btn_stop')) {
// Stop button pressed to finish an uncompleted record.
$record_id = $request->getParameter('record_id');
- $record = ttTimeHelper::getRecord($record_id, $user->getActiveUser());
+ $record = ttTimeHelper::getRecord($record_id, $user->getUser());
$browser_date = $request->getParameter('browser_date');
$browser_time = $request->getParameter('browser_time');
// Can we complete this record?
if ($record['date'] == $browser_date // closing today's record
&& ttTimeHelper::isValidInterval($record['start'], $browser_time) // finish time is greater than start time
- && !ttTimeHelper::overlaps($user->getActiveUser(), $browser_date, $record['start'], $browser_time)) { // no overlap
+ && !ttTimeHelper::overlaps($user->getUser(), $browser_date, $record['start'], $browser_time)) { // no overlap
$res = ttTimeHelper::update(array(
'id'=>$record['id'],
'date'=>$record['date'],
- 'user_id'=>$user->getActiveUser(),
+ 'user_id'=>$user->getUser(),
'client'=>$record['client_id'],
'project'=>$record['project_id'],
'task'=>$record['task_id'],
}
} // isPost
-$week_total = ttTimeHelper::getTimeForWeek($user->getActiveUser(), $selected_date);
+$week_total = ttTimeHelper::getTimeForWeek($user->getUser(), $selected_date);
$smarty->assign('selected_date', $selected_date);
$smarty->assign('week_total', $week_total);
-$smarty->assign('day_total', ttTimeHelper::getTimeForDay($user->getActiveUser(), $cl_date));
-$smarty->assign('time_records', ttTimeHelper::getRecords($user->getActiveUser(), $cl_date));
+$smarty->assign('day_total', ttTimeHelper::getTimeForDay($user->getUser(), $cl_date));
+$smarty->assign('time_records', ttTimeHelper::getRecords($user->getUser(), $cl_date));
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);
$smarty->assign('task_list', $task_list);
exit();
}
$cl_id = (int)$request->getParameter('id');
-$time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser());
+$time_rec = ttTimeHelper::getRecord($cl_id, $user->getUser());
if (!$time_rec || $time_rec['invoice_id']) {
// Prohibit deleting not ours or invoiced records.
header('Location: access_denied.php');
if ($err->no()) {
// Delete the record.
- $result = ttTimeHelper::delete($cl_id, $user->getActiveUser());
+ $result = ttTimeHelper::delete($cl_id, $user->getUser());
if ($result) {
header('Location: time.php');
exit();
}
$cl_id = (int)$request->getParameter('id');
-$time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser());
+$time_rec = ttTimeHelper::getRecord($cl_id, $user->getUser());
if (!$time_rec || $time_rec['invoice_id']) {
// Prohibit editing not ours or invoiced records.
header('Location: access_denied.php');
// 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
$uncompleted = ($cl_finish == '' && $cl_duration == '');
if ($uncompleted) {
- $not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser());
+ $not_completed_rec = ttTimeHelper::getUncompleted($user->getUser());
if ($not_completed_rec && ($time_rec['id'] <> $not_completed_rec['id'])) {
// We have another not completed record.
$err->add($i18n->get('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->get('error.goto_uncompleted')."</a>");
// Prohibit creating an overlapping record.
if ($err->no()) {
- if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish, $cl_id))
+ if (ttTimeHelper::overlaps($user->getUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish, $cl_id))
$err->add($i18n->get('error.overlap'));
}
$res = ttTimeHelper::update(array(
'id'=>$cl_id,
'date'=>$new_date->toString(DB_DATEFORMAT),
- 'user_id'=>$user->getActiveUser(),
+ 'user_id'=>$user->getUser(),
'client'=>$cl_client,
'project'=>$cl_project,
'task'=>$cl_task,
// 2) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
$uncompleted = ($cl_finish == '' && $cl_duration == '');
if ($uncompleted) {
- $not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser());
+ $not_completed_rec = ttTimeHelper::getUncompleted($user->getUser());
if ($not_completed_rec) {
// We have another not completed record.
$err->add($i18n->get('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->get('error.goto_uncompleted')."</a>");
// Prohibit creating an overlapping record.
if ($err->no()) {
- if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish))
+ if (ttTimeHelper::overlaps($user->getUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish))
$err->add($i18n->get('error.overlap'));
}
$id = ttTimeHelper::insert(array(
'date'=>$new_date->toString(DB_DATEFORMAT),
- 'user_id'=>$user->getActiveUser(),
+ 'user_id'=>$user->getUser(),
'group_id'=>$user->getGroup(),
'org_id' => $user->org_id,
'client'=>$cl_client,
require_once('plugins/MonthlyQuota.class.php');
$quota = new MonthlyQuota();
$month_quota = $quota->get($selected_date->mYear, $selected_date->mMonth);
- $month_total = ttTimeHelper::getTimeForMonth($user->getActiveUser(), $selected_date);
+ $month_total = ttTimeHelper::getTimeForMonth($user->getUser(), $selected_date);
$minutes_left = round(60*$month_quota) - ttTimeHelper::toMinutes($month_total);
$smarty->assign('month_total', $month_total);
$dayHeaders = ttWeekViewHelper::getDayHeadersForWeek($startDate->toString(DB_DATEFORMAT));
$lockedDays = ttWeekViewHelper::getLockedDaysForWeek($startDate->toString(DB_DATEFORMAT));
// Get already existing records.
-$records = ttWeekViewHelper::getRecordsForInterval($user->getActiveUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT));
+$records = ttWeekViewHelper::getRecordsForInterval($user->getUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT));
// Build data array for the table. Format is described in ttWeekViewHelper::getDataForWeekView function.
if ($records)
$dataArray = ttWeekViewHelper::getDataForWeekView($records, $dayHeaders);
$result = ttWeekViewHelper::insertDurationFromWeekView($fields, $custom_fields, $err);
} elseif ($postedDuration == null || 0 == ttTimeHelper::toMinutes($postedDuration)) {
// Delete an already existing record here.
- $result = ttTimeHelper::delete($dataArray[$rowNumber][$dayHeader]['tt_log_id'], $user->getActiveUser());
+ $result = ttTimeHelper::delete($dataArray[$rowNumber][$dayHeader]['tt_log_id'], $user->getUser());
} else {
$fields = array();
$fields['tt_log_id'] = $dataArray[$rowNumber][$dayHeader]['tt_log_id'];
}
} // isPost
-$week_total = ttTimeHelper::getTimeForWeek($user->getActiveUser(), $selected_date);
+$week_total = ttTimeHelper::getTimeForWeek($user->getUser(), $selected_date);
$smarty->assign('selected_date', $selected_date);
$smarty->assign('week_total', $week_total);