From 1edd2eba5d227e1ff4538f0142474590248874ac Mon Sep 17 00:00:00 2001 From: Daniel Brendel Date: Sun, 15 Dec 2024 15:01:35 +0100 Subject: [PATCH] #305 PDF export basis --- app/models/InventoryModel.php | 16 ++++++++++++++++ app/views/layout.php | 1 + 2 files changed, 17 insertions(+) diff --git a/app/models/InventoryModel.php b/app/models/InventoryModel.php index 3c01505..f581c57 100644 --- a/app/models/InventoryModel.php +++ b/app/models/InventoryModel.php @@ -372,6 +372,20 @@ class InventoryModel extends \Asatru\Database\Model { } } + /** + * @param $items + * @return string + * @throws \Exception + */ + public static function exportItemsAsPdf($items) + { + try { + throw new \Exception('Not yet implemented'); + } catch (\Exception $e) { + throw $e; + } + } + /** * @param $items * @param $format @@ -387,6 +401,8 @@ class InventoryModel extends \Asatru\Database\Model { $file = static::exportItemsAsJson($items); } else if ($format === 'csv') { $file = static::exportItemsAsCsv($items); + } else if ($format === 'pdf') { + $file = static::exportItemsAsPdf($items); } else { throw new \Exception('Unsupported format: ' . $format); } diff --git a/app/views/layout.php b/app/views/layout.php index c3b5926..f938ef4 100644 --- a/app/views/layout.php +++ b/app/views/layout.php @@ -804,6 +804,7 @@