diff --git a/application/controllers/CisVue/Cms.php b/application/controllers/CisVue/Cms.php index d1fe5468e..ebd81350b 100644 --- a/application/controllers/CisVue/Cms.php +++ b/application/controllers/CisVue/Cms.php @@ -79,48 +79,6 @@ class Cms extends Auth_Controller $this->load->view('CisVue/Cms/Content', ['infoscreen' => $infoscreen, 'studiengang_kz' => $studiengang_kz, 'semester' => $semester, 'mischen' => $mischen, 'titel' => $titel, 'edit' => $edit, 'sichtbar' => $sichtbar]); } - public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true) - { - $get_page = intval($this->input->get('page', true)); - $get_page_size = intval($this->input->get('page_size', true)); - if ($get_page) { - $page = $get_page; - } - if ($get_page_size) { - $page_size = $get_page_size; - } else { - $page_size = $this->page_size; - } - $news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size); - - if (isError($news)) { - $this->terminateWithJsonError(getError($news)); - } - $news = hasData($news) ? getData($news) : null; - if ($news) { - echo json_encode($news); - } else { - show_error("News: No data found"); - } - - } - - public function getNewsRowCount($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $fachbereich_kurzbz = null, $maxalter = 0, $edit = false, $sichtbar = true, $page = 1, $page_size = 10) - { - list($studiengang_kz, $semester) = $this->cmslib->getStgAndSem($studiengang_kz, $semester); - $all = $edit; - $num_rows = $this->NewsModel->countNewsWithContent(getSprache(), $studiengang_kz, $semester, $fachbereich_kurzbz, $sichtbar, $maxalter, $page, $this->page_size, $all, $mischen); - if (isError($num_rows)) { - $this->terminateWithJsonError(getError($num_rows)); - } - $num_rows = hasData($num_rows) ? getData($num_rows) : null; - if ($num_rows) { - echo json_encode($num_rows); - } else { - show_error("News number rows: No data found"); - } - } - public function getRoomInformation($ort_kurzbz){ $this->load->view('CisVue/Cms/RoomInformation',['ort_kurzbz'=>$ort_kurzbz]); } diff --git a/application/controllers/api/frontend/v1/Cms.php b/application/controllers/api/frontend/v1/Cms.php index 50628bd4f..f1fe380de 100644 --- a/application/controllers/api/frontend/v1/Cms.php +++ b/application/controllers/api/frontend/v1/Cms.php @@ -175,14 +175,18 @@ class Cms extends FHCAPI_Controller // getting the GET parameters $page = intval($this->input->get('page', true)); $page_size = intval($this->input->get('page_size', true)); + $sprache = $this->input->get('sprache', true); + if(!$sprache) + { + $sprache = getUserLanguage(); + } // default value for the page_size is 10 $page_size = $page_size ?? 10; - $news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size); + $news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size, $sprache); $news = $this->getDataOrTerminateWithError($news); - $this->addMeta('test', $this->p->t('global', 'studiengangsleitung')); $this->addMeta('phrases', json_decode($this->p->getJson())); $this->terminateWithSuccess($news); diff --git a/application/libraries/CmsLib.php b/application/libraries/CmsLib.php index e7f2c2de2..60e982eab 100644 --- a/application/libraries/CmsLib.php +++ b/application/libraries/CmsLib.php @@ -221,7 +221,7 @@ class CmsLib * * @return void */ - public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true, $page = 1, $page_size = 10) + public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true, $page = 1, $page_size = 10, $sprache) { $this->ci->load->model('organisation/Studiengang_model', 'StudiengangModel'); list($studiengang_kz, $semester) = $this->getStgAndSem($studiengang_kz, $semester); @@ -230,7 +230,7 @@ class CmsLib $xml = ''; $this->ci->load->model('content/News_model', 'NewsModel'); - $news = $this->ci->NewsModel->getNewsWithContent(getSprache(), $studiengang_kz, $semester, null, $sichtbar, 0, $page, $page_size, $all, $mischen); + $news = $this->ci->NewsModel->getNewsWithContent($sprache, $studiengang_kz, $semester, null, $sichtbar, 0, $page, $page_size, $all, $mischen); if (isError($news)) return $news; diff --git a/public/js/api/cms.js b/public/js/api/cms.js index 94ce24862..23643ba28 100644 --- a/public/js/api/cms.js +++ b/public/js/api/cms.js @@ -12,12 +12,13 @@ export default { }, //api function used for the news View that renders the html - getNews(page = 1, page_size = 10) { + getNews(page = 1, page_size = 10, sprache) { return this.$fhcApi.get( "/api/frontend/v1/Cms/getNews", { page, page_size, + sprache, }, ); }, diff --git a/public/js/apps/Cis/Cms.js b/public/js/apps/Cis/Cms.js index d654395fd..79dc72e8b 100644 --- a/public/js/apps/Cis/Cms.js +++ b/public/js/apps/Cis/Cms.js @@ -39,6 +39,6 @@ const app = Vue.createApp({ setScrollbarWidth(); app.use(primevue.config.default, { zIndex: { overlay: 9999 } }); -app.use(Phrasen, {reload: true}); +app.use(Phrasen); app.mount("#cms"); //#cms [data-confirm], #cms [data-href] \ No newline at end of file diff --git a/public/js/apps/Cis/Documents.js b/public/js/apps/Cis/Documents.js index 7b5332bf9..7e51d1506 100644 --- a/public/js/apps/Cis/Documents.js +++ b/public/js/apps/Cis/Documents.js @@ -89,5 +89,5 @@ const app = Vue.createApp({ setScrollbarWidth(); -app.use(Phrasen, {reload: true}); +app.use(Phrasen); app.mount('#content'); diff --git a/public/js/apps/Cis/MyLv/Student.js b/public/js/apps/Cis/MyLv/Student.js index 4d7049096..70759216a 100644 --- a/public/js/apps/Cis/MyLv/Student.js +++ b/public/js/apps/Cis/MyLv/Student.js @@ -11,4 +11,4 @@ const app = Vue.createApp({ setScrollbarWidth(); -app.use(Phrasen, {reload: true}).mount('#content'); \ No newline at end of file +app.use(Phrasen).mount('#content'); \ No newline at end of file diff --git a/public/js/apps/Cis/Stundenplan.js b/public/js/apps/Cis/Stundenplan.js index 3327f5638..1facea322 100644 --- a/public/js/apps/Cis/Stundenplan.js +++ b/public/js/apps/Cis/Stundenplan.js @@ -161,5 +161,5 @@ const app = Vue.createApp({ ` }); -app.use(Phrasen, {reload: true}); +app.use(Phrasen); app.mount('#content'); \ No newline at end of file diff --git a/public/js/apps/lehre/Antrag.js b/public/js/apps/lehre/Antrag.js index c2d410e81..bb7de3485 100644 --- a/public/js/apps/lehre/Antrag.js +++ b/public/js/apps/lehre/Antrag.js @@ -21,5 +21,5 @@ const app = Vue.createApp({ } }); app - .use(Phrasen, {reload: true}) + .use(Phrasen) .mount('#wrapper'); \ No newline at end of file diff --git a/public/js/components/Cis/Cms/Content.js b/public/js/components/Cis/Cms/Content.js index efcd34e12..3c6c28c3b 100644 --- a/public/js/components/Cis/Cms/Content.js +++ b/public/js/components/Cis/Cms/Content.js @@ -12,10 +12,6 @@ export default { type: [String, Number], default: null, }, - sprache: { - type: [String, Number], - default: null, - }, sichtbar: { type: [String, Number], default: null, @@ -32,7 +28,16 @@ export default { content: null, }; }, + watch:{ + sprache: function(sprache){ + this.fetchContent(); + console.log(sprache); + }, + }, computed: { + sprache(){ + return this.$p.user_language.value; + }, computeContentType: function () { switch (this.content_type) { case "raum_contentmittitel": @@ -43,14 +48,16 @@ export default { ; }, }, - created() { - this.$fhcApi.factory.cms.content(this.content_id, this.version, this.sprache, this.sichtbar).then(res => { - this.content = res.data.content; - this.content_type = res.data.type; - }); + methods:{ + fetchContent(){ + return this.$fhcApi.factory.cms.content(this.content_id, this.version, this.sprache, this.sichtbar).then(res => { + this.content = res.data.content; + this.content_type = res.data.type; + }); + } }, - mounted() { - + created() { + this.fetchContent(); }, template: /*html*/ ` diff --git a/public/js/components/Cis/Cms/News.js b/public/js/components/Cis/Cms/News.js index d032cd44f..b0ff79a3d 100644 --- a/public/js/components/Cis/Cms/News.js +++ b/public/js/components/Cis/Cms/News.js @@ -11,9 +11,28 @@ export default { content: null, maxPageCount: 0, page_size: 10, + page:1, }; }, + watch:{ + '$p.user_language.value':function(sprache){ + this.fetchNews(); + console.log("ere") + } + }, + computed:{ + sprache: function(){ + return this.$p.user_language.value; + }, + }, methods: { + fetchNews: function(){ + return this.$fhcApi.factory.cms.getNews(this.page, this.page_size, this.sprache) + .then(res => res.data) + .then(result => { + this.content = result; + }); + }, loadNewPageContent: function (data) { this.$fhcApi.factory.cms.getNews(data.page, data.rows) .then(res => res.data) @@ -24,11 +43,7 @@ export default { }, }, created() { - this.$fhcApi.factory.cms.getNews(1, this.page_size) - .then(res => res.data) - .then(result => { - this.content = result; - }); + this.fetchNews(); this.$fhcApi.factory.cms.getNewsRowCount() .then(res => res.data) @@ -39,7 +54,7 @@ export default { template: /*html*/ `

News


- +