Source
<?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
*/
$form = (new CForm())
->cleanItems()
->setId('maintenance_period_form')
->addVar('action', 'popup.maintenance.period')
->addVar('refresh', 1)
->addVar('update', $data['update'])
->addVar('index', $data['index']);
$form_list = (new CFormList());
if (array_key_exists('timeperiodid', $data)) {
$form->addVar('timeperiodid', $data['timeperiodid']);
}
$days_weekly = [];
$days_monthly = [];
foreach ([1, 4, 6, 2, 5, 7, 3] as $day) {
$value = 1 << ($day - 1);
$days_weekly[] = [
'name' => getDayOfWeekCaption($day),
'value' => $value,
'checked' => ($data['timeperiod_type'] == TIMEPERIOD_TYPE_WEEKLY && (bool) ($value & $data['dayofweek']))
];
$days_monthly[] = [
'name' => getDayOfWeekCaption($day),
'value' => $value,
'checked' => ($data['timeperiod_type'] == TIMEPERIOD_TYPE_MONTHLY && (bool) ($value & $data['dayofweek']))
];
}
$months = [];
foreach ([1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8, 12] as $month) {
$value = 1 << ($month - 1);
$months[] = [
'name' => getMonthCaption($month),
'value' => $value,