function applyReportDatetimePeriod() { if ($this->isDatetimePeriodSelectorApplicable() === true) { $period = modApiFunc('Reports', 'getReportPeriodTimestamps', get_class($this)); if ($period !== null) { list($from, $to) = $period; $from = toMySQLDatetime($from); $to = toMySQLDatetime($to); $this->__source->setDatetimePeriod($from, $to); } } }
function output($const_period, $sql_class_name, $field_name) { $params = array('from' => null, 'to' => null); if ($const_period !== null) { $period = modApiFunc('Reports', 'getTimestampPeriodByDatetimeLabel', $const_period); if ($period !== null) { list($from, $to) = $period; $params['from'] = toMySQLDatetime($from); $params['to'] = toMySQLDatetime($to); } } $res = execQuery($sql_class_name, $params); if (!empty($res) and is_array($res) and isset($res[0]) and isset($res[0][$field_name])) { return modApiFunc("Localization", "num_format", $res[0][$field_name]); } else { return ''; } }
function initSource() { parent::initSource(); $period = modApiFunc('Reports', 'getTimestampPeriodByDatetimeLabel', DATETIME_PERIOD_DAY_LAST_30); if ($period !== null) { list($from, $to) = $period; $from = toMySQLDatetime($from); $to = toMySQLDatetime($to); $this->__source->setDatetimePeriod($from, $to); } }