Source
if (($first_alert = DBfetch(DBselect('SELECT MIN(a.clock) AS clock FROM alerts a'))) && $first_alert['clock']) {
<?php
/*
** 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 Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/include/config.inc.php';
$page['title'] = _('Notification report');
$page['file'] = 'report4.php';
$page['scripts'] = ['report4.js'];
require_once dirname(__FILE__).'/include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = [
'year' => [T_ZBX_INT, O_OPT, P_SYS|P_NZERO, null, null],
'period' => [T_ZBX_STR, O_OPT, P_SYS|P_NZERO, IN('"daily","weekly","monthly","yearly"'), null],
'media_type' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null]
];
check_fields($fields);
$media_type = getRequest('media_type', 0);
if ($media_type != 0) {
$db_media_type = API::MediaType()->get([
'mediatypeids' => $media_type,
'countOutput' => true
]);
if (!$db_media_type) {
access_deny ();
}
}
$year = getRequest('year', intval(date('Y')));
$period = getRequest('period', 'weekly');
$current_year = date('Y');
$media_types = [];
$db_media_types = API::MediaType()->get([
'output' => ['name'],
'preservekeys' => true
]);
CArrayHelper::sort($db_media_types, ['name']);
$media_types = array_column($db_media_types, 'name', 'mediatypeid');
$html_page = (new CHtmlPage())
->setTitle(_('Notifications'))
->setDocUrl(CDocHelper::getUrl(CDocHelper::REPORT4));
if ($media_types) {