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