rendering content pages

This commit is contained in:
SimonGschnell
2024-06-21 12:01:04 +02:00
parent f8c431e0bc
commit 7267d526bb
9 changed files with 122 additions and 17 deletions
+12 -2
View File
@@ -72,8 +72,18 @@ class Cms extends Auth_Controller
// return early if the content_id for the content is missing
if(!isset($content_id))
$this->terminateWithError("content_id is missing");
$this->load->view('CisHtml/Cms/Content', ['content_id' => $content_id, 'version' => $version, 'sprache' => $sprache, 'sichtbar' => $sichtbar]);
$content = $this->ContentModel->load($content_id);
if (isError($content))
$this->terminateWithError(getError($content));
$content = getData($content);
if(NULL === $content)
$this->terminateWithError("Content not found");
$content = current($content);
$this->load->view('CisVue/Cms/Content', ['content_id' => $content_id, 'template_kurzbz'=>$content->template_kurzbz , 'version' => $version, 'sprache' => $sprache, 'sichtbar' => $sichtbar]);
}
/**
+12 -2
View File
@@ -48,8 +48,18 @@ class Cms extends FHC_Controller
// return early if the content_id for the content is missing
if(!isset($content_id))
$this->terminateWithError("content_id is missing");
$this->load->view('CisHtml/Cms/Content', ['content_id' => $content_id, 'version' => $version, 'sprache' => $sprache, 'sichtbar' => $sichtbar]);
$content = $this->ContentModel->load($content_id);
if (isError($content))
$this->terminateWithError(getError($content));
$content = getData($content);
if(NULL === $content)
$this->terminateWithError("Content not found");
$content = current($content);
$this->load->view('CisVue/Cms/Content', ['content_id' => $content_id, 'template_kurzbz'=>$content->template_kurzbz , 'version' => $version, 'sprache' => $sprache, 'sichtbar' => $sichtbar]);
}
/**
+15 -2
View File
@@ -24,6 +24,9 @@ class Cms extends FHC_Controller
$this->loadPhrases([
'global'
]);
$this->load->model('content/Content_model', 'ContentModel');
}
// -----------------------------------------------------------------------------------------------------------------
@@ -42,8 +45,18 @@ class Cms extends FHC_Controller
// return early if the content_id for the content is missing
if(!isset($content_id))
$this->terminateWithError("content_id is missing");
$this->load->view('CisHtml/Cms/Content', ['content_id' => $content_id, 'version' => $version, 'sprache' => $sprache, 'sichtbar' => $sichtbar]);
$content = $this->ContentModel->load($content_id);
if (isError($content))
$this->terminateWithError(getError($content));
$content = getData($content);
if(NULL === $content)
$this->terminateWithError("Content not found");
$content = current($content);
$this->load->view('CisVue/Cms/Content', ['content_id' => $content_id, 'template_kurzbz'=>$content->template_kurzbz , 'version' => $version, 'sprache' => $sprache, 'sichtbar' => $sichtbar]);
}
/**
+7 -3
View File
@@ -110,10 +110,14 @@ class CmsLib
$processor = new XSLTProcessor();
$processor->importStylesheet($xsltemplate);
$content = $processor->transformToXML($XML);
$content = str_replace('dms.php', APP_ROOT . 'cms/dms.php', $content);
$transformed_content = $processor->transformToXML($XML);
$transformed_content = str_replace('dms.php', APP_ROOT . 'cms/dms.php', $transformed_content);
return success($content);
return success([
"type"=>$content->template_kurzbz,
"content"=>$transformed_content
]);
}
/**
+13 -3
View File
@@ -1,19 +1,29 @@
<?php
$includesArray = array(
'title' => 'FH-Complete',
'customJSModules' => ['public/js/apps/Cis/Cms.js'],
'primevue3'=>true,
'customCSSs' => [
'public/css/Cis4/Cms.css',
#'skin/style.css.php'
]
);
$this->load->view('templates/FHC-Header', $includesArray);
switch($template_kurzbz){
case 'raum_contentmittitel':
$includesArray['tabulator5'] = true;
break;
}
$this->load->view('templates/CISVUE-Header', $includesArray);
?>
<div id="cms">
<?php echo (isset($content_id) ? '<cms-content :content_id="'.$content_id.'" :version="'.$version.'" :sprache="'.$sprache.'" :sichtbar="'.$sichtbar.'" />' : '<cms-news/>'); ?>
</div>
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
<?php $this->load->view('templates/CISVUE-Footer', $includesArray); ?>
+12 -3
View File
@@ -1,20 +1,29 @@
<?php
$includesArray = array(
'primevue3' => true,
'customJSModules' => ['public/js/apps/Cis/Cms.js'],
'primevue3'=>true,
'customCSSs' => [
'public/css/Cis4/Cms.css',
#'skin/style.css.php'
]
);
$this->load->view('templates/CISHTML-Header', $includesArray);
switch($template_kurzbz){
case 'raum_contentmittitel':
$includesArray['tabulator5'] = true;
break;
}
$this->load->view('templates/CISVUE-Header', $includesArray);
?>
<div id="cms">
<?php echo (isset($content_id) ? '<cms-content :content_id="'.$content_id.'" :version="'.$version.'" :sprache="'.$sprache.'" :sichtbar="'.$sichtbar.'" />' : '<cms-news/>'); ?>
</div>
<?php $this->load->view('templates/CISHTML-Footer', $includesArray); ?>
<?php $this->load->view('templates/CISVUE-Footer', $includesArray); ?>
+9
View File
@@ -1,15 +1,24 @@
<?php
$includesArray = array(
'customJSModules' => ['public/js/apps/Cis/Cms.js'],
'primevue3'=>true,
'customCSSs' => [
'public/css/Cis4/Cms.css',
#'skin/style.css.php'
]
);
switch($template_kurzbz){
case 'raum_contentmittitel':
$includesArray['tabulator5'] = true;
break;
}
$this->load->view('templates/CISVUE-Header', $includesArray);
?>
<div id="cms">
<?php echo (isset($content_id) ? '<cms-content :content_id="'.$content_id.'" :version="'.$version.'" :sprache="'.$sprache.'" :sichtbar="'.$sichtbar.'" />' : '<cms-news/>'); ?>
+9 -2
View File
@@ -1,3 +1,5 @@
import raum_contentmittitel from './Content_types/Raum_contentmittitel.js'
export default {
props:{
@@ -19,6 +21,9 @@ export default {
}
},
components:{
raum_contentmittitel,
},
data() {
return {
@@ -29,12 +34,14 @@ export default {
created() {
console.log("this is the api", this.$fhcApi);
this.$fhcApi.factory.cms.content(this.content_id,this.version, this.sprache, this.sichtbar).then(res =>{
this.content = res.data;
this.content = res.data.content;
this.content_type = res.data.type;
});
},
template: /*html*/ `
<!-- div that contains the content -->
<div v-if="content" v-html="content"></div>
<component :is="content_type" v-if="content" :content="content" />
<p v-else>No content is available to display</p>
`,
};
@@ -0,0 +1,33 @@
export default {
props:{
content:{
type:String,
required:true,
},
},
mounted(){
let tables = document.getElementsByClassName("tablesorter");
for(let table of tables){
new Tabulator(table, {
layout:"fitDataStretch",
columnDefaults:{
formatter:"html",
resizable:false,
minWidth: "100px",
}
})
table.classList.add("mx-auto");
table.style.width="30em";
}
},
template: /*html*/ `
<!-- div that contains the content -->
<div v-html="content" v-if="content" :content="content" />
<p v-else>Content was not found</p>
`,
};