From d254b9c10b7066ed481d28952e8d7c4747a568d6 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 23 Aug 2024 11:58:08 +0200 Subject: [PATCH] Start Tab Pruefung, Abfrage Pruefungen --- .../api/frontend/v1/stv/Config.php | 4 + .../api/frontend/v1/stv/Pruefung.php | 48 +++++++++ .../models/education/LePruefung_model.php | 41 +++++++ .../Studentenverwaltung/Details/Pruefung.js | 25 +++++ .../Details/Pruefung/Pruefunglist.js | 101 ++++++++++++++++++ system/phrasesupdate.php | 20 ++++ 6 files changed, 239 insertions(+) create mode 100644 application/controllers/api/frontend/v1/stv/Pruefung.php create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index c28c49485..bfff14580 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -97,6 +97,10 @@ class Config extends FHCAPI_Controller 'component' => './Stv/Studentenverwaltung/Details/Noten.js' ]; */ + $result['exam'] = [ + 'title' => $this->p->t('stv', 'tab_exam'), + 'component' => './Stv/Studentenverwaltung/Details/Pruefung.js' + ]; Events::trigger('stv_conf_student', function & () use (&$result) { return $result; diff --git a/application/controllers/api/frontend/v1/stv/Pruefung.php b/application/controllers/api/frontend/v1/stv/Pruefung.php new file mode 100644 index 000000000..60666c610 --- /dev/null +++ b/application/controllers/api/frontend/v1/stv/Pruefung.php @@ -0,0 +1,48 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); + +/** + * This controller operates between (interface) the JS (GUI) and the back-end + * Provides data to the ajax get calls about addresses + * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON + */ +class Pruefung extends FHCAPI_Controller +{ + public function __construct() + { + //TODO(Manu) Berechtigungen + parent::__construct([ + 'getPruefungen' => self::PERM_LOGGED + ]); + + //Load Models + $this->load->model('education/LePruefung_model', 'PruefungModel'); + } + + public function getPruefungen($student_uid, $studiensemester_kurzbz = null) + { + $result = $this->PruefungModel->getPruefungenByStudentuid($student_uid); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + +} diff --git a/application/models/education/LePruefung_model.php b/application/models/education/LePruefung_model.php index ac6c7f9b2..5522a3998 100644 --- a/application/models/education/LePruefung_model.php +++ b/application/models/education/LePruefung_model.php @@ -11,4 +11,45 @@ class LePruefung_model extends DB_Model $this->dbTable = 'lehre.tbl_pruefung'; $this->pk = 'pruefung_id'; } + + /** + * CI_STYLE + * @param string $student_uid + * @param string $studiensemester_kurzbz + * + * @return stdClass + */ + public function getPruefungenByStudentuid($student_uid, $studiensemester_kurzbz = null) + { + $this->addSelect('tbl_pruefung.datum'); + $this->addSelect("TO_CHAR(tbl_pruefung.datum::timestamp, 'DD.MM.YYYY') AS format_datum"); + $this->addSelect('tbl_pruefung.anmerkung'); + $this->addSelect('tbl_pruefung.pruefungstyp_kurzbz'); + $this->addSelect('tbl_pruefung.pruefung_id'); + $this->addSelect('tbl_pruefung.lehreinheit_id'); + $this->addSelect('tbl_pruefung.student_uid'); + $this->addSelect('tbl_pruefung.mitarbeiter_uid'); + $this->addSelect('tbl_pruefung.punkte'); + + $this->addSelect('tbl_lehrveranstaltung.bezeichnung as lehrveranstaltung_bezeichnung'); + $this->addSelect('tbl_lehrveranstaltung.lehrveranstaltung_id'); + $this->addSelect('tbl_note.bezeichnung as note_bezeichnung'); + $this->addSelect('tbl_pruefungstyp.beschreibung as typ_beschreibung'); + $this->addSelect('tbl_lehreinheit.studiensemester_kurzbz as studiensemester_kurzbz'); + + $this->addJoin('lehre.tbl_lehreinheit', 'lehre.tbl_pruefung.lehreinheit_id=lehre.tbl_lehreinheit.lehreinheit_id'); + $this->addJoin('lehre.tbl_lehrveranstaltung', 'lehrveranstaltung_id'); + $this->addJoin('lehre.tbl_note', 'note'); + $this->addJoin('lehre.tbl_pruefungstyp', 'pruefungstyp_kurzbz'); + + if ($studiensemester_kurzbz) + $this->db->where("tbl_lehreinheit.studiensemester_kurzbz = ", $studiensemester_kurzbz); + + $this->addOrder('tbl_pruefung.datum', 'DESC'); + $this->addOrder('tbl_pruefung.pruefung_id', 'DESC'); + + return $this->loadWhere([ + 'student_uid' => $student_uid + ]); + } } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js new file mode 100644 index 000000000..eb43e36be --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js @@ -0,0 +1,25 @@ +import PruefungList from "./Pruefung/Pruefunglist.js"; + +export default { + components: { + PruefungList + }, + props: { + modelValue: Object, + config: Object + }, + data() { + return { + pruefungen: [] + } + }, + template: ` +
+ + {{modelValue}} +
+ + +
+
` +}; \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js new file mode 100644 index 000000000..6f034e087 --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js @@ -0,0 +1,101 @@ +import {CoreFilterCmpt} from "../../../../filter/Filter.js"; +import FormInput from "../../../../Form/Input.js"; + +export default{ + components: { + CoreFilterCmpt, + FormInput + }, + inject: { + defaultSemester: { + from: 'defaultSemester', + }, + }, + props: { + uid: Number + }, + data(){ + return { + tabulatorOptions: { + ajaxURL: 'api/frontend/v1/stv/pruefung/getPruefungen/' + this.uid, + ajaxRequestFunc: this.$fhcApi.get, + ajaxResponse: (url, params, response) => response.data, + columns: [ + {title: "Datum", field: "format_datum"}, + {title: "Lehrveranstaltung", field: "lehrveranstaltung_bezeichnung"}, + {title: "Note", field: "note_bezeichnung"}, + {title: "Anmerkung", field: "anmerkung"}, + {title: "Typ", field: "pruefungstyp_kurzbz"}, + {title: "PruefungId", field: "pruefung_id", visible:false}, + {title: "LehreinheitId", field: "lehreinheit_id", visible:false}, + {title: "Student_uid", field: "student_uid", visible:false}, + {title: "Mitarbeiter_uid", field: "mitarbeiter_uid", visible:false}, + {title: "Punkte", field: "punkte", visible:false}, + ], + layout: 'fitDataFill', + layoutColumnsOnNewData: false, + height: 'auto', + }, + tabulatorEvents: [{}], + pruefungData: {}, + filter: false + } + }, + computed:{}, +/* watch: { + modelValue() { + this.$refs.table.reloadTable(); + } + },*/ + methods:{ }, + template: ` +
+ +
+ + + +
+ +
+ +
+ + +
+ +
+

Form

+ + aktuelles Sem: {{defaultSemester}} + +
+
+
` +}; + diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 56a7304d4..00ae67abc 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -29300,6 +29300,26 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'stv', + 'phrase' => 'tab_exam', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Prüfung', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Exam', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), // konto array( 'app' => 'core',