From 41cf24c4700d2637472ef3c7cc920caf86f51cf4 Mon Sep 17 00:00:00 2001 From: anuko Date: Sat, 30 Sep 2017 21:36:31 +0000 Subject: [PATCH] Added this day and last day to report interval options. --- WEB-INF/lib/Period.class.php | 13 ++++++++++--- WEB-INF/resources/ca.lang.php | 1 + WEB-INF/resources/da.lang.php | 2 ++ WEB-INF/resources/en.lang.php | 1 + WEB-INF/resources/ru.lang.php | 1 + WEB-INF/templates/footer.tpl | 2 +- reports.php | 4 +++- 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/WEB-INF/lib/Period.class.php b/WEB-INF/lib/Period.class.php index f159794a..8456bbee 100644 --- a/WEB-INF/lib/Period.class.php +++ b/WEB-INF/lib/Period.class.php @@ -33,6 +33,7 @@ define('INTERVAL_THIS_YEAR', 4); define('INTERVAL_ALL_TIME', 5); define('INTERVAL_LAST_WEEK', 6); define('INTERVAL_LAST_MONTH', 7); +define('INTERVAL_LAST_DAY', 8); class Period { var $startDate; @@ -63,9 +64,15 @@ class Period { switch ($period_type) { case INTERVAL_THIS_DAY: - $date_begin->setTimestamp($date_point->getTimestamp()); - $date_end->setTimestamp($date_point->getTimestamp()); - break; + $date_begin->setTimestamp($date_point->getTimestamp()); + $date_end->setTimestamp($date_point->getTimestamp()); + break; + + case INTERVAL_LAST_DAY: + $date_begin->setTimestamp(mktime(0,0,0,$t_arr[4]+1,$t_arr[3]-1,$t_arr[5])); + $date_end->setTimestamp(mktime(0,0,0,$t_arr[4]+1,$t_arr[3]-1,$t_arr[5])); + break; + case INTERVAL_THIS_WEEK: $date_begin->setTimestamp(mktime(0,0,0,$t_arr[4]+1,$t_arr[3]-$t_arr[6]+$startWeekBias,$t_arr[5])); $date_end->setTimestamp(mktime(0,0,0,$t_arr[4]+1,$t_arr[3]-$t_arr[6]+6+$startWeekBias,$t_arr[5])); diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index 2b3d2451..c35961a1 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -293,6 +293,7 @@ $i18n_key_words = array( // 'dropdown.no' => '--- no ---', // NOTE TO TRANSLATORS: dropdown.this_day does not necessarily means "today". It means a specific ("this") day selected on calendar. See Charts. // 'dropdown.this_day' => 'this day', +// 'dropdown.last_day' => 'last day', // 'dropdown.this_week' => 'this week', // 'dropdown.last_week' => 'last week', // 'dropdown.this_month' => 'this month', diff --git a/WEB-INF/resources/da.lang.php b/WEB-INF/resources/da.lang.php index c07dd29e..a74d98a0 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -272,6 +272,8 @@ $i18n_key_words = array( 'dropdown.no' => '--- Ingen ---', // NOTE TO TRANSLATORS: dropdown.this_day does not necessarily means "today". It means a specific ("this") day selected on calendar. See Charts. 'dropdown.this_day' => 'Denne dag', +// TODO: translate the following. +// 'dropdown.last_day' => 'last day', 'dropdown.this_week' => 'Denne uge', 'dropdown.last_week' => 'Sidste uge', 'dropdown.this_month' => 'Denne måned', diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index e91d9345..c06ae761 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -273,6 +273,7 @@ $i18n_key_words = array( 'dropdown.no' => '--- no ---', // NOTE TO TRANSLATORS: dropdown.this_day does not necessarily means "today". It means a specific ("this") day selected on calendar. See Charts. 'dropdown.this_day' => 'this day', +'dropdown.last_day' => 'last day', 'dropdown.this_week' => 'this week', 'dropdown.last_week' => 'last week', 'dropdown.this_month' => 'this month', diff --git a/WEB-INF/resources/ru.lang.php b/WEB-INF/resources/ru.lang.php index 1a17deec..74b68f8f 100644 --- a/WEB-INF/resources/ru.lang.php +++ b/WEB-INF/resources/ru.lang.php @@ -270,6 +270,7 @@ $i18n_key_words = array( 'dropdown.all' => '--- все ---', 'dropdown.no' => '--- нет ---', 'dropdown.this_day' => 'этот день', +'dropdown.last_day' => 'прошлый день', 'dropdown.this_week' => 'эта неделя', 'dropdown.last_week' => 'прошлая неделя', 'dropdown.this_month' => 'этот месяц', diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index fb3861a0..236ada19 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.12.1.3668 | Copyright © Anuko | +  Anuko Time Tracker 1.12.2.3669 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/reports.php b/reports.php index 08ac64fe..9062abf8 100644 --- a/reports.php +++ b/reports.php @@ -164,7 +164,9 @@ $form->addInput(array('type'=>'combobox', 'data'=>array(INTERVAL_THIS_MONTH=>$i18n->getKey('dropdown.this_month'), INTERVAL_LAST_MONTH=>$i18n->getKey('dropdown.last_month'), INTERVAL_THIS_WEEK=>$i18n->getKey('dropdown.this_week'), - INTERVAL_LAST_WEEK=>$i18n->getKey('dropdown.last_week')), + INTERVAL_LAST_WEEK=>$i18n->getKey('dropdown.last_week'), + INTERVAL_THIS_DAY=>$i18n->getKey('dropdown.this_day'), + INTERVAL_LAST_DAY=>$i18n->getKey('dropdown.last_day')), 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); // Add controls for start and end dates. $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'start_date')); -- 2.20.1