icingadb-web/application/controllers/CommentsController.php
2019-12-11 08:59:30 +01:00

42 lines
1.1 KiB
PHP

<?php
namespace Icinga\Module\Icingadb\Controllers;
use Icinga\Module\Icingadb\Model\Comment;
use Icinga\Module\Icingadb\Web\Controller;
use Icinga\Module\Icingadb\Widget\ItemList\CommentList;
class CommentsController extends Controller
{
public function indexAction()
{
$this->setTitle($this->translate('Comments'));
$db = $this->getDb();
$comments = Comment::on($db)->with([
'host',
'host.state',
'service',
'service.host',
'service.host.state',
'service.state'
]);
$limitControl = $this->createLimitControl();
$paginationControl = $this->createPaginationControl($comments);
$filterControl = $this->createFilterControl($comments);
$this->filter($comments);
yield $this->export($comments);
$this->addControl($paginationControl);
$this->addControl($limitControl);
$this->addControl($filterControl);
$this->addContent(new CommentList($comments));
$this->setAutorefreshInterval(10);
}
}