Conform to coding guidelines

This commit is contained in:
Matthias Jentsch 2015-05-04 16:29:07 +02:00
parent 5477a2f18e
commit e5e3e80300
4 changed files with 65 additions and 33 deletions

View File

@ -11,8 +11,18 @@ use Icinga\Web\Widget\Tabextension\DashboardAction;
*/ */
class Monitoring_CommentController extends Controller class Monitoring_CommentController extends Controller
{ {
/**
* The fetched comment
*
* @var stdClass
*/
protected $comment; protected $comment;
/**
* Fetch the first comment with the given id and add tabs
*
* @throws Zend_Controller_Action_Exception
*/
public function init() public function init()
{ {
$commentId = $this->params->get('comment_id'); $commentId = $this->params->get('comment_id');
@ -36,8 +46,7 @@ class Monitoring_CommentController extends Controller
throw new Zend_Controller_Action_Exception($this->translate('Comment not found')); throw new Zend_Controller_Action_Exception($this->translate('Comment not found'));
} }
$this->getTabs() $this->getTabs()->add(
->add(
'comment', 'comment',
array( array(
'title' => $this->translate( 'title' => $this->translate(
@ -50,6 +59,9 @@ class Monitoring_CommentController extends Controller
)->activate('comment')->extend(new DashboardAction()); )->activate('comment')->extend(new DashboardAction());
} }
/**
* Display comment detail view
*/
public function showAction() public function showAction()
{ {
$this->view->comment = $this->comment; $this->view->comment = $this->comment;
@ -58,6 +70,11 @@ class Monitoring_CommentController extends Controller
} }
} }
/**
* Create a command form to delete a single comment
*
* @return DeleteCommentCommandForm
*/
private function createDelCommentForm() private function createDelCommentForm()
{ {
$this->assertPermission('monitoring/command/comment/delete'); $this->assertPermission('monitoring/command/comment/delete');

View File

@ -12,8 +12,18 @@ use Icinga\Data\Filter\Filter;
*/ */
class Monitoring_CommentsController extends Controller class Monitoring_CommentsController extends Controller
{ {
/**
* The fetched comments
*
* @var array
*/
protected $comments; protected $comments;
/**
* Fetch all comments matching the current filter and add tabs
*
* @throws Zend_Controller_Action_Exception
*/
public function init() public function init()
{ {
$this->filter = Filter::fromQueryString(str_replace( $this->filter = Filter::fromQueryString(str_replace(
@ -40,8 +50,7 @@ class Monitoring_CommentsController extends Controller
throw new Zend_Controller_Action_Exception($this->translate('Comment not found')); throw new Zend_Controller_Action_Exception($this->translate('Comment not found'));
} }
$this->getTabs() $this->getTabs()->add(
->add(
'comments', 'comments',
array( array(
'title' => $this->translate( 'title' => $this->translate(
@ -54,6 +63,9 @@ class Monitoring_CommentsController extends Controller
)->activate('comments')->extend(new DashboardAction()); )->activate('comments')->extend(new DashboardAction());
} }
/**
* Display the detail view for a comment list
*/
public function showAction() public function showAction()
{ {
$this->view->comments = $this->comments; $this->view->comments = $this->comments;
@ -63,6 +75,9 @@ class Monitoring_CommentsController extends Controller
->setParams($this->params); ->setParams($this->params);
} }
/**
* Display the form for removing a comment list
*/
public function removeAllAction() public function removeAllAction()
{ {
$this->assertPermission('monitoring/command/comment/delete'); $this->assertPermission('monitoring/command/comment/delete');

View File

@ -21,7 +21,7 @@
$this->comment->service_description, $this->comment->service_description,
$this->comment->service_display_name, $this->comment->service_display_name,
$this->comment->host_name, $this->comment->host_name,
$this->comment->host_display_name $this->comment->host_display_names
); ?> ); ?>
</td> </td>
<?php else: ?> <?php else: ?>