From e2cf663f8811bfbe72358f37dc6476ba31d001b5 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Fri, 31 Mar 2023 09:21:09 +0200 Subject: [PATCH] Default Menu --- application/controllers/components/CisVue.php | 2 +- application/models/content/Content_model.php | 58 +++++++++++++++++++ .../views/templates/CISHTML-Header.php | 2 +- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/application/controllers/components/CisVue.php b/application/controllers/components/CisVue.php index dc172db76..b8b7f98cc 100644 --- a/application/controllers/components/CisVue.php +++ b/application/controllers/components/CisVue.php @@ -29,7 +29,7 @@ class CisVue extends Auth_Controller public function Menu() { $this->load->model('content/Content_model', 'ContentModel'); - $result = $this->ContentModel->getMenu(6739, get_uid()); + $result = $this->ContentModel->getMenu(defined('CIS4_MENU_ENTRY') ? CIS4_MENU_ENTRY : null, get_uid()); $menu = getData($result) ?? (object)['childs' => []]; $this->outputJsonSuccess($menu); diff --git a/application/models/content/Content_model.php b/application/models/content/Content_model.php index c0d3c52f5..97d1837be 100644 --- a/application/models/content/Content_model.php +++ b/application/models/content/Content_model.php @@ -72,6 +72,64 @@ class Content_model extends DB_Model */ public function getMenu($root_content_id, $uid, $sprache=DEFAULT_LANGUAGE) { + if ($root_content_id === null) { + $res = json_decode('{ + "content_id": 1000000, + "template_kurzbz": "contentmittitel", + "titel": "CIS4", + "content": "", + "menu_open": true, + "aktiv": true, + "childs": [ + { + "content_id": 1000001, + "template_kurzbz": "redirect", + "titel": "News", + "content": "", + "menu_open": false, + "aktiv": true, + "childs": [] + }, + { + "content_id": 1000002, + "template_kurzbz": "redirect", + "titel": "COVID-19", + "content": "", + "menu_open": false, + "aktiv": true, + "childs": [] + }, + { + "content_id": 1000003, + "template_kurzbz": "redirect", + "titel": "Meine LV", + "content": "", + "menu_open": false, + "aktiv": true, + "childs": [] + }, + { + "content_id": 1000004, + "template_kurzbz": "redirect", + "titel": "Stundenplan", + "content": "", + "menu_open": false, + "aktiv": true, + "childs": [] + }, + { + "content_id": 1000005, + "template_kurzbz": "redirect", + "titel": "Dokumente", + "content": "", + "menu_open": false, + "aktiv": true, + "childs": [] + } + ] + }'); + return success($res); + } $sql = " SELECT c.content_id, diff --git a/application/views/templates/CISHTML-Header.php b/application/views/templates/CISHTML-Header.php index 63d325d52..1a997e2c5 100644 --- a/application/views/templates/CISHTML-Header.php +++ b/application/views/templates/CISHTML-Header.php @@ -18,7 +18,7 @@ $this->load->view('templates/FHC-Header', $includesArray); if (!isset($menu)) { $ci =& get_instance(); // get CI instance $ci->load->model('content/Content_model', 'ContentModel'); - $result = $ci->ContentModel->getMenu(6739, get_uid()); + $result = $ci->ContentModel->getMenu(defined('CIS4_MENU_ENTRY') ? CIS4_MENU_ENTRY : null, get_uid()); $menu = getData($result) ?? (object)['childs' => []]; } ?>