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,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');

View File

@ -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');

View File

@ -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
); ?>
</td>
<?php else: ?>

View File

@ -22,7 +22,7 @@ if (count($comments) === 0) {
}
?>
<table data-base-target="_next"
class="action comments multiselect"
class="action comments multiselect"
data-icinga-multiselect-url="/icingaweb2/monitoring/comments/show"
data-icinga-multiselect-data="comment_id">
<tbody>