summaryrefslogtreecommitdiffstats
path: root/frontends/php/acknow.php
blob: 6371b241c2f939919bf17922c55397849c7e593b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/* 
** ZABBIX
** Copyright (C) 2000-2005 SIA Zabbix
**
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
?>
<?php
	$page["title"]="S_ACKNOWLEDGES";
	$page["file"]="acknow.php";

	include "include/config.inc.php";
	include "include/forms.inc.php";
?>
<?php
	show_header($page["title"],0,0);
?>
<?php
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
	$fields=array(
		"alarmid"=>		array(T_ZBX_INT, O_MAND, P_SYS,	DB_ID,		NULL),
		"message"=>		array(T_ZBX_STR, O_OPT,	NULL,	NOT_EMPTY,	'isset({save})'),

		"save"=>		array(T_ZBX_STR,O_OPT,	P_ACT|P_SYS, NULL,	NULL)
	);
	check_fields($fields);
?>
<?
	if(isset($_REQUEST["save"]))
	{
		$result = add_acknowledge_coment(
			$_REQUEST["alarmid"],
			$USER_DETAILS["userid"],
			$_REQUEST["message"]);

		show_messages($result, S_COMMENT_ADDED, S_CANNOT_ADD_COMMENT);
	}
?>
<?php

	$alarm = get_alarm_by_alarmid($_REQUEST["alarmid"]);
	$trigger=get_trigger_by_triggerid($alarm["triggerid"]);
	$expression=explode_exp($trigger["expression"],1);
	$description=expand_trigger_description($alarm["triggerid"]);

	show_table_header(S_ALARM_ACKNOWLEDGES_BIG.":".$description.BR.$expression);

	echo BR;
	$table = new CTable(NULL,"ack_msgs");
	$table->SetAlign("center");

	$db_acks = get_acknowledges_by_alarmid($_REQUEST["alarmid"]);
	while($db_ack = DBfetch($db_acks))
	{
		$db_user = get_user_by_userid($db_ack["userid"]);
		$table->AddRow(array(
			new CCol($db_user["alias"],"user"),
			new CCol(date("d-m-Y h:i:s A",$db_ack["clock"]),"time")),
			"title");

		$msgCol = new CCol(nl2br($db_ack["message"]));
		$msgCol->SetColspan(2);
		$table->AddRow($msgCol,"msg");
	}
/**/
	$table->Show();
	echo BR;
	insert_new_message_form();
?>

<?php
	show_page_footer();
?>