Source
$text = $first_characters[$row['change_type']] . str_repeat(' ', $row['depth'] * 2 -1) . $line . "\n";
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* @var CView $this
*/
function drawToc(array $toc): CDiv {
$change_types_list = (new CTag('ul', true))
->addClass(ZBX_STYLE_TOC_LIST);
foreach ($toc as $change_type => $entity_types) {
$change_types_list->addItem(drawChangeType($change_type, $entity_types));
}
return (new CDiv())
->addClass(ZBX_STYLE_TOC)
->addItem($change_types_list);
}
function drawChangeType(string $name, array $entity_types): CTag {
$entity_types_list = (new CTag('ul', true))
->addClass(ZBX_STYLE_TOC_SUBLIST);
foreach ($entity_types as $entity_type => $entities) {
$entity_types_list->addItem(drawEntityType($entity_type, $entities));
}
return (new CTag('li', true))
->addItem((new CDiv())
->addClass(ZBX_STYLE_TOC_ROW)
->addItem((new CTag('button', true))
->addClass(ZBX_STYLE_TOC_ITEM)
->addClass(ZBX_STYLE_TOC_ARROW)
->addItem((new CSpan())
->addClass(ZBX_STYLE_ARROW_DOWN)
)
->addItem($name)
)
)
->addItem($entity_types_list);
}
function drawEntityType(string $name, array $entities): CTag {