1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Admin-UI: $field 'filter' attribute now accepts 'future' and 'both', defaults to 'past' when set to true. ie. search future dates, past/future dates or past dates.

This commit is contained in:
Cameron
2018-03-05 14:37:56 -08:00
parent f1460787a1
commit 48b3318ecb
3 changed files with 42 additions and 3 deletions

View File

@@ -3484,7 +3484,7 @@ class e_admin_controller_ui extends e_admin_controller
/**
* Handle requested filter dropdown value
* @param string $value
* @param string $filter_value
* @return array field -> value
*/
protected function _parseFilterRequest($filter_value)
@@ -3512,6 +3512,11 @@ class e_admin_controller_ui extends e_admin_controller
"week" => "1 week ago",
"month" => "1 month ago",
"year" => "1 year ago",
"nhour" => "now + 1 hour",
"nday" => "now + 24 hours",
"nweek" => "now + 1 week",
"nmonth" => "now + 1 month",
"nyear" => "now + 1 year",
);
$ky = $filter[2];
@@ -4027,7 +4032,17 @@ class e_admin_controller_ui extends e_admin_controller
case 'integer':
if($_fieldType === 'datestamp') // Past Month, Past Year etc.
{
$searchQry[] = $this->fields[$filterField]['__tableField']." > ".intval($filterValue);
if($filterValue > time())
{
$searchQry[] = $this->fields[$filterField]['__tableField']." > ".time();
$searchQry[] = $this->fields[$filterField]['__tableField']." < ".intval($filterValue);
}
else
{
$searchQry[] = $this->fields[$filterField]['__tableField']." > ".intval($filterValue);
$searchQry[] = $this->fields[$filterField]['__tableField']." < ".time();
}
}
else
{
@@ -7218,6 +7233,24 @@ class e_admin_form_ui extends e_form
"month" => LAN_UI_FILTER_PAST_MONTH,
"year" => LAN_UI_FILTER_PAST_YEAR
);
$dateFiltersFuture = array (
'nhour' => LAN_UI_FILTER_NEXT_HOUR,
"nday" => LAN_UI_FILTER_NEXT_24_HOURS,
"nweek" => LAN_UI_FILTER_NEXT_WEEK,
"nmonth" => LAN_UI_FILTER_NEXT_MONTH,
"nyear" => LAN_UI_FILTER_NEXT_YEAR
);
if($val['filter'] === 'future' )
{
$dateFilters = $dateFiltersFuture;
}
if($val['filter'] === 'both')
{
$dateFilters += $dateFiltersFuture;
}
foreach($dateFilters as $k => $name)
{

View File

@@ -480,7 +480,7 @@ class e_parse extends e_parser
/**
* Converts the supplied text (presumed to be from user input) to a format suitable for storing in a database table.
*
* @param string $data
* @param mixed $data
* @param boolean $nostrip [optional] Assumes all data is GPC ($_GET, $_POST, $_COOKIE) unless indicate otherwise by setting this var to TRUE.
* If magic quotes is enabled on the server and you do not tell toDB() that the data is non GPC then slashes will be stripped when they should not be.
* @param boolean $no_encode [optional] This parameter should nearly always be FALSE. It is used by the save_prefs() function to preserve HTML content within prefs even when

View File

@@ -487,6 +487,12 @@ define("LAN_UI_FILTER_PAST_WEEK", "Past Week");
define("LAN_UI_FILTER_PAST_MONTH", "Past Month");
define("LAN_UI_FILTER_PAST_YEAR", "Past Year");
define("LAN_UI_FILTER_NEXT_HOUR", "Next Hour");
define("LAN_UI_FILTER_NEXT_24_HOURS", "Next 24 hours");
define("LAN_UI_FILTER_NEXT_WEEK", "Next Week");
define("LAN_UI_FILTER_NEXT_MONTH", "Next Month");
define("LAN_UI_FILTER_NEXT_YEAR", "Next Year");
define("LAN_USER_MANAGEALL", "Manage all User, Userclass and Extended User-Field settings");
define("LAN_USER_LIST", "User List");
define("LAN_USER_QUICKADD","Quick Add User");