From eae56941892e0279c49947b8afcfc7ea03bef25e Mon Sep 17 00:00:00 2001 From: Gemini Date: Thu, 14 May 2026 15:10:11 +0000 Subject: [PATCH] =?UTF-8?q?Feature:=20CSV-Export,=20UI-Fixes=20f=C3=BCr=20?= =?UTF-8?q?ToDo-Liste=20und=20help.php=20Absturz=20behoben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++ src/articles.php | 5 ++- src/export_articles.php | 90 +++++++++++++++++++++++++++++++++++++++++ src/help.php | 1 + src/todo_lists.php | 2 +- 5 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 src/export_articles.php diff --git a/README.md b/README.md index 785934e..42c2954 100644 --- a/README.md +++ b/README.md @@ -204,3 +204,6 @@ Das Projekt basiert auf bewährten Web-Standards: * Das Layout der ToDo-Listen-Verwaltung wurde an das restliche moderne App-Design (Cards) angeglichen. * PHP-Warning beim Deaktivieren von Checkboxen in ToDo-Listen behoben. * JavaScript-Standardmeldungen (`confirm()`) für das Löschen von Artikeln in Phase 1 durch moderne Bootstrap-Modals ersetzt. + * Styling der aktiven ToDo-Liste verbessert (grüner Hintergrund statt schwarzem Rand). + * Fatal Error auf der Hilfe-Seite (`help.php`) beim Aufruf ohne bestehende DB-Verbindung behoben. + * CSV-Export Funktion für alle Artikel im Bestand hinzugefügt. diff --git a/src/articles.php b/src/articles.php index 4f0639d..9a7c1c2 100644 --- a/src/articles.php +++ b/src/articles.php @@ -127,7 +127,10 @@ $conn->close();
diff --git a/src/export_articles.php b/src/export_articles.php new file mode 100644 index 0000000..fd75f18 --- /dev/null +++ b/src/export_articles.php @@ -0,0 +1,90 @@ +prepare($sql); +if ($stmt === false) { + die("Datenbankfehler."); +} + +$all_params = array_merge($household_member_ids, [$current_user_household_id]); +$all_types = $types . 'i'; +$stmt->bind_param($all_types, ...$all_params); +$stmt->execute(); +$result = $stmt->get_result(); + +header('Content-Type: text/csv; charset=utf-8'); +header('Content-Disposition: attachment; filename="artikel_export_' . date('Ymd_His') . '.csv"'); + +$output = fopen('php://output', 'w'); +fprintf($output, chr(0xEF).chr(0xBB).chr(0xBF)); // BOM for Excel + +// Output headers +$headers = [ + 'Artikelname', 'Produktbezeichnung', 'Kategorie', 'Hersteller', + 'Gewicht (g)', 'Anzahl im Besitz', 'Verbrauchsartikel', 'Produkt-URL', + 'Lagerort (Ebene 1)', 'Lagerort (Ebene 2)', 'Ersteller' +]; +fputcsv($output, $headers, ';'); + +// Output rows +while ($row = $result->fetch_assoc()) { + fputcsv($output, [ + $row['Artikelname'], + $row['Produktbezeichnung'], + $row['Kategorie'], + $row['Hersteller'], + $row['Gewicht (g)'], + $row['Anzahl'], + $row['Verbrauchsartikel'], + $row['Produkt-URL'], + $row['Lagerort (Ebene 1)'], + $row['Lagerort (Ebene 2)'], + $row['Ersteller'] + ], ';'); +} + +fclose($output); +$stmt->close(); +$conn->close(); +?> \ No newline at end of file diff --git a/src/help.php b/src/help.php index 7598ab9..92489c0 100644 --- a/src/help.php +++ b/src/help.php @@ -10,6 +10,7 @@ if (!isset($_SESSION['user_id'])) { exit; } +require_once 'db_connect.php'; require_once 'header.php'; ?> diff --git a/src/todo_lists.php b/src/todo_lists.php index 0289401..eed1aab 100644 --- a/src/todo_lists.php +++ b/src/todo_lists.php @@ -95,7 +95,7 @@ $active_list_id = isset($_GET['list_id']) ? intval($_GET['list_id']) : (!empty($
Meine Listen