method run documentation in bbn\Appui\Statistic

Run the stat

function($start, $end = NULL) { if ($this->db_cfg && !empty($this->db_cfg['values'])) { if (is_string($start)) { $start = strtotime($start . (strlen($start) === 10 ? ' 00:00:00' : '')); } if (!$start || !is_int($start)) { throw new Exception(X::_('Impossible to read the given start date')); } if (!$this->is_total) { if (!$end || ($end <= $start)) { $end = mktime(23, 59, 59, Date('n', $start), Date('j', $start), Date('Y', $start)); } if (!$end || !is_int($end)) { throw new Exception(X::_('Impossible to read the given end date')); } } $vals = []; foreach ($this->db_cfg['values'] as $v) { if (!$this->is_total && ($v === self::$_placeholder . '2')) { $vals[] = $end; } else { $vals[] = $v === self::$_placeholder ? $start : $v; } } $cfg = $this->db_cfg; $cfg['values'] = $vals; try { $res = $this->db->selectOne($cfg); } catch (\Exception $e) { X::log([$e->getMessage(), $this->ocfg, $cfg['sql'], $cfg['values']], 'stat'); throw new Exception($e); } return $res; } }

Run the stat BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.