From 26f9b4e344163cc2a843f48c3163653b94b32911 Mon Sep 17 00:00:00 2001 From: anuko Date: Mon, 25 Dec 2017 00:37:11 +0000 Subject: [PATCH] Improved week view slightly. --- WEB-INF/lib/ttTimeHelper.class.php | 19 +++++++++++++++++++ WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/week.tpl | 29 ++++++++++++++++++++++------- week.php | 26 ++++++++++++++++++-------- 4 files changed, 60 insertions(+), 16 deletions(-) diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index 50904886..48ebdc91 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -795,4 +795,23 @@ class ttTimeHelper { return $record_identifier; } + + // getGroupedRecordsTotals - returns day totals for grouped records. + static function getGroupedRecordsTotals($groupedRecords) { + $groupedRecordsTotals = array(); + foreach ($groupedRecords as $groupedRecord) { + foreach($groupedRecord as $key => $dayEntry) { + if ($dayEntry['duration']) { + $minutes = ttTimeHelper::toMinutes($dayEntry['duration']); + $groupedRecordsTotals[$key] += $minutes; + } + } + } + // Convert minutes to hh:mm for display. + foreach ($groupedRecordsTotals as $key => $single_total) { + $groupedRecordsTotals[$key] = ttTimeHelper::toAbsDuration($single_total); + } + + return $groupedRecordsTotals; + } } diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index be7b43fe..04af17ed 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- {/if} - - - - - - - + + + + + + + {/foreach} + + {if ($user->isPluginEnabled('cl') || ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode))} + + {/if} + {if ($user->isPluginEnabled('cf') || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} + + {/if} + + + + + + + +
 Anuko Time Tracker 1.12.3.3687 | Copyright © Anuko | +  Anuko Time Tracker 1.12.3.3688 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/week.tpl b/WEB-INF/templates/week.tpl index d919fd14..b120c49b 100644 --- a/WEB-INF/templates/week.tpl +++ b/WEB-INF/templates/week.tpl @@ -62,15 +62,30 @@ {if ($user->isPluginEnabled('cf') || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} {$record.task|escape}

{$record.cf_1_value|escape}

{$record.$day_header_0.duration}{$record.$day_header_1.duration}{$record.$day_header_2.duration}{$record.$day_header_3.duration}{$record.$day_header_4.duration}{$record.$day_header_5.duration}{$record.$day_header_6.duration}{$record.$date_0.duration}{$record.$date_1.duration}{$record.$date_2.duration}{$record.$date_3.duration}{$record.$date_4.duration}{$record.$date_5.duration}{$record.$date_6.duration}
{$grouped_records_totals.$date_0}{$grouped_records_totals.$date_1}{$grouped_records_totals.$date_2}{$grouped_records_totals.$date_3}{$grouped_records_totals.$date_4}{$grouped_records_totals.$date_5}{$grouped_records_totals.$date_6}
{/if} diff --git a/week.php b/week.php index dea27e33..fd7af524 100644 --- a/week.php +++ b/week.php @@ -369,7 +369,10 @@ $endDate->setTimestamp(mktime(0,0,0,$t_arr[4]+1,$t_arr[3]-$t_arr[6]+6+$startWeek $smarty->assign('selected_date', $selected_date); $smarty->assign('week_total', $week_total); $smarty->assign('day_total', ttTimeHelper::getTimeForDay($user->getActiveUser(), $cl_date)); -$smarty->assign('grouped_records', ttTimeHelper::getGroupedRecordsForInterval($user->getActiveUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT))); +$groupedRecords = ttTimeHelper::getGroupedRecordsForInterval($user->getActiveUser(), $startDate->toString(DB_DATEFORMAT), $endDate->toString(DB_DATEFORMAT)); +$smarty->assign('grouped_records', $groupedRecords); +$smarty->assign('grouped_records_totals', ttTimeHelper::getGroupedRecordsTotals($groupedRecords)); + $smarty->assign('client_list', $client_list); $smarty->assign('project_list', $project_list); $smarty->assign('task_list', $task_list); @@ -378,19 +381,26 @@ $smarty->assign('onload', 'onLoad="fillDropdowns()"'); $smarty->assign('timestring', $startDate->toString($user->date_format).' - '.$endDate->toString($user->date_format)); // Prepare and assign date headers. Note how startDate moves to the end of the week, so it no longer holds correct start week value. -$smarty->assign('day_header_0', $startDate->toString($user->date_format)); +$smarty->assign('date_0', $startDate->toString(DB_DATEFORMAT)); +$smarty->assign('day_header_0', $startDate->getDate()); $startDate->incDay(); -$smarty->assign('day_header_1', $startDate->toString($user->date_format)); +$smarty->assign('date_1', $startDate->toString(DB_DATEFORMAT)); +$smarty->assign('day_header_1', $startDate->getDate()); $startDate->incDay(); -$smarty->assign('day_header_2', $startDate->toString($user->date_format)); +$smarty->assign('date_2', $startDate->toString(DB_DATEFORMAT)); +$smarty->assign('day_header_2', $startDate->getDate()); $startDate->incDay(); -$smarty->assign('day_header_3', $startDate->toString($user->date_format)); +$smarty->assign('date_3', $startDate->toString(DB_DATEFORMAT)); +$smarty->assign('day_header_3', $startDate->getDate()); $startDate->incDay(); -$smarty->assign('day_header_4', $startDate->toString($user->date_format)); +$smarty->assign('date_4', $startDate->toString(DB_DATEFORMAT)); +$smarty->assign('day_header_4', $startDate->getDate()); $startDate->incDay(); -$smarty->assign('day_header_5', $startDate->toString($user->date_format)); +$smarty->assign('date_5', $startDate->toString(DB_DATEFORMAT)); +$smarty->assign('day_header_5', $startDate->getDate()); $startDate->incDay(); -$smarty->assign('day_header_6', $startDate->toString($user->date_format)); +$smarty->assign('date_6', $startDate->toString(DB_DATEFORMAT)); +$smarty->assign('day_header_6', $startDate->getDate()); $smarty->assign('title', $i18n->getKey('title.time')); $smarty->assign('content_page_name', 'week.tpl'); -- 2.20.1