diff --git a/modules/monitoring/application/controllers/CommentController.php b/modules/monitoring/application/controllers/CommentController.php index a595ffeca..e5e181449 100644 --- a/modules/monitoring/application/controllers/CommentController.php +++ b/modules/monitoring/application/controllers/CommentController.php @@ -11,17 +11,27 @@ use Icinga\Web\Widget\Tabextension\DashboardAction; */ class Monitoring_CommentController extends Controller { + /** + * The fetched comment + * + * @var stdClass + */ protected $comment; + /** + * Fetch the first comment with the given id and add tabs + * + * @throws Zend_Controller_Action_Exception + */ public function init() { $commentId = $this->params->get('comment_id'); $this->comment = $this->backend->select()->from('comment', array( - 'id' => 'comment_internal_id', + 'id' => 'comment_internal_id', 'objecttype' => 'comment_objecttype', 'comment' => 'comment_data', - 'author' => 'comment_author_name', + 'author' => 'comment_author_name', 'timestamp' => 'comment_timestamp', 'type' => 'comment_type', 'persistent' => 'comment_is_persistent', @@ -35,21 +45,23 @@ class Monitoring_CommentController extends Controller if (false === $this->comment) { throw new Zend_Controller_Action_Exception($this->translate('Comment not found')); } - - $this->getTabs() - ->add( - 'comment', - array( - 'title' => $this->translate( - 'Display detailed information about a comment.' - ), - 'icon' => 'comment', - 'label' => $this->translate('Comment'), - 'url' =>'monitoring/comments/show' - ) + + $this->getTabs()->add( + 'comment', + array( + 'title' => $this->translate( + 'Display detailed information about a comment.' + ), + 'icon' => 'comment', + 'label' => $this->translate('Comment'), + 'url' =>'monitoring/comments/show' + ) )->activate('comment')->extend(new DashboardAction()); } - + + /** + * Display comment detail view + */ public function showAction() { $this->view->comment = $this->comment; @@ -57,7 +69,12 @@ class Monitoring_CommentController extends Controller $this->view->delCommentForm = $this->createDelCommentForm(); } } - + + /** + * Create a command form to delete a single comment + * + * @return DeleteCommentCommandForm + */ private function createDelCommentForm() { $this->assertPermission('monitoring/command/comment/delete'); diff --git a/modules/monitoring/application/controllers/CommentsController.php b/modules/monitoring/application/controllers/CommentsController.php index 85fddcb50..bde2170e3 100644 --- a/modules/monitoring/application/controllers/CommentsController.php +++ b/modules/monitoring/application/controllers/CommentsController.php @@ -12,14 +12,24 @@ use Icinga\Data\Filter\Filter; */ class Monitoring_CommentsController extends Controller { + /** + * The fetched comments + * + * @var array + */ protected $comments; + /** + * Fetch all comments matching the current filter and add tabs + * + * @throws Zend_Controller_Action_Exception + */ public function init() { $this->filter = Filter::fromQueryString(str_replace( - 'comment_id', - 'comment_internal_id', - (string)$this->params + 'comment_id', + 'comment_internal_id', + (string)$this->params )); $this->comments = $this->backend->select()->from('comment', array( 'id' => 'comment_internal_id', @@ -40,20 +50,22 @@ class Monitoring_CommentsController extends Controller throw new Zend_Controller_Action_Exception($this->translate('Comment not found')); } - $this->getTabs() - ->add( - 'comments', - array( - 'title' => $this->translate( - 'Display detailed information about multiple comments.' - ), - 'icon' => 'comment', - 'label' => $this->translate('Comments'), - 'url' =>'monitoring/comments/show' - ) + $this->getTabs()->add( + 'comments', + array( + 'title' => $this->translate( + 'Display detailed information about multiple comments.' + ), + 'icon' => 'comment', + 'label' => $this->translate('Comments'), + 'url' =>'monitoring/comments/show' + ) )->activate('comments')->extend(new DashboardAction()); } - + + /** + * Display the detail view for a comment list + */ public function showAction() { $this->view->comments = $this->comments; @@ -63,6 +75,9 @@ class Monitoring_CommentsController extends Controller ->setParams($this->params); } + /** + * Display the form for removing a comment list + */ public function removeAllAction() { $this->assertPermission('monitoring/command/comment/delete'); diff --git a/modules/monitoring/application/views/scripts/comment/show.phtml b/modules/monitoring/application/views/scripts/comment/show.phtml index fa2682d2e..88a25a57b 100644 --- a/modules/monitoring/application/views/scripts/comment/show.phtml +++ b/modules/monitoring/application/views/scripts/comment/show.phtml @@ -21,7 +21,7 @@ $this->comment->service_description, $this->comment->service_display_name, $this->comment->host_name, - $this->comment->host_display_name + $this->comment->host_display_names ); ?> diff --git a/modules/monitoring/application/views/scripts/list/comments.phtml b/modules/monitoring/application/views/scripts/list/comments.phtml index ab9eb6548..5d5d21217 100644 --- a/modules/monitoring/application/views/scripts/list/comments.phtml +++ b/modules/monitoring/application/views/scripts/list/comments.phtml @@ -22,7 +22,7 @@ if (count($comments) === 0) { } ?>