diff options
author | Simon Rettberg | 2017-11-30 14:16:35 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-11-30 14:16:35 +0100 |
commit | 0914ae089ccaaa1a44d6d6fab4e6966dd06b813c (patch) | |
tree | 07630f1d02cf9f8b802c0e558748b6e40622e85c /modules-available/statistics/inc/filter.inc.php | |
parent | [locationinfo] Added standby to the summary panel (diff) | |
download | slx-admin-0914ae089ccaaa1a44d6d6fab4e6966dd06b813c.tar.gz slx-admin-0914ae089ccaaa1a44d6d6fab4e6966dd06b813c.tar.xz slx-admin-0914ae089ccaaa1a44d6d6fab4e6966dd06b813c.zip |
[statistics] Handle runmode and its isclient flag
Diffstat (limited to 'modules-available/statistics/inc/filter.inc.php')
-rw-r--r-- | modules-available/statistics/inc/filter.inc.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/modules-available/statistics/inc/filter.inc.php b/modules-available/statistics/inc/filter.inc.php index b16bd9fb..6e437a71 100644 --- a/modules-available/statistics/inc/filter.inc.php +++ b/modules-available/statistics/inc/filter.inc.php @@ -29,7 +29,7 @@ class Filter $addendum = ''; /* check if we have to do some parsing*/ - if (Page_Statistics::$columns[$this->column]['type'] == 'date') { + if (Page_Statistics::$columns[$this->column]['type'] === 'date') { $args[$key] = strtotime($this->argument); } else { $args[$key] = $this->argument; @@ -180,8 +180,7 @@ class StateFilter extends Filter { public function __construct($operator, $argument) { - $this->operator = $operator; - $this->argument = $argument; + parent::__construct(null, $operator, $argument); } public function whereClause(&$args, &$joins) @@ -236,3 +235,20 @@ class SubnetFilter extends Filter } } +class IsClientFilter extends Filter +{ + public function __construct($argument) + { + parent::__construct(null, null, $argument); + } + + public function whereClause(&$args, &$joins) + { + if ($this->argument) { + $joins[] = ' LEFT JOIN runmode USING (machineuuid)'; + return "(runmode.isclient <> 0 OR runmode.isclient IS NULL)"; + } + $joins[] = ' INNER JOIN runmode USING (machineuuid)'; + return "runmode.isclient = 0"; + } +} |