From 9fcc2c76a5a99dccd9a096fb33bec5d9d434691e Mon Sep 17 00:00:00 2001 From: jsatoh Date: Thu, 21 Aug 2014 01:04:00 +0000 Subject: [PATCH] 2014-08-21 Junichi Satoh * include/functions_api.php: Added a function to add an event comment. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10439 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 4 +++ pandora_console/include/functions_api.php | 32 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index fe185b237a..7531eea177 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,7 @@ +2014-08-21 Junichi Satoh + + * include/functions_api.php: Added a function to add an event comment. + 2014-08-20 Alejandro Gallardo * include/functions_graph.php: Modified the color of diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 7b75adf0df..990c7c67eb 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -6513,6 +6513,38 @@ function api_set_create_event($id, $trash1, $other, $returnType) { } } +/** + * Add event commet. + * + * @param $id event id. + * @param $thrash2 Don't use. + * @param array $other it's array, but only is available. + * @param $thrash3 Don't use. + * + * example: + * http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_event_comment&id=event_id&other=string|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora + */ +function api_set_add_event_comment($id, $thrash2, $other, $thrash3) { + + if ($other['type'] == 'string') { + returnError('error_parameter', 'Error in the parameters.'); + return; + } + else if ($other['type'] == 'array') { + $comment = $other['data'][0]; + $meta = $other['data'][1]; + $history = $other['data'][2]; + + $status = events_comment ($id, $comment, 'Added comment', $meta, $history); + if (is_error($status)) { + returnError('error_add_event_comment', __('Error adding event comment.')); + return; + } + } + returnData('string', array('type' => 'string', 'data' => $status)); + return; +} + // http://localhost/pandora_console/include/api.php?op=get&op2=tactical_view&apipass=1234&user=admin&pass=pandora function api_get_tactical_view($trash1, $trash2, $trash3, $returnType) { $tactical_info = reporting_get_group_stats();