Source
$righty_min = $parser->parse($fields['righty_min']) == CParser::PARSE_SUCCESS ? $parser->calcValue() : '';
<?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.
**/
require_once dirname(__FILE__).'/../../include/blocks.inc.php';
class CControllerWidgetSvgGraphView extends CControllerWidget {
const GRAPH_WIDTH_MIN = 1;
const GRAPH_WIDTH_MAX = 65535;
const GRAPH_HEIGHT_MIN = 1;
const GRAPH_HEIGHT_MAX = 65535;
public function __construct() {
parent::__construct();
$this->setType(WIDGET_SVG_GRAPH);
$this->setValidationRules([
'name' => 'string',
'edit_mode' => 'in 0,1',
'content_width' => 'int32|ge '.self::GRAPH_WIDTH_MIN.'|le '.self::GRAPH_WIDTH_MAX,
'content_height' => 'int32|ge '.self::GRAPH_HEIGHT_MIN.'|le '.self::GRAPH_HEIGHT_MAX,
'preview' => 'in 1',
'from' => 'range_time',
'to' => 'range_time',
'fields' => 'json'
]);
}
protected function checkInput() {
$ret = parent::checkInput();
if ($ret && !$this->getInput('preview', 0)) {
$fields = [
'from' => 'required',
'to' => 'required'
];
$validator = new CNewValidator(array_intersect_key($this->getInputAll(), $fields), $fields);
foreach ($validator->getAllErrors() as $error) {
info($error);
}
$ret = !$validator->isErrorFatal() && !$validator->isError();