diff --git a/application/controllers/TimeperiodController.php b/application/controllers/TimeperiodController.php new file mode 100644 index 00000000..c2f695c7 --- /dev/null +++ b/application/controllers/TimeperiodController.php @@ -0,0 +1,6 @@ +// Controller für details zu einer Timeperiod + diff --git a/application/controllers/TimeperiodsController.php b/application/controllers/TimeperiodsController.php new file mode 100644 index 00000000..1e9c6d83 --- /dev/null +++ b/application/controllers/TimeperiodsController.php @@ -0,0 +1,35 @@ +// Controller für alle Timeperiods zeigt Liste + + +addTitleTab('Time Periods'); + + $db = $this->getDb(); + + $query = Timeperiod::on($db); + + $this->addContent(new TimePeriodsTable($query)); + + + + } +} diff --git a/library/Icingadb/Widget/ItemTable/TimePeriodsTable.php b/library/Icingadb/Widget/ItemTable/TimePeriodsTable.php new file mode 100644 index 00000000..77f11d5d --- /dev/null +++ b/library/Icingadb/Widget/ItemTable/TimePeriodsTable.php @@ -0,0 +1,41 @@ + '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); + + } + } + +}