mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
wip
This commit is contained in:
parent
b5eed40255
commit
f2833c195c
3 changed files with 82 additions and 0 deletions
6
application/controllers/TimeperiodController.php
Normal file
6
application/controllers/TimeperiodController.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// Controller für details zu einer Timeperiod
|
||||
<!--/
|
||||
indexAction
|
||||
|
||||
Detail; zeigt Display Name oben im Header, Name und Ranges im Content
|
||||
/-->
|
||||
35
application/controllers/TimeperiodsController.php
Normal file
35
application/controllers/TimeperiodsController.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// Controller für alle Timeperiods zeigt Liste
|
||||
<!--/
|
||||
indexAction
|
||||
Liste; zeigt erst mal nur Display Name
|
||||
|
||||
/-->
|
||||
|
||||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Controllers;
|
||||
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Module\Icingadb\Model\Timeperiod;
|
||||
use Icinga\Module\Icingadb\Widget\ItemTable\TimePeriodsTable;
|
||||
use Icinga\Web\Controller;
|
||||
use ipl\Web\Compat\CompatController;
|
||||
|
||||
class TimeperiodsController extends CompatController
|
||||
{
|
||||
public function indexAction(): void
|
||||
{
|
||||
$this->addTitleTab('Time Periods');
|
||||
|
||||
$db = $this->getDb();
|
||||
|
||||
$query = Timeperiod::on($db);
|
||||
|
||||
$this->addContent(new TimePeriodsTable($query));
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
41
library/Icingadb/Widget/ItemTable/TimePeriodsTable.php
Normal file
41
library/Icingadb/Widget/ItemTable/TimePeriodsTable.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2022 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Widget\ItemTable;
|
||||
|
||||
use Icinga\Module\Icingadb\Common\DetailActions;
|
||||
use Icinga\Module\Icingadb\Common\Links;
|
||||
use ipl\Html\Html;
|
||||
use ipl\Html\Table;
|
||||
use ipl\Web\Url;
|
||||
use ipl\Web\Widget\ItemTable;
|
||||
use ipl\Web\Widget\Link;
|
||||
|
||||
class TimePeriodsTable extends Table
|
||||
{
|
||||
protected $defaultAttributes = ['class' => 'common-table'];
|
||||
|
||||
protected Query $timeperiods;
|
||||
|
||||
public function __construct($timeperiods)
|
||||
{
|
||||
$this->timeperiods = $timeperiods;
|
||||
}
|
||||
|
||||
protected function assemble()
|
||||
{
|
||||
$tbody = $this->getBody();
|
||||
foreach ($this->timeperiods as $timeperiod) {
|
||||
$displayName = new Link($timeperiod->display_name, Url::fromPath('timeperiods/details', ['id' =>$timeperiod->id]));
|
||||
|
||||
$displayName = Html::tag('strong')->add($displayName->setBaseTarget('_next'));
|
||||
$r = Table::row([
|
||||
$displayName
|
||||
]);
|
||||
$tbody->addHtml($r);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue