Jetzt mit einem Ordner für neue Dokumente

This commit is contained in:
Thomas Spohr
2025-08-27 14:12:48 +02:00
parent 103fea5c48
commit 31af9b27e7
8 changed files with 140 additions and 34 deletions

Binary file not shown.

View File

@@ -34,7 +34,10 @@ class DisplayController extends BaseController
$path = SettingsHelper::getSetting('document_root', '/var/www/pdf');
if (!$path || !is_dir($path)) {
$app->enqueueMessage(Text::sprintf('COM_EIS_MSG_PATH_NOT_EXISTS', $path) ?: ('Pfad ungültig oder nicht gesetzt: ' . $path), 'error');
$app->enqueueMessage(
Text::sprintf('COM_EIS_MSG_PATH_NOT_EXISTS', $path) ?: ('Pfad ungültig oder nicht gesetzt: ' . $path),
'error'
);
$this->setRedirect(Route::_('index.php?option=com_eis&view=main', false));
return;
}
@@ -45,12 +48,16 @@ class DisplayController extends BaseController
// Alte Einträge löschen (Hinweis: Dann sind ALLE eingefügten „neu“)
$db->truncateTable('#__eis_documents');
// In Datenbank speichern und neue IDs sammeln
// In Datenbank speichern und neue IDs sammeln (nur Dateien)
$newIds = $this->saveToDb($data, null, $db);
// Neue IDs im UserState für die View -> virtueller Ordner "Neue Dokumente"
$app->setUserState('com_eis.new_ids', $newIds);
// NEU: dauerhaft speichern (für das Frontend-Modul)
SettingsHelper::setSetting('last_new_ids', json_encode($newIds, JSON_UNESCAPED_SLASHES));
SettingsHelper::setSetting('last_scan_at', date('Y-m-d H:i:s'));
// Erfolgsmeldung
$app->enqueueMessage(Text::_('COM_EIS_MSG_SCAN_DONE') ?: 'PDF-Struktur erfolgreich gespeichert.', 'message');
$this->setRedirect(Route::_('index.php?option=com_eis&view=main', false));
@@ -90,7 +97,7 @@ class DisplayController extends BaseController
}
}
// Alphabetisch stabil sortieren (Ordner/Dateien je Ebene)
// Alphabetisch stabil sortieren
usort($result, static function ($a, $b) {
return strcasecmp((string)$a['name'], (string)$b['name']);
});