diff --git a/com_eis/.DS_Store b/com_eis/.DS_Store index 9e68a39..5a1479c 100644 Binary files a/com_eis/.DS_Store and b/com_eis/.DS_Store differ diff --git a/com_eis/Archiv.zip b/com_eis/Archiv.zip index 2083cf4..1a795cc 100644 Binary files a/com_eis/Archiv.zip and b/com_eis/Archiv.zip differ diff --git a/com_eis/language/.DS_Store b/com_eis/language/.DS_Store index 2f0642a..58951d7 100644 Binary files a/com_eis/language/.DS_Store and b/com_eis/language/.DS_Store differ diff --git a/com_eis/language/en-GB/en-GB.com_eis.ini b/com_eis/language/en-GB/en-GB.com_eis.ini index 69c1898..b1a830b 100644 --- a/com_eis/language/en-GB/en-GB.com_eis.ini +++ b/com_eis/language/en-GB/en-GB.com_eis.ini @@ -6,3 +6,4 @@ COM_EIS_MAIN="EIS Hauptansicht" COM_EIS_MENU="EIS" COM_EIS_CONFIG="Einstellungen" COM_EIS_MAINTENANCE="Wartung" +COM_EIS_PDF_TREE="Verzeichnisbaum" diff --git a/com_eis/services/provider.php b/com_eis/services/provider.php index e081340..761779a 100644 --- a/com_eis/services/provider.php +++ b/com_eis/services/provider.php @@ -23,7 +23,7 @@ return new class implements ServiceProviderInterface $container->registerServiceProvider(new MVCFactory('\\EIS\\Component\\EIS')); $container->registerServiceProvider(new RouterFactory('\\EIS\\Component\\EIS')); - // DownloadController explizit registrieren + // Optional: DownloadController explizit registrieren (kann auch weggelassen werden) $container->set( DownloadController::class, fn(Container $c) => new DownloadController() diff --git a/com_eis/site/.DS_Store b/com_eis/site/.DS_Store new file mode 100644 index 0000000..6479e22 Binary files /dev/null and b/com_eis/site/.DS_Store differ diff --git a/com_eis/site/src/.DS_Store b/com_eis/site/src/.DS_Store new file mode 100644 index 0000000..83806af Binary files /dev/null and b/com_eis/site/src/.DS_Store differ diff --git a/com_eis/src/.DS_Store b/com_eis/src/.DS_Store index de809fd..63835f0 100644 Binary files a/com_eis/src/.DS_Store and b/com_eis/src/.DS_Store differ diff --git a/com_eis/src/Controller/DisplayController.php b/com_eis/src/Controller/DisplayController.php index 019c7c7..dd15b78 100644 --- a/com_eis/src/Controller/DisplayController.php +++ b/com_eis/src/Controller/DisplayController.php @@ -1,4 +1,5 @@ input->get('id'); + $title = trim((string) $app->input->get('title', '', 'STRING')); + + if ($id <= 0) { + $app->enqueueMessage('Ungültige ID', 'error'); + $this->setRedirect('index.php?option=com_eis&view=main'); + return; + } + + /** @var \Joomla\Database\DatabaseDriver $db */ + $db = \Joomla\CMS\Factory::getDbo(); + $query = $db->getQuery(true) + ->update($db->quoteName('#__eis_documents')) + ->set($db->quoteName('title') . ' = ' . ($title === '' ? 'NULL' : $db->quote($title))) + ->where($db->quoteName('id') . ' = ' . (int) $id); + + try { + $db->setQuery($query)->execute(); + $app->enqueueMessage('Anzeigename gespeichert', 'message'); + } catch (\Throwable $e) { + $app->enqueueMessage('Fehler beim Speichern: ' . $e->getMessage(), 'error'); + } + + $this->setRedirect('index.php?option=com_eis&view=main'); + } } diff --git a/com_eis/src/Helper/TreeHelper.php b/com_eis/src/Helper/TreeHelper.php new file mode 100644 index 0000000..ba62edd --- /dev/null +++ b/com_eis/src/Helper/TreeHelper.php @@ -0,0 +1,112 @@ +getQuery(true) + ->select('*') + ->from($db->quoteName('#__eis_documents')) + ->order($db->quoteName('ordering') . ' ASC'); + + $rows = $db->setQuery($query)->loadAssocList(); + + $grouped = []; + foreach ($rows as $row) { + $pid = $row['parent_id'] === null ? null : (int) $row['parent_id']; + $grouped[$pid][] = $row; + } + + // alphabetisch nach name + foreach ($grouped as &$group) { + usort($group, fn($a, $b) => strcasecmp($a['name'], $b['name'])); + } + + return $grouped; + } + + /** Baum rendern (nutzt title als alternativen Anzeigenamen) */ + public static function renderTree(array $items, ?int $parentId = null): string + { + if (!isset($items[$parentId])) { + return ''; + } + + $html = ''; + return $html; + } + + private static function countFilesRecursive(array $items, int $parentId): int + { + $count = 0; + if (!isset($items[$parentId])) { + return 0; + } + foreach ($items[$parentId] as $item) { + if ((bool) $item['is_folder']) { + $count += self::countFilesRecursive($items, (int)$item['id']); + } else { + $count++; + } + } + return $count; + } + + private static function formatFileSize(int $bytes): string + { + if ($bytes >= 1073741824) return number_format($bytes / 1073741824, 2) . ' GB'; + if ($bytes >= 1048576) return number_format($bytes / 1048576, 1) . ' MB'; + if ($bytes >= 1024) return number_format($bytes / 1024, 0) . ' KB'; + return $bytes . ' B'; + } +} diff --git a/com_eis/src/View/.DS_Store b/com_eis/src/View/.DS_Store index 264a6c7..d3f08b2 100644 Binary files a/com_eis/src/View/.DS_Store and b/com_eis/src/View/.DS_Store differ diff --git a/com_eis/src/View/Main/HtmlView.php b/com_eis/src/View/Main/HtmlView.php index 4637434..d1eb580 100644 --- a/com_eis/src/View/Main/HtmlView.php +++ b/com_eis/src/View/Main/HtmlView.php @@ -1,15 +1,20 @@ Willkommen bei EIS"; - $this->data = Factory::getApplication()->getUserState('com_eis.pdfdata'); + // Baumdaten laden und fürs Template bereitstellen + $items = TreeHelper::getItems(); + $this->treeHtml = TreeHelper::renderTree($items); + parent::display($tpl); } } diff --git a/com_eis/tmpl/.DS_Store b/com_eis/tmpl/.DS_Store index ad922eb..be3cf99 100644 Binary files a/com_eis/tmpl/.DS_Store and b/com_eis/tmpl/.DS_Store differ diff --git a/com_eis/tmpl/main/default.php b/com_eis/tmpl/main/default.php index 55a7148..7ecccf5 100644 --- a/com_eis/tmpl/main/default.php +++ b/com_eis/tmpl/main/default.php @@ -4,41 +4,231 @@ use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\Language\Text; -use Joomla\CMS\Session\Session; - ?> +
-
-
- +
+
+ + +
-
-
- -
+
+
- +
+
-data)) : ?> -
-

- - -' . htmlspecialchars($item['name']) . ''; - } else { - $html .= '
  • ' . htmlspecialchars($item['name']) . '
  • '; - } +
    + +treeHtml); ?> + + +

    + +

    + + + + +

    + +
    + + +
    +
    + + +
    + +
    + treeHtml; ?> +
    +
    + + +
    +

    +
    +
    + + +
    + +
    + + +
    + + + +
    + + +
    + + +
    +
    +
    + + + + \ No newline at end of file