diff --git a/application/controllers/api/frontend/v1/lv/Lehreinheit.php b/application/controllers/api/frontend/v1/lv/Lehreinheit.php index 6329d30ac..fb76540d0 100644 --- a/application/controllers/api/frontend/v1/lv/Lehreinheit.php +++ b/application/controllers/api/frontend/v1/lv/Lehreinheit.php @@ -19,7 +19,8 @@ class Lehreinheit extends FHCAPI_Controller 'getLehrfach' => ['admin:r', 'assistenz:r'], 'getSprache' => ['admin:r', 'assistenz:r'], 'getRaumtyp' => ['admin:r', 'assistenz:r'], - 'getLehrform' => ['admin:r', 'assistenz:r'] + 'getLehrform' => ['admin:r', 'assistenz:r'], + 'getLehreinheitenBySemester' => self::PERM_LOGGED, ]); $this->_ci = &get_instance(); @@ -438,6 +439,14 @@ class Lehreinheit extends FHCAPI_Controller $this->terminateWithSuccess($this->p->t('global', 'gespeichert')); } + public function getLehreinheitenBySemester() + { + $semester = $this->input->get('semester'); + $lehreinheiten = $this->LehreinheitModel->getLehrenheitenBySemester(getAuthUID(), $semester); + $lehreinheiten = $this->getDataOrTerminateWithError($lehreinheiten); + $this->terminateWithSuccess($lehreinheiten); + } + private function checkPermission($lehreinheit_id) { diff --git a/application/models/education/Lehreinheit_model.php b/application/models/education/Lehreinheit_model.php index 8a242cf2a..579532edb 100644 --- a/application/models/education/Lehreinheit_model.php +++ b/application/models/education/Lehreinheit_model.php @@ -763,4 +763,37 @@ EOSQL; return $this->execQuery($query, [$lva_id, $sem_kurzbz, $ma_uid]); } + + public function getLehrenheitenBySemester($uid, $semester) + { + $query = "SELECT + tbl_lehreinheit.lehreinheit_id, + lehrfach.kurzbz as lehrfach, + tbl_lehreinheit.lehrform_kurzbz as lehrform, + tbl_lehrveranstaltung.bezeichnung as lv_bezeichnung, + (SELECT kurzbz FROM public.tbl_mitarbeiter + WHERE mitarbeiter_uid=tbl_lehreinheitmitarbeiter.mitarbeiter_uid) as lektor, + UPPER(tbl_studiengang.typ::varchar(1) || tbl_studiengang.kurzbz) as stg_kurzbz, + tbl_lehrveranstaltung.semester as lv_semester, + tbl_lehreinheit.raumtyp, + tbl_lehreinheit.raumtypalternativ, + tbl_lehreinheit.stundenblockung, + tbl_lehreinheit.wochenrythmus, + tbl_lehreinheitmitarbeiter.semesterstunden as semesterstunden, + tbl_lehreinheit.start_kw, + lvangebot.anmeldefenster_start, + lvangebot.anmeldefenster_ende + FROM + lehre.tbl_lehreinheit JOIN lehre.tbl_lehreinheitmitarbeiter USING(lehreinheit_id) + JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + JOIN lehre.tbl_lehrveranstaltung as lehrfach ON(tbl_lehreinheit.lehrfach_id=lehrfach.lehrveranstaltung_id) + LEFT JOIN lehre.tbl_lvangebot as lvangebot ON(tbl_lehrveranstaltung.lehrveranstaltung_id=lvangebot.lehrveranstaltung_id) + WHERE + tbl_lehreinheit.studiensemester_kurzbz = '$semester' + AND mitarbeiter_uid = '$uid' + ORDER BY stg_kurzbz,lv_semester,lv_bezeichnung"; + + return $this->execReadOnlyQuery($query); + } } diff --git a/public/js/api/factory/lehreinheit.js b/public/js/api/factory/lehreinheit.js new file mode 100644 index 000000000..777c5154c --- /dev/null +++ b/public/js/api/factory/lehreinheit.js @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2026 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 . + */ + +export default { + getLehreinheitenBySemester(semester) { + return { + method: 'get', + url: '/api/frontend/v1/lv/Lehreinheit/getLehreinheitenBySemester', + params: { + semester + }, + }; + }, +}; \ No newline at end of file diff --git a/public/js/components/Cis/Mylv/Lehreinheiten.js b/public/js/components/Cis/Mylv/Lehreinheiten.js new file mode 100644 index 000000000..4ba24d80e --- /dev/null +++ b/public/js/components/Cis/Mylv/Lehreinheiten.js @@ -0,0 +1,206 @@ +import { CoreFilterCmpt } from "../../filter/Filter.js"; + +import ApiLehreinheit from "../../../api/factory/lehreinheit.js"; + +export default { + name: "Lehreinheiten", + components: { + CoreFilterCmpt, + }, + props: { + semester: null | String, + }, + data() { + return { + lehreinheiten: [], + isFetchingLehreinheiten: false, + lehreinheitTableOptions: { + layout: "fitColumns", + columns: [ + { + titlePhrase: "lehreinheiten/inputGrades", + title: "placeholder", + field: "inputGrades", + widthGrow: 2, + }, + { + title: "ID", + field: "lehreinheitId", + widthGrow: 2, + }, + { + titlePhrase: "lehreinheiten/subject", + title: "placeholder", + field: "subject", + widthGrow: 2, + }, + { + titlePhrase: "lehreinheiten/lehrform", + title: "placeholder", + field: "lehrform", + widthGrow: 2, + }, + { + titlePhrase: "lehreinheiten/title", + title: "placeholder", + field: "title", + widthGrow: 3, + }, + { + titlePhrase: "lehreinheiten/lector", + title: "placeholder", + field: "lector", + widthGrow: 2, + }, + { + titlePhrase: "lehreinheiten/dp", + title: "placeholder", + field: "stg", + widthGrow: 2, + }, + { + titlePhrase: "lehreinheiten/sem", + title: "placeholder", + field: "semester", + widthGrow: 1, + }, + { + titlePhrase: "lehreinheiten/groups", + title: "placeholder", + field: "groups", + widthGrow: 2, + }, + { + titlePhrase: "lehreinheiten/room", + title: "placeholder", + field: "room", + widthGrow: 3, + }, + { + titlePhrase: "lehreinheiten/alt", + title: "placeholder", + field: "alternativeRoom", + widthGrow: 3, + }, + { + titlePhrase: "lehreinheiten/block", + title: "placeholder", + field: "block", + widthGrow: 1, + }, + { + titlePhrase: "lehreinheiten/wr", + title: "placeholder", + field: "weeklyRhythm", + widthGrow: 1, + }, + { + titlePhrase: "lehreinheiten/hrs", + title: "placeholder", + field: "hours", + widthGrow: 1, + bottomCalc: "sum", + bottomCalcParams: { precision: 2 }, + }, + { + titlePhrase: "lehreinheiten/cw", + title: "placeholder", + field: "cw", + widthGrow: 1, + }, + { + titlePhrase: "lehreinheiten/registrationWindowStart", + title: "placeholder", + field: "registrationWindowStart", + widthGrow: 2, + }, + { + titlePhrase: "lehreinheiten/registrationWindowEnd", + title: "placeholder", + field: "registrationWindowEnd", + widthGrow: 2, + }, + ], + locale: true, + persistence: false, + persistenceID: "supervisorTable", + }, + }; + }, + watch: { + semester() { + this.getLehreinheiten(); + }, + }, + methods: { + async getLehreinheiten() { + if (!this.$props.semester?.length) return; + + this.lehreinheiten = []; + this.isFetchingLehreinheiten = true; + + const lehreinheitenResponse = await this.$api.call( + ApiLehreinheit.getLehreinheitenBySemester(this.$props.semester), + ); + if (lehreinheitenResponse.meta.status === "success") { + this.lehreinheiten = lehreinheitenResponse.data.map( + (lehreinheitData) => { + return { + lehreinheitId: lehreinheitData.lehreinheit_id, + subject: lehreinheitData.lehrfach, + lehrform: lehreinheitData.lehrform, + title: lehreinheitData.lv_bezeichnung, + lector: lehreinheitData.lektor, + stg: lehreinheitData.stg_kurzbz, + semester: lehreinheitData.lv_semester, + room: lehreinheitData.raumtyp, + alternativeRoom: lehreinheitData.raumtypalternativ, + block: lehreinheitData.stundenblockung, + weeklyRhythm: lehreinheitData.wochenrythmus, + hours: lehreinheitData.semesterstunden, + cw: lehreinheitData.start_kw, + registrationWindowStart: + lehreinheitData.anmeldefenster_start, + registrationWindowEnd: + lehreinheitData.anmeldefenster_ende, + }; + }, + ); + } + this.setTableData(); + + this.isFetchingLehreinheiten = false; + }, + handleTableBuilt() { + this.setTableData(); + }, + setTableData() { + if (this.$refs.lehreinheitenTable && this.lehreinheiten?.length) { + this.$refs.lehreinheitenTable.tabulator.setData(this.lehreinheiten); + } + }, + }, + mounted() { + this.getLehreinheiten(); + }, + template: /*html*/ ` +
+
+ +
+
+
{{ lehreinheiten.length + " teaching units" }}
+ +
+
+

No teaching units found!

+
+
+ `, +}; diff --git a/public/js/components/Cis/Mylv/Lehrenheiten.js b/public/js/components/Cis/Mylv/Lehrenheiten.js deleted file mode 100644 index 97aa926a3..000000000 --- a/public/js/components/Cis/Mylv/Lehrenheiten.js +++ /dev/null @@ -1,12 +0,0 @@ -export default { - name: "Lehrenheiten", - props: ["current"], - data() { - return {}; - }, - template: /*html*/ ` -
- LEHRENHEITEN PLACEHOLDER -
- `, -} \ No newline at end of file diff --git a/public/js/components/Cis/Mylv/MyLv.js b/public/js/components/Cis/Mylv/MyLv.js index 7720a37c9..a0467c42c 100644 --- a/public/js/components/Cis/Mylv/MyLv.js +++ b/public/js/components/Cis/Mylv/MyLv.js @@ -1,5 +1,5 @@ import Lvs from "./Lvs.js"; -import Lehrenheiten from "./Lehrenheiten.js"; +import Lehreinheiten from "./Lehreinheiten.js"; import Supervisor from "./Supervisor.js"; import ApiAddons from "../../../api/factory/addons.js" @@ -8,7 +8,7 @@ export default { name: 'MyLv', components: { Lvs, - Lehrenheiten, + Lehreinheiten, Supervisor, }, data: () => { @@ -155,7 +155,7 @@ export default {

- +
diff --git a/public/js/components/Cis/Mylv/Supervisor.js b/public/js/components/Cis/Mylv/Supervisor.js index 59d5f52f6..daef104eb 100644 --- a/public/js/components/Cis/Mylv/Supervisor.js +++ b/public/js/components/Cis/Mylv/Supervisor.js @@ -15,7 +15,6 @@ export default { students: [], isFetchingStudents: false, supervisorTableOptions: { - index: "lehrveranstaltung_id", layout: "fitColumns", columns: [ { @@ -131,7 +130,7 @@ export default {
- {{ students.length + " supervised students" }} +
{{ students.length + " supervised students" }}
'core', + 'category' => 'lehreinheiten', + 'phrase' => 'inputGrades', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Noten eintragen', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Input grades', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'subject', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Lehrfach', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Subject', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'lehrform', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Lehrform', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Course Type', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'title', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'LV Bezeichnung', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Course Title', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'lector', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Lektor/in', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Lector', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'dp', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Stg', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'DP', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'sem', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Sem', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Sem', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'groups', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Gruppen', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Groups', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'room', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Raumtyp', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Room', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'alt', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Alternativ', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Alternative', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'block', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Block', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Block', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'wr', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'WR', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'WR', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'hrs', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Std', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Hrs', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'cw', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'KW', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'CW', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'registrationWindowStart', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Anm. von', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Registration Start', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'lehreinheiten', + 'phrase' => 'registrationWindowEnd', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Anm. bis', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Registration End', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + // LEHREINHEITEN PHRASES END );