1<?php declare(strict_types = 1);
2/*
3** Zabbix
4** Copyright (C) 2001-2021 Zabbix SIA
5**
6** This program is free software; you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation; either version 2 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program; if not, write to the Free Software
18** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19**/
20
21
22/**
23 * @var CView $this
24 */
25
26$this->addJsFile('multiselect.js');
27$this->addJsFile('class.calendar.js');
28$this->includeJsFile('reports.scheduledreport.edit.js.php', [
29	'old_dashboardid' => $data['old_dashboardid'],
30	'dashboard_inaccessible' => $data['dashboard_inaccessible']
31]);
32
33$widget = (new CWidget())->setTitle(_('Scheduled reports'));
34
35$form = (new CForm())
36	->setId('scheduledreport-form')
37	->setName('scheduledreport-form')
38	->setAction(
39		(new CUrl('zabbix.php'))
40			->setArgument('action', ($data['reportid'] == 0) ? 'scheduledreport.create' : 'scheduledreport.update')
41			->getUrl()
42	)
43	->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE);
44
45if ($data['reportid'] != 0) {
46	$form->addVar('reportid', $data['reportid']);
47}
48
49if ($data['old_dashboardid'] != 0) {
50	$form->addVar('old_dashboardid', $data['old_dashboardid']);
51}
52
53$form_grid = new CPartial('scheduledreport.formgrid.html', [
54	'source' => 'reports',
55	'form' => $form->getName()
56] + $data);
57
58$form->addItem((new CTabView())->addTab('scheduledreport_tab', _('Scheduled report'), $form_grid));
59
60$widget
61	->addItem($form)
62	->show();
63