1<?php
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$form = (new CForm())
27	->setId('scheduledreport-form')
28	->setName('scheduledreport-form')
29	->addVar('action', 'popup.scheduledreport.create')
30	->addItem((new CInput('submit', 'submit'))->addStyle('display: none;'));
31
32$form->addItem(new CPartial('scheduledreport.formgrid.html', [
33	'source' => 'popup',
34	'form' => $form->getName()
35] + $data));
36
37$output = [
38	'header' => $data['title'],
39	'body' => $form->toString(),
40	'script_inline' => $this->readJsFile('popup.scheduledreport.edit.js.php'),
41	'buttons' => [
42		[
43			'title' => _('Add'),
44			'keepOpen' => true,
45			'isSubmit' => true,
46			'action' => 'return submitScheduledReport(overlay);'
47		]
48	]
49];
50
51if (($messages = getMessages()) !== null) {
52	$output['messages'] = $messages->toString();
53}
54
55if ($data['user']['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) {
56	CProfiler::getInstance()->stop();
57	$output['debug'] = CProfiler::getInstance()->make()->toString();
58}
59
60echo json_encode($output);
61