Source
<?php
/*
** Zabbix
** Copyright (C) 2001-2024 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* This controller is used by gtlc.js to update time selector date and time interval in user's profile.
*/
class CControllerTimeSelectorUpdate extends CController {
public static $profiles = ['web.dashboard.filter', 'web.charts.filter', 'web.httpdetails.filter',
'web.problem.filter', 'web.auditlog.filter', 'web.auditacts.filter', 'web.item.graph.filter',
'web.toptriggers.filter', 'web.avail_report.filter', CControllerHost::FILTER_IDX, CControllerProblem::FILTER_IDX
];
/**
* @var CRangeTimeParser
*/
private $range_time_parser;
private $data = [];
public function init() {
$this->range_time_parser = new CRangeTimeParser();
}
protected function checkInput() {
$fields = [
'method' => 'required|in increment,zoomout,decrement,rangechange,rangeoffset',
'idx' => 'required|in '.implode(',', static::$profiles),
'idx2' => 'required|id',
'from' => 'required|string',
'to' => 'required|string',
'from_offset' => 'int32|ge 0',
'to_offset' => 'int32|ge 0'
];
$ret = $this->validateInput($fields);
if (!$ret) {
/*
* This block executes if, for example, a missing profile is given. Since this is an AJAX request, it should
* throw a JS alert() with current message in timeSelectorEventHandler() in gtlc.js.
*/
$messages = CMessageHelper::getMessages();