diff --git a/application/controllers/api/frontend/v1/RendererLoader.php b/application/controllers/api/frontend/v1/RendererLoader.php new file mode 100644 index 000000000..dc16bb3fc --- /dev/null +++ b/application/controllers/api/frontend/v1/RendererLoader.php @@ -0,0 +1,72 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); + +use CI3_Events as Events; + +class RendererLoader extends FHCAPI_Controller +{ + + /** + * Object initialization + */ + public function __construct() + { + + parent::__construct([ + 'GetRenderers' => self::PERM_LOGGED, + + ]); + + $this->load->library('LogLib'); + $this->loglib->setConfigs(array( + 'classIndex' => 5, + 'functionIndex' => 5, + 'lineIndex' => 4, + 'dbLogType' => 'API', // required + 'dbExecuteUser' => 'RESTful API' + )); + + + } + + //------------------------------------------------------------------------------------------------------------------ + // Public methods + + /** + * fetches Stundenplan and Moodle events together + * @access public + * + */ + public function GetRenderers(){ + $renderer_paths = []; + Events::trigger( + 'loadRenderers', + function & () use (&$renderer_paths) + { + return $renderer_paths; + } + ); + $this->terminateWithSuccess($renderer_paths); + } + + + + +} diff --git a/application/controllers/api/frontend/v1/Stundenplan.php b/application/controllers/api/frontend/v1/Stundenplan.php index 11a8a7034..fd765cf74 100644 --- a/application/controllers/api/frontend/v1/Stundenplan.php +++ b/application/controllers/api/frontend/v1/Stundenplan.php @@ -82,10 +82,12 @@ class Stundenplan extends FHCAPI_Controller $lv_id = $this->input->get('lv_id', TRUE); $stundenplan_events = $this->stundenplanlib->getStundenplan($start_date,$end_date,$lv_id); + $stundenplan_events = $this->getDataOrTerminateWithError($stundenplan_events); if( is_null($stundenplan_events) || isEmptyArray($stundenplan_events) ) { $stundenplan_events = array(); } + // fetching moodle events $moodle_events = []; Events::trigger( diff --git a/application/core/CI3_Events.php b/application/core/CI3_Events.php index 37f6c3f21..e283230c9 100644 --- a/application/core/CI3_Events.php +++ b/application/core/CI3_Events.php @@ -49,6 +49,9 @@ require_once(APPPATH.'config/Events.php'); $active_addons_array = explode(";", ACTIVE_ADDONS); +// Load Events from FHC core +require_once APPPATH.'core/Events.php'; + foreach (scandir(APPPATH.'config/extensions') as $dir) if ($dir[0] != '.' && file_exists(APPPATH.'config/extensions/'.$dir.'/Events.php')) require_once APPPATH.'config/extensions/'.$dir.'/Events.php'; diff --git a/application/core/Events.php b/application/core/Events.php new file mode 100644 index 000000000..cc61cd509 --- /dev/null +++ b/application/core/Events.php @@ -0,0 +1,15 @@ + APP_ROOT.'public/js/components/Cis/Stundenplan/EventTypes/calendarEvent.js', + 'modalTitle' => APP_ROOT.'public/js/components/Cis/Mylv/modalTitle.js', + 'modalContent' => APP_ROOT.'public/js/components/Cis/Mylv/modalContent.js' + ); +}); + + diff --git a/public/css/components/calendar.css b/public/css/components/calendar.css index 580e0becf..7eb6487dc 100644 --- a/public/css/components/calendar.css +++ b/public/css/components/calendar.css @@ -411,4 +411,79 @@ pointer-events: none; z-index: 2; opacity: 0.5; -} \ No newline at end of file +} + + +.dayPageContainer, .weekPageContainer{ + container-type: inline-size; +} + +.dayPageContainer .lehreinheitEventContent, +.weekPageContainer .lehreinheitEventContent { + display: flex; + flex-direction: column; +} + +.dayPageContainer .moodleEventContent, +.weekPageContainer .moodleEventContent{ + display: flex; + flex-direction: row; +} + +.dayPageContainer .lehreinheitEventContent{ + flex-grow:1; + align-items: center; + font-size: 0.875rem; + font-weight: 400; + line-height:1.25; +} + +.dayPageContainer .lehreinheitEventHeader { + display: flex; + flex-direction: column; + padding: 1rem; + border-right: 1px solid gray; +} + +.dayPageContainer .moodleEventContent { + align-items: center; + font-size: 0.875rem; + font-weight: 400; + line-height: 1.25; + width:100%; +} + +.weekPageContainer .moodleEventContent { + align-items: center; + font-size: 0.875rem; + font-weight: 400; + line-height: 1.25; + width: 100%; +} + +.weekPageContainer .lehreinheitEventHeader { + display: flex; + flex-direction: column; + padding: 1rem; + border-right: 1px solid gray; +} + +.weekPageContainer .lehreinheitEventContent { + flex-grow: 1; + align-items: center; + font-size: 0.875rem; + font-weight: 400; + line-height: 1.25; +} + + +@container( min-width: 500px){ + .dayPageContainer .lehreinheitEventContent, + .weekPageContainer .lehreinheitEventContent { + flex-direction: row; + } + + .dayPageContainer .lehreinheitEventContent{ + justify-content: space-evenly; + } +} diff --git a/public/js/api/factory/renderers.js b/public/js/api/factory/renderers.js new file mode 100644 index 000000000..fee81e4df --- /dev/null +++ b/public/js/api/factory/renderers.js @@ -0,0 +1,12 @@ + +export default { + + loadRenderers() { + return { + method: 'get', + url: '/api/frontend/v1/RendererLoader/GetRenderers', + params: { + } + }; + }, +} \ No newline at end of file diff --git a/public/js/apps/Dashboard/Fhc.js b/public/js/apps/Dashboard/Fhc.js index a7c88874e..4f3452b60 100644 --- a/public/js/apps/Dashboard/Fhc.js +++ b/public/js/apps/Dashboard/Fhc.js @@ -16,6 +16,8 @@ import AbgabetoolMitarbeiter from "../../components/Cis/Abgabetool/AbgabetoolMit import DeadlineOverview from "../../components/Cis/Abgabetool/DeadlineOverview.js"; import Studium from "../../components/Cis/Studium/Studium.js"; +import ApiRenderers from '../../api/factory/renderers.js'; + const ciPath = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/(https:|)(^|\/\/)(.*?\/)/g, '') + FHC_JS_DATA_STORAGE_OBJECT.ci_router; const router = VueRouter.createRouter({ @@ -235,7 +237,8 @@ const router = VueRouter.createRouter({ const app = Vue.createApp({ name: 'FhcApp', data: () => ({ - appSideMenuEntries: {} + appSideMenuEntries: {}, + renderers: null, }), components: {}, computed: { @@ -245,7 +248,8 @@ const app = Vue.createApp({ }, provide() { return { // provide injectable & watchable language property - language: Vue.computed(() => this.$p.user_language) + language: Vue.computed(() => this.$p.user_language), + renderers: Vue.computed(() => this.renderers), } }, methods: { @@ -283,6 +287,28 @@ const app = Vue.createApp({ } } }, + async created(){ + await this.$api + .call(ApiRenderers.loadRenderers()) + .then(res => res.data) + .then(data => { + for (let rendertype of Object.keys(data)) { + + let modalTitle = Vue.markRaw(Vue.defineAsyncComponent(() => import(data[rendertype].modalTitle))); + let modalContent = Vue.markRaw(Vue.defineAsyncComponent(() => import(data[rendertype].modalContent))); + let calendarEvent = Vue.markRaw(Vue.defineAsyncComponent(() => import(data[rendertype].calendarEvent))); + if(this.renderers === null) { + this.renderers = {}; + } + if (!this.renderers[rendertype]) { + this.renderers[rendertype] = {} + } + this.renderers[rendertype].modalTitle = modalTitle; + this.renderers[rendertype].modalContent = modalContent; + this.renderers[rendertype].calendarEvent = calendarEvent; + } + }); + }, mounted() { document.addEventListener('click', this.handleClick); }, diff --git a/public/js/components/Cis/Mylv/LvInfo.js b/public/js/components/Cis/Mylv/LvInfo.js index 7120c5821..4fdbb695d 100644 --- a/public/js/components/Cis/Mylv/LvInfo.js +++ b/public/js/components/Cis/Mylv/LvInfo.js @@ -10,13 +10,6 @@ export default { } }, computed: { - LV_TYPES: function () { - return { - lehreinheit: "lehreinheit", - reservierung: "reservierung", - moodle: "moodle", - }; - }, lektorenLinks: function () { if (!this.event || !Array.isArray(this.event.lektor) || !this.event.lektor.length) return "a"; @@ -56,49 +49,6 @@ export default { }, template:/*html*/` - -
` } diff --git a/public/js/components/Cis/Mylv/LvModal.js b/public/js/components/Cis/Mylv/LvModal.js index 435caa97c..f62243475 100644 --- a/public/js/components/Cis/Mylv/LvModal.js +++ b/public/js/components/Cis/Mylv/LvModal.js @@ -1,7 +1,6 @@ import BsModal from "../../Bootstrap/Modal.js"; import Alert from "../../Bootstrap/Alert.js"; import LvMenu from "./LvMenu.js" -import LvInfo from "./LvInfo.js" import ApiStundenplan from '../../../api/factory/stundenplan.js'; import ApiAddons from '../../../api/factory/addons.js'; @@ -11,7 +10,6 @@ export default { BsModal, Alert, LvMenu, - LvInfo, }, mixins: [BsModal], props: { @@ -44,6 +42,9 @@ export default { }; }, methods:{ + onHideModal: function(){ + this.menu = null; + }, onModalShow: function() { // do not load the menu if the menu is not getting rendered @@ -74,22 +75,13 @@ export default { return BsModal.popup.bind(this)(null, options); }, template: /*html*/ ` - +