From 2fdb99abd22d9d1ff2312497990a4758feb468f4 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 2 Oct 2014 18:38:14 +0200 Subject: [PATCH] Finally, the comments are showed correctly on the events list --- .../operation/events/events.build_table.php | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/pandora_console/operation/events/events.build_table.php b/pandora_console/operation/events/events.build_table.php index 8275162d0e..ad35bf6ae2 100644 --- a/pandora_console/operation/events/events.build_table.php +++ b/pandora_console/operation/events/events.build_table.php @@ -435,7 +435,29 @@ foreach ($result as $event) { } if (in_array('user_comment',$show_fields)) { - $data[$i] = '' .ui_print_truncate_text(strip_tags($event["user_comment"])) . ''; + $safe_event_user_comment = strip_tags(io_safe_output($event["user_comment"])); + $event_user_comments = json_decode($safe_event_user_comment, true); + $event_user_comment_str = ""; + if (!empty($event_user_comments)) { + $last_key = key(array_slice($event_user_comments, -1, 1, true)); + $date_format = $config['date_format']; + + foreach ($event_user_comments as $key => $event_user_comment) { + $event_user_comment_str .= sprintf('%s: %s
%s: %s
%s: %s
', + __('Date'), date($date_format, $event_user_comment['utimestamp']), + __('User'), $event_user_comment['id_user'], + __('Comment'), $event_user_comment['comment']); + if ($key != $last_key) { + $event_user_comment_str .= '
'; + } + } + } + $comments_help_tip = ""; + if (!empty($event_user_comment_str)) { + $comments_help_tip = ui_print_help_tip($event_user_comment_str, true); + } + + $data[$i] = '' . $comments_help_tip . ''; $table->cellclass[count($table->data)][$i] = $myclass; $i++; }