diff --git a/application/controllers/api/frontend/v1/Stundenplan.php b/application/controllers/api/frontend/v1/Stundenplan.php index 84c7933ad..815631d60 100644 --- a/application/controllers/api/frontend/v1/Stundenplan.php +++ b/application/controllers/api/frontend/v1/Stundenplan.php @@ -172,6 +172,7 @@ class Stundenplan extends FHCAPI_Controller */ public function getRoomplan() { + $this->load->library('StundenplanLib'); // form validation $this->load->library('form_validation'); $this->form_validation->set_data($_GET); @@ -188,8 +189,7 @@ class Stundenplan extends FHCAPI_Controller $roomplan_data = $this->StundenplanModel->stundenplanGruppierung($this->StundenplanModel->getRoomQuery($ort_kurzbz, $start_date, $end_date)); $roomplan_data = $this->getDataOrTerminateWithError($roomplan_data); - - $this->expand_object_information($roomplan_data); + $this->stundenplanlib->expand_object_information($roomplan_data); $this->terminateWithSuccess($roomplan_data); @@ -198,6 +198,7 @@ class Stundenplan extends FHCAPI_Controller // gets the reservierungen of a room if the ort_kurzbz parameter is supplied otherwise gets the reservierungen of the stundenplan of a student public function Reservierungen($ort_kurzbz = null) { + $this->load->library('StundenplanLib'); //form validation $this->load->library('form_validation'); $this->form_validation->set_data($_GET); @@ -211,7 +212,6 @@ class Stundenplan extends FHCAPI_Controller $start_date = $this->input->get('start_date', TRUE); $end_date = $this->input->get('end_date', TRUE); - $this->load->library('StundenplanLib'); $result = $this->stundenplanlib->getReservierungen($start_date,$end_date,$ort_kurzbz); $result = $this->getDataOrTerminateWithError($result); $this->terminateWithSuccess($result); diff --git a/application/libraries/StundenplanLib.php b/application/libraries/StundenplanLib.php index 5a741e10c..e0691ecab 100644 --- a/application/libraries/StundenplanLib.php +++ b/application/libraries/StundenplanLib.php @@ -144,8 +144,8 @@ class StundenplanLib{ } - private function expand_object_information($data){ - + public function expand_object_information($data){ + $this->_ci =& get_instance(); foreach ($data as $item) { diff --git a/application/views/Cis/Login.php b/application/views/Cis/Login.php index 68490e67e..90f78f123 100644 --- a/application/views/Cis/Login.php +++ b/application/views/Cis/Login.php @@ -2,7 +2,8 @@ $includesArray = array( 'title' => 'FH-Complete', 'bootstrap5' => true, - 'fontawesome6' => true + 'fontawesome6' => true, + 'customJSs' => 'public/js/helpers/ColorThemeSetting.js' ); $this->load->view('templates/FHC-Header', $includesArray); diff --git a/application/views/lehre/anrechnung/requestAnrechnungImportant.php b/application/views/lehre/anrechnung/requestAnrechnungImportant.php index 0ee13d422..d224a52dd 100644 --- a/application/views/lehre/anrechnung/requestAnrechnungImportant.php +++ b/application/views/lehre/anrechnung/requestAnrechnungImportant.php @@ -4,8 +4,8 @@
this is a placeholder which means that no template was passed to the Calendar Page slot
No content is available to display
`, }; diff --git a/public/js/components/Cis/Cms/Content_types/General.js b/public/js/components/Cis/Cms/Content_types/General.js index 692843e3e..85716ef43 100644 --- a/public/js/components/Cis/Cms/Content_types/General.js +++ b/public/js/components/Cis/Cms/Content_types/General.js @@ -85,26 +85,36 @@ export default { .then(() => { Axios.get(el.href) .then((res) => { - // TODO(chris): check for success then show message and/or reload - location = location; + // TODO(chris): check for success then show message and/or reload + location = location; }) .catch((err) => console.error("ERROR:", err)); }) .catch(() => {}); }); }); - document.querySelectorAll("#cms [data-href]").forEach((el) => { + document.querySelectorAll("#cms [data-href]").forEach((el) => { el.href = el.dataset.href.replace( - /^ROOT\//, - FHC_JS_DATA_STORAGE_OBJECT.app_root + /^ROOT\//, + FHC_JS_DATA_STORAGE_OBJECT.app_root ); - }); + }); - document.querySelectorAll("[href]").forEach((element) => { - let orignal_href = element.getAttribute("href"); - let new_href = replaceRelativeLegacyLink(orignal_href); - element.href = new_href; - }); + document.querySelectorAll("[href]").forEach((element) => { + let orignal_href = element.getAttribute("href"); + let new_href = replaceRelativeLegacyLink(orignal_href); + element.href = new_href; + }); + + document.querySelectorAll("[style*=background-color]").forEach((element) => { + if (element.style.backgroundColor == "rgb(255, 255, 255)"){ + element.style.backgroundColor = "var(--fhc-background)"; + } + if(element.querySelector("*[style*=background-color]")){ + element.style.backgroundColor = "var(--fhc-secondary)"; + } + }); + }, template: /*html*/ ` diff --git a/public/js/components/Cis/Cms/News.js b/public/js/components/Cis/Cms/News.js index 1567cbef4..81d26e6c5 100644 --- a/public/js/components/Cis/Cms/News.js +++ b/public/js/components/Cis/Cms/News.js @@ -80,7 +80,7 @@ export default {- + {{vertretungFormatedName(vertretung,false)}}
diff --git a/public/js/components/Cis/DarkTheme.js b/public/js/components/Cis/DarkTheme.js new file mode 100644 index 000000000..2d3192b6d --- /dev/null +++ b/public/js/components/Cis/DarkTheme.js @@ -0,0 +1,51 @@ +export default { + data:()=>{ + return{ + theme:'light', + themes:['light','dark','purple'], + } + }, + methods:{ + toggleTheme(theme){ + if(!theme) return; + + for(const theme of this.themes){ + document.documentElement.classList.remove(theme); + } + document.documentElement.classList.add(theme); + + document.body.setAttribute("data-bs-theme", theme); + + let stylesheet = document.querySelector('link[href*="primevue/resources/themes"]'); + if(theme =="dark"){ + stylesheet.attributes.href.value = stylesheet.attributes.href.value.replace("bootstrap4-light-blue", "bootstrap4-dark-blue"); + }else if(theme =="light"){ + stylesheet.attributes.href.value = stylesheet.attributes.href.value.replace("bootstrap4-dark-blue", "bootstrap4-light-blue"); + } + + localStorage.setItem("theme",theme); + this.theme = theme; + } + }, + computed:{ + nextTheme(){ + return this.themes[(this.themes.indexOf(this.theme) + 1) % this.themes.length]; + }, + }, + mounted(){ + const theme =localStorage.getItem("theme"); + if(this.themes.includes(theme)){ + this.theme = theme; + } + this.toggleTheme(this.theme); + + }, + template:/*html*/` + + + ` +} \ No newline at end of file diff --git a/public/js/components/Cis/Menu.js b/public/js/components/Cis/Menu.js index ebab00109..08934cc78 100644 --- a/public/js/components/Cis/Menu.js +++ b/public/js/components/Cis/Menu.js @@ -1,12 +1,14 @@ import CisMenuEntry from "./Menu/Entry.js"; import FhcSearchbar from "../searchbar/searchbar.js"; import CisSprachen from "./Sprachen.js" +import DarkTheme from "./DarkTheme.js"; export default { components: { CisMenuEntry, FhcSearchbar, CisSprachen, + DarkTheme, }, props: { rootUrl: String, @@ -103,10 +105,15 @@ export default { -