<?php declare(strict_types = 0);
class CControllerServiceList extends CControllerServiceListGeneral {
protected function init(): void {
$this->disableSIDValidation();
protected function checkInput(): bool {
'serviceid' => 'db services.serviceid',
'filter_name' => 'string',
'filter_status' => 'in '.implode(',', [SERVICE_STATUS_ANY, SERVICE_STATUS_OK, SERVICE_STATUS_PROBLEM]),
'filter_evaltype' => 'in '.TAG_EVAL_TYPE_AND_OR.','.TAG_EVAL_TYPE_OR,
'filter_tags' => 'array',
$ret = $this->validateInput($fields);
$this->setResponse(new CControllerResponseFatal());
protected function checkPermissions(): bool {
if (!$this->checkAccess(CRoleHelper::UI_SERVICES_SERVICES)) {
return parent::checkPermissions();
protected function doAction(): void {
$path = $this->getPath();
'serviceid' => $this->service !== null ? $this->service['serviceid'] : self::WITHOUT_PARENTS_SERVICEID,
'name' => $this->getInput('filter_name', self::FILTER_DEFAULT_NAME),
'status' => $this->getInput('filter_status', self::FILTER_DEFAULT_STATUS),
'without_children' => self::FILTER_DEFAULT_WITHOUT_CHILDREN,
'without_problem_tags' => self::FILTER_DEFAULT_WITHOUT_PROBLEM_TAGS,
'tag_source' => self::FILTER_DEFAULT_TAG_SOURCE,
'evaltype' => $this->getInput('filter_evaltype', self::FILTER_DEFAULT_EVALTYPE),
'filter_set' => $this->hasInput('filter_set')
foreach ($this->getInput('filter_tags', []) as $tag) {
if (!array_key_exists('tag', $tag) || !array_key_exists('value', $tag)
|| ($tag['tag'] === '' && $tag['value'] === '')) {
$filter['tags'][] = $tag;
$reset_curl = (new CUrl('zabbix.php'))
->setArgument('action', 'service.list')
->setArgument('path', $path ?: null)
->setArgument('serviceid', $this->service !== null ? $this->service['serviceid'] : null);
$paging_curl = clone $reset_curl;
if ($filter['filter_set']) {
->setArgument('filter_name', $filter['name'])