diff --git a/application/controllers/CisVue/Cms.php b/application/controllers/CisVue/Cms.php index 2c1fa1fc6..f8bd61a7b 100755 --- a/application/controllers/CisVue/Cms.php +++ b/application/controllers/CisVue/Cms.php @@ -115,4 +115,8 @@ class Cms extends FHC_Controller show_error("News number rows: No data found"); } } + + public function getRoomInformation(){ + $this->load->view('CisVue/Cms/RoomInformation'); + } } diff --git a/application/controllers/components/Cis/Stundenplan.php b/application/controllers/components/Cis/Stundenplan.php index 2b35e11ca..2ec001843 100755 --- a/application/controllers/components/Cis/Stundenplan.php +++ b/application/controllers/components/Cis/Stundenplan.php @@ -16,7 +16,8 @@ class Stundenplan extends Auth_Controller parent::__construct([ 'index' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions? 'Reservierungen' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions? - 'Stunden' => ['student/anrechnung_beantragen:r','user:r'] // TODO(chris): permissions? + 'Stunden' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions? + 'RoomInformation'=> ['student/anrechnung_beantragen:r','user:r'], ]); } @@ -65,4 +66,14 @@ class Stundenplan extends Auth_Controller $this->outputJsonSuccess(getData($result)); } + public function RoomInformation() + { + $this->load->model('ressource/Stundenplan_model', 'StundenplanModel'); + + $result = $this->StundenplanModel->getRoomDataOnDay('EDV_A2.06','2024-05-21'); + //echo($this->db->last_query()); + echo json_encode($result); + + } + } diff --git a/application/models/ressource/Stundenplan_model.php b/application/models/ressource/Stundenplan_model.php index 5ec6ea302..4d0a7893b 100755 --- a/application/models/ressource/Stundenplan_model.php +++ b/application/models/ressource/Stundenplan_model.php @@ -12,6 +12,18 @@ class Stundenplan_model extends DB_Model $this->pk = 'stundenplan_id'; } + /** + * @param string $ort_kurzbz + * @param string $date + * + * @return stdClass + */ + public function getRoomDataOnDay($ort_kurzbz,$date){ + $res = $this->loadWhere(['ort_kurzbz'=>$ort_kurzbz,'datum'=>$date]); + $res = hasData($res) ? getData($res): null; + return $res; + } + /** * @param string $uid * diff --git a/application/models/ressource/Stundenplandev_model.php b/application/models/ressource/Stundenplandev_model.php index a498e209b..800540d60 100755 --- a/application/models/ressource/Stundenplandev_model.php +++ b/application/models/ressource/Stundenplandev_model.php @@ -12,6 +12,8 @@ class Stundenplandev_model extends DB_Model $this->pk = 'stundenplandev_id'; } + + public function getMissingDirectGroups($studiensemester_kurzbz = null) { $qry = " diff --git a/application/views/CisVue/Cms/RoomInformation.php b/application/views/CisVue/Cms/RoomInformation.php new file mode 100644 index 000000000..c14b68024 --- /dev/null +++ b/application/views/CisVue/Cms/RoomInformation.php @@ -0,0 +1,17 @@ + 'RoomInformation', + 'customJSModules' => ['public/js/apps/Cis/RoomInformation.js'], + 'customCSSs' => ['public/css/components/calendar.css'] +); + +$this->load->view('templates/CISHTML-Header', $includesArray); +?> + +
+

Room Information

+
+
+
+ +load->view('templates/CISHTML-Footer', $includesArray); ?> diff --git a/public/js/apps/Cis/RoomInformation.js b/public/js/apps/Cis/RoomInformation.js new file mode 100644 index 000000000..63587d2d1 --- /dev/null +++ b/public/js/apps/Cis/RoomInformation.js @@ -0,0 +1,61 @@ +import FhcCalendar from "../../components/Calendar/Calendar.js"; + +const app = Vue.createApp({ + components: { + FhcCalendar + }, + data() { + return { + stunden: [], + events: null + } + }, + created() { + axios.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/Cis/Stundenplan/Stunden').then(res => { + + + res.data.retval.forEach(std => { + this.stunden[std.stunde] = std; // TODO(chris): geht besser + }); + console.log("this are the loaded stunden", this.stunden) + }); + + axios.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/Cis/Stundenplan').then(res => { + + let events; + if (res.data.retval && res.data.retval.forEach) { + res.data.retval.forEach((el, i) => { + el.id = i; + el.color = '#' + (el.farbe || 'CCCCCC'); + el.start = new Date(el.datum + ' ' + this.stunden[el.stunde].beginn); + el.end = new Date(el.datum + ' ' + this.stunden[el.stunde].ende); + el.title = el.lehrfach; + if (el.lehrform) + el.title += '-' + el.lehrform; + }); + events = res.data.retval; + } + + console.log("this are the loaded events",events) + // TODO(chris): do we need that + + }).catch((e)=>{console.log(e,"this is the exception")}) + + + axios.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/Cis/Stundenplan/RoomInformation').then(res => { + console.log(res) + console.log("this string got printed after the get was successfully finished") + }).catch((e)=>{console.log(e,"this is the exception")}) + + + + }, + template: /*html*/` +
+ + +
+ `, +}); +app.config.unwrapInjectedRef = true; +app.mount('#content'); \ No newline at end of file