Merge branch 'feature-39911/Suche_um_raeume_erweitern' into feature-25999/C4

This commit is contained in:
Harald Bamberger
2024-09-09 11:50:27 +02:00
5 changed files with 195 additions and 11 deletions
+65
View File
@@ -454,6 +454,71 @@ EOSC;
*/
private function _raum($searchstr, $type)
{
$dbModel = new DB_Model();
$rooms = $dbModel->execReadOnlyQuery('
SELECT
\''.$type.'\' AS type,
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
FROM public.tbl_standort
LEFT JOIN public.tbl_adresse USING(adresse_id)
) standort USING(standort_id)
WHERE LOWER(ort.ort_kurzbz) like LOWER(\'%'. $searchstr . '%\') '
);
// If something has been found
if (hasData($rooms))
{
// Returns the dataset
return getData($rooms);
}
// Otherwise return an empty array
return array();
}
}
+1 -1
View File
@@ -55,4 +55,4 @@ export default {
</div>
</div>
</nav>`
};
};
+22 -10
View File
@@ -7,10 +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*/`
<div class="searchbar_result searchbar_raum">
<div class="searchbar_grid">
<div class="searchbar_icon">
<action :res="this.res" :action="this.actions.defaultaction" @actionexecuted="$emit('actionexecuted')">
@@ -19,23 +27,27 @@ export default {
</div>
<div class="searchbar_data">
<action :res="this.res" :action="this.actions.defaultaction" @actionexecuted="$emit('actionexecuted')">
<span class="fw-bold">{{ res.r }}</span>
<span class="fw-bold">{{ res.ort_kurzbz }}</span>
</action>
<div class="mb-3"></div>
<div class="searchbar_table">
<div class="searchbar_tablerow">
<div class="searchbar_tablecell">Standort</div>
<div class="searchbar_tablecell">{{ res.standort }}</div>
</div>
<div class="searchbar_tablerow">
<div class="searchbar_tablecell">Sitzplätze</div>
<div class="searchbar_tablecell">{{ res.sitzplaetze }}</div>
</div>
<div class="searchbar_tablerow">
<div class="searchbar_tablecell">Gebäude</div>
<div class="searchbar_tablecell">{{ res.g }}</div>
<div class="searchbar_tablecell">{{ res.building }}</div>
</div>
<div class="searchbar_tablerow">
<div class="searchbar_tablecell">Stockwerk</div>
<div class="searchbar_tablecell">{{ res.s }}</div>
</div>
<div class="searchbar_tablerow">
<div class="searchbar_tablecell">Raumnummer</div>
<div class="searchbar_tablecell">{{ res.rn }}</div>
<div class="searchbar_tablecell">Zusatz Informationen</div>
<div class="searchbar_tablecell"><div v-html="res.austattung.replace('<br />','')"></div></div>
</div>
</div>
+1
View File
@@ -63,6 +63,7 @@ require_once('dbupdate_3.4/41134_bookmark_dashboardWidget.php');
require_once('dbupdate_3.4/28575_softwarebereitstellung.php');
require_once('dbupdate_3.4/41150_oe-pfad_db_view.php');
require_once('dbupdate_3.4/44031_stv_favorites.php');
require_once('dbupdate_3.4/39911_tabulator_in_contentmittitel.php');
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
@@ -0,0 +1,106 @@
<?php
$raum_contentmittitel_xslt_xhtml= <<<EOD
<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="content">
<html>
<head>
<title><xsl:value-of select="titel" /></title>
<link rel="stylesheet" href="../skin/style.css.php" type="text/css" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/5.0.7/css/tabulator.min.css" rel="stylesheet" />
<script type="text/javascript" src="https://c3p0.ma0594.technikum-wien.at/fh-core/vendor/olifolkerd/tabulator5/dist/js/tabulator.min.js?2019102903"></script>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function()
{
let tables = document.getElementsByClassName("tablesorter");
for(table of tables){
new Tabulator(table, {
layout:"fitDataFill",
autoResize:true,
resizableRows:true,
columnDefaults:{
formatter:"html",
resizable:true,
}
})
}
});
</script>
</head>
<body>
<h1><xsl:value-of select="titel" /></h1>
<xsl:value-of select="inhalt" disable-output-escaping="yes" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
EOD;
$raum_contentmittitel_xsd=<<<EOD
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="content">
<xs:element name="titel" type="xs:string"/>
<xs:element name="inhalt" type="wysiwyg"/>
</xs:element>
</xs:schema>
EOD;
$raum_contentmittitel_xslt_xhtml_c4= <<<EOD
<xsl:stylesheet version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="content">
<h1>
<xsl:value-of select="titel" />
</h1>
<xsl:value-of select="inhalt" disable-output-escaping="yes" />
</xsl:template>
</xsl:stylesheet>
EOD;
$raum_contentmittitel_insert_query= <<<EOD
INSERT INTO campus.tbl_template
(template_kurzbz, bezeichnung, xsd, xslt_xhtml, xslfo_pdf, xslt_xhtml_c4)
VALUES
('raum_contentmittitel','template for the raum view that uses the tabulator javascript instead of the jquery scripts and the table sorter ', '{$raum_contentmittitel_xsd}', '{$raum_contentmittitel_xslt_xhtml}' , NULL, '{$raum_contentmittitel_xslt_xhtml_c4}');
EOD;
$raum_content_update_query= <<<EOD
UPDATE campus.tbl_content
SET template_kurzbz = 'raum_contentmittitel'
where content_id IN
(SELECT content_id
FROM public.tbl_ort
JOIN campus.tbl_content USING(content_id));
EOD;
if ($result = @$db->db_query("SELECT * FROM campus.tbl_template WHERE template_kurzbz='raum_contentmittitel'")) {
// only inserting the new template if it doesn't exist already
if ($db->db_num_rows($result) == 0) {
// executing the insert statement for the new template
if (!$db->db_query($raum_contentmittitel_insert_query)){
echo '<strong>FAILED INSERTING NEW TEMPLATE RAUM_CONTENTMITTITEL : ' . $db->db_last_error() . '</strong><br>';
}
else {
echo '<br>SUCCESSFULLY INSERTING NEW TEMPLATE RAUM_CONTENTMITTITEL ';
// only update the rooms template if the insert of the room_contentmittitel template was successful
// executing the update statement to update the template for all room content
if (!$db->db_query($raum_content_update_query)){
echo '<strong>FAILED TO UPDATE ROOMS WITH NEW TEMPLATE raum_contentmittitel : ' . $db->db_last_error() . '</strong><br>';
}
else{
echo '<br>SUCCESSFULLY UPDATED ROOMS WITH NEW TEMPLATE raum_contentmittitel';
}
}
}
}