<?php declare(strict_types = 0);
class CControllerTriggerList extends CController {
protected function init(): void {
$this->disableCsrfValidation();
protected function checkInput(): bool {
'context' => 'required|in '.implode(',', ['host', 'template']),
'filter_evaltype' => 'in '.implode(',', [TAG_EVAL_TYPE_AND_OR, TAG_EVAL_TYPE_OR]),
'filter_dependent' => 'in '.implode(',', [-1, 0, 1]),
'filter_discovered' => 'in '.implode(',', [-1, 0, 1]),
'filter_groupids' => 'array_id',
'filter_hostids' => 'array_id',
'filter_inherited' => 'in '.implode(',', [-1, 0, 1]),
'filter_name' => 'string',
'filter_priority' => 'array',
'filter_state' => 'in '.implode(',', [-1, TRIGGER_STATE_NORMAL, TRIGGER_STATE_UNKNOWN]),
'filter_status' => 'in '.implode(',', [-1, TRIGGER_STATUS_ENABLED, TRIGGER_STATUS_DISABLED]),
'filter_tags' => 'array',
'filter_value' => 'in '.implode(',', [-1, TRIGGER_VALUE_FALSE, TRIGGER_VALUE_TRUE]),
'sort' => 'in '.implode(',', ['description', 'priority', 'status']),
'sortorder' => 'in '.implode(',', [ZBX_SORT_UP, ZBX_SORT_DOWN]),
$ret = $this->validateInput($fields);
$this->setResponse(new CControllerResponseFatal());
protected function checkPermissions(): bool {
return $this->getInput('context') === 'host'
? $this->checkAccess(CRoleHelper::UI_CONFIGURATION_HOSTS)
: $this->checkAccess(CRoleHelper::UI_CONFIGURATION_TEMPLATES);
protected function doAction() {
'context' => $this->getInput('context'),
'uncheck' => $this->hasInput('uncheck')
$prefix = ($data['context'] === 'host') ? 'web.hosts.' : 'web.templates.';
if ($this->hasInput('filter_set') && $this->getInput('filter_set')) {
$filter_inherited = $this->getInput('filter_inherited', -1);
$filter_discovered = $this->getInput('filter_discovered', -1);
$filter_dependent = $this->getInput('filter_dependent', -1);
$filter_name = $this->getInput('filter_name', '');
$filter_priority = $this->getInput('filter_priority', []);
$filter_groupids = $this->getInput('filter_groupids', []);
$filter_hostids = $this->getInput('filter_hostids', []);
$filter_state = $this->getInput('filter_state', -1);
$filter_status = $this->getInput('filter_status', -1);
$filter_value = $this->getInput('filter_value', -1);
$filter_evaltype = $this->getInput('filter_evaltype', TAG_EVAL_TYPE_AND_OR);
$filter_tags = $this->getInput('filter_tags', []);
elseif ($this->hasInput('filter_rst') && $this->getInput('filter_rst')) {