Source
$host_output->addClass($host['status'] == HOST_STATUS_MONITORED ? ZBX_STYLE_GREEN : ZBX_STYLE_RED);
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/**
* @var CView $this
* @var array $data
*/
$this->addJsFile('items.js');
$this->addJsFile('multilineinput.js');
$this->includeJsFile('configuration.hostgroup.list.js.php');
$html_page = (new CHtmlPage())
->setTitle(_('Host groups'))
->setDocUrl(CDocHelper::getUrl(CDocHelper::DATA_COLLECTION_HOSTGROUPS_LIST))
->setControls(
(new CTag('nav', true,
(new CList())
->addItem(
CWebUser::getType() == USER_TYPE_SUPER_ADMIN
? (new CSimpleButton(_('Create host group')))->addClass('js-create-hostgroup')
: (new CSimpleButton(_('Create host group').' '._('(Only super admins can create groups)')))
->setEnabled(false)
)
))->setAttribute('aria-label', _('Content controls'))
)
->addItem((new CFilter())
->setResetUrl((new CUrl('zabbix.php'))->setArgument('action', 'hostgroup.list'))
->setProfile($data['profileIdx'])
->setActiveTab($data['active_tab'])
->addFilterTab(_('Filter'), [
(new CFormGrid())
->addItem([
new CLabel(_('Name'), 'filter_name'),
new CFormField(
(new CTextBox('filter_name', $data['filter']['name']))
->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH)
->setAttribute('autofocus', 'autofocus')
)
])
])
->addVar('action', 'hostgroup.list')
);
$form = (new CForm())->setName('hostgroup_list');
$view_url = (new CUrl('zabbix.php'))
->setArgument('action', 'hostgroup.list')
->getUrl();
$table = (new CTableInfo())
->setHeader([
(new CColHeader(
(new CCheckBox('all_groups'))
->onClick("checkAll('".$form->getName()."', 'all_groups', 'groups');")
))->addClass(ZBX_STYLE_CELL_WIDTH),
make_sorting_header(_('Name'), 'name', $data['sort'], $data['sortorder'], $view_url),
(new CColHeader(_('Hosts')))->setColSpan(2),
(new CColHeader(_('Info')))->addClass(ZBX_STYLE_CELL_WIDTH)
])
->setPageNavigation($data['paging']);
$current_time = time();
foreach ($data['groups'] as $group) {
$hosts_output = [];
$n = 0;
foreach ($group['hosts'] as $host) {
$n++;
if ($n > $data['config']['max_in_table']) {
$hosts_output[] = [' ', HELLIP()];
break;
}
if ($n > 1) {