From 0914ae089ccaaa1a44d6d6fab4e6966dd06b813c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 30 Nov 2017 14:16:35 +0100 Subject: [statistics] Handle runmode and its isclient flag --- modules-available/statistics/inc/filter.inc.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'modules-available/statistics/inc/filter.inc.php') 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"; + } +} -- cgit v1.2.3-55-g7522