From 841e3b03902f82ac61a3600f60b2f676483d5ad3 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Tue, 14 May 2024 14:21:52 +0200 Subject: [PATCH 1/7] raum query --- application/libraries/SearchBarLib.php | 74 +++++++++++++++++++++ public/js/components/Cis/Menu.js | 58 ++++++++++++++++ public/js/components/searchbar/raum.js | 11 +-- public/js/components/searchbar/searchbar.js | 5 ++ 4 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 public/js/components/Cis/Menu.js diff --git a/application/libraries/SearchBarLib.php b/application/libraries/SearchBarLib.php index 7197eae6a..5d60200a9 100644 --- a/application/libraries/SearchBarLib.php +++ b/application/libraries/SearchBarLib.php @@ -390,6 +390,80 @@ EOSC; */ private function _raum($searchstr, $type) { + $dbModel = new DB_Model(); + // select - ARRAY_AGG(ort_reihungstest_studiengang.test) as reihungstest_studiengang + /* LEFT JOIN ( + Select reihungstest_id, bezeichnung as reihungstest_studiengang_bezeichnung, CONCAT(reihungstest_id,\' - \',bezeichnung) as test, public.tbl_rt_ort.ort_kurzbz + FROM public.tbl_reihungstest + JOIN public.tbl_studiengang USING(studiengang_kz) + JOIN public.tbl_rt_ort ON reihungstest_id = rt_id + + ) ort_reihungstest_studiengang ON ort_reihungstest_studiengang.ort_kurzbz = ort.ort_kurzbz + */ + $rooms = $dbModel->execReadOnlyQuery(' + SELECT + \''.$type.'\' AS type, + ort.ort_kurzbz as ort_kurzbz, + ort.gebteil as building, + ort.stockwerk as floor, + ort.dislozierung as room_number + + FROM public.tbl_ort as ort + + WHERE ort.ort_kurzbz like \'%'. $searchstr . '%\' GROUP BY ort.ort_kurzbz' + /* + + org joins: + + JOIN public.tbl_organisationseinheittyp ot USING(organisationseinheittyp_kurzbz) + LEFT JOIN public.tbl_organisationseinheit oParent ON(oParent.oe_kurzbz = o.oe_parent_kurzbz) + LEFT JOIN public.tbl_organisationseinheittyp otParent ON(oParent.organisationseinheittyp_kurzbz = otParent.organisationseinheittyp_kurzbz) + LEFT JOIN ( + SELECT benutzerfunktion_id, oe_kurzbz + FROM public.tbl_benutzerfunktion + WHERE funktion_kurzbz = \'oezuordnung\' + AND (datum_von IS NULL OR datum_von <= NOW()) + AND (datum_bis IS NULL OR datum_bis >= NOW()) + ) bfCount ON(bfCount.oe_kurzbz = o.oe_kurzbz) + LEFT JOIN ( + SELECT bf.oe_kurzbz, bf.uid, p.vorname, p.nachname + FROM public.tbl_benutzerfunktion bf + JOIN public.tbl_benutzer b USING(uid) + JOIN public.tbl_person p USING(person_id) + WHERE funktion_kurzbz = \'Leitung\' + AND (datum_von IS NULL OR datum_von <= NOW()) + AND (datum_bis IS NULL OR datum_bis >= NOW()) + AND b.aktiv = TRUE + ) bfLeader ON(bfLeader.oe_kurzbz = o.oe_kurzbz) + + + + $this->buildSearchClause( + $dbModel, + array('o.oe_kurzbz', 'o.bezeichnung', 'ot.bezeichnung'), + $searchstr + ) . + 'GROUP BY type, o.oe_kurzbz, o.bezeichnung, ot.bezeichnung, oParent.oe_kurzbz, oParent.bezeichnung, otParent.bezeichnung' + */ + ); + + // If something has been found + if (hasData($rooms)) + { + // Loop through the returned dataset + foreach (getData($rooms) as $room) + { + if($room->building == null){ + $room->test = "test"; + + } + } + + // Returns the dataset + return getData($rooms); + } + + // Otherwise return an empty array return array(); } } diff --git a/public/js/components/Cis/Menu.js b/public/js/components/Cis/Menu.js new file mode 100644 index 000000000..f31bbc6fa --- /dev/null +++ b/public/js/components/Cis/Menu.js @@ -0,0 +1,58 @@ +import CisMenuEntry from "./Menu/Entry.js"; +import FhcSearchbar from "../searchbar/searchbar.js"; + +export default { + components: { + CisMenuEntry, + FhcSearchbar + }, + props: { + rootUrl: String, + logoUrl: String, + avatarUrl: String, + logoutUrl: String, + searchbaroptions: Object, + searchfunction: Function + }, + data: () => { + return { + entries: [] + }; + }, + created() { + axios.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/CisVue/Menu').then(res => { + this.entries = res.data.retval.childs; + }); + }, + template: /*html*/` + + + ` +}; \ No newline at end of file diff --git a/public/js/components/searchbar/raum.js b/public/js/components/searchbar/raum.js index 887820d6c..20a9b7bf9 100644 --- a/public/js/components/searchbar/raum.js +++ b/public/js/components/searchbar/raum.js @@ -10,7 +10,8 @@ export default { emits: [ 'actionexecuted' ], template: `
- +
{{JSON.stringify(actions,null,2)}}
+
{{JSON.stringify(res,null,2)}}
@@ -19,7 +20,7 @@ export default {
- {{ res.r }} + {{ res.ort_kurzbz }}
@@ -27,15 +28,15 @@ export default {
Gebäude
-
{{ res.g }}
+
{{ res.building }}
Stockwerk
-
{{ res.s }}
+
{{ res.floor }}
Raumnummer
-
{{ res.rn }}
+
{{ res.room_number }}
diff --git a/public/js/components/searchbar/searchbar.js b/public/js/components/searchbar/searchbar.js index 1f4dfc94b..41816292b 100644 --- a/public/js/components/searchbar/searchbar.js +++ b/public/js/components/searchbar/searchbar.js @@ -26,8 +26,13 @@ export default { employee: employee, organisationunit: organisationunit }, +<<<<<<< Updated upstream template: `
>>>>>> Stashed changes @focusin="this.searchfocusin" @focusout="this.searchfocusout">
Date: Tue, 14 May 2024 15:57:48 +0200 Subject: [PATCH 2/7] WIP sql query for the raum search --- application/libraries/SearchBarLib.php | 13 +++++++++---- public/js/components/searchbar/searchbar.js | 5 ----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/application/libraries/SearchBarLib.php b/application/libraries/SearchBarLib.php index 5d60200a9..9ed8b8922 100644 --- a/application/libraries/SearchBarLib.php +++ b/application/libraries/SearchBarLib.php @@ -406,11 +406,16 @@ EOSC; ort.ort_kurzbz as ort_kurzbz, ort.gebteil as building, ort.stockwerk as floor, - ort.dislozierung as room_number - + ort.dislozierung as room_number, + CONCAT(standort.plz,\' \',standort.ort,\', \',standort.strasse,\' \\ \',ort.stockwerk,\' Stockwerk\') as strasse, + CONCAT(ort.max_person,\', davon \',ort.arbeitsplaetze,\' PC-Plätze\') as plaetze FROM public.tbl_ort as ort - - WHERE ort.ort_kurzbz like \'%'. $searchstr . '%\' GROUP BY ort.ort_kurzbz' + LEFT JOIN ( + select ort,standort_id,strasse, plz + FROM public.tbl_standort + LEFT JOIN public.tbl_adresse USING(adresse_id) + ) standort USING(standort_id) + WHERE LOWER(ort.ort_kurzbz) like LOWER(\'%'. $searchstr . '%\') ' /* org joins: diff --git a/public/js/components/searchbar/searchbar.js b/public/js/components/searchbar/searchbar.js index 41816292b..c6c3ce42d 100644 --- a/public/js/components/searchbar/searchbar.js +++ b/public/js/components/searchbar/searchbar.js @@ -26,13 +26,8 @@ export default { employee: employee, organisationunit: organisationunit }, -<<<<<<< Updated upstream - template: ` - >>>>>> Stashed changes @focusin="this.searchfocusin" @focusout="this.searchfocusout">
Date: Wed, 15 May 2024 14:37:18 +0200 Subject: [PATCH 3/7] creates the sql query with the needed room information to be displayed in the search --- application/libraries/SearchBarLib.php | 98 +++++++++++--------------- public/js/components/searchbar/raum.js | 29 +++++--- 2 files changed, 62 insertions(+), 65 deletions(-) diff --git a/application/libraries/SearchBarLib.php b/application/libraries/SearchBarLib.php index 9ed8b8922..af4db6dcb 100644 --- a/application/libraries/SearchBarLib.php +++ b/application/libraries/SearchBarLib.php @@ -391,24 +391,52 @@ EOSC; private function _raum($searchstr, $type) { $dbModel = new DB_Model(); - // select - ARRAY_AGG(ort_reihungstest_studiengang.test) as reihungstest_studiengang - /* LEFT JOIN ( - Select reihungstest_id, bezeichnung as reihungstest_studiengang_bezeichnung, CONCAT(reihungstest_id,\' - \',bezeichnung) as test, public.tbl_rt_ort.ort_kurzbz - FROM public.tbl_reihungstest - JOIN public.tbl_studiengang USING(studiengang_kz) - JOIN public.tbl_rt_ort ON reihungstest_id = rt_id - ) ort_reihungstest_studiengang ON ort_reihungstest_studiengang.ort_kurzbz = ort.ort_kurzbz - */ $rooms = $dbModel->execReadOnlyQuery(' SELECT \''.$type.'\' AS type, - ort.ort_kurzbz as ort_kurzbz, - ort.gebteil as building, - ort.stockwerk as floor, - ort.dislozierung as room_number, - CONCAT(standort.plz,\' \',standort.ort,\', \',standort.strasse,\' \\ \',ort.stockwerk,\' Stockwerk\') as strasse, - CONCAT(ort.max_person,\', davon \',ort.arbeitsplaetze,\' PC-Plätze\') as plaetze + COALESCE(ort.ort_kurzbz, \'N/A\') as ort_kurzbz, + COALESCE(ort.gebteil, \'N/A\') as building, + COALESCE(ort.ausstattung, \'N/A\') as austattung, + COALESCE(CAST(ort.stockwerk AS VARCHAR), \'N/A\') as floor, + COALESCE(CAST(ort.dislozierung AS VARCHAR), \'N/A\') as room_number, + COALESCE(CAST(ort.content_id AS VARCHAR), \'N/A\') as content_id, + + CASE + WHEN standort.plz IS NULL OR standort.ort IS NULL THEN + CASE + WHEN standort.strasse IS NULL THEN + CASE + WHEN ort.stockwerk IS NULL THEN \'N/A\' + ELSE CONCAT(ort.stockwerk,\' Stockwerk\') + END + ELSE + CASE + WHEN ort.stockwerk IS NULL THEN standort.strasse + ELSE CONCAT(standort.strasse,\' / \',ort.stockwerk,\' Stockwerk\') + END + END + ELSE + CASE + WHEN standort.strasse IS NULL THEN + CASE + WHEN ort.stockwerk IS NULL THEN CONCAT(standort.plz,\' \',standort.ort) + ELSE CONCAT(standort.plz,\' \',standort.ort,\' / \',ort.stockwerk,\' Stockwerk\') + END + ELSE + CASE + WHEN ort.stockwerk IS NULL THEN CONCAT(standort.plz,\' \',standort.ort,\' / \',standort.strasse) + ELSE CONCAT(standort.plz,\' \',standort.ort,\', \',standort.strasse,\' / \',ort.stockwerk,\' Stockwerk\') + END + END + END as standort, + + + CASE + WHEN ort.max_person IS NULL OR ort.arbeitsplaetze IS NULL THEN \'N/A\' + ELSE CONCAT(ort.max_person,\', davon \',ort.arbeitsplaetze,\' PC-Plätze\') + END as sitzplaetze + FROM public.tbl_ort as ort LEFT JOIN ( select ort,standort_id,strasse, plz @@ -416,54 +444,12 @@ EOSC; LEFT JOIN public.tbl_adresse USING(adresse_id) ) standort USING(standort_id) WHERE LOWER(ort.ort_kurzbz) like LOWER(\'%'. $searchstr . '%\') ' - /* - org joins: - - JOIN public.tbl_organisationseinheittyp ot USING(organisationseinheittyp_kurzbz) - LEFT JOIN public.tbl_organisationseinheit oParent ON(oParent.oe_kurzbz = o.oe_parent_kurzbz) - LEFT JOIN public.tbl_organisationseinheittyp otParent ON(oParent.organisationseinheittyp_kurzbz = otParent.organisationseinheittyp_kurzbz) - LEFT JOIN ( - SELECT benutzerfunktion_id, oe_kurzbz - FROM public.tbl_benutzerfunktion - WHERE funktion_kurzbz = \'oezuordnung\' - AND (datum_von IS NULL OR datum_von <= NOW()) - AND (datum_bis IS NULL OR datum_bis >= NOW()) - ) bfCount ON(bfCount.oe_kurzbz = o.oe_kurzbz) - LEFT JOIN ( - SELECT bf.oe_kurzbz, bf.uid, p.vorname, p.nachname - FROM public.tbl_benutzerfunktion bf - JOIN public.tbl_benutzer b USING(uid) - JOIN public.tbl_person p USING(person_id) - WHERE funktion_kurzbz = \'Leitung\' - AND (datum_von IS NULL OR datum_von <= NOW()) - AND (datum_bis IS NULL OR datum_bis >= NOW()) - AND b.aktiv = TRUE - ) bfLeader ON(bfLeader.oe_kurzbz = o.oe_kurzbz) - - - - $this->buildSearchClause( - $dbModel, - array('o.oe_kurzbz', 'o.bezeichnung', 'ot.bezeichnung'), - $searchstr - ) . - 'GROUP BY type, o.oe_kurzbz, o.bezeichnung, ot.bezeichnung, oParent.oe_kurzbz, oParent.bezeichnung, otParent.bezeichnung' - */ ); // If something has been found if (hasData($rooms)) { - // Loop through the returned dataset - foreach (getData($rooms) as $room) - { - if($room->building == null){ - $room->test = "test"; - - } - } - // Returns the dataset return getData($rooms); } diff --git a/public/js/components/searchbar/raum.js b/public/js/components/searchbar/raum.js index 20a9b7bf9..69e303ed4 100644 --- a/public/js/components/searchbar/raum.js +++ b/public/js/components/searchbar/raum.js @@ -7,11 +7,18 @@ export default { action: action, actions: actions }, + created(){ + //! this should be the default action for a raum + /*this.actions.defaultaction = { + type: "link", + action: function(data) { + return FHC_JS_DATA_STORAGE_OBJECT.app_root+'cms/content.php?content_id='+data.content_id; + } + }; */ + }, emits: [ 'actionexecuted' ], - template: ` + template: /*html*/`
-
{{JSON.stringify(actions,null,2)}}
-
{{JSON.stringify(res,null,2)}}
@@ -26,17 +33,21 @@ export default {
+
+
Standort
+
{{ res.standort }}
+
+
+
Sitzplätze
+
{{ res.sitzplaetze }}
+
Gebäude
{{ res.building }}
-
Stockwerk
-
{{ res.floor }}
-
-
-
Raumnummer
-
{{ res.room_number }}
+
Zusatz Informationen
+
From d07c568d5e9e2e39fb4f07784446d47fb14c2857 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Tue, 21 May 2024 10:37:53 +0200 Subject: [PATCH 4/7] adds dbupdate queryies for the new raum template --- .../39911_tabulator_in_contentmittitel.php | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 system/dbupdate_3.4/39911_tabulator_in_contentmittitel.php diff --git a/system/dbupdate_3.4/39911_tabulator_in_contentmittitel.php b/system/dbupdate_3.4/39911_tabulator_in_contentmittitel.php new file mode 100644 index 000000000..466c525d3 --- /dev/null +++ b/system/dbupdate_3.4/39911_tabulator_in_contentmittitel.php @@ -0,0 +1,123 @@ + + + + + <xsl:value-of select="titel" /> + + + + + + + + + + + + + + + +

+ + + +
+ +END; + + + +$new_xslt_xhtml= << + + + + <xsl:value-of select="titel" /> + + + + + + + + + + + + +

+ + + +
+ +END; + $qry = "UPDATE campus.tbl_template SET xslt_xhtml='".$new_xslt_xhtml."' WHERE template_kurzbz='contentmittitel';"; + + if (!$db->db_query($qry)) + echo 'UPDATE OF TEMPLATE CONTENTMITTITEL FAILED : ' . $db->db_last_error() . '
'; + else + echo '
UPDATE OF TEMPLATE CONTENTMITTITEL WAS SUCCESSFUL'; + + +$raum_content_update_query= <<db_query($raum_content_update_query)) + echo 'FAILED TO UPDATE ALL TEMPLATES FOR THE ROOMS : ' . $db->db_last_error() . '
'; + else + echo '
SUCCESSFUL UPDATE ALL TEMPLATES FOR THE ROOMS TO raum_contentmittitel'; + + + + From 393475e62cfc4dd375332a48654e140dc56c3b57 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Tue, 21 May 2024 10:49:27 +0200 Subject: [PATCH 5/7] adds the content update script for the room content to the checksystem --- system/dbupdate_3.4.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 3a3f0be78..8974e7c15 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -54,6 +54,7 @@ require_once('dbupdate_3.4/21620_neues_feld_zum_erfassen_des_ESI.php'); require_once('dbupdate_3.4/36530_bis_internationsalisierung_codextabelle_neuerungen.php'); require_once('dbupdate_3.4/34543_ux_template.php'); require_once('dbupdate_3.4/17513_Entwicklungsteam.php'); +require_once('dbupdate_3.4/39911_tabulator_in_contentmittitel.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; From 48bb2ef7e14baa8ead75a596f1db8ab9dcc26c0a Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Tue, 21 May 2024 11:05:22 +0200 Subject: [PATCH 6/7] adds the insert query for the new raum template and the update statement to update the template for every room content --- .../39911_tabulator_in_contentmittitel.php | 107 +++++++----------- 1 file changed, 40 insertions(+), 67 deletions(-) diff --git a/system/dbupdate_3.4/39911_tabulator_in_contentmittitel.php b/system/dbupdate_3.4/39911_tabulator_in_contentmittitel.php index 466c525d3..1e86da19e 100644 --- a/system/dbupdate_3.4/39911_tabulator_in_contentmittitel.php +++ b/system/dbupdate_3.4/39911_tabulator_in_contentmittitel.php @@ -1,7 +1,6 @@ @@ -9,64 +8,8 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:value-of select="titel" /> - - - - - - - - - - - - -

- - - -
- -END; - - - -$new_xslt_xhtml= << - - - - <xsl:value-of select="titel" /> - - - - - - - - -