From d75e26f8aea359d073d46d54d7801c681721af10 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 7 Apr 2025 14:46:36 +0200 Subject: [PATCH] add basis framework for lv dates --- .../api/frontend/v1/stv/Config.php | 5 ++ .../api/frontend/v1/stv/Lvtermine.php | 67 +++++++++++++++++++ .../models/ressource/Stundenplan_model.php | 2 +- public/js/api/stv.js | 2 + public/js/api/stv/courselist.js | 6 ++ .../Details/Lehrveranstaltungstermine.js | 18 +++++ .../ListLehrveranstaltungstermine.js | 47 +++++++++++++ system/phrasesupdate.php | 24 ++++++- 8 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 application/controllers/api/frontend/v1/stv/Lvtermine.php create mode 100644 public/js/api/stv/courselist.js create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Lehrveranstaltungstermine.js create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Lehrveranstaltungstermine/ListLehrveranstaltungstermine.js diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index 42de1b02f..2232189b5 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -128,6 +128,11 @@ class Config extends FHCAPI_Controller 'component' => './Stv/Studentenverwaltung/Details/Mobility.js' ]; + $result['coursedates'] = [ + 'title' => $this->p->t('stv', 'tab_courseDates'), + 'component' => './Stv/Studentenverwaltung/Details/Lehrveranstaltungstermine.js' + ]; + Events::trigger('stv_conf_student', function & () use (&$result) { return $result; }); diff --git a/application/controllers/api/frontend/v1/stv/Lvtermine.php b/application/controllers/api/frontend/v1/stv/Lvtermine.php new file mode 100644 index 000000000..17a529f85 --- /dev/null +++ b/application/controllers/api/frontend/v1/stv/Lvtermine.php @@ -0,0 +1,67 @@ + ['admin:r', 'assistenz:r'], + 'getLvsStudent' => ['admin:r', 'assistenz:r'], + ]); + + // Load Libraries + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + $this->load->library('form_validation'); + + // Load language phrases + $this->loadPhrases([ + 'ui', + ]); + + // Load models + $this->load->model('ressource/Stundenplan_model', 'StundenplanModel'); + } + + public function getStundenplan($uid) + { + //get stundenplan for uid + $result = $this->StundenplanModel->loadForUid($uid); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + + } + + public function getLvsStudent($uid) + { + $authUID = getAuthUID(); + //$this->terminateWithError('uid' . $uid, self::ERROR_TYPE_GENERAL); + //$this->terminateWithError('uid' . $authUID, self::ERROR_TYPE_GENERAL); + + $this->load->model('system/Variable_model', 'VariableModel'); + $result = $this->VariableModel->getVariables($authUID); + $data = $this->getDataOrTerminateWithError($result); + + //$this->terminateWithSuccess(current($data)); // WS2025 + + $this->load->model('ressource/Stunde_model', 'StundeModel'); + $this->StundeModel->addOrder('stunde', 'ASC'); + $result = $this->StundeModel->load(); + $dataStunden = $this->getDataOrTerminateWithError($result); + $this->terminateWithSuccess($dataStunden); + // $this->terminateWithSuccess(current($data)); + + //TODO(manu) check existing apis for liste stundenplan und lvs + // version for student + // version for lehrfaecherverteilung + + + + + } +} \ No newline at end of file diff --git a/application/models/ressource/Stundenplan_model.php b/application/models/ressource/Stundenplan_model.php index 012ce0a57..40498a766 100644 --- a/application/models/ressource/Stundenplan_model.php +++ b/application/models/ressource/Stundenplan_model.php @@ -421,7 +421,7 @@ class Stundenplan_model extends DB_Model */ public function loadForUid($uid) { - $this->addSelect(['sp.*','le.studiensemester_kurzbz']); + $this->addSelect(['5sp.*','le.studiensemester_kurzbz']); $this->db->join('public.tbl_benutzergruppe bg', 'sp.gruppe_kurzbz=bg.gruppe_kurzbz AND bg.uid=?', 'LEFT', false); $this->addJoin('public.tbl_studiensemester ss1', 'bg.studiensemester_kurzbz=ss1.studiensemester_kurzbz AND ss1.start<=sp.datum AND ss1.ende>=sp.datum', 'LEFT'); $this->db->join('public.tbl_studentlehrverband slv', "sp.studiengang_kz=slv.studiengang_kz AND slv.student_uid=? AND (slv.semester=sp.semester OR sp.semester IS NULL) AND (slv.verband=sp.verband OR sp.verband IS NULL OR sp.verband='' OR sp.verband='0') AND (slv.gruppe=sp.gruppe OR sp.gruppe IS NULL OR sp.gruppe='' OR sp.gruppe='0') AND sp.gruppe_kurzbz IS NULL", 'LEFT', false); diff --git a/public/js/api/stv.js b/public/js/api/stv.js index ae88b0516..e9f0fd2f5 100644 --- a/public/js/api/stv.js +++ b/public/js/api/stv.js @@ -10,6 +10,7 @@ import exam from './stv/exam.js'; import abschlusspruefung from './stv/abschlusspruefung.js'; import grades from './stv/grades.js'; import mobility from './stv/mobility.js'; +import courselist from './stv/courselist.js'; export default { verband, @@ -24,6 +25,7 @@ export default { abschlusspruefung, grades, mobility, + courselist, configStudent() { return this.$fhcApi.get('api/frontend/v1/stv/config/student'); }, diff --git a/public/js/api/stv/courselist.js b/public/js/api/stv/courselist.js new file mode 100644 index 000000000..b6035c098 --- /dev/null +++ b/public/js/api/stv/courselist.js @@ -0,0 +1,6 @@ +export default { + getCourselist(url, config, params) { + console.log("her"); + return this.$fhcApi.get('api/frontend/v1/stv/Lvtermine/getLvsStudent/' + params.id); + }, +} \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Lehrveranstaltungstermine.js b/public/js/components/Stv/Studentenverwaltung/Details/Lehrveranstaltungstermine.js new file mode 100644 index 000000000..6845613ab --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Lehrveranstaltungstermine.js @@ -0,0 +1,18 @@ +import TableLvList from "./Lehrveranstaltungstermine/ListLehrveranstaltungstermine.js"; + +export default { + name: "TabCourseList", + components: { + TableLvList + }, + props: { + modelValue: Object, + }, + data(){ + return {} + }, + template: ` +
+ +
` +}; \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Lehrveranstaltungstermine/ListLehrveranstaltungstermine.js b/public/js/components/Stv/Studentenverwaltung/Details/Lehrveranstaltungstermine/ListLehrveranstaltungstermine.js new file mode 100644 index 000000000..8a6c0d2b0 --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Lehrveranstaltungstermine/ListLehrveranstaltungstermine.js @@ -0,0 +1,47 @@ +import {CoreFilterCmpt} from "../../../../filter/Filter.js"; + +export default { + name: "TblCourseList", + components: { + CoreFilterCmpt + }, + props: { + student: Object + }, + data(){ + return { + tabulatorOptions: { + ajaxURL: 'dummy', + ajaxRequestFunc: this.$fhcApi.factory.stv.courselist.getCourselist, + ajaxParams: () => { + return { + id: this.student.uid + }; + }, + ajaxResponse: (url, params, response) => response.data, + columns: [ + {title: "Prestudent_id", field: "prestudent_id"}, + ] + }, + tabulatorEvents: [], + } + + }, + methods: {}, + template: ` +
+

Termine

+ {{student}} + + + +
+ ` +} \ No newline at end of file diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index cd17215ee..7d6d7361d 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -41393,8 +41393,30 @@ and represent the current state of research on the topic. The prescribed citatio 'insertvon' => 'system' ) ) - ) + ), // PROJEKTARBEITSBEURTEILUNG SS2025 ENDE --------------------------------------------------------------------------- + // FHC 4 Lehrveranstaltungstermine START --------------------------------------------------------------------------- + array( + 'app' => 'core', + 'category' => 'stv', + 'phrase' => 'tab_courseDates', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'LV Termine', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Course Dates', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + // FHC 4 Lehrveranstaltungstermine ENDE --------------------------------------------------------------------------- );