<?php declare(strict_types = 0);
class CControllerSlaList extends CController {
protected function init(): void {
$this->disableCsrfValidation();
protected function checkInput(): bool {
'filter_name' => 'string',
'filter_status' => 'in '.implode(',', [CSlaHelper::SLA_STATUS_ANY, CSlaHelper::SLA_STATUS_ENABLED, CSlaHelper::SLA_STATUS_DISABLED]),
'filter_evaltype' => 'in '.TAG_EVAL_TYPE_AND_OR.','.TAG_EVAL_TYPE_OR,
'filter_tags' => 'array',
'sort' => 'in '.implode(',', ['name', 'slo', 'effective_date', 'status']),
'sortorder' => 'in '.ZBX_SORT_UP.','.ZBX_SORT_DOWN,
$ret = $this->validateInput($fields);
$this->setResponse(new CControllerResponseFatal());
protected function checkPermissions(): bool {
return $this->checkAccess(CRoleHelper::UI_SERVICES_SLA);
protected function doAction(): void {
if ($this->hasInput('filter_set')) {
CProfile::update('web.sla.filter.name', $this->getInput('filter_name', ''), PROFILE_TYPE_STR);
CProfile::update('web.sla.filter.status', $this->getInput('filter_status', CSlaHelper::SLA_STATUS_ANY),
CProfile::update('web.sla.filter.evaltype', $this->getInput('filter_evaltype', TAG_EVAL_TYPE_AND_OR),
$filter_tags = ['tags' => [], 'values' => [], 'operators' => []];
foreach ($this->getInput('filter_tags', []) as $filter_tag) {
if ($filter_tag['tag'] === '' && $filter_tag['value'] === '') {