<?php declare(strict_types = 0);
class CControllerChartsView extends CControllerCharts {
protected function init() {
$this->disableCsrfValidation();
protected function checkInput() {
'view_as' => 'in '.HISTORY_GRAPH.','.HISTORY_VALUES,
'filter_hostids' => 'array_id',
'filter_name' => 'string',
'filter_show' => 'in '.GRAPH_FILTER_ALL.','.GRAPH_FILTER_HOST.','.GRAPH_FILTER_SIMPLE,
'subfilter_set' => 'in 1',
'subfilter_tagnames' => 'array',
'subfilter_tags' => 'array',
$ret = $this->validateInput($fields) && $this->validateTimeSelectorPeriod();
$this->setResponse(new CControllerResponseFatal());
protected function checkPermissions() {
return $this->checkAccess(CRoleHelper::UI_MONITORING_HOSTS);
protected function doAction() {
if ($this->hasInput('filter_rst')) {
CProfile::deleteIdx('web.charts.filter.hostids');
CProfile::deleteIdx('web.charts.filter.name');
CProfile::deleteIdx('web.charts.filter.show');
CProfile::deleteIdx('web.charts.subfilter.tagnames');
CProfile::deleteIdx('web.charts.subfilter.tags');
elseif ($this->hasInput('subfilter_set')) {
CProfile::updateArray('web.charts.subfilter.tagnames', $this->getInput('subfilter_tagnames', []), PROFILE_TYPE_STR);
CProfile::update('web.charts.subfilter.tags', json_encode($this->getInput('subfilter_tags', [])), PROFILE_TYPE_STR);
elseif ($this->hasInput('filter_set')) {
CProfile::updateArray('web.charts.filter.hostids', $this->getInput('filter_hostids', []), PROFILE_TYPE_ID);
CProfile::update('web.charts.filter.name', $this->getInput('filter_name', ''), PROFILE_TYPE_STR);
CProfile::update('web.charts.filter.show',
$this->getInput('filter_show', GRAPH_FILTER_ALL), PROFILE_TYPE_INT
$filter_hostids = CProfile::getArray('web.charts.filter.hostids', []);
$filter_name = CProfile::get('web.charts.filter.name', '');
$filter_show = (int) CProfile::get('web.charts.filter.show', GRAPH_FILTER_ALL);
$subfilter_tagnames = CProfile::getArray('web.charts.subfilter.tagnames', []);
$subfilter_tags = json_decode(CProfile::get('web.charts.subfilter.tags', '{}'), true);
$timeselector_options = [
'profileIdx' => 'web.charts.filter',
'from' => $this->hasInput('from') ? $this->getInput('from') : null,
'to' => $this->hasInput('to') ? $this->getInput('to') : null