break; case 'year': $period_start = mktime(0, 0, 0, 1, 1, date('Y')); break; case 24: case 24 * 7: case 24 * 30: case 24 * DAY_IN_YEAR: $period_start = $period_end - $period * 3600; break; } // fetch services $services = API::Service()->get(array('output' => array('name', 'serviceid', 'showsla', 'goodsla', 'algorithm'), 'selectParent' => array('serviceid'), 'selectDependencies' => array('servicedownid', 'soft', 'linkid'), 'selectTrigger' => array('description', 'triggerid', 'expression'), 'preservekeys' => true, 'sortfield' => 'sortorder', 'sortorder' => ZBX_SORT_UP)); // expand trigger descriptions $triggers = zbx_objectValues($services, 'trigger'); $triggers = CMacrosResolverHelper::resolveTriggerNames($triggers); foreach ($services as &$service) { if ($service['trigger']) { $service['trigger'] = $triggers[$service['trigger']['triggerid']]; } } unset($service); // fetch sla $slaData = API::Service()->getSla(array('intervals' => array(array('from' => $period_start, 'to' => $period_end)))); // expand problem trigger descriptions foreach ($slaData as &$serviceSla) { foreach ($serviceSla['problems'] as &$problemTrigger) { $problemTrigger['description'] = $triggers[$problemTrigger['triggerid']]['description']; } unset($problemTrigger); }
/** * Get Triggers data. * * @param array $options * @param array $options['itemids'] * @param array $options['hostids'] * @param array $options['groupids'] * @param array $options['triggerids'] * @param array $options['applicationids'] * @param array $options['status'] * @param array $options['editable'] * @param array $options['count'] * @param array $options['pattern'] * @param array $options['limit'] * @param array $options['order'] * * @return array|int item data as array or false if error */ public function get(array $options = []) { $result = []; $userType = self::$userData['type']; $userid = self::$userData['userid']; $sqlParts = ['select' => ['triggers' => 't.triggerid'], 'from' => ['t' => 'triggers t'], 'where' => [], 'group' => [], 'order' => [], 'limit' => null]; $defOptions = ['groupids' => null, 'templateids' => null, 'hostids' => null, 'triggerids' => null, 'itemids' => null, 'applicationids' => null, 'functions' => null, 'inherited' => null, 'templated' => null, 'monitored' => null, 'active' => null, 'maintenance' => null, 'withUnacknowledgedEvents' => null, 'withAcknowledgedEvents' => null, 'withLastEventUnacknowledged' => null, 'skipDependent' => null, 'nopermissions' => null, 'editable' => null, 'lastChangeSince' => null, 'lastChangeTill' => null, 'group' => null, 'host' => null, 'only_true' => null, 'min_severity' => null, 'filter' => null, 'search' => null, 'searchByAny' => null, 'startSearch' => null, 'excludeSearch' => null, 'searchWildcardsEnabled' => null, 'expandDescription' => null, 'expandComment' => null, 'expandExpression' => null, 'output' => API_OUTPUT_EXTEND, 'selectGroups' => null, 'selectHosts' => null, 'selectItems' => null, 'selectFunctions' => null, 'selectDependencies' => null, 'selectDiscoveryRule' => null, 'selectLastEvent' => null, 'countOutput' => null, 'groupCount' => null, 'preservekeys' => null, 'sortfield' => '', 'sortorder' => '', 'limit' => null, 'limitSelects' => null]; $options = zbx_array_merge($defOptions, $options); // editable + PERMISSION CHECK if ($userType != USER_TYPE_SUPER_ADMIN && !$options['nopermissions']) { $permission = $options['editable'] ? PERM_READ_WRITE : PERM_READ; $userGroups = getUserGroupsByUserId($userid); $sqlParts['where'][] = 'NOT EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts_groups hgg' . ' LEFT JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE t.triggerid=f.triggerid ' . ' AND f.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY i.hostid' . ' HAVING MAX(permission)<' . zbx_dbstr($permission) . ' OR MIN(permission) IS NULL' . ' OR MIN(permission)=' . PERM_DENY . ')'; } // groupids if (!is_null($options['groupids'])) { zbx_value2array($options['groupids']); sort($options['groupids']); $sqlParts['from']['functions'] = 'functions f'; $sqlParts['from']['items'] = 'items i'; $sqlParts['from']['hosts_groups'] = 'hosts_groups hg'; $sqlParts['where']['hgi'] = 'hg.hostid=i.hostid'; $sqlParts['where']['ft'] = 'f.triggerid=t.triggerid'; $sqlParts['where']['fi'] = 'f.itemid=i.itemid'; $sqlParts['where']['groupid'] = dbConditionInt('hg.groupid', $options['groupids']); if (!is_null($options['groupCount'])) { $sqlParts['group']['hg'] = 'hg.groupid'; } } // templateids if (!is_null($options['templateids'])) { zbx_value2array($options['templateids']); if (!is_null($options['hostids'])) { zbx_value2array($options['hostids']); $options['hostids'] = array_merge($options['hostids'], $options['templateids']); } else { $options['hostids'] = $options['templateids']; } } // hostids if (!is_null($options['hostids'])) { zbx_value2array($options['hostids']); $sqlParts['from']['functions'] = 'functions f'; $sqlParts['from']['items'] = 'items i'; $sqlParts['where']['hostid'] = dbConditionInt('i.hostid', $options['hostids']); $sqlParts['where']['ft'] = 'f.triggerid=t.triggerid'; $sqlParts['where']['fi'] = 'f.itemid=i.itemid'; if (!is_null($options['groupCount'])) { $sqlParts['group']['i'] = 'i.hostid'; } } // triggerids if (!is_null($options['triggerids'])) { zbx_value2array($options['triggerids']); $sqlParts['where']['triggerid'] = dbConditionInt('t.triggerid', $options['triggerids']); } // itemids if (!is_null($options['itemids'])) { zbx_value2array($options['itemids']); $sqlParts['from']['functions'] = 'functions f'; $sqlParts['where']['itemid'] = dbConditionInt('f.itemid', $options['itemids']); $sqlParts['where']['ft'] = 'f.triggerid=t.triggerid'; if (!is_null($options['groupCount'])) { $sqlParts['group']['f'] = 'f.itemid'; } } // applicationids if (!is_null($options['applicationids'])) { zbx_value2array($options['applicationids']); $sqlParts['from']['functions'] = 'functions f'; $sqlParts['from']['items_applications'] = 'items_applications ia'; $sqlParts['where']['a'] = dbConditionInt('ia.applicationid', $options['applicationids']); $sqlParts['where']['ft'] = 'f.triggerid=t.triggerid'; $sqlParts['where']['fia'] = 'f.itemid=ia.itemid'; } // functions if (!is_null($options['functions'])) { zbx_value2array($options['functions']); $sqlParts['from']['functions'] = 'functions f'; $sqlParts['where']['ft'] = 'f.triggerid=t.triggerid'; $sqlParts['where'][] = dbConditionString('f.function', $options['functions']); } // monitored if (!is_null($options['monitored'])) { $sqlParts['where']['monitored'] = 'NOT EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts h' . ' WHERE t.triggerid=f.triggerid' . ' AND f.itemid=i.itemid' . ' AND i.hostid=h.hostid' . ' AND (' . 'i.status<>' . ITEM_STATUS_ACTIVE . ' OR h.status<>' . HOST_STATUS_MONITORED . ')' . ')'; $sqlParts['where']['status'] = 't.status=' . TRIGGER_STATUS_ENABLED; } // active if (!is_null($options['active'])) { $sqlParts['where']['active'] = 'NOT EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts h' . ' WHERE t.triggerid=f.triggerid' . ' AND f.itemid=i.itemid' . ' AND i.hostid=h.hostid' . ' AND h.status<>' . HOST_STATUS_MONITORED . ')'; $sqlParts['where']['status'] = 't.status=' . TRIGGER_STATUS_ENABLED; } // maintenance if (!is_null($options['maintenance'])) { $sqlParts['where'][] = ($options['maintenance'] == 0 ? 'NOT ' : '') . 'EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts h' . ' WHERE t.triggerid=f.triggerid' . ' AND f.itemid=i.itemid' . ' AND i.hostid=h.hostid' . ' AND h.maintenance_status=' . HOST_MAINTENANCE_STATUS_ON . ')'; $sqlParts['where'][] = 't.status=' . TRIGGER_STATUS_ENABLED; } // lastChangeSince if (!is_null($options['lastChangeSince'])) { $sqlParts['where']['lastchangesince'] = 't.lastchange>' . zbx_dbstr($options['lastChangeSince']); } // lastChangeTill if (!is_null($options['lastChangeTill'])) { $sqlParts['where']['lastchangetill'] = 't.lastchange<' . zbx_dbstr($options['lastChangeTill']); } // withUnacknowledgedEvents if (!is_null($options['withUnacknowledgedEvents'])) { $sqlParts['where']['unack'] = 'EXISTS (' . 'SELECT NULL' . ' FROM events e' . ' WHERE t.triggerid=e.objectid' . ' AND e.source=' . EVENT_SOURCE_TRIGGERS . ' AND e.object=' . EVENT_OBJECT_TRIGGER . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' AND e.acknowledged=' . EVENT_NOT_ACKNOWLEDGED . ')'; } // withAcknowledgedEvents if (!is_null($options['withAcknowledgedEvents'])) { $sqlParts['where']['ack'] = 'NOT EXISTS (' . 'SELECT NULL' . ' FROM events e' . ' WHERE e.objectid=t.triggerid' . ' AND e.source=' . EVENT_SOURCE_TRIGGERS . ' AND e.object=' . EVENT_OBJECT_TRIGGER . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' AND e.acknowledged=' . EVENT_NOT_ACKNOWLEDGED . ')'; } // templated if (!is_null($options['templated'])) { $sqlParts['from']['functions'] = 'functions f'; $sqlParts['from']['items'] = 'items i'; $sqlParts['from']['hosts'] = 'hosts h'; $sqlParts['where']['ft'] = 'f.triggerid=t.triggerid'; $sqlParts['where']['fi'] = 'f.itemid=i.itemid'; $sqlParts['where']['hi'] = 'h.hostid=i.hostid'; if ($options['templated']) { $sqlParts['where'][] = 'h.status=' . HOST_STATUS_TEMPLATE; } else { $sqlParts['where'][] = 'h.status<>' . HOST_STATUS_TEMPLATE; } } // inherited if (!is_null($options['inherited'])) { if ($options['inherited']) { $sqlParts['where'][] = 't.templateid IS NOT NULL'; } else { $sqlParts['where'][] = 't.templateid IS NULL'; } } // search if (is_array($options['search'])) { zbx_db_search('triggers t', $options, $sqlParts); } // filter if (is_null($options['filter'])) { $options['filter'] = []; } if (is_array($options['filter'])) { if (!array_key_exists('flags', $options['filter'])) { $options['filter']['flags'] = [ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED]; } $this->dbFilter('triggers t', $options, $sqlParts); if (isset($options['filter']['host']) && !is_null($options['filter']['host'])) { zbx_value2array($options['filter']['host']); $sqlParts['from']['functions'] = 'functions f'; $sqlParts['from']['items'] = 'items i'; $sqlParts['where']['ft'] = 'f.triggerid=t.triggerid'; $sqlParts['where']['fi'] = 'f.itemid=i.itemid'; $sqlParts['from']['hosts'] = 'hosts h'; $sqlParts['where']['hi'] = 'h.hostid=i.hostid'; $sqlParts['where']['host'] = dbConditionString('h.host', $options['filter']['host']); } if (isset($options['filter']['hostid']) && !is_null($options['filter']['hostid'])) { zbx_value2array($options['filter']['hostid']); $sqlParts['from']['functions'] = 'functions f'; $sqlParts['from']['items'] = 'items i'; $sqlParts['where']['ft'] = 'f.triggerid=t.triggerid'; $sqlParts['where']['fi'] = 'f.itemid=i.itemid'; $sqlParts['where']['hostid'] = dbConditionInt('i.hostid', $options['filter']['hostid']); } } // group if (!is_null($options['group'])) { $sqlParts['from']['functions'] = 'functions f'; $sqlParts['from']['items'] = 'items i'; $sqlParts['from']['hosts_groups'] = 'hosts_groups hg'; $sqlParts['from']['groups'] = 'groups g'; $sqlParts['where']['ft'] = 'f.triggerid=t.triggerid'; $sqlParts['where']['fi'] = 'f.itemid=i.itemid'; $sqlParts['where']['hgi'] = 'hg.hostid=i.hostid'; $sqlParts['where']['ghg'] = 'g.groupid = hg.groupid'; $sqlParts['where']['group'] = ' g.name=' . zbx_dbstr($options['group']); } // host if (!is_null($options['host'])) { $sqlParts['from']['functions'] = 'functions f'; $sqlParts['from']['items'] = 'items i'; $sqlParts['from']['hosts'] = 'hosts h'; $sqlParts['where']['ft'] = 'f.triggerid=t.triggerid'; $sqlParts['where']['fi'] = 'f.itemid=i.itemid'; $sqlParts['where']['hi'] = 'h.hostid=i.hostid'; $sqlParts['where']['host'] = ' h.host=' . zbx_dbstr($options['host']); } // only_true if (!is_null($options['only_true'])) { $config = select_config(); $sqlParts['where']['ot'] = '((t.value=' . TRIGGER_VALUE_TRUE . ')' . ' OR ' . '((t.value=' . TRIGGER_VALUE_FALSE . ') AND (t.lastchange>' . (time() - $config['ok_period']) . ')))'; } // min_severity if (!is_null($options['min_severity'])) { $sqlParts['where'][] = 't.priority>=' . zbx_dbstr($options['min_severity']); } // limit if (!zbx_ctype_digit($options['limit']) || !$options['limit']) { $options['limit'] = null; } $sqlParts = $this->applyQueryOutputOptions($this->tableName(), $this->tableAlias(), $options, $sqlParts); $sqlParts = $this->applyQuerySortOptions($this->tableName(), $this->tableAlias(), $options, $sqlParts); // return count or grouped counts via direct SQL count if (!is_null($options['countOutput']) && !$this->requiresPostSqlFiltering($options)) { $dbRes = DBselect($this->createSelectQueryFromParts($sqlParts), $options['limit']); while ($trigger = DBfetch($dbRes)) { if (!is_null($options['groupCount'])) { $result[] = $trigger; } else { $result = $trigger['rowscount']; } } return $result; } $result = zbx_toHash($this->customFetch($this->createSelectQueryFromParts($sqlParts), $options), 'triggerid'); // return count for post SQL filtered result sets if (!is_null($options['countOutput'])) { return count($result); } if ($result) { $result = $this->addRelatedObjects($options, $result); } // expandDescription if (!is_null($options['expandDescription']) && $result && array_key_exists('description', reset($result))) { $result = CMacrosResolverHelper::resolveTriggerNames($result); } // expandComment if (!is_null($options['expandComment']) && $result && array_key_exists('comments', reset($result))) { $result = CMacrosResolverHelper::resolveTriggerDescriptions($result); } // expand expression if ($options['expandExpression'] !== null && $result && array_key_exists('expression', reset($result))) { $result = CMacrosResolverHelper::resolveTriggerExpressions($result, ['resolve_usermacros' => true, 'resolve_macros' => true]); } // removing keys (hash -> array) if (is_null($options['preservekeys'])) { $result = zbx_cleanHashes($result); } $result = $this->unsetExtraFields($result, ['state', 'expression'], $options['output']); return $result; }
/** * Generate table for dashboard triggers popup. * * @see make_system_status * * @param array $triggers * @param array $ackParams * @param array $actions * @param array $config * * @return CTableInfo */ function makeTriggersPopup(array $triggers, array $ackParams, array $actions, array $config) { $popupTable = new CTableInfo(); $popupTable->setAttribute('style', 'width: 400px;'); $popupTable->setHeader(array(_('Host'), _('Issue'), _('Age'), _('Info'), $config['event_ack_enable'] ? _('Ack') : null, _('Actions'))); CArrayHelper::sort($triggers, array(array('field' => 'lastchange', 'order' => ZBX_SORT_DOWN))); $triggers = CMacrosResolverHelper::resolveTriggerNames($triggers); foreach ($triggers as $trigger) { // unknown triggers $unknown = SPACE; if ($trigger['state'] == TRIGGER_STATE_UNKNOWN) { $unknown = new CDiv(SPACE, 'status_icon iconunknown'); $unknown->setHint($trigger['error'], 'on'); } // ack if ($config['event_ack_enable']) { $ack = isset($trigger['event']['eventid']) ? getEventAckState($trigger['event'], true, true, $ackParams) : _('No events'); } else { $ack = null; } // action $action = isset($trigger['event']['eventid']) && isset($actions[$trigger['event']['eventid']]) ? $actions[$trigger['event']['eventid']] : _('-'); $popupTable->addRow(array($trigger['hosts'][0]['name'], getSeverityCell($trigger['priority'], $trigger['description']), zbx_date2age($trigger['lastchange']), $unknown, $ack, $action)); } return $popupTable; }
$trigger['hostname'] = $host['name']; $description = new CLink($trigger['description'], 'javascript:void(0);'); $trigger['description'] = $trigger['hostname'] . NAME_DELIMITER . $trigger['description']; if ($multiselect) { $js_action = 'addValue(' . zbx_jsvalue($reference) . ', ' . zbx_jsvalue($trigger['triggerid']) . ', ' . $parentId . ');'; } else { $values = [$dstfld1 => $trigger[$srcfld1], $dstfld2 => $trigger[$srcfld2]]; if (isset($srcfld3)) { $values[$dstfld3] = $trigger[$srcfld3]; } $js_action = 'addValues(' . zbx_jsvalue($dstfrm) . ', ' . zbx_jsvalue($values) . '); return false;'; } $description->onClick($js_action . ' jQuery(this).removeAttr("onclick");'); if ($trigger['dependencies']) { $description = [$description, BR(), bold(_('Depends on')), BR()]; $dependencies = CMacrosResolverHelper::resolveTriggerNames(zbx_toHash($trigger['dependencies'], 'triggerid')); foreach ($dependencies as $dependency) { $description[] = $dependency['description']; $description[] = BR(); } array_pop($description); } $table->addRow([$multiselect ? new CCheckBox('triggers[' . zbx_jsValue($trigger[$srcfld1]) . ']', $trigger['triggerid']) : null, $description, getSeverityCell($trigger['priority'], $config), (new CSpan(triggerIndicator($trigger['status'], $trigger['state'])))->addClass(triggerIndicatorStyle($trigger['status'], $trigger['state']))]); // made to save memory usage if ($multiselect) { $jsTriggers[$trigger['triggerid']] = ['id' => $trigger['triggerid'], 'name' => $trigger['description'], 'triggerid' => $trigger['triggerid'], 'description' => $trigger['description'], 'expression' => $trigger['expression'], 'priority' => $trigger['priority'], 'status' => $trigger['status'], 'host' => $trigger['hostname']]; } } if ($multiselect) { $table->setFooter(new CCol((new CButton('select', _('Select')))->onClick("addSelectedValues('triggers', " . zbx_jsvalue($reference) . ', ' . $parentId . ');'))); insert_js('var popupReference = ' . zbx_jsValue($jsTriggers, true) . ';');
/** * Creates and returns the trigger overview table for the given hosts. * * @param array $hosts an array of hosts with host IDs as keys * @param string $hosts[hostid][name] * @param string $hosts[hostid][hostid] * @param array $triggers * @param string $triggers[][triggerid] * @param string $triggers[][description] * @param string $triggers[][expression] * @param int $triggers[][value] * @param int $triggers[][lastchange] * @param int $triggers[][flags] * @param array $triggers[][url] * @param int $triggers[][priority] * @param array $triggers[][hosts] * @param string $triggers[][hosts][][hostid] * @param string $triggers[][hosts][][name] * @param string $pageFile the page where the element is displayed * @param int $viewMode table display style: either hosts on top, or host on the left side * @param string $screenId the ID of the screen, that contains the trigger overview table * * @return CTableInfo */ function getTriggersOverview(array $hosts, array $triggers, $pageFile, $viewMode = null, $screenId = null) { $data = []; $hostNames = []; $trcounter = []; $triggers = CMacrosResolverHelper::resolveTriggerNames($triggers, true); foreach ($triggers as $trigger) { $trigger_name = $trigger['description']; foreach ($trigger['hosts'] as $host) { // triggers may belong to hosts that are filtered out and shouldn't be displayed, skip them if (!isset($hosts[$host['hostid']])) { continue; } $hostNames[$host['hostid']] = $host['name']; if (!array_key_exists($host['name'], $trcounter)) { $trcounter[$host['name']] = []; } if (!array_key_exists($trigger_name, $trcounter[$host['name']])) { $trcounter[$host['name']][$trigger_name] = 0; } $data[$trigger_name][$trcounter[$host['name']][$trigger_name]][$host['name']] = ['groupid' => $trigger['groupid'], 'hostid' => $host['hostid'], 'triggerid' => $trigger['triggerid'], 'value' => $trigger['value'], 'lastchange' => $trigger['lastchange'], 'priority' => $trigger['priority'], 'flags' => $trigger['flags'], 'url' => $trigger['url'], 'hosts' => $trigger['hosts'], 'items' => $trigger['items']]; $trcounter[$host['name']][$trigger_name]++; } } $triggerTable = new CTableInfo(); if (empty($hostNames)) { return $triggerTable; } $triggerTable->makeVerticalRotation(); order_result($hostNames); if ($viewMode == STYLE_TOP) { // header $header = [_('Triggers')]; foreach ($hostNames as $hostName) { $header[] = (new CColHeader($hostName))->addClass('vertical_rotation'); } $triggerTable->setHeader($header); // data foreach ($data as $trigger_name => $trigger_data) { foreach ($trigger_data as $trigger_hosts) { $columns = [nbsp($trigger_name)]; foreach ($hostNames as $hostName) { $columns[] = getTriggerOverviewCells(isset($trigger_hosts[$hostName]) ? $trigger_hosts[$hostName] : null, $pageFile, $screenId); } $triggerTable->addRow($columns); } } } else { // header $header = [_('Host')]; foreach ($data as $trigger_name => $trigger_data) { foreach ($trigger_data as $trigger_hosts) { $header[] = (new CColHeader($trigger_name))->addClass('vertical_rotation'); } } $triggerTable->setHeader($header); // data $scripts = API::Script()->getScriptsByHosts(zbx_objectValues($hosts, 'hostid')); foreach ($hostNames as $hostId => $hostName) { $name = (new CSpan($hostName))->addClass(ZBX_STYLE_LINK_ACTION); $name->setMenuPopup(CMenuPopupHelper::getHost($hosts[$hostId], $scripts[$hostId])); $columns = [(new CCol($name))->addClass(ZBX_STYLE_NOWRAP)]; foreach ($data as $trigger_data) { foreach ($trigger_data as $trigger_hosts) { $columns[] = getTriggerOverviewCells(isset($trigger_hosts[$hostName]) ? $trigger_hosts[$hostName] : null, $pageFile, $screenId); } } $triggerTable->addRow($columns); } } return $triggerTable; }
$data['trigger'] = $host['name'] . NAME_DELIMITER . $trigger['description']; } else { $data['trigger'] = ''; } // render view $servicesView = new CView('configuration.services.edit', $data); $servicesView->render(); $servicesView->show(); } else { // services $services = API::Service()->get(['output' => ['name', 'serviceid', 'algorithm'], 'selectParent' => ['serviceid'], 'selectDependencies' => ['servicedownid', 'soft', 'linkid'], 'selectTrigger' => ['description', 'triggerid', 'expression'], 'preservekeys' => true, 'sortfield' => 'sortorder', 'sortorder' => ZBX_SORT_UP]); // triggers $triggers = zbx_objectValues(array_filter($services, function ($service) { return (bool) $service['trigger']; }), 'trigger'); $triggers = CMacrosResolverHelper::resolveTriggerNames(zbx_toHash($triggers, 'triggerid')); foreach ($services as &$service) { if ($service['trigger']) { $service['trigger'] = $triggers[$service['trigger']['triggerid']]; } } unset($service); $treeData = []; createServiceConfigurationTree($services, $treeData); $tree = new CServiceTree('service_conf_tree', $treeData, ['caption' => _('Service'), 'action' => _('Action'), 'algorithm' => _('Status calculation'), 'description' => _('Trigger')]); if (empty($tree)) { error(_('Cannot format tree.')); } $data = ['tree' => $tree]; // render view $servicesView = new CView('configuration.services.list', $data);