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 22require_once dirname(__FILE__).'/include/config.inc.php'; 23 24$page['title'] = _('Configuration of trigger displaying options'); 25$page['file'] = 'adm.triggerdisplayoptions.php'; 26 27require_once dirname(__FILE__).'/include/page_header.php'; 28 29$fields = [ 30 'problem_unack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', 31 _('Unacknowledged PROBLEM events') 32 ], 33 'problem_ack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', 34 _('Acknowledged PROBLEM events') 35 ], 36 'ok_unack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Unacknowledged OK events')], 37 'ok_ack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Acknowledged OK events')], 38 'problem_unack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 39 'problem_ack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 40 'ok_unack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 41 'ok_ack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 42 'ok_period' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 999999), 'isset({update})', 43 _('Display OK triggers for') 44 ], 45 'blink_period' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 999999), 'isset({update})', 46 _('On status change triggers blink for') 47 ], 48 // actions 49 'update'=> [T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null], 50 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null] 51]; 52check_fields($fields); 53 54/* 55 * Actions 56 */ 57if (hasRequest('update')) { 58 DBstart(); 59 $result = update_config([ 60 'problem_unack_color' => getRequest('problem_unack_color'), 61 'problem_ack_color' => getRequest('problem_ack_color'), 62 'ok_unack_color' => getRequest('ok_unack_color'), 63 'ok_ack_color' => getRequest('ok_ack_color'), 64 'problem_unack_style' => getRequest('problem_unack_style', 0), 65 'problem_ack_style' => getRequest('problem_ack_style', 0), 66 'ok_unack_style' => getRequest('ok_unack_style', 0), 67 'ok_ack_style' => getRequest('ok_ack_style', 0), 68 'ok_period' => getRequest('ok_period'), 69 'blink_period' => getRequest('blink_period') 70 ]); 71 $result = DBend($result); 72 73 show_messages($result, _('Configuration updated'), _('Cannot update configuration')); 74} 75 76/* 77 * Display 78 */ 79$config = select_config(); 80 81// form has been submitted 82if (hasRequest('form_refresh')) { 83 $data = [ 84 'problem_unack_color' => getRequest('problem_unack_color', $config['problem_unack_color']), 85 'problem_ack_color' => getRequest('problem_ack_color', $config['problem_ack_color']), 86 'ok_unack_color' => getRequest('ok_unack_color', $config['ok_unack_color']), 87 'ok_ack_color' => getRequest('ok_ack_color', $config['ok_ack_color']), 88 'problem_unack_style' => getRequest('problem_unack_style', 0), 89 'problem_ack_style' => getRequest('problem_ack_style', 0), 90 'ok_unack_style' => getRequest('ok_unack_style', 0), 91 'ok_ack_style' => getRequest('ok_ack_style', 0), 92 'ok_period' => getRequest('ok_period', $config['ok_period']), 93 'blink_period' => getRequest('blink_period', $config['blink_period']) 94 ]; 95} 96else { 97 $data = [ 98 'problem_unack_color' => $config['problem_unack_color'], 99 'problem_ack_color' => $config['problem_ack_color'], 100 'ok_unack_color' => $config['ok_unack_color'], 101 'ok_ack_color' => $config['ok_ack_color'], 102 'problem_unack_style' => $config['problem_unack_style'], 103 'problem_ack_style' => $config['problem_ack_style'], 104 'ok_unack_style' => $config['ok_unack_style'], 105 'ok_ack_style' => $config['ok_ack_style'], 106 'ok_period' => $config['ok_period'], 107 'blink_period' => $config['blink_period'] 108 ]; 109} 110 111$view = new CView('administration.general.trigger.options.edit', $data); 112$view->render(); 113$view->show(); 114 115require_once dirname(__FILE__).'/include/page_footer.php'; 116