From 6f34dc9f29fc48d63f6f11a180b5deafcf2cd438 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 22 May 2022 13:19:21 -0700 Subject: [PATCH] Issue #4778 - Additional date-filter options added. --- e107_handlers/admin_ui.php | 14 +++++++++++--- e107_languages/English/admin/lan_admin.php | 5 +++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 3584089138..88a72d5f5b 100755 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -3916,6 +3916,10 @@ protected function _parseFilterRequest($filter_value) 'hour' => '1 hour ago', 'day' => '24 hours ago', 'week' => '1 week ago', + 'today' => 'today midnight', + 'thisweek' => 'monday this week midnight', + 'thismonth' => 'first day of this month midnight', + 'thisyear' => 'first day of January midnight', 'month' => '1 month ago', 'month3' => '3 months ago', 'month6' => '6 months ago', @@ -3934,9 +3938,9 @@ protected function _parseFilterRequest($filter_value) $ky = $filter[2]; $time = vartrue($dateConvert[$ky]); $timeStamp = strtotime($time); - - $res = array($filter[1], $timeStamp); + $res = array($filter[1], $timeStamp); + // e107::getMessage()->addDebug('Date: '.date('c', $timeStamp)); $this->_log('listQry Filtered by ' .$filter[1]. ' (' .$time. ')'); break; @@ -8325,7 +8329,11 @@ public function renderBatchFilter($type='batch', $selected = '') // Common funct 'month3' => $tp->lanVars(LAN_UI_FILTER_PAST_XMONTHS,3), 'month6' => $tp->lanVars(LAN_UI_FILTER_PAST_XMONTHS,6), 'month9' => $tp->lanVars(LAN_UI_FILTER_PAST_XMONTHS,9), - 'year' => LAN_UI_FILTER_PAST_YEAR + 'year' => LAN_UI_FILTER_PAST_YEAR, + 'today' => LAN_UI_FILTER_TODAY, + 'thisweek' => LAN_UI_FILTER_THIS_WEEK, + 'thismonth' => LAN_UI_FILTER_THIS_MONTH, + 'thisyear' => LAN_UI_FILTER_THIS_YEAR, ); $dateFiltersFuture = array ( diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php index 9db6a18b1e..3990c8b4ac 100644 --- a/e107_languages/English/admin/lan_admin.php +++ b/e107_languages/English/admin/lan_admin.php @@ -589,3 +589,8 @@ define("LAN_NO_SCRIPT_ACCESS", "You don't have permission to use [script] tags."); define("LAN_NO_SCRIPT_ACCESS_ASK", "If you believe this is an error, please ask the main administrator to grant you script access via [b]Preferences > Content Filters[/b]"); + +define("LAN_UI_FILTER_TODAY", "Today"); +define("LAN_UI_FILTER_THIS_WEEK", "This Week"); +define("LAN_UI_FILTER_THIS_MONTH", "This Month"); +define("LAN_UI_FILTER_THIS_YEAR", "This Year"); \ No newline at end of file