diff --git a/application/controllers/api/frontend/v1/Stundenplan.php b/application/controllers/api/frontend/v1/Stundenplan.php index 5e35ae3c9..5970835c9 100644 --- a/application/controllers/api/frontend/v1/Stundenplan.php +++ b/application/controllers/api/frontend/v1/Stundenplan.php @@ -49,11 +49,15 @@ class Stundenplan extends FHCAPI_Controller */ public function roomInformation() { + + // storing the get parameter in local variables $ort_kurzbz = $this->input->get('ort_kurzbz', TRUE); $start_date = $this->input->get('start_date', TRUE); $end_date = $this->input->get('end_date', TRUE); + $this->addMeta("test_start_date",$start_date); + $this->addMeta("ort",$ort_kurzbz); $this->addMeta("start date",$start_date); $this->addMeta("end date",$end_date); @@ -67,11 +71,50 @@ class Stundenplan extends FHCAPI_Controller } $result = hasData($result) ? getData($result) : []; + + // set up the log library and configure the library to log to the db + $this->load->library('LogLib'); + $this->loglib->setConfigs(array( + 'classIndex' => 5, + 'functionIndex' => 5, + 'lineIndex' => 4, + 'dbLogType' => 'API', // required + 'dbExecuteUser' => 'RESTful API' + )); + + /* foreach($result as $event){ + $this->loglib->logInfoDB($event->datum,"NEW DATE"); + } */ + + $testStartDate = new DateTime($start_date); + $this->loglib->logInfoDB($testStartDate->format('Y-m-d'),"php start date"); + $testStartDate->modify('+1 day'); + $this->loglib->logInfoDB($testStartDate->format('Y-m-d'),"php start date plus one day"); + $testStartDate->modify('+1 day'); + $this->loglib->logInfoDB($testStartDate->format('Y-m-d'),"php start date plus one day"); + $testStartDate->modify('+1 day'); + $this->loglib->logInfoDB($testStartDate->format('Y-m-d'),"php start date plus one day"); + $testStartDate->modify('+1 day'); + $this->loglib->logInfoDB($testStartDate->format('Y-m-d'),"php start date plus one day"); + + $this->groupTheCalendar($result); + //php start date + $phpStartDate = new DateTime($start_date); + + //$phpStartDate->modify('+1 day'); + $this->addMeta('result',$phpStartDate); + + error_log("test".print_r($result,true)); + //echo($this->db->last_query()); $this->terminateWithSuccess($result); } + private function groupTheCalendar($data){ + + } + public function Stunden() { $this->load->model('ressource/Stunde_model', 'StundeModel'); diff --git a/application/models/ressource/Stundenplan_model.php b/application/models/ressource/Stundenplan_model.php index 64550ccbf..077201f0f 100755 --- a/application/models/ressource/Stundenplan_model.php +++ b/application/models/ressource/Stundenplan_model.php @@ -18,7 +18,7 @@ class Stundenplan_model extends DB_Model * * @return stdClass */ - public function getRoomDataOnDay($ort_kurzbz='EDV_A2.06',$start_date='2024-05-21',$end_date='2024-05-21'){ + public function getRoomDataOnDay($ort_kurzbz='EDV_A2.06',$start_date,$end_date){ $this->addSelect(['*',"CONCAT(UPPER(sp.stg_typ),UPPER(sp.stg_kurzbz),'-',COALESCE(CAST(sp.semester AS varchar),'/'),COALESCE(CAST(sp.verband AS varchar),'/')) as stg","lektor","CONCAT(lehrfach,'-',lehrform) as lv_info" ]); diff --git a/public/js/apps/Cis/RoomInformation.js b/public/js/apps/Cis/RoomInformation.js index fbe49386d..6aa590b31 100644 --- a/public/js/apps/Cis/RoomInformation.js +++ b/public/js/apps/Cis/RoomInformation.js @@ -17,6 +17,11 @@ const app = Vue.createApp({ currentDate: function(){ return new Date(this.calendarWeek.y, this.calendarWeek.m, this.calendarWeek.d); }, + }, + methods:{ + calendarDate_to_UTC_date: function(calendarDate){ + return [calendarDate.y, calendarDate.m, calendarDate.d].join('-'); + } }, created() { @@ -25,6 +30,18 @@ const app = Vue.createApp({ this.stunden[std.stunde] = std; // TODO(chris): geht besser }); + + console.log(this.calendarDate_to_UTC_date(this.calendarWeek.firstDayOfWeek),"this is the converted calendar date") + + /* console.log(this.convertDateToUtcDate(this.calendarWeek.firstDayOfWeek), "iso string here") + + console.log(this.calendarWeek.cdFirstDayOfWeek.y,"this is the year of the first day of the week"); + console.log(this.calendarWeek.cdFirstDayOfWeek.m,"this is the month of the first day of the week"); + console.log(this.calendarWeek.cdFirstDayOfWeek.d,"this is the day of the first day of the week"); + + console.log(this.calendarWeek.firstDayOfWeek,"this is the first day of the week"); + console.log(this.convertDateToUtcDate(this.calendarWeek.firstDayOfWeek), "this is the UTC date") + */ this.$fhcApi.factory.stundenplan.getRoomInfo('EDV_A6.09', this.calendarWeek.firstDayOfWeek, this.calendarWeek.lastDayOfWeek).then(res =>{ let events; if (res.data && res.data.forEach) {