parent
37df008d7f
commit
2b938442c4
|
@ -27,10 +27,26 @@ class AnnouncementsController extends Controller
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$repo = new AnnouncementIniRepository();
|
$announcements = (new AnnouncementIniRepository())
|
||||||
$this->view->announcements = $repo
|
->select([
|
||||||
->select(array('id', 'author', 'message', 'start', 'end'))
|
'id',
|
||||||
->order('start', 'DESC');
|
'author',
|
||||||
|
'message',
|
||||||
|
'start',
|
||||||
|
'end'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$sortAndFilterColumns = [
|
||||||
|
'author' => $this->translate('Author'),
|
||||||
|
'message' => $this->translate('Message'),
|
||||||
|
'start' => $this->translate('Start'),
|
||||||
|
'end' => $this->translate('End')
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->setupSortControl($sortAndFilterColumns, $announcements, ['start' => 'desc']);
|
||||||
|
$this->setupFilterControl($announcements, $sortAndFilterColumns, ['message']);
|
||||||
|
|
||||||
|
$this->view->announcements = $announcements->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
<?php if (! $compact): ?>
|
<?php if (! $this->compact): ?>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?= $tabs ?>
|
<?= $this->tabs ?>
|
||||||
|
<?= $this->paginator ?>
|
||||||
|
<div class="sort-controls-container">
|
||||||
|
<?= $this->limiter ?>
|
||||||
|
<?= $this->sortBox ?>
|
||||||
|
</div>
|
||||||
|
<?= $this->filterEditor ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -17,7 +23,7 @@
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} ?>
|
} ?>
|
||||||
<?php if (! $announcements->hasResult()): ?>
|
<?php if (empty($this->announcements)): ?>
|
||||||
<p><?= $this->translate('No announcements found.') ?></p>
|
<p><?= $this->translate('No announcements found.') ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php return; endif ?>
|
<?php return; endif ?>
|
||||||
|
@ -32,7 +38,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($announcements as $announcement): /** @var object $announcement */ ?>
|
<?php foreach ($this->announcements as $announcement): /** @var object $announcement */ ?>
|
||||||
<?php if ($this->hasPermission('admin')): ?>
|
<?php if ($this->hasPermission('admin')): ?>
|
||||||
<tr href="<?= $this->href('announcements/update', array('id' => $announcement->id)) ?>">
|
<tr href="<?= $this->href('announcements/update', array('id' => $announcement->id)) ?>">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|
Loading…
Reference in New Issue