icingadb-web/application/controllers/DowntimesController.php
2019-11-05 01:07:30 +01:00

40 lines
1 KiB
PHP

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