Source
(new CRowHeader([_('Start time'), _('Duration'), _('Name'), _('Action')]))->addClass(ZBX_STYLE_GREY)
<?php declare(strict_types = 0);
/*
** Zabbix
** 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 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
* @var array $data
*/
$form = (new CForm('post'))
->setId('sla-form')
->setName('sla_form')
->addItem(getMessages());
// Enable form submitting on Enter.
$form->addItem((new CSubmitButton(null))->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
// SLA tab.
$schedule = (new CTable())->addStyle('min-width: '.ZBX_TEXTAREA_STANDARD_WIDTH.'px;');
for ($weekday = 0; $weekday < 7; $weekday++) {
$schedule->addRow(new CRow([
(new CCheckBox('schedule_enabled['.$weekday.']', $weekday))
->setLabel(getDayOfWeekCaption($weekday))
->setChecked($data['form']['schedule_periods'][$weekday] !== ''),
(new CTextBox('schedule_periods['.$weekday.']', $data['form']['schedule_periods'][$weekday]))
->setWidth(ZBX_TEXTAREA_MEDIUM_WIDTH)
->setAttribute('placeholder', '8:00-17:00, ...')
]));
}
$sla_tab = (new CFormGrid())
->addItem([
(new CLabel(_('Name'), 'name'))->setAsteriskMark(),
new CFormField(
(new CTextBox('name', $data['form']['name'], false, DB::getFieldLength('sla', 'name')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()
->setAttribute('autofocus', 'autofocus')
)
])
->addItem([
(new CLabel(_('SLO'), 'slo'))->setAsteriskMark(),
new CFormField([
(new CTextBox('slo', $data['form']['slo'], false, 7))