Vorab, nach einem Update sind die Änderungen futsch.
Ändere in application/modules/events/mappers/Events.php folgendes:
/**
* Liefert die kommenden Veranstaltungen.
* Sortierung: nach Startdatum aufsteigend (das nächste zuerst).
*
* @param int|null $limit
* @return EventModel[]|null
*/
public function getEventListUpcoming(?int $limit = null): ?array
{
$pagination = null;
if ($limit) {
$pagination = new Pagination();
$pagination->setRowsPerPage($limit);
}
return $this->getEntriesBy(
[new \Ilch\Database\Mysql\Expression\Comparison('`start`', '>', 'NOW()')],
['start' => 'ASC'], // vorher []; jetzt aufsteigend nach Datum
$pagination
);
}
/**
* Liefert die vergangenen Veranstaltungen.
* Sortierung: nach Startdatum absteigend (das neueste zuerst).
*
* @param int|null $limit
* @return EventModel[]|array
*/
public function getEventListPast(?int $limit = null): ?array
{
$pagination = null;
if ($limit) {
$pagination = new Pagination();
$pagination->setRowsPerPage($limit);
}
return $this->getEntriesBy(
[new \Ilch\Database\Mysql\Expression\Comparison('`end`', '<', 'NOW()')],
['start' => 'DESC'], // vorher []; jetzt neueste zuerst
$pagination
);
}
/**
* Liefert die aktuell laufenden Veranstaltungen.
* Sortierung: nach Startdatum aufsteigend.
*
* @param int|null $limit
* @return EventModel[]|null
*/
public function getEventListCurrent(?int $limit = null): ?array
{
$pagination = null;
if ($limit) {
$pagination = new Pagination();
$pagination->setRowsPerPage($limit);
}
return $this->getEntriesBy(
[
new \Ilch\Database\Mysql\Expression\Comparison('`start`', '<', 'NOW()'),
new \Ilch\Database\Mysql\Expression\Comparison('`end`', '>', 'NOW()'),
],
['start' => 'ASC'], // vorher []; jetzt aufsteigend nach Datum
$pagination
);
}
Für den Adminbereich application/modules/events/controllers/admin/Index.php
musst du nur die letzte Zeile anpassen.
public function indexAction()
{
$eventMapper = new EventMapper();
$this->getLayout()->getAdminHmenu()
->add($this->getTranslator()->trans('menuEvents'), ['action' => 'index']);
if ($this->getRequest()->getPost('check_entries') && $this->getRequest()->getPost('action') === 'delete') {
foreach ($this->getRequest()->getPost('check_entries') as $eventId) {
$eventMapper->delete($eventId);
}
}
// vorher: $eventMapper->getEntries(); sortierte nach 'start' ASC (älteste oben)
// nachher: explizit DESC; neueste Veranstaltung oben
$this->getView()->set('events', $eventMapper->getEntriesBy([], ['start' => 'DESC']));
}
Zuletzt modifiziert von RTX2070 am 07.06.2026 - 15:37:09