Source
(new CWidgetFieldSelect('sort_triggers', _('Sort entries by'), $this->getSortTriggersValues()))
<?php declare(strict_types = 0);
/*
** Zabbix
** Copyright (C) 2001-2023 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.
**/
namespace Widgets\Problems\Includes;
use Zabbix\Widgets\{
CWidgetField,
CWidgetForm
};
use Zabbix\Widgets\Fields\{
CWidgetFieldCheckBox,
CWidgetFieldIntegerBox,
CWidgetFieldMultiSelectGroup,
CWidgetFieldMultiSelectHost,
CWidgetFieldMultiSelectOverrideHost,
CWidgetFieldRadioButtonList,
CWidgetFieldSelect,
CWidgetFieldSeverities,
CWidgetFieldTags,
CWidgetFieldTextBox
};
/**
* Problems widget form.
*/
class WidgetForm extends CWidgetForm {
private bool $show_tags = false;
protected function normalizeValues(array $values): array {
$values = parent::normalizeValues($values);
if (array_key_exists('show_tags', $values)) {
$this->show_tags = $values['show_tags'] !== SHOW_TAGS_NONE;
}
return $values;
}
public function addFields(): self {
return $this
->addField(
(new CWidgetFieldRadioButtonList('show', _('Show'), [
TRIGGERS_OPTION_RECENT_PROBLEM => _('Recent problems'),