mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
links the ort_kurzbz from the Stundenplan in the Dashboard to the Ort Information Content
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2024 fhcomplete.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This controller operates between (interface) the JS (GUI) and the SearchBarLib (back-end)
|
||||
* Provides data to the ajax get calls about the searchbar component
|
||||
* This controller works with JSON calls on the HTTP GET and the output is always JSON
|
||||
*/
|
||||
class Ort extends FHCAPI_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Object initialization
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// NOTE(chris): additional permission checks will be done in SearchBarLib
|
||||
parent::__construct([
|
||||
'ContentID' => self::PERM_LOGGED
|
||||
]);
|
||||
|
||||
$this->load->model('ressource/Ort_model', 'OrtModel');
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Gets a JSON body via HTTP POST and provides the parameters
|
||||
*/
|
||||
public function ContentID()
|
||||
{
|
||||
// if error
|
||||
//$this->terminateWithError(SearchBarLib::ERROR_WRONG_JSON, self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$ort_kurzbz = $this->input->get('ort_kurzbz',TRUE);
|
||||
|
||||
if(!$ort_kurzbz){
|
||||
$this->terminateWithError("missing ort_kurzbz parameter", self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$result = $this->OrtModel->getContentID($ort_kurzbz);
|
||||
|
||||
if(isError($result)){
|
||||
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$result = hasData($result) ? current(getData($result)) : null;
|
||||
|
||||
$this->terminateWithSuccess($result->content_id ?? NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,16 @@ class Ort_model extends DB_Model
|
||||
|
||||
return $this->OrtModel->loadWhere(array("raumtyp_kurzbz" => $raumtyp_kurzbz));
|
||||
}
|
||||
|
||||
public function getContentID($ort_kurzbz)
|
||||
{
|
||||
|
||||
return $this->execReadOnlyQuery("
|
||||
SELECT content_id
|
||||
FROM public.tbl_ort
|
||||
WHERE ort_kurzbz = ?;
|
||||
",[$ort_kurzbz]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,11 +20,13 @@ import phrasen from "./phrasen.js";
|
||||
import navigation from "./navigation.js";
|
||||
import filter from "./filter.js";
|
||||
import studstatus from "./studstatus.js";
|
||||
import ort from "./ort.js";
|
||||
|
||||
export default {
|
||||
search,
|
||||
phrasen,
|
||||
navigation,
|
||||
filter,
|
||||
studstatus
|
||||
studstatus,
|
||||
ort,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
export default {
|
||||
getContentID($ort_kurbz) {
|
||||
return this.$fhcApi.get(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
"/api/frontend/v1/Ort/ContentID",
|
||||
{ ort_kurzbz: $ort_kurbz }
|
||||
);
|
||||
},
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import {CoreNavigationCmpt} from '../../components/navigation/Navigation.js';
|
||||
import DashboardAdmin from '../../components/Dashboard/Admin.js';
|
||||
import FhcApi from '../../plugin/FhcApi.js';
|
||||
|
||||
const app = Vue.createApp({
|
||||
data: () => ({
|
||||
@@ -11,4 +12,5 @@ const app = Vue.createApp({
|
||||
}
|
||||
});
|
||||
app.config.unwrapInjectedRef = true;
|
||||
app.use(FhcApi);
|
||||
app.mount('#main');
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import FhcDashboard from '../../components/Dashboard/Dashboard.js';
|
||||
import FhcApi from '../../plugin/FhcApi.js';
|
||||
|
||||
const app = Vue.createApp({
|
||||
data: () => ({
|
||||
@@ -9,4 +10,5 @@ const app = Vue.createApp({
|
||||
}
|
||||
});
|
||||
app.config.unwrapInjectedRef = true;
|
||||
app.use(FhcApi);
|
||||
app.mount('#content');
|
||||
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
currentEvents() {
|
||||
return (this.events || []).filter(evt => evt.end < this.dayAfterCurrentDay && evt.start >= this.currentDay);
|
||||
},
|
||||
@@ -29,12 +30,28 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
printEntry: function(item){
|
||||
console.log(item);
|
||||
},
|
||||
selectDay(day) {
|
||||
this.currentDay = day;
|
||||
this.minimized = true;
|
||||
},
|
||||
showRoomInfo: function($ort_kurzbz){
|
||||
|
||||
this.$fhcApi.factory.ort.getContentID($ort_kurzbz).then(res =>{
|
||||
|
||||
window.location.href = FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
"/CisHtml/Cms/content/" + res.data;
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
this.$emit('setConfig', false);
|
||||
axios
|
||||
.get(this.apiurl + '/components/Cis/Stundenplan/Stunden').then(res => {
|
||||
@@ -67,11 +84,11 @@ export default {
|
||||
<i class="fa-solid fa-spinner fa-pulse fa-3x"></i>
|
||||
</div>
|
||||
<div v-else-if="currentEvents.length" class="list-group list-group-flush">
|
||||
<div class="" v-for="evt in currentEvents" :key="evt.id" class="list-group-item small" :style="{'background-color':evt.color}">
|
||||
<div @click="printEntry(evt)" class="" v-for="evt in currentEvents" :key="evt.id" class="list-group-item small" :style="{'background-color':evt.color}">
|
||||
<b>{{evt.title}}</b>
|
||||
<br>
|
||||
<small class="d-flex w-100 justify-content-between">
|
||||
<span>{{evt.ort_kurzbz}}</span>
|
||||
<span @click="showRoomInfo(evt.ort_kurzbz)" style="text-decoration:underline" type="button">{{evt.ort_kurzbz}}</span>
|
||||
<span>{{evt.start.toLocaleTimeString(undefined, {hour:'numeric',minute:'numeric'})}}-{{evt.end.toLocaleTimeString(undefined, {hour:'numeric',minute:'numeric'})}}</span>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user