}
// getTimeForWeek - gets total time for a user for a given week.
- static function getTimeForWeek($user_id, $date) {
+ static function getTimeForWeek($date) {
+ global $user;
import('Period');
$mdb2 = getConnection();
+ $user_id = $user->getUser();
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+
$period = new Period(INTERVAL_THIS_WEEK, $date);
- $sql = "select sum(time_to_sec(duration)) as sm from tt_log where user_id = $user_id and date >= '".$period->getStartDate(DB_DATEFORMAT)."' and date <= '".$period->getEndDate(DB_DATEFORMAT)."' and status = 1";
+ $sql = "select sum(time_to_sec(duration)) as sm from tt_log".
+ " where user_id = $user_id and group_id = $group_id and org_id = $org_id".
+ " and date >= '".$period->getStartDate(DB_DATEFORMAT)."' and date <= '".$period->getEndDate(DB_DATEFORMAT)."' and status = 1";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.30.4644 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.30.4645 | 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>
}
} // isPost
-$week_total = ttTimeHelper::getTimeForWeek($user->getUser(), $cl_date);
+$week_total = ttTimeHelper::getTimeForWeek($cl_date);
$smarty->assign('week_total', $week_total);
$smarty->assign('uncompleted', $uncompleted);
}
} // 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);
}
} // isPost
-$week_total = ttTimeHelper::getTimeForWeek($user->getUser(), $selected_date);
+$week_total = ttTimeHelper::getTimeForWeek($selected_date);
$smarty->assign('selected_date', $selected_date);
$smarty->assign('week_total', $week_total);