|
5 | 5 | namespace Icinga\Module\Reporting\Controllers;
|
6 | 6 |
|
7 | 7 | use Icinga\Module\Reporting\Database;
|
| 8 | +use Icinga\Module\Reporting\Model\Report; |
8 | 9 | use Icinga\Module\Reporting\Web\Controller;
|
9 | 10 | use Icinga\Module\Reporting\Web\Forms\ReportForm;
|
10 | 11 | use Icinga\Module\Reporting\Web\ReportsTimeframesAndTemplatesTabs;
|
11 | 12 | use ipl\Html\Html;
|
12 |
| -use ipl\Sql\Select; |
13 | 13 | use ipl\Web\Url;
|
14 | 14 | use ipl\Web\Widget\ButtonLink;
|
15 | 15 | use ipl\Web\Widget\Icon;
|
@@ -38,21 +38,18 @@ public function indexAction()
|
38 | 38 |
|
39 | 39 | $tableRows = [];
|
40 | 40 |
|
41 |
| - $select = (new Select()) |
42 |
| - ->from('report r') |
43 |
| - ->columns(['r.*', 'timeframe' => 't.name']) |
44 |
| - ->join('timeframe t', 'r.timeframe_id = t.id') |
45 |
| - ->orderBy('r.mtime', SORT_DESC); |
| 41 | + $reports = Report::on($this->getDb()) |
| 42 | + ->withColumns(['report.timeframe.name']); |
46 | 43 |
|
47 |
| - foreach ($this->getDb()->select($select) as $report) { |
| 44 | + foreach ($reports as $report) { |
48 | 45 | $url = Url::fromPath('reporting/report', ['id' => $report->id])->getAbsoluteUrl('&');
|
49 | 46 |
|
50 | 47 | $tableRows[] = Html::tag('tr', ['href' => $url], [
|
51 | 48 | Html::tag('td', null, $report->name),
|
52 | 49 | Html::tag('td', null, $report->author),
|
53 |
| - Html::tag('td', null, $report->timeframe), |
54 |
| - Html::tag('td', null, date('Y-m-d H:i', $report->ctime / 1000)), |
55 |
| - Html::tag('td', null, date('Y-m-d H:i', $report->mtime / 1000)), |
| 50 | + Html::tag('td', null, $report->timeframe->name), |
| 51 | + Html::tag('td', null, $report->ctime->format('Y-m-d H:i')), |
| 52 | + Html::tag('td', null, $report->mtime->format('Y-m-d H:i')), |
56 | 53 | Html::tag('td', ['class' => 'icon-col'], [
|
57 | 54 | new Link(
|
58 | 55 | new Icon('edit'),
|
|
0 commit comments