Source
$percentile_right_value = $parser->parse($this->fields_values['percentile_right_value']) == CParser::PARSE_SUCCESS
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
namespace Widgets\SvgGraph\Actions;
use CControllerDashboardWidgetView,
CControllerResponseData,
CNumberParser,
CParser;
use Widgets\SvgGraph\Includes\{
CSvgGraphHelper,
WidgetForm
};
use Widgets\SvgGraph\Widget;
class WidgetView extends CControllerDashboardWidgetView {
private const GRAPH_WIDTH_MIN = 1;
private const GRAPH_WIDTH_MAX = 65535;
private const GRAPH_HEIGHT_MIN = 1;
private const GRAPH_HEIGHT_MAX = 65535;
protected function init(): void {
parent::init();
$this->addValidationRules([
'edit_mode' => 'in 0,1',
'contents_width' => 'int32|ge '.self::GRAPH_WIDTH_MIN.'|le '.self::GRAPH_WIDTH_MAX,
'contents_height' => 'int32|ge '.self::GRAPH_HEIGHT_MIN.'|le '.self::GRAPH_HEIGHT_MAX,
'has_custom_time_period' => 'in 1',
'preview' => 'in 1'
]);
}
protected function doAction(): void {
$edit_mode = $this->getInput('edit_mode', 0);
$width = (int) $this->getInput('contents_width', self::GRAPH_WIDTH_MIN);
$height = (int) $this->getInput('contents_height', self::GRAPH_HEIGHT_MIN);
$has_custom_time_period = $this->hasInput('has_custom_time_period');
$preview = $this->hasInput('preview'); // Configuration preview.
// Hide left/right Y axis if it is not used by any dataset.
$ds_y_axes = array_column($this->fields_values['ds'], 'axisy', 'axisy');
$lefty = array_key_exists(GRAPH_YAXIS_SIDE_LEFT, $ds_y_axes)
? $this->fields_values['lefty']
: SVG_GRAPH_AXIS_OFF;
$righty = array_key_exists(GRAPH_YAXIS_SIDE_RIGHT, $ds_y_axes)
? $this->fields_values['righty']