From 6e9ee7cf814f7d8cba1e95b481abc6dbf7c9af89 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 3 May 2024 09:43:49 +0200 Subject: [PATCH 0001/1746] Notizcomponent: Api Controller for Notizzuordnungs_ids --- .../api/frontend/v1/notiz/Notiz.php | 384 ------------------ .../api/frontend/v1/notiz/NotizAnrechnung.php | 44 ++ .../api/frontend/v1/notiz/NotizBestellung.php | 43 ++ .../frontend/v1/notiz/NotizLehreinheit.php | 44 ++ .../frontend/v1/notiz/NotizMitarbeiter.php | 44 ++ .../api/frontend/v1/notiz/NotizPerson.php | 33 ++ .../api/frontend/v1/notiz/NotizPrestudent.php | 44 ++ .../api/frontend/v1/notiz/NotizProjekt.php | 32 ++ .../frontend/v1/notiz/NotizProjektphase.php | 32 ++ .../frontend/v1/notiz/NotizProjekttask.php | 32 ++ application/core/Notiz_Controller.php | 79 ++-- public/js/api/notiz.js | 22 +- public/js/api/notiz/anrechnung.js | 38 ++ public/js/api/notiz/bestellung.js | 38 ++ public/js/api/notiz/lehreinheit.js | 38 ++ public/js/api/notiz/mitarbeiter.js | 38 ++ public/js/api/notiz/person.js | 19 +- public/js/api/notiz/prestudent.js | 38 ++ public/js/api/notiz/projekt.js | 38 ++ public/js/api/notiz/projektphase.js | 38 ++ public/js/api/notiz/projekttask.js | 38 ++ .../Studentenverwaltung/Details/Notizen.js | 72 ++-- system/phrasesupdate.php | 22 + 23 files changed, 786 insertions(+), 464 deletions(-) delete mode 100644 application/controllers/api/frontend/v1/notiz/Notiz.php create mode 100644 application/controllers/api/frontend/v1/notiz/NotizAnrechnung.php create mode 100644 application/controllers/api/frontend/v1/notiz/NotizBestellung.php create mode 100644 application/controllers/api/frontend/v1/notiz/NotizLehreinheit.php create mode 100644 application/controllers/api/frontend/v1/notiz/NotizMitarbeiter.php create mode 100644 application/controllers/api/frontend/v1/notiz/NotizPerson.php create mode 100644 application/controllers/api/frontend/v1/notiz/NotizPrestudent.php create mode 100644 application/controllers/api/frontend/v1/notiz/NotizProjekt.php create mode 100644 application/controllers/api/frontend/v1/notiz/NotizProjektphase.php create mode 100644 application/controllers/api/frontend/v1/notiz/NotizProjekttask.php create mode 100644 public/js/api/notiz/anrechnung.js create mode 100644 public/js/api/notiz/bestellung.js create mode 100644 public/js/api/notiz/lehreinheit.js create mode 100644 public/js/api/notiz/mitarbeiter.js create mode 100644 public/js/api/notiz/prestudent.js create mode 100644 public/js/api/notiz/projekt.js create mode 100644 public/js/api/notiz/projektphase.js create mode 100644 public/js/api/notiz/projekttask.js diff --git a/application/controllers/api/frontend/v1/notiz/Notiz.php b/application/controllers/api/frontend/v1/notiz/Notiz.php deleted file mode 100644 index 2288766c4..000000000 --- a/application/controllers/api/frontend/v1/notiz/Notiz.php +++ /dev/null @@ -1,384 +0,0 @@ - ['admin:r', 'assistenz:r'], - 'getNotizen' => ['admin:r', 'assistenz:r'], - 'loadNotiz' => 'assistenz:r', // TODO(manu): self::PERM_LOGGED - 'addNewNotiz' => 'assistenz:r', // TODO(manu): self::PERM_LOGGED - 'updateNotiz' => 'assistenz:r', // TODO(manu): self::PERM_LOGGED - 'deleteNotiz' => ['admin:r', 'assistenz:r'], - 'loadDokumente' => ['admin:r', 'assistenz:r'], - 'getMitarbeiter' => ['admin:r', 'assistenz:r'] - ]); - - //Load Models - $this->load->model('person/Notiz_model', 'NotizModel'); - $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); - - // Load Libraries - $this->load->library('VariableLib', ['uid' => getAuthUID()]); - - // Load language phrases - $this->loadPhrases([ - 'ui' - ]); - } - - /* public function getUid() - { - $this->terminateWithSuccess(getAuthUID()); - }*/ - - - public function getNotizen($id, $type) - { - - //check if valid type - $result = $this->NotizzuordnungModel->isValidType($type); - if(isError($result)) - $this->terminateWithError($result->retval, self::ERROR_TYPE_GENERAL); - - //$this->terminateWithError(" after check type not valid", self::ERROR_TYPE_GENERAL); - $result = $this->NotizModel->getNotizWithDocEntries($id, $type); - - if (isError($result)) { - $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - return $this->terminateWithSuccess(getData($result) ?: []); - - // return $this->terminateWithError("type not valid", self::ERROR_TYPE_GENERAL); - - } - - /* public function loadNotiz() - { - $_POST = json_decode(utf8_encode($this->input->raw_input_stream), true); - - $notiz_id = $this->input->post('notiz_id'); - - //$this->load->model('person/Notiz_model', 'NotizModel'); - $this->NotizModel->addJoin('public.tbl_notiz_dokument', 'notiz_id', 'LEFT'); - $this->NotizModel->addSelect('*'); - $this->NotizModel->addSelect("TO_CHAR(CASE WHEN public.tbl_notiz.updateamum >= public.tbl_notiz.insertamum - THEN public.tbl_notiz.updateamum ELSE public.tbl_notiz.insertamum END::timestamp, 'DD.MM.YYYY HH24:MI:SS') AS lastUpdate"); - $this->NotizModel->addLimit(1); - - $result = $this->NotizModel->loadWhere( - array('notiz_id' => $notiz_id) - ); - if (isError($result)) - { - $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); - } - elseif (!hasData($result)) - { - $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=>'Notiz_id']), self::ERROR_TYPE_GENERAL); - } - else - { - $this->terminateWithSuccess(current(getData($result))); - } - } - - - public function updateNotiz() - { - $this->load->library('form_validation'); - $this->load->library('DmsLib'); - - if (isset($_POST['data'])) - { - $data = json_decode($_POST['data']); - unset($_POST['data']); - foreach ($data as $k => $v) { - $_POST[$k] = $v; - } - } - - $notiz_id = $this->input->post('notiz_id'); - - if(!$notiz_id) - { - $this->terminateWithError($this->p->t('ui','error_missingId',['id'=>'Notiz_id']), self::ERROR_TYPE_GENERAL); - } - - //Form Validation - $this->form_validation->set_rules('titel', 'Titel', 'required', [ - 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Titel']) - ]); - - $this->form_validation->set_rules('text', 'Text', 'required', [ - 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Text']) - ]); - - if ($this->form_validation->run() == false) - { - $this->terminateWithValidationErrors($this->form_validation->error_array()); - } - - //update Notiz - $uid = getAuthUID(); - $titel = $this->input->post('titel'); - $text = $this->input->post('text'); - $verfasser_uid = $this->input->post('verfasser'); - $bearbeiter_uid = isset($_POST['bearbeiter']) ? $_POST['bearbeiter'] : $uid; - $erledigt = $this->input->post('erledigt'); - $start = $this->input->post('start'); - $ende = $this->input->post('ende'); - - $result = $this->NotizModel->update( - [ - 'notiz_id' => $notiz_id - ], - [ - 'titel' => $titel, - 'updatevon' => $uid, - 'updateamum' => date('c'), - 'text' => $text, - 'verfasser_uid' => $verfasser_uid, - 'bearbeiter_uid' => $bearbeiter_uid, - 'start' => $start, - 'ende' => $ende, - 'erledigt' => $erledigt - ] - ); - if (isError($result)) - { - return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - - //update(1) laden aller bereits mit dieser notiz_id verknüpften DMS-Einträge - $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); - $this->NotizdokumentModel->addJoin('campus.tbl_dms_version', 'dms_id'); - $dms_uploaded = null; - - $result = $this->NotizdokumentModel->loadWhere(array('notiz_id' => $notiz_id)); - if (isError($result)) - { - $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - elseif (!hasData($result)) - { - $dms_id_arr = null; - } - else - { - $result = getData($result); - foreach($result as $doc) { - $dms_id_arr[] = array( - 'name' => $doc->name, - 'dms_id' => $doc->dms_id - ); - } - } - - foreach ($_FILES as $k => $file) - { - //update(2) alle neuen files (alle außer type application/x.fhc-dms+json) anhängen - if($file["type"] == 'application/x.fhc-dms+json') - { - $dms_uploaded[] = array( - 'name' => $file["name"] - ); - } - else - { - $dms = array( - 'kategorie_kurzbz' => 'notiz', - 'version' => 0, - 'name' => $file["name"], - 'mimetype' => $file["type"], - 'insertamum' => date('c'), - 'insertvon' => $uid - ); - - //Todo(manu) check if filetypes weiter eingeschränkt werden sollen - //Todo(manu)check name files: nicht gleiches file 2mal hochladen - $result = $this->dmslib->upload($dms, $k, array('*')); - - if (isError($result)) - { - return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - $dms_id = $result->retval['dms_id']; - - $result = $this->NotizdokumentModel->insert(array('notiz_id' => $notiz_id, 'dms_id' => $dms_id)); - if (isError($result)) - { - return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - } - } - - //update(3) check if Dateien gelöscht wurden - if(count($dms_uploaded) != count($dms_id_arr)) - { - if (count($dms_uploaded) == 0) - { - $filesDeleted = $dms_id_arr; - } - else - { - $upload_new_names = array_column($dms_uploaded, "name"); - - $filesDeleted = array_filter($dms_id_arr, function ($file) use ($upload_new_names) { - return !in_array($file["name"], $upload_new_names); - }); - } - - foreach ($filesDeleted as $file) - { - $result = $this->dmslib->removeAll($file['dms_id']); - - if (isError($result)) - { - return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - else - $this->outputJson($result); - } - } - return $this->terminateWithSuccess($result); - }*/ - - - /* public function deleteNotiz() - { - $_POST = json_decode(utf8_encode($this->input->raw_input_stream), true); - $notiz_id = $this->input->post('notiz_id'); - $type = $this->input->post('type_id'); - $id = $this->input->post('id'); - - //dms_id auslesen aus notizdokument wenn vorhanden - $dms_id_arr = []; - $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); - - $result = $this->NotizdokumentModel->loadWhere(array('notiz_id' => $notiz_id)); - - if (isError($result)) - { - return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - - if(hasData($result)) - { - $result = getData($result); - foreach ($result as $doc) { - $dms_id_arr[] = $doc->dms_id; - } - } - - if($dms_id_arr) - { - $this->load->library('DmsLib'); - foreach($dms_id_arr as $dms_id) - { - $result = $this->dmslib->removeAll($dms_id); - - if (isError($result)) - { - return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - - $this->outputJson($result); - } - } - - //delete Notizzuordnung - if($type == "software_id") - { - // Loads extension Model - $this->load->model('extensions/FHC-Core-Softwarebereitstellung/Softwarenotizzuordnung_model', 'ExtensionnotizzuordnungModel'); - $result = $this->ExtensionnotizzuordnungModel->delete([ - 'notiz_id' => $notiz_id, - 'id' => strval($id) - ], - [ - 'type_id' => $type - ]); - - } - else - { - //notizzuordnungsid! - $result = $this->NotizzuordnungModel->delete(['notiz_id' => $notiz_id, $type => $id]); - } - - - $this->load->model('person/Notiz_model', 'NotizModel'); - //$this->NotizModel->addJoin('public.tbl_notizzuordnung', 'notiz_id'); - - //TODO (erweitern um Type_id) für Extensions, damit auch Notizzuordnung gelöscht werden kann - - //Löschen von Notiz - $result = $this->NotizModel->delete( - array('notiz_id' => $notiz_id) - ); - - if (isError($result)) - { - return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); - } - if(!hasData($result)) - { - return $this->terminateWithError($this->p->t('ui','error_missingId', ['id'=> 'Notiz_id']), self::ERROR_TYPE_GENERAL); - } - - return $this->terminateWithSuccess(current(getData($result))); - }*/ - - /* public function loadDokumente() - { - $_POST = json_decode(utf8_encode($this->input->raw_input_stream), true); - $notiz_id = $this->input->post('notiz_id'); - - $this->NotizModel->addSelect('campus.tbl_dms_version.*'); - - $this->NotizModel->addJoin('public.tbl_notiz_dokument', 'ON (public.tbl_notiz_dokument.notiz_id = public.tbl_notiz.notiz_id)'); - $this->NotizModel->addJoin('campus.tbl_dms_version', 'ON (public.tbl_notiz_dokument.dms_id = campus.tbl_dms_version.dms_id)'); - - $result = $this->NotizModel->loadWhere( - array('public.tbl_notiz.notiz_id' => $notiz_id) - ); - if (isError($result)) { - return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); - } - - if(!hasData($result)) - { - return $this->terminateWithError($this->p->t('ui','error_missingId', ['id'=> 'Notiz_id']), self::ERROR_TYPE_GENERAL); - } - return $this->terminateWithSuccess(getData($result)); - }*/ - - /* public function getMitarbeiter($searchString) - { - $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); - $result = $this->MitarbeiterModel->searchMitarbeiter($searchString); - if (isError($result)) { - $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); - } - return $this->terminateWithSuccess($result); - }*/ - - public function isBerechtigt($id, $typeId) - { - if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) - { - $result = $this->p->t('lehre','error_keineSchreibrechte'); - - return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); - } - return success("berechtigt in überschreibender Funktion"); - /* return $this->terminateWithError('keine Berechtigung bro', self::ERROR_TYPE_GENERAL);*/ - } - -} \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/notiz/NotizAnrechnung.php b/application/controllers/api/frontend/v1/notiz/NotizAnrechnung.php new file mode 100644 index 000000000..b58020507 --- /dev/null +++ b/application/controllers/api/frontend/v1/notiz/NotizAnrechnung.php @@ -0,0 +1,44 @@ + ['admin:r', 'assistenz:r'], + ]); + + //Load Models + $this->load->model('person/Notiz_model', 'NotizModel'); + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + + // Load Libraries + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + + // Load language phrases + $this->loadPhrases([ + 'ui' + ]); + } + + public function isBerechtigt($id, $typeId) + { + if($typeId != "anrechnung_id") + { + return $this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); + } + + //TODO define permission + if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) + { + $result = $this->p->t('lehre','error_keineSchreibrechte'); + + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess("berechtigt in überschreibender Funktion"); + } +} \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/notiz/NotizBestellung.php b/application/controllers/api/frontend/v1/notiz/NotizBestellung.php new file mode 100644 index 000000000..483efd619 --- /dev/null +++ b/application/controllers/api/frontend/v1/notiz/NotizBestellung.php @@ -0,0 +1,43 @@ + ['admin:r', 'assistenz:r'], + ]); + + //Load Models + $this->load->model('person/Notiz_model', 'NotizModel'); + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + + // Load Libraries + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + + // Load language phrases + $this->loadPhrases([ + 'ui' + ]); + } + + public function isBerechtigt($id, $typeId) + { + if($typeId != "bestellung_id") + { + return $this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); + } + //TODO define permission + if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) + { + $result = $this->p->t('lehre','error_keineSchreibrechte'); + + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess("berechtigt in überschreibender Funktion"); + } +} \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/notiz/NotizLehreinheit.php b/application/controllers/api/frontend/v1/notiz/NotizLehreinheit.php new file mode 100644 index 000000000..5c40af368 --- /dev/null +++ b/application/controllers/api/frontend/v1/notiz/NotizLehreinheit.php @@ -0,0 +1,44 @@ + ['admin:r', 'assistenz:r'], + ]); + + //Load Models + $this->load->model('person/Notiz_model', 'NotizModel'); + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + + // Load Libraries + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + + // Load language phrases + $this->loadPhrases([ + 'ui' + ]); + } + + public function isBerechtigt($id, $typeId) + { + if($typeId != "lehreinheit_id") + { + return $this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); + } + + //TODO define permission + if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) + { + $result = $this->p->t('lehre','error_keineSchreibrechte'); + + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess("berechtigt in überschreibender Funktion"); + } +} \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/notiz/NotizMitarbeiter.php b/application/controllers/api/frontend/v1/notiz/NotizMitarbeiter.php new file mode 100644 index 000000000..fd8ee3bbb --- /dev/null +++ b/application/controllers/api/frontend/v1/notiz/NotizMitarbeiter.php @@ -0,0 +1,44 @@ + ['admin:r', 'assistenz:r'], + ]); + + //Load Models + $this->load->model('person/Notiz_model', 'NotizModel'); + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + + // Load Libraries + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + + // Load language phrases + $this->loadPhrases([ + 'ui' + ]); + } + + public function isBerechtigt($id, $typeId) + { + if($typeId != "mitarbeiter_uid") + { + return $this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); + } + + //TODO define permission + if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) + { + $result = $this->p->t('lehre','error_keineSchreibrechte'); + + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess("berechtigt in überschreibender Funktion"); + } +} \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/notiz/NotizPerson.php b/application/controllers/api/frontend/v1/notiz/NotizPerson.php new file mode 100644 index 000000000..2cf1f2519 --- /dev/null +++ b/application/controllers/api/frontend/v1/notiz/NotizPerson.php @@ -0,0 +1,33 @@ + ['admin:r', 'assistenz:r'], + ]); + } + + public function isBerechtigt($id, $typeId) + { + if($typeId != "person_id") + { + return $this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); + } + + //TODO define permission + if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) + { + $result = $this->p->t('lehre','error_keineSchreibrechte'); + + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + + return $this->outputJsonSuccess(true); + } +} \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/notiz/NotizPrestudent.php b/application/controllers/api/frontend/v1/notiz/NotizPrestudent.php new file mode 100644 index 000000000..d4f50e69c --- /dev/null +++ b/application/controllers/api/frontend/v1/notiz/NotizPrestudent.php @@ -0,0 +1,44 @@ + ['admin:r', 'assistenz:r'], + ]); + + //Load Models + $this->load->model('person/Notiz_model', 'NotizModel'); + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + + // Load Libraries + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + + // Load language phrases + $this->loadPhrases([ + 'ui' + ]); + } + + public function isBerechtigt($id, $typeId) + { + if($typeId != "prestudent_id") + { + return $this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); + } + + //TODO define permission + if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) + { + $result = $this->p->t('lehre','error_keineSchreibrechte'); + + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess("berechtigt in überschreibender Funktion"); + } +} \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/notiz/NotizProjekt.php b/application/controllers/api/frontend/v1/notiz/NotizProjekt.php new file mode 100644 index 000000000..180f58b1b --- /dev/null +++ b/application/controllers/api/frontend/v1/notiz/NotizProjekt.php @@ -0,0 +1,32 @@ + ['admin:r', 'assistenz:r'], + ]); + } + + public function isBerechtigt($id, $typeId) + { + if($typeId != "projekt_kurzbz") + { + return $this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); + } + + //TODO define permission + if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) + { + $result = $this->p->t('lehre','error_keineSchreibrechte'); + + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess("berechtigt in überschreibender Funktion"); + } +} \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/notiz/NotizProjektphase.php b/application/controllers/api/frontend/v1/notiz/NotizProjektphase.php new file mode 100644 index 000000000..071aae6a5 --- /dev/null +++ b/application/controllers/api/frontend/v1/notiz/NotizProjektphase.php @@ -0,0 +1,32 @@ + ['admin:r', 'assistenz:r'], + ]); + } + + public function isBerechtigt($id, $typeId) + { + if($typeId != "projektphase_id") + { + return $this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); + } + + //TODO define permission + if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) + { + $result = $this->p->t('lehre','error_keineSchreibrechte'); + + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess("berechtigt in überschreibender Funktion"); + } +} \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/notiz/NotizProjekttask.php b/application/controllers/api/frontend/v1/notiz/NotizProjekttask.php new file mode 100644 index 000000000..4d407051a --- /dev/null +++ b/application/controllers/api/frontend/v1/notiz/NotizProjekttask.php @@ -0,0 +1,32 @@ + ['admin:r', 'assistenz:r'], + ]); + } + + public function isBerechtigt($id, $typeId) + { + if($typeId != "projekttask_id") + { + return $this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); + } + + //TODO define permission + if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) + { + $result = $this->p->t('lehre','error_keineSchreibrechte'); + + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess("berechtigt in überschreibender Funktion"); + } +} \ No newline at end of file diff --git a/application/core/Notiz_Controller.php b/application/core/Notiz_Controller.php index 51d6854b7..8a93c4f0f 100644 --- a/application/core/Notiz_Controller.php +++ b/application/core/Notiz_Controller.php @@ -10,19 +10,20 @@ abstract class Notiz_Controller extends FHCAPI_Controller public function __construct() { parent::__construct([ - 'getUid' => ['admin:r', 'assistenz:r'], - 'getNotizen' => ['admin:r', 'assistenz:r'], - 'loadNotiz' => 'assistenz:r', // TODO(manu): self::PERM_LOGGED - 'addNewNotiz' => 'assistenz:r', // TODO(manu): self::PERM_LOGGED - 'updateNotiz' => 'assistenz:r', // TODO(manu): self::PERM_LOGGED - 'deleteNotiz' => ['admin:r', 'assistenz:r'], - 'loadDokumente' => ['admin:r', 'assistenz:r'], - 'getMitarbeiter' => ['admin:r', 'assistenz:r'], - 'isBerechtigt' => ['admin:r', 'assistenz:r'] + 'getUid' => self::PERM_LOGGED, + 'getNotizen' => self::PERM_LOGGED, + 'loadNotiz' => self::PERM_LOGGED, + 'addNewNotiz' => self::PERM_LOGGED, + 'updateNotiz' => self::PERM_LOGGED, + 'deleteNotiz' => ['admin:w', 'assistenz:w'], + 'loadDokumente' => ['admin:w', 'assistenz:w'], + 'getMitarbeiter' => self::PERM_LOGGED, + 'isBerechtigt' => self::PERM_LOGGED, ]); //Load Models $this->load->model('person/Notiz_model', 'NotizModel'); + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); // Load Libraries $this->load->library('VariableLib', ['uid' => getAuthUID()]); @@ -39,7 +40,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller } - //Standardfall: für extensions überschreiben: speichern der Zuordnung in eigene Extensiontabelle angeben + //Override function for extensions protected function assignNotiz($notiz_id, $id, $type) { $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); @@ -55,7 +56,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller return success(getData($result)); } - //Standardfall: für extensions überschreiben: speichern der Zuordnung in eigene Extensiontabelle angeben + //Override function for extensions protected function deleteNotizzuordnung($notiz_id, $id, $type) { $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); @@ -72,11 +73,23 @@ abstract class Notiz_Controller extends FHCAPI_Controller } + //Override function for extensions + public function getNotizen($id, $type) + { + $result = $this->NotizzuordnungModel->isValidType($type); + if(isError($result)) + $this->terminateWithError($result->retval, self::ERROR_TYPE_GENERAL); - //TODO(manu) abstract - protected function getNotizen($id, $type) {} + $result = $this->NotizModel->getNotizWithDocEntries($id, $type); - //TODO(manu) to abstract + if (isError($result)) { + $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess(getData($result) ?: []); + } + + + //Override function protected function isBerechtigt($id, $typeId){ return $this->terminateWithError("in abstract function: define right in extension", self::ERROR_TYPE_GENERAL); } @@ -144,7 +157,8 @@ abstract class Notiz_Controller extends FHCAPI_Controller $titel = $this->input->post('titel'); $text = $this->input->post('text'); $erledigt = $this->input->post('erledigt'); - $verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : $uid; + $verfasser_uid = isset($_POST['verfasser']) ? $_POST['verfasser'] : $uid; + //$verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : $uid; $bearbeiter_uid = isset($_POST['bearbeiter_uid']) ? $_POST['bearbeiter_uid'] : null; $type = $this->input->post('typeId'); $start = $this->input->post('start'); @@ -153,7 +167,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller // Start DB transaction $this->db->trans_start(); - //Speichern der Notiz + //Save note $result = $this->NotizModel->insert(array('titel' => $titel, 'text' => $text, 'erledigt' => $erledigt, 'verfasser_uid' => $verfasser_uid, "insertvon" => $verfasser_uid, 'start' => $start, 'ende' => $ende, 'bearbeiter_uid' => $bearbeiter_uid)); @@ -165,7 +179,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller $notiz_id = $result->retval; - //Speichern der Notizzuordnung + //save Notizzuordnung $result = $this->assignNotiz($notiz_id, $id, $type); if (isError($result)) @@ -174,7 +188,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); } - //Speichern der Dokumente + //save Documents $dms_id_arr = []; foreach ($_FILES as $k => $file) { @@ -189,6 +203,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller //Todo(manu) check if filetypes weiter eingeschränkt werden sollen //Todo(manu)check name files: nicht gleiches file 2mal hochladen + //Todo define in dms component: readFile, downloadFile $result = $this->dmslib->upload($dms, $k, ['*']); /* $result = $this->dmslib->upload($dms, $k, ['application/pdf','application/x.fhc-dms+json']);*/ if (isError($result)) @@ -199,10 +214,9 @@ abstract class Notiz_Controller extends FHCAPI_Controller $dms_id_arr[] = $result->retval['dms_id']; } - //Eintrag in Notizdokument speichern + //save entry in Notizdokument if($dms_id_arr) { - // Loads model Notizdokument_model $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); foreach($dms_id_arr as $dms_id) { @@ -257,8 +271,8 @@ abstract class Notiz_Controller extends FHCAPI_Controller $uid = getAuthUID(); $titel = $this->input->post('titel'); $text = $this->input->post('text'); - $verfasser_uid = $this->input->post('verfasser_uid'); - $bearbeiter_uid = isset($_POST['bearbeiter_uid']) ? $_POST['bearbeiter_uid'] : $uid; + $verfasser_uid = isset($_POST['verfasser']) ? $_POST['verfasser'] : $uid; + $bearbeiter_uid = isset($_POST['bearbeiter']) ? $_POST['bearbeiter'] : $uid; $erledigt = $this->input->post('erledigt'); $start = $this->input->post('start'); $ende = $this->input->post('ende'); @@ -284,7 +298,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); } - //update(1) laden aller bereits mit dieser notiz_id verknüpften DMS-Einträge + //update(1) loading all dms-entries with this notiz_id $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); $this->NotizdokumentModel->addJoin('campus.tbl_dms_version', 'dms_id'); $dms_uploaded = null; @@ -311,7 +325,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller foreach ($_FILES as $k => $file) { - //update(2) alle neuen files (alle außer type application/x.fhc-dms+json) anhängen + //update(2) attach all new files (except type application/x.fhc-dms+json) if($file["type"] == 'application/x.fhc-dms+json') { $dms_uploaded[] = array( @@ -331,6 +345,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller //Todo(manu) check if filetypes weiter eingeschränkt werden sollen //Todo(manu)check name files: nicht gleiches file 2mal hochladen + //Todo define in dms component: readFile, downloadFile $result = $this->dmslib->upload($dms, $k, array('*')); if (isError($result)) @@ -347,7 +362,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller } } - //update(3) check if Dateien gelöscht wurden + //update(3) check if all files have been deleted if(count($dms_uploaded) != count($dms_id_arr)) { if (count($dms_uploaded) == 0) @@ -387,12 +402,9 @@ abstract class Notiz_Controller extends FHCAPI_Controller $typeId = $this->input->post('type_id'); $id = $this->input->post('id'); - if(!$this->isBerechtigt($id, $typeId)) - { - $this->terminateWithError($this->p->t('ui', 'keineBerechtigung'), self::ERROR_TYPE_GENERAL); - } + //TODO(manu): define Permissions for deletion document if filecomponent finished - //dms_id auslesen aus notizdokument wenn vorhanden + //get dms_id from notizdokument $dms_id_arr = []; $this->load->model('person/Notizdokument_model', 'NotizdokumentModel'); @@ -416,7 +428,6 @@ abstract class Notiz_Controller extends FHCAPI_Controller // Start DB transaction $this->db->trans_start(); - //return $this->terminateWithError("dms_id kommt: " . $notiz_id, self::ERROR_TYPE_GENERAL); $this->load->library('DmsLib'); @@ -444,7 +455,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller $this->load->model('person/Notiz_model', 'NotizModel'); - //Löschen von Notiz + //Delete Note $result = $this->NotizModel->delete( array('notiz_id' => $notiz_id) ); @@ -465,10 +476,6 @@ abstract class Notiz_Controller extends FHCAPI_Controller public function loadDokumente() { - if(!$this->isBerechtigt('$id', '$typeId')) - { - $this->terminateWithError($this->p->t('ui', 'keineBerechtigung'), self::ERROR_TYPE_GENERAL); - } $_POST = json_decode(utf8_encode($this->input->raw_input_stream), true); $notiz_id = $this->input->post('notiz_id'); diff --git a/public/js/api/notiz.js b/public/js/api/notiz.js index 9d210a8f9..b0a01e989 100644 --- a/public/js/api/notiz.js +++ b/public/js/api/notiz.js @@ -1,13 +1,29 @@ -//TODO(Manu) refactor with require or async +//TODO(Manu) refactor for extensions with require or async //sonst Error wenn extension file nicht vorhanden import person from "./notiz/person.js"; -import softwarenotiz from "../../extensions/FHC-Core-Softwarebereitstellung/js/api/softwarenotiz.js"; +import prestudent from "./notiz/prestudent.js"; +import mitarbeiter from "./notiz/mitarbeiter.js"; +import projekt from "./notiz/projekt.js"; +import anrechnung from "./notiz/anrechnung.js"; +import bestellung from "./notiz/bestellung.js"; +import lehreinheit from "./notiz/lehreinheit.js"; +import projektphase from "./notiz/projektphase.js"; +import projekttask from "./notiz/projekttask.js"; +//import softwarenotiz from "../../extensions/FHC-Core-Softwarebereitstellung/js/api/softwarenotiz.js"; //import pppnotiz from "../../extensions/FHC-Core-PEP/js/api/pppnotiz.js"; export default { person, - softwarenotiz, + prestudent, + mitarbeiter, + anrechnung, + bestellung, + lehreinheit, + projekt, + projektphase, + projekttask, +// softwarenotiz, // pppnotiz } \ No newline at end of file diff --git a/public/js/api/notiz/anrechnung.js b/public/js/api/notiz/anrechnung.js new file mode 100644 index 000000000..843017687 --- /dev/null +++ b/public/js/api/notiz/anrechnung.js @@ -0,0 +1,38 @@ +export default { + getNotizen(url, config, params){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizAnrechnung/getNotizen/' + params.id + '/' + params.type); + }, + getUid(){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizAnrechnung/getUid/'); + }, + addNewNotiz(id, formData) { + return this.$fhcApi.post('api/frontend/v1/notiz/notizAnrechnung/addNewNotiz/' + id, + formData + ); + }, + loadNotiz(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizAnrechnung/loadNotiz/', { + notiz_id + }); + }, + loadDokumente(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizAnrechnung/loadDokumente/', { + notiz_id + }); + }, + deleteNotiz(notiz_id, type_id, id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizAnrechnung/deleteNotiz/', { + notiz_id, + type_id, + id + }); + }, + updateNotiz(notiz_id, formData){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizAnrechnung/updateNotiz/' + notiz_id, + formData + ); + }, + getMitarbeiter(event){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizAnrechnung/getMitarbeiter/' + event); + } +} \ No newline at end of file diff --git a/public/js/api/notiz/bestellung.js b/public/js/api/notiz/bestellung.js new file mode 100644 index 000000000..3f0f5268c --- /dev/null +++ b/public/js/api/notiz/bestellung.js @@ -0,0 +1,38 @@ +export default { + getNotizen(url, config, params){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizBestellung/getNotizen/' + params.id + '/' + params.type); + }, + getUid(){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizBestellung/getUid/'); + }, + addNewNotiz(id, formData) { + return this.$fhcApi.post('api/frontend/v1/notiz/notizBestellung/addNewNotiz/' + id, + formData + ); + }, + loadNotiz(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizBestellung/loadNotiz/', { + notiz_id + }); + }, + loadDokumente(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizBestellung/loadDokumente/', { + notiz_id + }); + }, + deleteNotiz(notiz_id, type_id, id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizBestellung/deleteNotiz/', { + notiz_id, + type_id, + id + }); + }, + updateNotiz(notiz_id, formData){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizBestellung/updateNotiz/' + notiz_id, + formData + ); + }, + getMitarbeiter(event){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizBestellung/getMitarbeiter/' + event); + } +} \ No newline at end of file diff --git a/public/js/api/notiz/lehreinheit.js b/public/js/api/notiz/lehreinheit.js new file mode 100644 index 000000000..85b3187ae --- /dev/null +++ b/public/js/api/notiz/lehreinheit.js @@ -0,0 +1,38 @@ +export default { + getNotizen(url, config, params){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizLehreinheit/getNotizen/' + params.id + '/' + params.type); + }, + getUid(){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizLehreinheit/getUid/'); + }, + addNewNotiz(id, formData) { + return this.$fhcApi.post('api/frontend/v1/notiz/notizLehreinheit/addNewNotiz/' + id, + formData + ); + }, + loadNotiz(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizLehreinheit/loadNotiz/', { + notiz_id + }); + }, + loadDokumente(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizLehreinheit/loadDokumente/', { + notiz_id + }); + }, + deleteNotiz(notiz_id, type_id, id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizLehreinheit/deleteNotiz/', { + notiz_id, + type_id, + id + }); + }, + updateNotiz(notiz_id, formData){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizLehreinheit/updateNotiz/' + notiz_id, + formData + ); + }, + getMitarbeiter(event){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizLehreinheit/getMitarbeiter/' + event); + } +} \ No newline at end of file diff --git a/public/js/api/notiz/mitarbeiter.js b/public/js/api/notiz/mitarbeiter.js new file mode 100644 index 000000000..ada9b0ae8 --- /dev/null +++ b/public/js/api/notiz/mitarbeiter.js @@ -0,0 +1,38 @@ +export default { + getNotizen(url, config, params){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizMitarbeiter/getNotizen/' + params.id + '/' + params.type); + }, + getUid(){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizMitarbeiter/getUid/'); + }, + addNewNotiz(id, formData) { + return this.$fhcApi.post('api/frontend/v1/notiz/notizMitarbeiter/addNewNotiz/' + id, + formData + ); + }, + loadNotiz(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizMitarbeiter/loadNotiz/', { + notiz_id + }); + }, + loadDokumente(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizMitarbeiter/loadDokumente/', { + notiz_id + }); + }, + deleteNotiz(notiz_id, type_id, id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizMitarbeiter/deleteNotiz/', { + notiz_id, + type_id, + id + }); + }, + updateNotiz(notiz_id, formData){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizMitarbeiter/updateNotiz/' + notiz_id, + formData + ); + }, + getMitarbeiter(event){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizMitarbeiter/getMitarbeiter/' + event); + } +} \ No newline at end of file diff --git a/public/js/api/notiz/person.js b/public/js/api/notiz/person.js index be19b4ed9..62a3640f0 100644 --- a/public/js/api/notiz/person.js +++ b/public/js/api/notiz/person.js @@ -1,38 +1,41 @@ export default { getNotizen(url, config, params){ - return this.$fhcApi.get('api/frontend/v1/notiz/notiz/getNotizen/' + params.id + '/' + params.type); + return this.$fhcApi.get('api/frontend/v1/notiz/notizPerson/getNotizen/' + params.id + '/' + params.type); }, getUid(){ - return this.$fhcApi.get('api/frontend/v1/notiz/notiz/getUid/'); + return this.$fhcApi.get('api/frontend/v1/notiz/notizPerson/getUid/'); }, addNewNotiz(id, formData) { - return this.$fhcApi.post('api/frontend/v1/notiz/notiz/addNewNotiz/' + id, + return this.$fhcApi.post('api/frontend/v1/notiz/notizPerson/addNewNotiz/' + id, formData ); }, loadNotiz(notiz_id){ - return this.$fhcApi.post('api/frontend/v1/notiz/notiz/loadNotiz/', { + return this.$fhcApi.post('api/frontend/v1/notiz/notizPerson/loadNotiz/', { notiz_id }); }, loadDokumente(notiz_id){ - return this.$fhcApi.post('api/frontend/v1/notiz/notiz/loadDokumente/', { + return this.$fhcApi.post('api/frontend/v1/notiz/notizPerson/loadDokumente/', { notiz_id }); }, deleteNotiz(notiz_id, type_id, id){ - return this.$fhcApi.post('api/frontend/v1/notiz/notiz/deleteNotiz/', { + return this.$fhcApi.post('api/frontend/v1/notiz/notizPerson/deleteNotiz/', { notiz_id, type_id, id }); }, updateNotiz(notiz_id, formData){ - return this.$fhcApi.post('api/frontend/v1/notiz/notiz/updateNotiz/' + notiz_id, + return this.$fhcApi.post('api/frontend/v1/notiz/notizPerson/updateNotiz/' + notiz_id, formData ); }, getMitarbeiter(event){ - return this.$fhcApi.get('api/frontend/v1/notiz/notiz/getMitarbeiter/' + event); + return this.$fhcApi.get('api/frontend/v1/notiz/notizPerson/getMitarbeiter/' + event); + }, + isBerechtigt(id, type_id){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizPerson/isBerechtigt/'); } } \ No newline at end of file diff --git a/public/js/api/notiz/prestudent.js b/public/js/api/notiz/prestudent.js new file mode 100644 index 000000000..c529ea44e --- /dev/null +++ b/public/js/api/notiz/prestudent.js @@ -0,0 +1,38 @@ +export default { + getNotizen(url, config, params){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizPrestudent/getNotizen/' + params.id + '/' + params.type); + }, + getUid(){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizPrestudent/getUid/'); + }, + addNewNotiz(id, formData) { + return this.$fhcApi.post('api/frontend/v1/notiz/notizPrestudent/addNewNotiz/' + id, + formData + ); + }, + loadNotiz(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizPrestudent/loadNotiz/', { + notiz_id + }); + }, + loadDokumente(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizPrestudent/loadDokumente/', { + notiz_id + }); + }, + deleteNotiz(notiz_id, type_id, id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizPrestudent/deleteNotiz/', { + notiz_id, + type_id, + id + }); + }, + updateNotiz(notiz_id, formData){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizPrestudent/updateNotiz/' + notiz_id, + formData + ); + }, + getMitarbeiter(event){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizPrestudent/getMitarbeiter/' + event); + } +} \ No newline at end of file diff --git a/public/js/api/notiz/projekt.js b/public/js/api/notiz/projekt.js new file mode 100644 index 000000000..ac8b71623 --- /dev/null +++ b/public/js/api/notiz/projekt.js @@ -0,0 +1,38 @@ +export default { + getNotizen(url, config, params){ + return this.$fhcApi.get('api/frontend/v1/notiz/NotizProjekt/getNotizen/' + params.id + '/' + params.type); + }, + getUid(){ + return this.$fhcApi.get('api/frontend/v1/notiz/NotizProjekt/getUid/'); + }, + addNewNotiz(id, formData) { + return this.$fhcApi.post('api/frontend/v1/notiz/NotizProjekt/addNewNotiz/' + id, + formData + ); + }, + loadNotiz(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/NotizProjekt/loadNotiz/', { + notiz_id + }); + }, + loadDokumente(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/NotizProjekt/loadDokumente/', { + notiz_id + }); + }, + deleteNotiz(notiz_id, type_id, id){ + return this.$fhcApi.post('api/frontend/v1/notiz/NotizProjekt/deleteNotiz/', { + notiz_id, + type_id, + id + }); + }, + updateNotiz(notiz_id, formData){ + return this.$fhcApi.post('api/frontend/v1/notiz/NotizProjekt/updateNotiz/' + notiz_id, + formData + ); + }, + getMitarbeiter(event){ + return this.$fhcApi.get('api/frontend/v1/notiz/NotizProjekt/getMitarbeiter/' + event); + } +} \ No newline at end of file diff --git a/public/js/api/notiz/projektphase.js b/public/js/api/notiz/projektphase.js new file mode 100644 index 000000000..8b85106a3 --- /dev/null +++ b/public/js/api/notiz/projektphase.js @@ -0,0 +1,38 @@ +export default { + getNotizen(url, config, params){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizProjektphase/getNotizen/' + params.id + '/' + params.type); + }, + getUid(){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizProjektphase/getUid/'); + }, + addNewNotiz(id, formData) { + return this.$fhcApi.post('api/frontend/v1/notiz/notizProjektphase/addNewNotiz/' + id, + formData + ); + }, + loadNotiz(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizProjektphase/loadNotiz/', { + notiz_id + }); + }, + loadDokumente(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizProjektphase/loadDokumente/', { + notiz_id + }); + }, + deleteNotiz(notiz_id, type_id, id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizProjektphase/deleteNotiz/', { + notiz_id, + type_id, + id + }); + }, + updateNotiz(notiz_id, formData){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizProjektphase/updateNotiz/' + notiz_id, + formData + ); + }, + getMitarbeiter(event){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizProjektphase/getMitarbeiter/' + event); + } +} \ No newline at end of file diff --git a/public/js/api/notiz/projekttask.js b/public/js/api/notiz/projekttask.js new file mode 100644 index 000000000..6b6db3c77 --- /dev/null +++ b/public/js/api/notiz/projekttask.js @@ -0,0 +1,38 @@ +export default { + getNotizen(url, config, params){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizProjekttask/getNotizen/' + params.id + '/' + params.type); + }, + getUid(){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizProjekttask/getUid/'); + }, + addNewNotiz(id, formData) { + return this.$fhcApi.post('api/frontend/v1/notiz/notizProjekttask/addNewNotiz/' + id, + formData + ); + }, + loadNotiz(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizProjekttask/loadNotiz/', { + notiz_id + }); + }, + loadDokumente(notiz_id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizProjekttask/loadDokumente/', { + notiz_id + }); + }, + deleteNotiz(notiz_id, type_id, id){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizProjekttask/deleteNotiz/', { + notiz_id, + type_id, + id + }); + }, + updateNotiz(notiz_id, formData){ + return this.$fhcApi.post('api/frontend/v1/notiz/notizProjekttask/updateNotiz/' + notiz_id, + formData + ); + }, + getMitarbeiter(event){ + return this.$fhcApi.get('api/frontend/v1/notiz/notizProjekttask/getMitarbeiter/' + event); + } +} \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index 4c128bfea..185b8d0d5 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -11,20 +11,6 @@ export default {

Notizen

- - - + - - diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index ba4dcfa01..e4d6d1870 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -27781,6 +27781,28 @@ array( ) ) ), + + //**************************** FHC-Core-Notizcomponent + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'error_typeNotizIdIncorrect', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Id-Typ der Notiz ist nicht korrekt', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Id type of note is incorrect', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), ); From c0e2cec5568bfa01bee49a39bbb7a610483c5869 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 14 Aug 2024 15:51:27 +0200 Subject: [PATCH 0002/1746] s&d --- application/libraries/AntragLib.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application/libraries/AntragLib.php b/application/libraries/AntragLib.php index c1649587d..1a8b28ed3 100644 --- a/application/libraries/AntragLib.php +++ b/application/libraries/AntragLib.php @@ -77,7 +77,9 @@ class AntragLib 'studiensemester_kurzbz'=>$prestudentstatus->studiensemester_kurzbz, 'ausbildungssemester'=>$prestudentstatus->ausbildungssemester ], [ - 'statusgrund_id' => null + 'statusgrund_id' => null, + 'updateamum' => date('c'), + 'updatevon' => $insertvon ]); } } @@ -335,7 +337,10 @@ class AntragLib 'status_kurzbz'=>$prestudentstatus->status_kurzbz, 'studiensemester_kurzbz'=>$prestudentstatus->studiensemester_kurzbz, 'ausbildungssemester'=>$prestudentstatus->ausbildungssemester - ], []); + ], [ + 'updateamum' => $insertam, + 'updatevon' => $insertvon + ]); if (isError($result)) { $errors[] = getError($result); From d542cf7720b9c0651d8510a18a73916e3200a6ae Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 14 Aug 2024 16:20:47 +0200 Subject: [PATCH 0003/1746] s&d --- application/libraries/AntragLib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/libraries/AntragLib.php b/application/libraries/AntragLib.php index c1649587d..1a96eadf1 100644 --- a/application/libraries/AntragLib.php +++ b/application/libraries/AntragLib.php @@ -126,7 +126,7 @@ class AntragLib return $this->_ci->StudierendenantragstatusModel->resumeAntraegeForAbmeldungStgl($antrag_id); } // NOTE(chris): get last status that is not pause - $this->_ci->StudierendenantragstatusModel->addOrder('insertamum'); + $this->_ci->StudierendenantragstatusModel->addOrder('insertamum', 'DESC'); $this->_ci->StudierendenantragstatusModel->addLimit(1); $result = $this->_ci->StudierendenantragstatusModel->loadWhere([ 'studierendenantrag_id' => $antrag_id, From d254b9c10b7066ed481d28952e8d7c4747a568d6 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 23 Aug 2024 11:58:08 +0200 Subject: [PATCH 0004/1746] 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', From de0fbdb72c8bbb7d1eb1084d33e8283fb7dd364d Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 29 Aug 2024 09:53:34 +0200 Subject: [PATCH 0005/1746] Form, Table and Queries for new Tab Pruefung --- .../api/frontend/v1/stv/Pruefung.php | 273 +++++++++- .../models/education/LePruefung_model.php | 2 +- .../models/education/Lehreinheit_model.php | 53 ++ application/models/education/Note_model.php | 14 + .../models/ressource/Mitarbeiter_model.php | 24 + .../Studentenverwaltung/Details/Pruefung.js | 2 +- .../Details/Pruefung/Pruefunglist.js | 481 ++++++++++++++++-- 7 files changed, 811 insertions(+), 38 deletions(-) create mode 100644 application/models/education/Note_model.php diff --git a/application/controllers/api/frontend/v1/stv/Pruefung.php b/application/controllers/api/frontend/v1/stv/Pruefung.php index 60666c610..9ddd22897 100644 --- a/application/controllers/api/frontend/v1/stv/Pruefung.php +++ b/application/controllers/api/frontend/v1/stv/Pruefung.php @@ -29,7 +29,19 @@ class Pruefung extends FHCAPI_Controller { //TODO(Manu) Berechtigungen parent::__construct([ - 'getPruefungen' => self::PERM_LOGGED + 'getPruefungen' => ['admin:r', 'assistenz:r'], + 'loadPruefung' => ['admin:r', 'assistenz:r'], + 'getTypenPruefungen' => self::PERM_LOGGED, + 'getLehreinheiten' => self::PERM_LOGGED, + 'getAllLehreinheiten' => self::PERM_LOGGED, + 'getLvsByStudent' => self::PERM_LOGGED, + 'getLvsandLesByStudent' => self::PERM_LOGGED, + 'getLvsAndMas' => self::PERM_LOGGED, + 'getMitarbeiterLv' => self::PERM_LOGGED, + 'getNoten' => self::PERM_LOGGED, + 'insertPruefung' => ['admin:r', 'assistenz:r'], + 'updatePruefung' =>['admin:r', 'assistenz:r'], + 'deletePruefung' =>['admin:r', 'assistenz:r'], ]); //Load Models @@ -45,4 +57,263 @@ class Pruefung extends FHCAPI_Controller $this->terminateWithSuccess($data); } + public function loadPruefung($pruefung_id) + { + $this->PruefungModel->addSelect('tbl_pruefung.datum'); + $this->PruefungModel->addSelect("TO_CHAR(tbl_pruefung.datum::timestamp, 'DD.MM.YYYY') AS format_datum"); + $this->PruefungModel->addSelect('tbl_pruefung.anmerkung'); + $this->PruefungModel->addSelect('tbl_pruefung.pruefungstyp_kurzbz'); + $this->PruefungModel->addSelect('tbl_pruefung.pruefung_id'); + $this->PruefungModel->addSelect('tbl_pruefung.lehreinheit_id'); + $this->PruefungModel->addSelect('tbl_pruefung.student_uid'); + $this->PruefungModel->addSelect('tbl_pruefung.mitarbeiter_uid'); + $this->PruefungModel->addSelect('tbl_pruefung.punkte'); + $this->PruefungModel->addSelect('tbl_pruefung.note'); + + $this->PruefungModel->addSelect('tbl_lehrveranstaltung.bezeichnung as lehrveranstaltung_bezeichnung'); + $this->PruefungModel->addSelect('tbl_lehrveranstaltung.lehrveranstaltung_id'); + $this->PruefungModel->addSelect('tbl_lehrveranstaltung.semester'); + $this->PruefungModel->addSelect('tbl_lehrveranstaltung.lehrform_kurzbz'); + $this->PruefungModel->addSelect('tbl_note.bezeichnung as note_bezeichnung'); + $this->PruefungModel->addSelect('tbl_pruefungstyp.beschreibung as typ_beschreibung'); + $this->PruefungModel->addSelect('tbl_lehreinheit.studiensemester_kurzbz as studiensemester_kurzbz'); + + $this->PruefungModel->addJoin('lehre.tbl_lehreinheit', 'lehre.tbl_pruefung.lehreinheit_id=lehre.tbl_lehreinheit.lehreinheit_id'); + $this->PruefungModel->addJoin('lehre.tbl_lehrveranstaltung', 'lehrveranstaltung_id'); + $this->PruefungModel->addJoin('lehre.tbl_note', 'note'); + $this->PruefungModel->addJoin('lehre.tbl_pruefungstyp', 'pruefungstyp_kurzbz'); + + + $this->PruefungModel->addLimit(1); + + $result = $this->PruefungModel->loadWhere( + array('pruefung_id' => $pruefung_id) + ); + if (isError($result)) { + return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + } + + if (!hasData($result)) + { + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Pruefung_id']), self::ERROR_TYPE_GENERAL); + } + $this->terminateWithSuccess(current(getData($result)) ? : null); + } + + public function insertPruefung(){ + //TODO(Manu) validations + + $authUID = getAuthUID(); + $lehreinheit_id = $this->input->post('lehreinheit_id'); + $student_uid = $this->input->post('student_uid'); + $mitarbeiter_uid = $this->input->post('mitarbeiter_uid'); + $datum = $this->input->post('datum'); + $note = $this->input->post('note'); + $pruefungstyp_kurzbz = $this->input->post('pruefungstyp_kurzbz'); + $anmerkung = $this->input->post('anmerkung'); + + + $result = $this->PruefungModel->insert([ + 'lehreinheit_id' => $lehreinheit_id, + 'student_uid' => $student_uid, + 'mitarbeiter_uid' => $mitarbeiter_uid, + 'datum' => $datum, + 'pruefungstyp_kurzbz' => $pruefungstyp_kurzbz, + 'note' => $note, + 'anmerkung' => $anmerkung, + 'insertamum' => date('c'), + 'insertvon' => $authUID, + ]); + + $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess(true); + + } + + public function updatePruefung($pruefung_id){ + //TODO(Manu) validations + $result = $this->PruefungModel->load($pruefung_id); + + $oldpruefung = $this->getDataOrTerminateWithError($result); + if (!$oldpruefung) + show_404(); // Pruefung that should be updated does not exist + + $authUID = getAuthUID(); + + $lehreinheit_id = $this->input->post('lehreinheit_id'); + $student_uid = $this->input->post('student_uid'); + $mitarbeiter_uid = $this->input->post('mitarbeiter_uid'); + $datum = $this->input->post('datum'); + $note = $this->input->post('note'); + $pruefungstyp_kurzbz = $this->input->post('pruefungstyp_kurzbz'); + $anmerkung = $this->input->post('anmerkung'); + + $result = $this->PruefungModel->update( + [ + 'pruefung_id' => $pruefung_id + ], + [ 'lehreinheit_id' => $lehreinheit_id, + 'student_uid' => $student_uid, + 'mitarbeiter_uid' => $mitarbeiter_uid, + 'note' => $note, + 'pruefungstyp_kurzbz' => $pruefungstyp_kurzbz, + 'datum' => $datum, + 'anmerkung' => $anmerkung, + 'updatevon' => $authUID, + 'updateamum' => date('c'), + ] + ); + + $this->getDataOrTerminateWithError($result); + + return $this->outputJsonSuccess(true); + } + + public function deletePruefung($pruefung_id){ + $result = $this->PruefungModel->load($pruefung_id); + + $oldpruefung = $this->getDataOrTerminateWithError($result); + if (!$oldpruefung) + show_404(); // Pruefung that should be deleted does not exist + + $result = $this->PruefungModel->delete( + [ + 'pruefung_id' => $pruefung_id + ] + ); + + $this->getDataOrTerminateWithError($result); + + return $this->terminateWithSuccess(true); + } + + public function getTypenPruefungen() + { + $this->load->model('education/Pruefungstyp_model', 'PruefungtypModel'); + + //TODO(Manu) sort Termin3 + $this->PruefungtypModel->addOrder('sort', 'ASC'); + $result = $this->PruefungtypModel->loadWhere( + array('abschluss' => 'false') + ); + + if (isError($result)) { + $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess(getData($result) ?: []); + } + + public function getAllLehreinheiten(){ + + //TODO MANU (validations) + + $lv_id = $this->input->post('lv_id'); + $studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz'); + + $this->load->model('education/Lehreinheit_model', 'LehreinheitModel'); + + $result = $this->LehreinheitModel->getLesFromLvIds($lv_id, $studiensemester_kurzbz); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getLvsandLesByStudent($student_uid) + { + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + + $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid); + + $data = $this->getDataOrTerminateWithError($result); + + $lv_ids = array(); + $allData = array(); + + foreach ($data as $lehrveranstaltung) { + $lv_ids[] = $lehrveranstaltung->lehrveranstaltung_id; + } + + $this->load->model('education/Lehreinheit_model', 'LehreinheitModel'); + + foreach ($lv_ids as $id) + { + $result = $this->LehreinheitModel->getLesFromLvIds($id); + $data = $this->getDataOrTerminateWithError($result); + + if (is_array($data)) { + $allData = array_merge($allData, $data); + } + } + + return $this->terminateWithSuccess($allData); + } + + public function getLvsAndMas($student_uid) + { + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + + $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid); + + $data = $this->getDataOrTerminateWithError($result); + + $lv_ids = array(); + $allDataMa = array(); + + foreach ($data as $lehrveranstaltung) { + $lv_ids[] = $lehrveranstaltung->lehrveranstaltung_id; + } + + $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); + + foreach ($lv_ids as $id) { + + $resultMa = $this->MitarbeiterModel->getMitarbeiterFromLV($id); + $dataMa = $this->getDataOrTerminateWithError($resultMa); + + if (is_array($dataMa)) { + $allDataMa = array_merge($allDataMa, $dataMa); + } + } + + return $this->terminateWithSuccess($allDataMa); + } + + public function getLvsByStudent($student_uid) + { + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + + $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid); + + $data = $this->getDataOrTerminateWithError($result); + + return $this->terminateWithSuccess($data); + } + + public function getMitarbeiterLv($lv_id) + { + $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); + + $result = $this->MitarbeiterModel->getMitarbeiterFromLV($lv_id); + + $data = $this->getDataOrTerminateWithError($result); + + return $this->terminateWithSuccess($data); + } + + public function getNoten() + { + $this->load->model('education/Note_model', 'NoteModel'); + + $this->NoteModel->addOrder('note', 'ASC'); + $result = $this->NoteModel->load(); + + if (isError($result)) { + $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess(getData($result) ?: []); + } + + } diff --git a/application/models/education/LePruefung_model.php b/application/models/education/LePruefung_model.php index 5522a3998..6e51f1975 100644 --- a/application/models/education/LePruefung_model.php +++ b/application/models/education/LePruefung_model.php @@ -13,7 +13,7 @@ class LePruefung_model extends DB_Model } /** - * CI_STYLE + * gets all Pruefungen for a student_uid * @param string $student_uid * @param string $studiensemester_kurzbz * diff --git a/application/models/education/Lehreinheit_model.php b/application/models/education/Lehreinheit_model.php index 10c122b94..3b7e8d330 100644 --- a/application/models/education/Lehreinheit_model.php +++ b/application/models/education/Lehreinheit_model.php @@ -113,4 +113,57 @@ class Lehreinheit_model extends DB_Model return $this->execQuery($query, array($lehreinheit_id)); } + + /** + * Gets Lehreinheiten for Lehrveranstaltungen in a Studiensemester. + * Without using tbl_lehrfach: bezeichnung and kurzbz ALWAYS from lehrveranstaltung + * @param $lehrveranstaltung_id + * @param $studiensemester + * @return array with Lehreinheiten and their Lehreinheitgruppen + */ + public function getLesFromLvIds($lehrveranstaltung_id, $studiensemester_kurzbz = null) + { + $params = array($lehrveranstaltung_id); + + $query = " + SELECT + lv.lehrveranstaltung_id, + le.lehreinheit_id, + le.lehrform_kurzbz, + lv.kurzbz, + lv.bezeichnung, + lv.semester, + ma.mitarbeiter_uid, + ( + SELECT + STRING_AGG(CONCAT(leg.semester, leg.verband, leg.gruppe), ' ') + FROM lehre.tbl_lehreinheitgruppe leg + WHERE leg.lehreinheit_id = le.lehreinheit_id + ) AS gruppe + FROM + lehre.tbl_lehreinheit le + JOIN + lehre.tbl_lehrveranstaltung lv ON lv.lehrveranstaltung_id = le.lehrveranstaltung_id + JOIN + lehre.tbl_lehreinheitmitarbeiter ma USING (lehreinheit_id) + WHERE + lv.lehrveranstaltung_id = ? + --AND le.studiensemester_kurzbz = 'WS2021' + "; + + if (isset($studiensemester_kurzbz)) + { + $query .= " AND le.studiensemester_kurzbz = ?"; + $params[] = $studiensemester_kurzbz; + } + + $query .=" + ORDER BY + le.lehreinheit_id; + "; + + return $this->execQuery($query, $params); + + } + } diff --git a/application/models/education/Note_model.php b/application/models/education/Note_model.php new file mode 100644 index 000000000..80b454398 --- /dev/null +++ b/application/models/education/Note_model.php @@ -0,0 +1,14 @@ +dbTable = 'lehre.tbl_note'; + $this->pk = 'note'; + } +} \ No newline at end of file diff --git a/application/models/ressource/Mitarbeiter_model.php b/application/models/ressource/Mitarbeiter_model.php index c38fcf054..52ed62be1 100644 --- a/application/models/ressource/Mitarbeiter_model.php +++ b/application/models/ressource/Mitarbeiter_model.php @@ -238,4 +238,28 @@ class Mitarbeiter_model extends DB_Model return $this->execQuery($qry); } + + /** + * Gets Mitarbeiter for a certain Lehrveranstaltung. + * + * @param $lehrveranstaltung_id + * @return array with Mitarbeiter and their Lehreinheiten + */ + public function getMitarbeiterFromLV($lehrveranstaltung_id){ + //TODO(manu) maybe filter that in pruefungslist.js ? + $qry = "SELECT DISTINCT + lehrveranstaltung_id, uid, vorname, wahlname, vornamen, nachname, titelpre, titelpost, kurzbz, mitarbeiter_uid + FROM + lehre.tbl_lehreinheitmitarbeiter, campus.vw_mitarbeiter, lehre.tbl_lehreinheit + WHERE + lehrveranstaltung_id= ? + AND + mitarbeiter_uid=uid + AND + tbl_lehreinheitmitarbeiter.lehreinheit_id=tbl_lehreinheit.lehreinheit_id;"; + + $parametersArray = array($lehrveranstaltung_id); + + return $this->execQuery($qry, $parametersArray); + } } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js index eb43e36be..e45f97240 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung.js @@ -16,7 +16,7 @@ export default { template: `
- {{modelValue}} +
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js index 6f034e087..006cc6218 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js @@ -1,10 +1,12 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js"; import FormInput from "../../../../Form/Input.js"; +import BsModal from "../../../../Bootstrap/Modal.js"; export default{ components: { CoreFilterCmpt, - FormInput + FormInput, + BsModal }, inject: { defaultSemester: { @@ -26,40 +28,327 @@ export default{ {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}, - ], + {title: "PruefungId", field: "pruefung_id", visible: false}, + {title: "LehreinheitId", field: "lehreinheit_id", visible: false}, + {title: "Student_uid", field: "student_uid", visible: false}, + {title: "LV_id", field: "lehrveranstaltung_id", visible: false}, //just for testing + {title: "Mitarbeiter_uid", field: "mitarbeiter_uid", visible: false}, + {title: "Punkte", field: "punkte", visible: false}, + { + title: 'Aktionen', field: 'actions', + minWidth: 150, + maxWidth: 150, + formatter: (cell, formatterParams, onRendered) => { + let container = document.createElement('div'); + container.className = "d-flex gap-2"; + + let button = document.createElement('button'); + button.className = 'btn btn-outline-secondary btn-action'; + button.innerHTML = ''; + button.title = 'neue Prüfung aus dieser LV erstellen'; + button.addEventListener( + 'click', + (event) => + this.actionNewFromOldPruefung(cell.getData().pruefung_id) + ); + container.append(button); + + button = document.createElement('button'); + button.className = 'btn btn-outline-secondary btn-action'; + button.innerHTML = ''; + button.title = 'Prüfung bearbeiten'; + button.addEventListener( + 'click', + (event) => + this.actionEditPruefung(cell.getData().pruefung_id) + ); + container.append(button); + + button = document.createElement('button'); + button.className = 'btn btn-outline-secondary btn-action'; + button.innerHTML = ''; + button.title = 'Prüfung löschen'; + button.addEventListener( + 'click', + () => + this.actionDeletePruefung(cell.getData().pruefung_id) + ); + container.append(button); + + return container; + }, + frozen: true + }], layout: 'fitDataFill', layoutColumnsOnNewData: false, height: 'auto', }, - tabulatorEvents: [{}], + tabulatorEvents: [ + { + event: 'tableBuilt', + handler: async () => { + await this.$p.loadCategory(['fristenmanagement', 'global', 'person', 'ui',]); + let cm = this.$refs.table.tabulator.columnManager; + + cm.getColumnByField('bezeichnung').component.updateDefinition({ + title: this.$p.t('global', 'typ') + }); + + cm.getColumnByField('anmerkung').component.updateDefinition({ + title: this.$p.t('global', 'anmerkung') + }); + } + } + ], pruefungData: {}, - filter: false + listTypesExam: [], + listLvsAndLes: [], + listLvsAndMas: [], + listLvs: [], //TODO(Manu) nachträglich sortieren + listLes: [], + listMas: [], //TODO(Manu) Filter statt SELECT DISTINCT + listMarks: [], + filter: false, + statusNew: true, + isStartDropDown: false + } + }, + computed:{ +/* lehrveranstaltungen(){ + return this.listLvsAndLes.filter((value, index, self) => { + return self.indexOf(value) === index; + }); + },*/ + lv_teile(){ + return this.listLvsAndLes.filter(lv => lv.lehrveranstaltung_id == this.pruefungData.lehrveranstaltung_id); + }, + lv_teile_ma(){ + return this.listLvsAndMas.filter(lv => lv.lehrveranstaltung_id == this.pruefungData.lehrveranstaltung_id); } }, - computed:{}, /* watch: { modelValue() { this.$refs.table.reloadTable(); } },*/ - methods:{ }, + methods:{ + loadPruefung(pruefung_id) { + return this.$fhcApi.get('api/frontend/v1/stv/pruefung/loadPruefung/' + pruefung_id) + .then(result => { + this.pruefungData = result.data; + return result; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + actionNewPruefung(){ + this.statusNew = true; + this.isStartDropDown = true; + +/* this.getLvsByStudent(this.uid).then(() => { + this.$refs.pruefungModal.show(); + });*/ + + this.$refs.pruefungModal.show(); + // this.prepareDropdowns(); + // this.$refs.pruefungModal.show(); + + }, + actionNewFromOldPruefung(pruefung_id) { + this.statusNew = true; + this.isStartDropDown = false; + this.loadPruefung(pruefung_id).then(() => { + this.pruefungData.note_bezeichnung = 'Noch nicht eingetragen'; + this.pruefungData.datum = new Date(); + this.prepareDropdowns(); + + this.$refs.pruefungModal.show(); + }); + }, + actionEditPruefung(pruefung_id) { + this.statusNew = false; + this.isStartDropDown = false; + this.loadPruefung(pruefung_id).then(() => { + + this.prepareDropdowns(); + + this.$refs.pruefungModal.show(); + }); + }, + actionDeletePruefung(pruefung_id) { + console.log("action delete Prüfung" + pruefung_id); + this.loadPruefung(pruefung_id).then(() => { + if(this.pruefungData.pruefung_id) + + this.$fhcAlert + .confirmDelete() + .then(result => result + ? pruefung_id + : Promise.reject({handled: true})) + .then(this.deletePruefung) + .catch(this.$fhcAlert.handleSystemError); + + }); + }, + addPruefung(){ + this.$fhcApi.post('api/frontend/v1/stv/pruefung/insertPruefung/', + this.pruefungData + ).then(response => { + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + this.hideModal('pruefungModal'); + this.resetModal(); + }).catch(this.$fhcAlert.handleSystemError) + .finally(() => { + window.scrollTo(0, 0); + this.reload(); + }); + }, + updatePruefung(pruefung_id){ + console.log("update Prüfung" + pruefung_id); + this.$fhcApi.post('api/frontend/v1/stv/pruefung/updatePruefung/' + pruefung_id, + this.pruefungData + ).then(response => { + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + this.hideModal('pruefungModal'); + this.resetModal(); + }).catch(this.$fhcAlert.handleSystemError) + .finally(() => { + window.scrollTo(0, 0); + this.reload(); + }); + }, + deletePruefung(pruefung_id) { + this.$fhcApi.post('api/frontend/v1/stv/pruefung/deletePruefung/' + pruefung_id) + .then(response => { + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); + }).catch(this.$fhcAlert.handleSystemError) + .finally(()=> { + window.scrollTo(0, 0); + this.reload(); + }); + }, + hideModal(modalRef) { + this.$refs[modalRef].hide(); + }, + resetModal() { + this.pruefungData = {}; + +/* this.pruefungData.strasse = null; + this.pruefungData.zustellpruefunge = true; + this.pruefungData.heimatpruefunge = true; + this.pruefungData.rechnungspruefunge = false; + this.pruefungData.co_name = null; + this.pruefungData.firma_id = null; + this.pruefungData.name = null; + this.pruefungData.anmerkung = null; + this.pruefungData.typ = 'h'; + this.pruefungData.nation = 'A'; + this.pruefungData.plz = null;*/ + + this.statusNew = true; + }, + reload() { + this.$refs.table.reloadTable(); + }, + getLvsByStudent(student_uid){ + return this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsByStudent/' + student_uid) + .then(result => { + this.listLvs = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + getMaFromLv(lv_id){ + return this.$fhcApi.get('api/frontend/v1/stv/pruefung/getMitarbeiterLv/' + lv_id) + .then(result => { + this.listMas = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + getLehreinheiten(lv_id, studiensemester_kurzbz) { + const data = { + lv_id: lv_id, + studiensemester_kurzbz: studiensemester_kurzbz + }; + + return this.$fhcApi.post('api/frontend/v1/stv/pruefung/getAllLehreinheiten/', data) + .then(response => { + this.listLes = response.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + prepareDropdowns(){ + + // Get Lvs from Student +/* this.getLvsByStudent(this.pruefungData.student_uid).then(() => { + + }).catch(error => { + console.error('Error loading Lvs:', error); + });*/ + + + // Get Ma from Lv + this.getMaFromLv(this.pruefungData.lehrveranstaltung_id).then(() => { + }).catch(error => { + console.error('Error loading Ma data:', error); + }); + + // Get Lehreinheiten + this.getLehreinheiten(this.pruefungData.lehrveranstaltung_id, this.pruefungData.studiensemester_kurzbz).then(() => { + + }).catch(error => { + console.error('Error loading Lehreinheiten multiple:', error); + }); + + + + this.$refs.pruefungModal.show(); + } + }, + created(){ + this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsByStudent/' + this.uid) + .then(result => { + this.listLvs = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + + this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsandLesByStudent/' + this.uid) + .then(result => { + this.listLvsAndLes = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + + this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsAndMas/' + this.uid) + .then(result => { + this.listLvsAndMas = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + + this.$fhcApi.get('api/frontend/v1/stv/pruefung/getTypenPruefungen') + .then(result => { + this.listTypesExam = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + + this.$fhcApi.get('api/frontend/v1/stv/pruefung/getNoten') + .then(result => { + this.listMarks = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, template: `
- + + aktuelles Sem: {{defaultSemester}} +
+
- - +
-
- -
- - -
- -
-

Form

+ + + +

Form

+ + + + + +
+ Details - aktuelles Sem: {{defaultSemester}} - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
` }; From d6d6d0ac48a2c5c5fea4bc16790c66ea134e31d4 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 16 Sep 2024 18:22:28 +0200 Subject: [PATCH 0006/1746] Added phrases for softwarebereitstellung app --- system/phrasesupdate.php | 64 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index a6fbf4f4d..9a99b21ec 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -28826,13 +28826,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => 'Softwareanforderung und Lizenzmanagement für die Lehre', + 'text' => 'Softwareanforderung für die Lehre', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => 'Software Request and License management for Education', + 'text' => 'Software Request for Education', 'description' => '', 'insertvon' => 'system' ) @@ -30605,6 +30605,66 @@ array( ) ) ), + array( + 'app' => 'softwarebereitstellung', + 'category' => 'global', + 'phrase' => 'userAnzahl', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'User-Anzahl', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'User Number', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'softwarebereitstellung', + 'category' => 'global', + 'phrase' => 'userAnzahlAendern', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'User-Anzahl ändern', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Change User Number', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'softwarebereitstellung', + 'category' => 'global', + 'phrase' => 'userAnzahlNeu', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'User-Anzahl NEU', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'NEW User Number', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), ); From 4d5ea1f519c68569ed504c8388988084688778cc Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 17 Sep 2024 15:28:18 +0200 Subject: [PATCH 0007/1746] adapt addNewPruefung, pruefungModal, function getLvsByStudent --- .../api/frontend/v1/stv/Pruefung.php | 17 ++- .../education/Lehrveranstaltung_model.php | 7 +- .../Details/Pruefung/Pruefunglist.js | 128 +++++++++++++++--- 3 files changed, 125 insertions(+), 27 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Pruefung.php b/application/controllers/api/frontend/v1/stv/Pruefung.php index 9ddd22897..cdac93b4b 100644 --- a/application/controllers/api/frontend/v1/stv/Pruefung.php +++ b/application/controllers/api/frontend/v1/stv/Pruefung.php @@ -101,7 +101,7 @@ class Pruefung extends FHCAPI_Controller } public function insertPruefung(){ - //TODO(Manu) validations + //TODO(Manu) Berechtigungen $authUID = getAuthUID(); $lehreinheit_id = $this->input->post('lehreinheit_id'); @@ -112,6 +112,11 @@ class Pruefung extends FHCAPI_Controller $pruefungstyp_kurzbz = $this->input->post('pruefungstyp_kurzbz'); $anmerkung = $this->input->post('anmerkung'); + $this->load->library('form_validation'); + + $this->form_validation->set_rules( + 'datum', $this->p->t('global', 'datum'), ['is_valid_date'] + ); $result = $this->PruefungModel->insert([ 'lehreinheit_id' => $lehreinheit_id, @@ -132,7 +137,7 @@ class Pruefung extends FHCAPI_Controller } public function updatePruefung($pruefung_id){ - //TODO(Manu) validations + //TODO(Manu) validations and Berechtigungen $result = $this->PruefungModel->load($pruefung_id); $oldpruefung = $this->getDataOrTerminateWithError($result); @@ -280,11 +285,15 @@ class Pruefung extends FHCAPI_Controller return $this->terminateWithSuccess($allDataMa); } - public function getLvsByStudent($student_uid) + public function getLvsByStudent($student_uid, $studiensemester_kurzbz=null ) { + //bei post request +/* $student_uid = $this->input->post('student_uid'); + $studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz');*/ + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); - $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid); + $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid, $studiensemester_kurzbz); $data = $this->getDataOrTerminateWithError($result); diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index cefd147b9..f343f2583 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -226,7 +226,7 @@ class Lehrveranstaltung_model extends DB_Model /** * Gets Lehrveranstaltungen of a student * @param $student_uid - * @param null $studiensemester_kurzbz + * @param $studiensemester_kurzbz * @return array|null */ public function getLvsByStudent($student_uid, $studiensemester_kurzbz = null) @@ -236,6 +236,7 @@ class Lehrveranstaltung_model extends DB_Model $qry = "SELECT * FROM lehre.tbl_lehrveranstaltung WHERE lehrveranstaltung_id IN(SELECT lehrveranstaltung_id FROM campus.vw_student_lehrveranstaltung WHERE uid=?"; + if (isset($studiensemester_kurzbz)) { $qry .= " AND studiensemester_kurzbz=?"; @@ -243,11 +244,11 @@ class Lehrveranstaltung_model extends DB_Model } $qry .= ") OR lehrveranstaltung_id IN(SELECT lehrveranstaltung_id FROM lehre.tbl_zeugnisnote WHERE student_uid=?"; $params[] = $student_uid; - if (isset($studiensemester_kurzbz)) +/* if (isset($studiensemester_kurzbz)) { $qry .= " AND studiensemester_kurzbz=?"; $params[] = $studiensemester_kurzbz; - } + }*/ $qry .= ") ORDER BY semester, bezeichnung"; return $this->execQuery($qry, $params); diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js index 006cc6218..31f709e26 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js @@ -12,6 +12,10 @@ export default{ defaultSemester: { from: 'defaultSemester', }, +/* $reloadList: { + from: '$reloadList', + required: true + }*/ }, props: { uid: Number @@ -26,6 +30,7 @@ export default{ {title: "Datum", field: "format_datum"}, {title: "Lehrveranstaltung", field: "lehrveranstaltung_bezeichnung"}, {title: "Note", field: "note_bezeichnung"}, + {title: "StudSem", field: "studiensemester_kurzbz"}, //just testing {title: "Anmerkung", field: "anmerkung"}, {title: "Typ", field: "pruefungstyp_kurzbz"}, {title: "PruefungId", field: "pruefung_id", visible: false}, @@ -110,7 +115,10 @@ export default{ listMarks: [], filter: false, statusNew: true, - isStartDropDown: false + isStartDropDown: false, + currentSemester: false, + // componentKey: 0, + isFilterSet: false, } }, computed:{ @@ -124,13 +132,31 @@ export default{ }, lv_teile_ma(){ return this.listLvsAndMas.filter(lv => lv.lehrveranstaltung_id == this.pruefungData.lehrveranstaltung_id); - } + }, + semester_intern: { + get() { + if (this.currentSemester) + return this.currentSemester; + else + return false; + }, + set(value) { + this.currentSemester = value; + } + }, }, -/* watch: { + watch: { +/* defaultSemester(newVal, oldVal) { + if (newVal !== oldVal) { + console.log("variable did change"); + //this.reload(); // Methode aufrufen, um die Komponente neu zu laden + this.componentKey += 1; + } + }, modelValue() { this.$refs.table.reloadTable(); - } - },*/ + }*/ + }, methods:{ loadPruefung(pruefung_id) { return this.$fhcApi.get('api/frontend/v1/stv/pruefung/loadPruefung/' + pruefung_id) @@ -143,6 +169,7 @@ export default{ actionNewPruefung(){ this.statusNew = true; this.isStartDropDown = true; + this.resetModal(); /* this.getLvsByStudent(this.uid).then(() => { this.$refs.pruefungModal.show(); @@ -157,8 +184,9 @@ export default{ this.statusNew = true; this.isStartDropDown = false; this.loadPruefung(pruefung_id).then(() => { - this.pruefungData.note_bezeichnung = 'Noch nicht eingetragen'; + this.pruefungData.note = 9; this.pruefungData.datum = new Date(); + this.pruefungData.pruefungstyp_kurzbz = null; this.prepareDropdowns(); this.$refs.pruefungModal.show(); @@ -249,6 +277,16 @@ export default{ reload() { this.$refs.table.reloadTable(); }, +/* setFilter(semester) { + if (semester == 'open') + window.localStorage.setItem(LOCAL_STORAGE_ID_FILTER, this.filter ? 1 : 0); + else if( semester == 'default_semester') + this.$fhcApi.factory + .stv.filter.setSemester(this.defaultSemester) + .catch(this.$fhcAlert.handleSystemError); + + this.$nextTick(this.$refs.table.reloadTable); + },*/ getLvsByStudent(student_uid){ return this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsByStudent/' + student_uid) .then(result => { @@ -256,6 +294,18 @@ export default{ }) .catch(this.$fhcAlert.handleSystemError); }, +/* //version post request +getLvsByStudent(student_uid, studiensemester_kurzbz){ + const data = { + student_uid: student_uid, + studiensemester_kurzbz: studiensemester_kurzbz + }; + return this.$fhcApi.post('api/frontend/v1/stv/pruefung/getLvsByStudent/', data) + .then(result => { + this.listLvs = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + },*/ getMaFromLv(lv_id){ return this.$fhcApi.get('api/frontend/v1/stv/pruefung/getMitarbeiterLv/' + lv_id) .then(result => { @@ -301,7 +351,17 @@ export default{ this.$refs.pruefungModal.show(); - } + }, + onSwitchChange() { + if (this.isFilterSet) { + console.log('filter gesetzt: ' + this.defaultSemester + ' uid ' + this.uid); + this.$refs.table.setFilter("studiensemester_kurzbz", "=", this.defaultSemester); + //TODO(Manu) TypeError: this.$refs.table.setFilter is not a function + + } else { + console.log('Alle anzeigen'); + } + }, }, created(){ this.$fhcApi.get('api/frontend/v1/stv/pruefung/getLvsByStudent/' + this.uid) @@ -337,19 +397,41 @@ export default{ template: `
- aktuelles Sem: {{defaultSemester}} + + + aktuelles Sem: {{defaultSemester}}
+ current Sem: {{currentSemester}}
+
+ + + +
- - - - +

From b9911e69c547cdba3ab7448d220d7df3bcb1eea5 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 2 Oct 2024 08:58:24 +0200 Subject: [PATCH 0017/1746] renaming id: Tab Contact --- .../Details/Kontakt/Address.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js index 7c3933f01..d9cdc75b2 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js @@ -196,9 +196,9 @@ export default{ this.resetModal(); this.$refs.adressModal.show(); }, - actionEditAdress(adress_id) { + actionEditAdress(adresse_id) { this.statusNew = false; - this.loadAdress(adress_id).then(() => { + this.loadAdress(adresse_id).then(() => { if(this.addressData.adresse_id) { this.loadPlaces(this.addressData.plz); @@ -207,8 +207,8 @@ export default{ } }); }, - actionDeleteAdress(adress_id) { - this.loadAdress(adress_id).then(() => { + actionDeleteAdress(adresse_id) { + this.loadAdress(adresse_id).then(() => { if(this.addressData.adresse_id) if(this.addressData.heimatadresse) this.$fhcAlert.alertError(this.$p.t('person', 'error_deleteHomeAdress')); @@ -216,7 +216,7 @@ export default{ this.$fhcAlert .confirmDelete() .then(result => result - ? adress_id + ? adresse_id : Promise.reject({handled: true})) .then(this.deleteAddress) .catch(this.$fhcAlert.handleSystemError); @@ -238,17 +238,17 @@ export default{ reload() { this.$refs.table.reloadTable(); }, - loadAdress(adress_id) { + loadAdress(adresse_id) { this.statusNew = false; - return this.$fhcApi.factory.stv.kontakt.loadAddress(adress_id) + return this.$fhcApi.factory.stv.kontakt.loadAddress(adresse_id) .then(result => { this.addressData = result.data; return result; }) .catch(this.$fhcAlert.handleSystemError); }, - updateAddress(adress_id) { - return this.$fhcApi.factory.stv.kontakt.updateAddress(adress_id, + updateAddress(adresse_id) { + return this.$fhcApi.factory.stv.kontakt.updateAddress(adresse_id, this.addressData ).then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); @@ -260,8 +260,8 @@ export default{ this.reload(); }); }, - deleteAddress(adress_id) { - return this.$fhcApi.factory.stv.kontakt.deleteAddress(adress_id) + deleteAddress(adresse_id) { + return this.$fhcApi.factory.stv.kontakt.deleteAddress(adresse_id) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); }).catch(this.$fhcAlert.handleSystemError) From 11b0e770a2aae6ec0d64629ce3859b48976cdcf3 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 7 Oct 2024 16:29:53 +0200 Subject: [PATCH 0018/1746] Added filter lehrtyp_kurzbz to getAutocompleteSuggestions in Lehrveranstaltung_model.php --- .../education/Lehrveranstaltung_model.php | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index de8ebc5c9..f10ba5423 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -20,19 +20,45 @@ class Lehrveranstaltung_model extends DB_Model * @param $eventQuery String * @param string $studiensemester_kurzbz Filter by Studiensemester * @param array $oes Filter by Organisationseinheiten + * @param null $lehrtyp_kurzbz Filter by Lehrtyp 'lv' or 'modul' * @return array */ - public function getAutocompleteSuggestions($eventQuery, $studiensemester_kurzbz = null, $oes = null) + public function getAutocompleteSuggestions($eventQuery, $studiensemester_kurzbz = null, $oes = null, $lehrtyp_kurzbz = null) { - $subQry = $this->_getQryLvsByStudienplan($studiensemester_kurzbz, $oes); + // Subquery + $subQry = $this->_getQryLvsByStudienplan(); $params = []; - /* filter by input string */ - if (is_string($eventQuery)) { + if (isset($studiensemester_kurzbz) && is_string($studiensemester_kurzbz)) + { + /* filter by studiensemester */ + $subQry.= ' AND stplsem.studiensemester_kurzbz = ?'; + $params[] = $studiensemester_kurzbz; + } + + if (isset($oes) && is_array($oes)) + { + /* filter by organisationseinheit */ + $subQry.= ' AND lv.oe_kurzbz IN ?'; + $params[]= $oes; + } + + if (isset($lehrtyp_kurzbz) && is_string($lehrtyp_kurzbz)) + { + /* filter by lehrtyp_kurzbz */ + $subQry .= ' AND lehrtyp_kurzbz = ?'; + $params[] = $lehrtyp_kurzbz; + } + + + if (is_string($eventQuery)) + { + /* filter by input string */ $subQry.= ' AND lv.bezeichnung ILIKE ?'; $params[] = '%' . $eventQuery . '%'; } + // Final Query $qry = 'SELECT DISTINCT ON (lehrveranstaltung_id) * FROM ('. $subQry. ') AS tmp'; return $this->execQuery($qry, $params); From 8744a00ce7e42afe54806d260136302525503731 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 7 Oct 2024 16:34:41 +0200 Subject: [PATCH 0019/1746] Added filter lehrtyp_kurzbz and $oe_column to getLvsByStudienplan in Lehrveranstaltung_model.php .lehrtyp_kurzbz filters by Lehrtyp 'lv' or 'modul' (default no filter) .oe_column is used when filtering $oes: Filter by lv.oe_kurzbz or stg.oe_kurzbz (the stg joined to lv) --- .../education/Lehrveranstaltung_model.php | 49 ++++++++++++++++--- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index f10ba5423..1fb949d7b 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -67,15 +67,50 @@ class Lehrveranstaltung_model extends DB_Model /** * Get Lehrveranstaltungen with its Stg, OE and OE-type. * Filter by Studiensemester and Organisationseinheiten if necessary. - * @param $eventQuery String - * @param string $studiensemester_kurzbz Filter by Studiensemester - * @param array $oes Filter by Organisationseinheiten - * @param array $lv_ids Filter by Lehrveranstaltung-Ids + * @param null|string $studiensemester_kurzbz Filter by Studiensemester + * @param null|array $oes Filter by Organisationseinheiten + * @param null|string $lehrtyp_kurzbz Filter by Lehrtyp 'lv' or 'modul' + * @param null|array $lv_ids Filter by Lehrveranstaltung-Ids + * @param string $oe_column 'lv'|'stg' Used when filtering $oes: Filter by lv.oe_kurzbz or stg.oe_kurzbz (the stg joined to lv) * @return array */ - public function getLvsByStudienplan($studiensemester_kurzbz = null, $oes = null, $lv_ids = null) + public function getLvsByStudienplan($studiensemester_kurzbz = null, $oes = null, $lehrtyp_kurzbz = null, $lv_ids = null, $oe_column = 'lv') { - $subQry = $this->_getQryLvsByStudienplan($studiensemester_kurzbz, $oes); + // Subquery LVs + $subQry = $this->_getQryLvsByStudienplan(); + $params = []; + + if (isset($studiensemester_kurzbz) && is_string($studiensemester_kurzbz)) + { + /* filter by studiensemester */ + $subQry.= ' AND stplsem.studiensemester_kurzbz = ?'; + $params[] = $studiensemester_kurzbz; + } + + if (isset($oes) && is_array($oes)) + { + if ($oe_column === 'lv') + { + /* filter by lv organisationseinheit (Standard behaviour) */ + $subQry.= ' AND lv.oe_kurzbz IN ?'; + } + elseif ($oe_column === 'stg') + { + /* filter by lv studiengangs organisationseinheit () */ + $subQry.= ' AND stg.oe_kurzbz IN ?'; + } + + $params[]= $oes; + } + + if (isset($lehrtyp_kurzbz) && is_string($lehrtyp_kurzbz)) + { + /* filter by lehrtyp_kurzbz */ + $subQry .= ' AND lehrtyp_kurzbz = ?'; + $params[] = $lehrtyp_kurzbz; + } + + // Final Query $qry = 'SELECT * FROM ('. $subQry. ') AS tmp'; if (isset($lv_ids) && is_array($lv_ids)) @@ -87,7 +122,7 @@ class Lehrveranstaltung_model extends DB_Model $qry.= ' ORDER BY stg_typ_kurzbz, orgform_kurzbz DESC'; - return $this->execQuery($qry); + return $this->execQuery($qry, $params); } /** From b08e01f72f8589c0790856b1d656d6ac9df0f252 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 7 Oct 2024 16:37:07 +0200 Subject: [PATCH 0020/1746] Added columns to and moved where-clauses from _getQryLvsByStudienplan to calling methods in Lehrveranstaltung_model.php .added cols lehrtyp_kurzbz and lehrveranstaltung_template_id --- .../education/Lehrveranstaltung_model.php | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index 1fb949d7b..1c601a291 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -130,7 +130,7 @@ class Lehrveranstaltung_model extends DB_Model * * @return string */ - private function _getQryLvsByStudienplan($studiensemester_kurzbz = null, $oes = null, $lehrtyp_kurzbz = 'lv') + private function _getQryLvsByStudienplan() { $qry = ' SELECT @@ -152,6 +152,8 @@ class Lehrveranstaltung_model extends DB_Model lv.lehrveranstaltung_id, lv.semester, lv.bezeichnung AS lv_bezeichnung, + lv.lehrtyp_kurzbz, + lv.lehrveranstaltung_template_id, ( -- comma seperated string of all lehreinheitgruppen SELECT string_agg(bezeichnung, \', \') AS lehreinheitgruppe_bezeichnung @@ -186,23 +188,8 @@ class Lehrveranstaltung_model extends DB_Model JOIN public.tbl_organisationseinheit oe USING (oe_kurzbz) JOIN public.tbl_studiengang stg ON stg.studiengang_kz = sto.studiengang_kz JOIN public.tbl_studiengangstyp stgtyp ON stgtyp.typ = stg.typ - /* filter by lehrtyp_kurzbz, default is lvs only */ - WHERE - lehrtyp_kurzbz = '. $this->db->escape($lehrtyp_kurzbz); - - if (isset($studiensemester_kurzbz) && is_string($studiensemester_kurzbz)) - { - /* filter by studiensemester */ - $qry.= ' AND stplsem.studiensemester_kurzbz = '. $this->db->escape($studiensemester_kurzbz); - - } - - if (isset($oes) && is_array($oes)) - { - /* filter by organisationseinheit */ - $implodedOes = "'". implode("', '", $oes). "'"; - $qry.= ' AND lv.oe_kurzbz IN ('. $implodedOes. ')'; - } + WHERE 1 = 1 + '; return $qry; } From 7096bba958ed8db567532d6812764bda07ccfa48 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 7 Oct 2024 16:37:45 +0200 Subject: [PATCH 0021/1746] Added phrases for Softwarebereitstellung --- system/phrasesupdate.php | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 9a99b21ec..89dc427c3 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -30665,6 +30665,86 @@ array( ) ) ), + array( + 'app' => 'softwarebereitstellung', + 'category' => 'global', + 'phrase' => 'standardLvTemplate', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Standard LV-Template', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Standard Course Template', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'softwarebereitstellung', + 'category' => 'global', + 'phrase' => 'anforderungNachStandardLvTemplate', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Anforderung nach Standard LV-Template', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Request by Standard Course Template', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'softwarebereitstellung', + 'category' => 'global', + 'phrase' => 'swAnforderungUeberAuswahlVonStandardisiertenLvTemplates', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Softwareanforderung über die Auswahl von standardisierten LV-Templates (Quellkurse)", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Software Requirements based on the Selection of Standardized Course-Templates", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'softwarebereitstellung', + 'category' => 'global', + 'phrase' => 'swFuerLvAnfordern', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Software für LV anfordern", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Request software for courses", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), ); From bf1bc8d1a97dbb52c2d1bd30a295a3909058da22 Mon Sep 17 00:00:00 2001 From: Alexei Karpenko Date: Sun, 13 Oct 2024 13:32:15 +0200 Subject: [PATCH 0022/1746] added new contact type email unverifiziert and adresse type meldeadresse (mainly for electronic onboarding) --- system/dbupdate_3.4.php | 1 + ...14_electronic_onboarding_anbindung_ida.php | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 system/dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 11880fd55..d3b7b454d 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -58,6 +58,7 @@ require_once('dbupdate_3.4/17513_Entwicklungsteam.php'); require_once('dbupdate_3.4/28575_softwarebereitstellung.php'); require_once('dbupdate_3.4/41150_oe-pfad_db_view.php'); require_once('dbupdate_3.4/44031_stv_favorites.php'); +require_once('dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/system/dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php b/system/dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php new file mode 100644 index 000000000..ccc0a5827 --- /dev/null +++ b/system/dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php @@ -0,0 +1,30 @@ +db_query("SELECT 1 FROM public.tbl_kontakttyp WHERE kontakttyp='email_unverifiziert'")) +{ + if($db->db_num_rows($result)==0) + { + $qry = "INSERT INTO public.tbl_kontakttyp(kontakttyp, beschreibung, bezeichnung_mehrsprachig) VALUES('email_unverifiziert', 'Unverifizierte E-Mail', '{\"Unverifizierte E-Mail\", \"Unverified email\"}');"; + + if(!$db->db_query($qry)) + echo 'Kontakttyp: '.$db->db_last_error().'
'; + else + echo '
Neuen Kontakttyp E-Mail unverifiziert in public.tbl_kontakttyp hinzugefügt'; + } +} + +// public.tbl_adressentyp: add type Meldeadresse +if($result = $db->db_query("SELECT 1 FROM public.tbl_adressentyp WHERE adressentyp_kurzbz='m'")) +{ + if($db->db_num_rows($result)==0) + { + $qry = "INSERT INTO public.tbl_adressentyp(adressentyp_kurzbz, bezeichnung, bezeichnung_mehrsprachig, sort) VALUES('m', 'Meldeadresse', '{\"Meldeadresse\", \"Registered adress\"}', 6);"; + + if(!$db->db_query($qry)) + echo 'Adressentyp: '.$db->db_last_error().'
'; + else + echo '
Neue Adressentyp Meldeadresse in public.tbl_adressentyp hinzugefügt'; + } +} From 322544c7fb0746c85934e21d232845f7f38971e6 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Mon, 14 Oct 2024 11:20:46 +0200 Subject: [PATCH 0023/1746] dynamic image url for searchresults --- application/config/search.php | 15 ++++++++++++--- application/libraries/SearchBarLib.php | 1 - .../components/searchbar/result/mergedperson.js | 12 ++++-------- public/js/components/searchbar/result/person.js | 9 +-------- .../js/components/searchbar/result/prestudent.js | 9 +-------- public/js/components/searchbar/result/student.js | 9 +-------- 6 files changed, 19 insertions(+), 36 deletions(-) diff --git a/application/config/search.php b/application/config/search.php index ac6189527..14b6e89d8 100644 --- a/application/config/search.php +++ b/application/config/search.php @@ -74,7 +74,10 @@ $config['person'] = [ "p.person_id", "(p.vorname || ' ' || p.nachname) AS name", "ARRAY( SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp = 'email' AND person_id=p.person_id ) AS email", - "p.foto" + "CASE + WHEN p.foto IS NOT NULL THEN 'data:image/jpeg' || CONVERT_FROM(DECODE('3b','hex'), 'UTF8') || 'base64,' || p.foto + ELSE NULL END + AS photo_url" ], 'resultjoin' => " JOIN public.tbl_person p USING (person_id) @@ -200,7 +203,10 @@ $config['student'] = [ "p.person_id", "(p.vorname || ' ' || p.nachname) AS name", "ARRAY( SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp = 'email' AND person_id=p.person_id ) AS email", - "p.foto" + "CASE + WHEN p.foto IS NOT NULL THEN 'data:image/jpeg' || CONVERT_FROM(DECODE('3b','hex'), 'UTF8') || 'base64,' || p.foto + ELSE NULL END + AS photo_url" ], 'resultjoin' => " JOIN public.tbl_student s USING (student_uid) @@ -298,7 +304,10 @@ $config['prestudent'] = [ "b.uid", "(p.vorname || ' ' || p.nachname) AS name", "ARRAY( SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp = 'email' AND person_id=p.person_id ) AS email", - "p.foto", + "CASE + WHEN p.foto IS NOT NULL THEN 'data:image/jpeg' || CONVERT_FROM(DECODE('3b','hex'), 'UTF8') || 'base64,' || p.foto + ELSE NULL END + AS photo_url", "UPPER(sg.typ || sg.kurzbz) AS stg_kuerzel", "sg.bezeichnung", "( diff --git a/application/libraries/SearchBarLib.php b/application/libraries/SearchBarLib.php index 6547cd107..c3528978d 100644 --- a/application/libraries/SearchBarLib.php +++ b/application/libraries/SearchBarLib.php @@ -228,7 +228,6 @@ class SearchBarLib GROUP BY " . $table_config['primarykey'] . " )"; - $other_selects = $selects[] = " SELECT " . $this->_ci->db->escape($type) . " AS type, diff --git a/public/js/components/searchbar/result/mergedperson.js b/public/js/components/searchbar/result/mergedperson.js index f6b07f3d2..09b967b2f 100644 --- a/public/js/components/searchbar/result/mergedperson.js +++ b/public/js/components/searchbar/result/mergedperson.js @@ -20,8 +20,9 @@ export default { if (person.length) return person.pop(); - const { person_id, name, foto, photo_url, email } = this.res.list[0]; - return { person_id, name, foto, photo_url, email }; + // TODO(chris): first one might have not one of these but a later one + const { person_id, name, photo_url, email } = this.res.list[0]; + return { person_id, name, photo_url, email }; }, employee() { const ma = this.res.list.filter(item => [ @@ -34,11 +35,6 @@ export default { const students = this.res.list.filter(item => item.type == 'prestudent'); return students.length ? students : null; }, - foto() { - if (this.person.foto) - return 'data:image/jpeg;base64,' + this.person.foto; - return this.person.photo_url; - }, emails() { if (Array.isArray(this.person.email)) return this.person.email; @@ -51,7 +47,7 @@ export default { :res="person" :actions="actions" :title="person.name" - :image="foto" + :image="this.person.photo_url" image-fallback="fas fa-user-circle fa-7x" @actionexecuted="$emit('actionexecuted')" > diff --git a/public/js/components/searchbar/result/person.js b/public/js/components/searchbar/result/person.js index f8adee56e..65155a95f 100644 --- a/public/js/components/searchbar/result/person.js +++ b/public/js/components/searchbar/result/person.js @@ -9,20 +9,13 @@ export default { res: Object, actions: Object }, - computed: { - foto() { - if (this.res.foto) - return 'data:image/jpeg;base64,' + this.res.foto; - return null; - } - }, template: ` diff --git a/public/js/components/searchbar/result/prestudent.js b/public/js/components/searchbar/result/prestudent.js index 8c174d3c0..662069b75 100644 --- a/public/js/components/searchbar/result/prestudent.js +++ b/public/js/components/searchbar/result/prestudent.js @@ -9,20 +9,13 @@ export default { res: Object, actions: Object }, - computed: { - foto() { - if (this.res.foto) - return 'data:image/jpeg;base64,' + this.res.foto; - return null; - } - }, template: ` diff --git a/public/js/components/searchbar/result/student.js b/public/js/components/searchbar/result/student.js index 8d8c4894b..93033d08b 100644 --- a/public/js/components/searchbar/result/student.js +++ b/public/js/components/searchbar/result/student.js @@ -9,20 +9,13 @@ export default { res: Object, actions: Object }, - computed: { - foto() { - if (this.res.foto) - return 'data:image/jpeg;base64,' + this.res.foto; - return null; - } - }, template: ` From 123f29a75062d5008fbfdd8b55370f09404ba93e Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Mon, 14 Oct 2024 11:22:20 +0200 Subject: [PATCH 0024/1746] CMS Search --- application/config/search.php | 94 +++++++++++++++++++ application/config/searchfunctions.php | 2 +- .../controllers/api/frontend/v1/Language.php | 47 ++++++++++ application/libraries/SearchBarLib.php | 6 ++ public/js/api/fhcapifactory.js | 4 +- public/js/api/language.js | 22 +++++ public/js/components/searchbar/result/cms.js | 81 ++++++++++++++++ public/js/components/searchbar/searchbar.js | 34 ++++++- system/dbupdate_3.4/40128_search.php | 15 +++ 9 files changed, 298 insertions(+), 7 deletions(-) create mode 100644 application/controllers/api/frontend/v1/Language.php create mode 100644 public/js/api/language.js create mode 100644 public/js/components/searchbar/result/cms.js diff --git a/application/config/search.php b/application/config/search.php index 14b6e89d8..f52d755dd 100644 --- a/application/config/search.php +++ b/application/config/search.php @@ -671,3 +671,97 @@ $config['room'] = [ LEFT JOIN public.tbl_adresse address USING (adresse_id)" ]; + +$config['cms'] = [ + 'primarykey' => 'contentsprache_id', + 'table' => 'cms', + 'prepare' => " + cms_auth (content_id) AS ( + SELECT content_id + FROM campus.tbl_content c + WHERE NOT EXISTS (SELECT 1 FROM campus.tbl_contentgruppe g WHERE g.content_id=c.content_id) + UNION + SELECT content_id + FROM public.vw_gruppen g + JOIN campus.tbl_contentgruppe c USING (gruppe_kurzbz) + WHERE uid = (TABLE auth) + ), + cms_active (content_id, template_kurzbz) AS ( + SELECT content_id, template_kurzbz + FROM cms_auth + JOIN campus.tbl_content USING (content_id) + WHERE aktiv = TRUE + ), + cms_active_redirect (content_id) AS ( + SELECT content_id + FROM cms_active + WHERE template_kurzbz = 'redirect' + ), + cms_active_redirect_linked (content_id) AS ( + SELECT content_id + FROM cms_active_redirect + JOIN campus.tbl_contentsprache USING (content_id) + WHERE LEFT((xpath('string(/content/url)', content))[1]::text, 1) <> '#' + ), + cms_active_others (content_id) AS ( + SELECT content_id + FROM cms_active + WHERE template_kurzbz IN ('contentmittitel', 'contentohnetitel', 'contentmittitel_filterwidget') + ), + cms (contentsprache_id) AS ( + SELECT contentsprache_id + FROM campus.tbl_contentsprache + WHERE content_id IN ( + SELECT content_id + FROM cms_active_redirect_linked + UNION + SELECT content_id + FROM cms_active_others + ) + AND version = campus.get_highest_content_version(content_id) + ) + ", + 'searchfields' => [ + 'content' => [ + 'alias' => ['inhalt'], + 'comparison' => "vector", + 'field' => "(setweight(to_tsvector('simple', COALESCE(titel, '')), 'A') || setweight(to_tsvector('simple', COALESCE(content, '')::text), 'B'))", + 'join' => [ + 'table' => "campus.tbl_contentsprache", + 'using' => "contentsprache_id" + ] + ], + 'content_id' => [ + 'alias' => ['id'], + 'comparison' => "equal-int", + 'field' => "content_id", + 'join' => [ + 'table' => "campus.tbl_contentsprache", + 'using' => "contentsprache_id" + ] + ], + 'lang' => [ + 'alias' => ['language', 'sprache'], + 'comparison' => "equals", + 'field' => "sprache", + 'join' => [ + 'table' => "campus.tbl_contentsprache", + 'using' => "contentsprache_id" + ] + ] + ], + 'resultfields' => [ + "contentsprache.content_id", + "content.template_kurzbz", + "contentsprache.version", + "contentsprache.sprache AS language", + "contentsprache.titel AS title", + "contentsprache.content", + "(xpath('string(/content/url)', contentsprache.content))[1] AS content_url" + ], + 'resultjoin' => " + JOIN campus.tbl_contentsprache contentsprache + USING (contentsprache_id) + JOIN campus.tbl_content content + USING (content_id)" +]; diff --git a/application/config/searchfunctions.php b/application/config/searchfunctions.php index c8244e9a3..898069aed 100644 --- a/application/config/searchfunctions.php +++ b/application/config/searchfunctions.php @@ -25,7 +25,7 @@ $config['similar'] = [ $config['vector'] = [ 'priority' => 1, - 'rank' => "ts_rank_cd({field}, to_tsquery('simple', {word}))", + 'rank' => "ts_rank({field}, to_tsquery('simple', {word}))", 'compare' => "to_tsquery('simple', {word}) @@ {field}" ]; diff --git a/application/controllers/api/frontend/v1/Language.php b/application/controllers/api/frontend/v1/Language.php new file mode 100644 index 000000000..797af4804 --- /dev/null +++ b/application/controllers/api/frontend/v1/Language.php @@ -0,0 +1,47 @@ +. + */ + +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 languages + * This controller works with JSON calls on the HTTP GET and the output is always JSON + */ +class Language extends FHCAPI_Controller +{ + public function __construct() + { + parent::__construct([ + 'get' => self::PERM_LOGGED + ]); + + // Load models + $this->load->model('system/Sprache_model', 'SpracheModel'); + } + + public function get() + { + $this->SpracheModel->addOrder('sprache'); + + $result = $this->SpracheModel->load(); + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } +} diff --git a/application/libraries/SearchBarLib.php b/application/libraries/SearchBarLib.php index c3528978d..782e30843 100644 --- a/application/libraries/SearchBarLib.php +++ b/application/libraries/SearchBarLib.php @@ -168,6 +168,9 @@ class SearchBarLib FROM public.tbl_sprache WHERE sprache=" . $this->_ci->db->escape($lang) . " LIMIT 1 + ), + auth (uid) AS ( + SELECT " . $this->_ci->db->escape(getAuthUID()) . " AS uid )"; if ($sql_with) { @@ -248,6 +251,9 @@ class SearchBarLib WHERE sprache=" . $this->_ci->db->escape($lang) . " LIMIT 1 )"); + array_unshift($with, "auth (uid) AS ( + SELECT " . $this->_ci->db->escape(getAuthUID()) . " AS uid + )"); return success(" WITH " . implode(", ", $with) . " diff --git a/public/js/api/fhcapifactory.js b/public/js/api/fhcapifactory.js index 655bfa409..26ed8847b 100644 --- a/public/js/api/fhcapifactory.js +++ b/public/js/api/fhcapifactory.js @@ -23,6 +23,7 @@ import studstatus from "./studstatus.js"; import stv from "./stv.js"; import notiz from "./notiz.js"; import betriebsmittel from "./betriebsmittel.js"; +import language from "./language.js"; export default { search, @@ -32,5 +33,6 @@ export default { studstatus, stv, notiz, - betriebsmittel + betriebsmittel, + language }; diff --git a/public/js/api/language.js b/public/js/api/language.js new file mode 100644 index 000000000..6a11d193b --- /dev/null +++ b/public/js/api/language.js @@ -0,0 +1,22 @@ +/** + * 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 . + */ + +export default { + getAll() { + return this.$fhcApi.get('/api/frontend/v1/language/get'); + } +}; \ No newline at end of file diff --git a/public/js/components/searchbar/result/cms.js b/public/js/components/searchbar/result/cms.js new file mode 100644 index 000000000..af2d6b0bb --- /dev/null +++ b/public/js/components/searchbar/result/cms.js @@ -0,0 +1,81 @@ +import TemplateFrame from "./template/frame.js"; + +export default { + components: { + TemplateFrame + }, + emits: [ 'actionexecuted' ], + props: { + res: Object, + actions: Object + }, + inject: [ + 'languages', + 'query' + ], + computed: { + preview() { + if (this.res.template_kurzbz != 'redirect') { + let text = this.res.content.replace(//ig, '').replace(/<[^>]+>/ig, '').replace(/^\s+|\s+$/g, ''); + + if (text.length > 1000) { + // NOTE(chris): focus on searched text! + let lower = text.toLowerCase(); + let firstOccurence = Math.min(this.query.split(' ').reduce((a, c) => { + // NOTE(chris): filter query for words that affects the content field and get the lowest index of them + if (c == 'or') + return a; + let i = c.indexOf(':'); + if (i < 0 || (i > 0 && ['content', 'inhalt'].includes(c.split(':')[0]))) { + let posInText = lower.indexOf(c); + if (posInText >= 0) + a.push(posInText); + } + return a; + }, [])); + + if (firstOccurence) { + if (firstOccurence + 997 >= text.length) { + firstOccurence = text.length - 997; + if (firstOccurence > 0) + return '...' + text.substr(firstOccurence, 997); + } else { + return '...' + text.substr(firstOccurence, 994) + '...'; + } + } + + text = text.substr(0, 997) + '...'; + } + + return text; + } + + let url = this.res.content_url; + if (url.substr(0, 16) == '../index.ci.php/') + url = this.$fhcApi.getUri(url.substr(16)); + else if (url.substr(0, 3) == '../') + url = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/\/+$/, '') + url.substr(2); + return '' + url + ''; + }, + flag() { + if (!this.languages || !this.languages[this.res.language]) + return ""; + return "data:image/jpeg;base64," + this.languages[this.res.language].flagge; + } + }, + template: ` + + +
+
+ No Content +
+
` +}; \ No newline at end of file diff --git a/public/js/components/searchbar/searchbar.js b/public/js/components/searchbar/searchbar.js index 54049679e..8ac64e856 100644 --- a/public/js/components/searchbar/searchbar.js +++ b/public/js/components/searchbar/searchbar.js @@ -4,6 +4,7 @@ import ResultPrestudent from "./result/prestudent.js"; import ResultEmployee from "./result/employee.js"; import ResultOrganisationunit from "./result/organisationunit.js"; import ResultRoom from "./result/room.js"; +import ResultCms from "./result/cms.js"; import ResultMergedperson from "./result/mergedperson.js"; import ResultMergedstudent from "./result/mergedstudent.js"; @@ -17,10 +18,17 @@ export default { ResultEmployee, ResultOrganisationunit, ResultRoom, + ResultCms, ResultMergedperson, ResultMergedstudent }, props: [ "searchoptions", "searchfunction" ], + provide() { + return { + languages: Vue.computed(() => this.languages), + query: Vue.computed(() => this.lastQuery) + }; + }, data() { return { searchtimer: null, @@ -35,9 +43,22 @@ export default { searching: false, error: null, abortController: null, - retry: 5 + retry: 0, + languages: null, + lastQuery: '' }; }, + created() { + this.$fhcApi.factory + .language.getAll() + .then(result => { + this.languages = result.data.reduce((a, c) => { + a[c.sprache] = c; + return a; + }, {}); + }) + .catch(this.$fhcAlert.handleSystemError); + }, beforeMount() { this.updateSearchOptions(); }, @@ -82,12 +103,14 @@ export default { this.abortController = new AbortController(); this - .searchfunction(this.searchsettings, { signal: this.abortController.signal }) + .searchfunction(this.searchsettings, { timeout: 50000, signal: this.abortController.signal }) .then(response => { if (!response.data) { this.error = 'Bei der Suche ist ein Fehler aufgetreten.'; } else { let res = response.data.map(el => ({...el, ...JSON.parse(el.data)})); + this.lastQuery = response.meta.searchstring; + if (this.searchoptions.mergeResults) { let counter = 0; let mergeTypes = []; @@ -131,11 +154,11 @@ export default { this.searchresult = res; } this.searching = false; - this.retry = 5; + this.retry = 0; }) .catch(error => { if (error.code == "ERR_CANCELED") { - return this.retry = 5; + return this.retry = 0; } if (error.code == "ECONNABORTED" && this.retry) { this.retry--; @@ -144,7 +167,7 @@ export default { this.error = 'Bei der Suche ist ein Fehler aufgetreten.' + ' ' + error.message; this.searching = false; - this.retry = 5; + this.retry = 0; }); }, refreshsearch() { @@ -239,6 +262,7 @@ export default { +
Unbekannter Ergebnistyp: '{{ res.type }}'.
diff --git a/system/dbupdate_3.4/40128_search.php b/system/dbupdate_3.4/40128_search.php index 2ef8f8b4a..92e1a10fd 100644 --- a/system/dbupdate_3.4/40128_search.php +++ b/system/dbupdate_3.4/40128_search.php @@ -169,3 +169,18 @@ FROM pg_indexes WHERE indexname = 'idx_tbl_organisationseinheit_fts_bezeichnung_ else echo 'public.tbl_organisationseinheit: added index "idx_tbl_organisationseinheit_fts_bezeichnung_vector"
'; } +// Add index for titel || ' ' || content to campus.tbl_contentsprache +if (!$db->db_num_rows(@$db->db_query("SELECT 1 +FROM pg_indexes WHERE indexname = 'idx_tbl_contentsprache_fts_titel_content_vector' LIMIT 1;"))) +{ + $qry = " + CREATE INDEX idx_tbl_contentsprache_fts_titel_content_vector + ON campus.tbl_contentsprache + USING GIN ((setweight(to_tsvector('simple', COALESCE(titel, '')), 'A') || setweight(to_tsvector('simple', COALESCE(content, '')::text), 'B'))); + "; + + if (!$db->db_query($qry)) + echo 'campus.tbl_contentsprache ' . $db->db_last_error() . '
'; + else + echo 'campus.tbl_contentsprache: added index "idx_tbl_contentsprache_fts_titel_content_vector"
'; +} From 5cee80ed124e28205145d6ec723234764609ba3f Mon Sep 17 00:00:00 2001 From: ma0048 Date: Fri, 18 Oct 2024 13:24:39 +0200 Subject: [PATCH 0025/1746] - rtliste automatisierte messages --- public/js/plugin/FhcAlert.js | 26 ++++++++++++++++++++ system/dbupdate_3.4.php | 2 ++ system/dbupdate_3.4/37620_reihungslisten.php | 13 ++++++++++ vilesci/stammdaten/auswertung_fhtw.php | 18 ++++++++++++-- 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 system/dbupdate_3.4/37620_reihungslisten.php diff --git a/public/js/plugin/FhcAlert.js b/public/js/plugin/FhcAlert.js index b079bf98e..aa8c7a3cc 100644 --- a/public/js/plugin/FhcAlert.js +++ b/public/js/plugin/FhcAlert.js @@ -60,6 +60,13 @@ * Displays a confirmation dialog and returns a Promise which resolves * with true or false depending und the pressed button. * @return Promise + * + * confirm + * ------------ + * Displays a confirmation dialog and returns a Promise which resolves + * with true or false depending und the pressed button. + * @param string message + * @return Promise * * alertDefault * ------------ @@ -226,6 +233,25 @@ export default { }); }); }, + confirm(message) { + return new Promise((resolve, reject) => { + helperAppInstance.$confirm.require({ + group: 'fhcAlertConfirm', + header: 'Achtung', + message: message, + acceptLabel: 'Ja', + acceptClass: 'btn btn-success', + rejectLabel: 'Abbrechen', + rejectClass: 'btn btn-outline-secondary', + accept() { + resolve(true); + }, + reject() { + resolve(false); + }, + }); + }); + }, alertDefault(severity, title, message, sticky = false) { let options = { severity: severity, summary: title, detail: message}; diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 11880fd55..ca8b42db9 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -58,6 +58,8 @@ require_once('dbupdate_3.4/17513_Entwicklungsteam.php'); require_once('dbupdate_3.4/28575_softwarebereitstellung.php'); require_once('dbupdate_3.4/41150_oe-pfad_db_view.php'); require_once('dbupdate_3.4/44031_stv_favorites.php'); +require_once('dbupdate_3.4/37620_reihungslisten.php'); + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/system/dbupdate_3.4/37620_reihungslisten.php b/system/dbupdate_3.4/37620_reihungslisten.php new file mode 100644 index 000000000..950d6af0e --- /dev/null +++ b/system/dbupdate_3.4/37620_reihungslisten.php @@ -0,0 +1,13 @@ +db_query("SELECT 1 FROM public.tbl_buchungstyp WHERE buchungstyp_kurzbz = 'KautionDrittStaat';")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO public.tbl_buchungstyp (buchungstyp_kurzbz, beschreibung, standardtext, standardbetrag) VALUES ('KautionDrittStaat', 'Kaution', 'Deposit for application, third countries', '-250');"; + if (!$db->db_query($qry)) + echo 'public.tbl_buchungstyp '.$db->db_last_error().'
'; + else + echo ' public.tbl_buchungstyp: Added buchungstyp "KautionDrittStaat"
'; + } +} \ No newline at end of file diff --git a/vilesci/stammdaten/auswertung_fhtw.php b/vilesci/stammdaten/auswertung_fhtw.php index aa39889cb..10809dc4f 100644 --- a/vilesci/stammdaten/auswertung_fhtw.php +++ b/vilesci/stammdaten/auswertung_fhtw.php @@ -1220,6 +1220,7 @@ $reihungstest = isset($_REQUEST['reihungstest']) ? $_REQUEST['reihungstest'] : ' $studiengang = isset($_REQUEST['studiengang']) ? $_REQUEST['studiengang'] : ''; $semester = isset($_REQUEST['semester']) ? $_REQUEST['semester'] : ''; $prestudent_id = isset($_REQUEST['prestudent_id']) ? $_REQUEST['prestudent_id'] : ''; +$prestudent_ids = isset($_REQUEST['prestudent_ids']) ? $_REQUEST['prestudent_ids'] : ''; $orgform_kurzbz = isset($_REQUEST['orgform_kurzbz']) ? $_REQUEST['orgform_kurzbz'] : ''; $format = (isset($_REQUEST['format']) ? $_REQUEST['format'] : ''); $stgtyp = (isset($_REQUEST['stgtyp']) ? $_REQUEST['stgtyp'] : ''); @@ -1259,7 +1260,7 @@ if ($prestudent_id != '' && !is_numeric($prestudent_id)) { die('PrestudentID ist ungueltig'); } -if (isset($_POST['rtauswsubmit']) && $reihungstest == '' && $studiengang == '' && $semester == '' && $prestudent_id == '' && $datum_von == '' && $datum_bis == '') +if (isset($_POST['rtauswsubmit']) && $reihungstest == '' && $studiengang == '' && $semester == '' && $prestudent_id == '' && $datum_von == '' && $datum_bis == '' && $prestudent_ids == '') { die('Waehlen Sie bitte mindestens eine der Optionen aus'); } @@ -1378,6 +1379,10 @@ if (isset($_REQUEST['reihungstest']) || isset($_POST['rtauswsubmit'])) { $query .= " AND ps.prestudent_id=" . $db->db_add_param($prestudent_id, FHC_INTEGER); } + if ($prestudent_ids != '') + { + $query .= " AND ps.prestudent_id IN (" .$db->db_implode4SQL(explode(',', $prestudent_ids)) . ")"; + } if ($orgform_kurzbz != '' && $studiengang != '') { $query .= " AND (tbl_ablauf.studienplan_id=( @@ -1611,6 +1616,10 @@ if (isset($_REQUEST['reihungstest']) || isset($_POST['rtauswsubmit'])) { $query .= " AND ps.prestudent_id=" . $db->db_add_param($prestudent_id, FHC_INTEGER); } + if ($prestudent_ids != '') + { + $query .= " AND ps.prestudent_id IN (" .$db->db_implode4SQL(explode(',',$prestudent_ids)) . ")"; + } if ($orgform_kurzbz != '') { //$query .= " AND tbl_prestudentstatus.orgform_kurzbz=" . $db->db_add_param($orgform_kurzbz); @@ -2890,7 +2899,7 @@ else $selectedrtstr = ''; $checkbxstr = ''; $first = true; - $noparamsselected = $prestudent_id == '' && $reihungstest == '' && $datum_von == '' && $datum_bis == '' && $studiengang == '' && $semester == ''; + $noparamsselected = $prestudent_id == '' && $reihungstest == '' && $datum_von == '' && $datum_bis == '' && $studiengang == '' && $semester == '' && $prestudent_ids == ''; //$maxeachline = 1; foreach ($rtest as $rt) { @@ -3006,6 +3015,9 @@ else echo ''; echo ''; echo 'PrestudentIn: '; + echo ''; + echo ''; + echo 'PrestudentIn (Mehrfachauswahl): '; echo ' '; echo '

'; @@ -3014,6 +3026,7 @@ else &datum_von=' . $datum_von . ' &datum_bis=' . $datum_bis . ' &prestudent_id=' . $prestudent_id . ' + &' . http_build_query(array('prestudent_ids' => $prestudent_ids)) . ' &' . http_build_query(array('reihungstest' => $reihungstest)) . ' &orgform_kurzbz=' . $orgform_kurzbz . ' &stgtyp=' . $stgtyp . ' @@ -3067,6 +3080,7 @@ else datum_von=' . $datum_von . '& datum_bis=' . $datum_bis . '& prestudent_id=' . $prestudent_id . '& + &' . http_build_query(array('prestudent_ids' => $prestudent_ids)) . ' &' . http_build_query(array('reihungstest' => $reihungstest)) . '">
'; echo '
'; From b8ff37eb8edfd28c897119d032c517533663574f Mon Sep 17 00:00:00 2001 From: Alexei Karpenko Date: Sat, 19 Oct 2024 17:25:09 +0200 Subject: [PATCH 0026/1746] added kontakt verifikation table for saving of kontakt verifikation data, added model for the table --- .../person/Kontaktverifikation_model.php | 42 ++++++++++++++++ ...14_electronic_onboarding_anbindung_ida.php | 48 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 application/models/person/Kontaktverifikation_model.php diff --git a/application/models/person/Kontaktverifikation_model.php b/application/models/person/Kontaktverifikation_model.php new file mode 100644 index 000000000..b15439edb --- /dev/null +++ b/application/models/person/Kontaktverifikation_model.php @@ -0,0 +1,42 @@ +dbTable = 'public.tbl_kontakt_verifikation'; + $this->pk = 'kontakt_verifikation_id'; + } + + /** + * Gets contact verification for a person and a verification code + * @param person_id + * @param kontakttyp + * @param verifikation_code + * @param expiration_days number of days after which verifikation code expires + * @return object success or error + */ + public function getKontaktVerifikation($person_id, $kontakttyp, $verifikation_code, $expiration_days = 1) + { + $qry = " + SELECT + kt.kontakt_id, + kv.verifikation_code + FROM + public.tbl_kontakt_verifikation kv + JOIN public.tbl_kontakt kt USING(kontakt_id) + WHERE kt.person_id = ? + AND kt.kontakttyp = ? + AND kv.verifikation_code = ? + AND kv.erstelldatum >= NOW() - INTERVAL '".$this->escape($expiration_days)." days' + ORDER BY + kt.kontakt_id DESC + LIMIT 1"; + + return $this->execQuery($qry, array($person_id, $kontakttyp, $verifikation_code)); + } +} diff --git a/system/dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php b/system/dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php index ccc0a5827..b204d45aa 100644 --- a/system/dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php +++ b/system/dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php @@ -28,3 +28,51 @@ if($result = $db->db_query("SELECT 1 FROM public.tbl_adressentyp WHERE adressent echo '
Neue Adressentyp Meldeadresse in public.tbl_adressentyp hinzugefügt'; } } + +if (!$result = @$db->db_query('SELECT 1 FROM public.tbl_kontakt_verifikation LIMIT 1')) +{ + $qry = "CREATE SEQUENCE public.tbl_kontakt_verifikation_kontakt_verifikation_id_seq + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + START WITH 1 + CACHE 1 + NO CYCLE; + + CREATE TABLE public.tbl_kontakt_verifikation + ( + kontakt_verifikation_id integer DEFAULT nextval('public.tbl_kontakt_verifikation_kontakt_verifikation_id_seq'::regclass), + kontakt_id integer UNIQUE NOT NULL, + verifikation_code varchar(32) UNIQUE NOT NULL, + erstelldatum timestamp without time zone, + verifikation_datum timestamp without time zone, + app varchar(32), + CONSTRAINT pk_tbl_kontakt_verifikation_id PRIMARY KEY (kontakt_verifikation_id) + ); + + ALTER TABLE public.tbl_kontakt_verifikation ADD CONSTRAINT fk_tbl_kontakt_verifikation_kontakt_id FOREIGN KEY (kontakt_id) + REFERENCES public.tbl_kontakt (kontakt_id) + ON DELETE CASCADE ON UPDATE CASCADE; + + ALTER TABLE public.tbl_kontakt_verifikation ADD CONSTRAINT fk_tbl_kontakt_verifikation_app FOREIGN KEY (app) + REFERENCES system.tbl_app (app) + ON DELETE RESTRICT ON UPDATE CASCADE; + + COMMENT ON TABLE public.tbl_kontakt_verifikation IS 'Contact verification'; + COMMENT ON COLUMN public.tbl_kontakt_verifikation.kontakt_id IS 'Contact to verify'; + COMMENT ON COLUMN public.tbl_kontakt_verifikation.verifikation_code IS 'Code generated for verification'; + COMMENT ON COLUMN public.tbl_kontakt_verifikation.erstelldatum IS 'Time when verification code was generated'; + COMMENT ON COLUMN public.tbl_kontakt_verifikation.verifikation_datum IS 'Time when contact was verified'; + COMMENT ON COLUMN public.tbl_kontakt_verifikation.app IS 'App where contact was verified'; + + GRANT SELECT, UPDATE, INSERT, DELETE ON public.tbl_kontakt_verifikation TO web; + GRANT SELECT, UPDATE, INSERT, DELETE ON public.tbl_kontakt_verifikation TO vilesci; + GRANT SELECT, UPDATE ON public.tbl_kontakt_verifikation_kontakt_verifikation_id_seq TO vilesci; + GRANT SELECT, UPDATE ON public.tbl_kontakt_verifikation_kontakt_verifikation_id_seq TO web; + "; + + if(!$db->db_query($qry)) + echo 'public.tbl_kontakt_verifikation: '.$db->db_last_error().'
'; + else + echo ' public.tbl_kontakt_verifikation: Tabelle hinzugefuegt
'; +} From dcb24415fcb75f75f920ad0bffb1f61135f41559 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 21 Oct 2024 14:02:25 +0200 Subject: [PATCH 0027/1746] Added phrases 'errorConfigFehlt' and 'errorUnbekannteUrl' --- system/phrasesupdate.php | 42 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 59c4a2246..a8d80a4af 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -31165,7 +31165,47 @@ array( 'insertvon' => 'system' ) ) - ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'errorConfigFehlt', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Config-Eintrag fehlt", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Missing config entry", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'errorUnbekannteUrl', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Unbekannte URL. Seite bzw. Link kann nicht geöffnet werden.", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Unknown URL. Cannot open to site or link", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), ); From 8787558fef91b6eb9a6d886f79b45d944d9d6a97 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 22 Oct 2024 15:58:02 +0200 Subject: [PATCH 0028/1746] cleanUp Tasks Tab PrestudentIn --- application/config/stv.php | 22 +++ .../api/frontend/v1/stv/Config.php | 8 +- .../api/frontend/v1/stv/Prestudent.php | 12 ++ .../models/codex/Bisstandort_model.php | 14 ++ application/views/Studentenverwaltung.php | 6 +- public/js/api/stv/prestudent.js | 38 ++++ .../Studentenverwaltung/Details/Prestudent.js | 174 ++++++++++-------- .../Details/Prestudent/MultiStatus.js | 1 + 8 files changed, 198 insertions(+), 77 deletions(-) create mode 100644 application/config/stv.php create mode 100644 application/models/codex/Bisstandort_model.php diff --git a/application/config/stv.php b/application/config/stv.php new file mode 100644 index 000000000..6296e8e6b --- /dev/null +++ b/application/config/stv.php @@ -0,0 +1,22 @@ + [ + + //all fields can be configured to be hidden, see class attribute stv-prestudent-prestudent-name for name + 'hiddenFields' => [ + + //corresponding to config-entry 'ZGV_DOKTOR_ANZEIGEN' in global.config + 'zgvdoktor_code', 'zgvdoktorort', 'zgvdoktordatum', 'zgvdoktornation', 'zgvdoktor_erfuellt', + + //corresponding to config-entry 'ZGV_ERFUELLT_ANZEIGEN' in global.config + 'zgv_erfuellt', 'zgvmas_erfuellt','zgvdoktor_erfuellt', + + //propably used by FH-Communities + 'aufnahmeschluessel', 'standort_code', 'facheinschlaegigBerufstaetig' + + ], + 'hideUDFs' => false + ] +]; \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index c28c49485..97477fca7 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -46,11 +46,16 @@ class Config extends FHCAPI_Controller 'stv', 'konto' ]); + + // Load Config + $this->load->config('stv'); } public function student() { $result = []; + $config = $this->config->item('tabs'); + $result['details'] = [ 'title' => $this->p->t('stv', 'tab_details'), 'component' => './Stv/Studentenverwaltung/Details/Details.js' @@ -69,7 +74,8 @@ class Config extends FHCAPI_Controller ]; $result['prestudent'] = [ 'title' => $this->p->t('stv', 'tab_prestudent'), - 'component' => './Stv/Studentenverwaltung/Details/Prestudent.js' + 'component' => './Stv/Studentenverwaltung/Details/Prestudent.js', + 'config' => $config['prestudent'] ]; $result['status'] = [ 'title' => 'Status', diff --git a/application/controllers/api/frontend/v1/stv/Prestudent.php b/application/controllers/api/frontend/v1/stv/Prestudent.php index ef9aeb111..0b06b9667 100644 --- a/application/controllers/api/frontend/v1/stv/Prestudent.php +++ b/application/controllers/api/frontend/v1/stv/Prestudent.php @@ -19,6 +19,7 @@ class Prestudent extends FHCAPI_Controller 'getAufmerksamdurch' => ['admin:r', 'assistenz:r'], 'getBerufstaetigkeit' => ['admin:r', 'assistenz:r'], 'getTypenStg' => ['admin:r', 'assistenz:r'], + 'getBisstandort' => ['admin:r', 'assistenz:r'], 'getStudienplaene' => ['admin:r', 'assistenz:r'], 'getStudiengang' => ['admin:r', 'assistenz:r'] ]); @@ -265,6 +266,17 @@ class Prestudent extends FHCAPI_Controller return $this->terminateWithSuccess(getData($result) ?: []); } + public function getBisstandort() + { + $this->load->model('codex/Bisstandort_model', 'BisstandortModel'); + + $result = $this->BisstandortModel->load(); + if (isError($result)) { + $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + } + return $this->terminateWithSuccess(getData($result) ?: []); + } + public function getStudienplaene($prestudent_id) { $this->load->model('organisation/Studienplan_model', 'StudienplanModel'); diff --git a/application/models/codex/Bisstandort_model.php b/application/models/codex/Bisstandort_model.php new file mode 100644 index 000000000..9c7e9e45b --- /dev/null +++ b/application/models/codex/Bisstandort_model.php @@ -0,0 +1,14 @@ +dbTable = 'bis.tbl_bisstandort'; + $this->pk = 'standort_code'; + } +} diff --git a/application/views/Studentenverwaltung.php b/application/views/Studentenverwaltung.php index 2d0d22346..c8d9dc3f7 100644 --- a/application/views/Studentenverwaltung.php +++ b/application/views/Studentenverwaltung.php @@ -34,8 +34,10 @@ !defined('GENERATE_ALIAS_STUDENT') ? true : GENERATE_ALIAS_STUDENT, - 'showZgvDoktor' => !defined('ZGV_DOKTOR_ANZEIGEN') ? false : ZGV_DOKTOR_ANZEIGEN, - 'showZgvErfuellt' => !defined('ZGV_ERFUELLT_ANZEIGEN') ? false : ZGV_ERFUELLT_ANZEIGEN + + //replaced by possibility to hide each formular field via config stv.php + #'showZgvDoktor' => !defined('ZGV_DOKTOR_ANZEIGEN') ? false : ZGV_DOKTOR_ANZEIGEN, + #'showZgvErfuellt' => !defined('ZGV_ERFUELLT_ANZEIGEN') ? false : ZGV_ERFUELLT_ANZEIGEN ]; ?> diff --git a/public/js/api/stv/prestudent.js b/public/js/api/stv/prestudent.js index 4e97759f4..dd90880c5 100644 --- a/public/js/api/stv/prestudent.js +++ b/public/js/api/stv/prestudent.js @@ -1,5 +1,43 @@ export default { +//------------- Prestudent.js------------------------------------------------------ + + get(prestudent_id){ + return this.$fhcApi.post('api/frontend/v1/stv/prestudent/get/' + prestudent_id); + }, + updatePrestudent(prestudent_id, data){ + return this.$fhcApi.post('api/frontend/v1/stv/prestudent/updatePrestudent/' + prestudent_id, + data + ); + }, + getBezeichnungZGV() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getBezeichnungZGV/'); + }, + getBezeichnungMZgv() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getBezeichnungMZgv/'); + }, + getBezeichnungDZgv() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getBezeichnungDZgv/'); + }, + getStgs() { + return this.$fhcApi.get('api/frontend/v1/stv/lists/getStgs/'); + }, + getAusbildung() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getAusbildung/'); + }, + getAufmerksamdurch() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getAufmerksamdurch/'); + }, + getBerufstaetigkeit() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getBerufstaetigkeit/'); + }, + getTypenStg() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getTypenStg/'); + }, + getBisstandort() { + return this.$fhcApi.get('api/frontend/v1/stv/prestudent/getBisstandort/'); + }, + //------------- MultiStatus.js------------------------------------------------------ getHistoryPrestudent (url, config, params){ diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js index e6db926cc..46edeaaf9 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js @@ -15,14 +15,6 @@ export default { lists: { from: 'lists' }, - showZgvErfuellt: { - from: 'configShowZgvErfuellt', - default: false - }, - showZgvDoktor: { - from: 'configShowZgvDoktor', - default: false - }, hasPrestudentPermission: { from: 'hasPrestudentPermission', default: false @@ -41,6 +33,10 @@ export default { }, props: { modelValue: Object, + config: { + type: Object, + default: {} + } }, data() { return { @@ -58,6 +54,7 @@ export default { { text: 'Nein', value: false } ], listStgTyp: [], + listBisStandort: [], initialFormData: {}, deltaArray: {}, actionUpdate: false @@ -91,8 +88,7 @@ export default { methods: { loadPrestudent() { - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/get/' + this.modelValue.prestudent_id) + return this.$fhcApi.factory.stv.prestudent.get(this.modelValue.prestudent_id) .then(result => result.data) .then(result => { this.data = result; @@ -105,8 +101,7 @@ export default { this.initialFormData = {...(this.initialFormData || {}), ...udfs}; }, updatePrestudent(){ - this.$refs.form - .post('api/frontend/v1/stv/prestudent/updatePrestudent/' + this.modelValue.prestudent_id, this.deltaArray) + return this.$fhcApi.factory.stv.prestudent.updatePrestudent(this.modelValue.prestudent_id, this.deltaArray) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.deltaArray = []; @@ -120,62 +115,60 @@ export default { }, created() { this.loadPrestudent(); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getBezeichnungZGV') + this.$fhcApi.factory.stv.prestudent.getBezeichnungZGV() .then(result => result.data) .then(result => { this.listZgvs = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getBezeichnungMZgv') + this.$fhcApi.factory.stv.prestudent.getBezeichnungMZgv() .then(result => result.data) .then(result => { this.listZgvsmaster = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getBezeichnungDZgv') + this.$fhcApi.factory.stv.prestudent.getBezeichnungDZgv() .then(result => result.data) .then(result => { this.listZgvsdoktor = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/lists/getStgs') + this.$fhcApi.factory.stv.prestudent.getStgs() .then(result => result.data) .then(result => { this.listStgs = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getAusbildung') + this.$fhcApi.factory.stv.prestudent.getAusbildung() .then(result => result.data) .then(result => { this.listAusbildung = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getAufmerksamdurch') + this.$fhcApi.factory.stv.prestudent.getAufmerksamdurch() .then(result => result.data) .then(result => { this.listAufmerksamdurch = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getBerufstaetigkeit') + this.$fhcApi.factory.stv.prestudent.getBerufstaetigkeit() .then(result => result.data) .then(result => { this.listBerufe = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/prestudent/getTypenStg') + this.$fhcApi.factory.stv.prestudent.getTypenStg() .then(result => result.data) .then(result => { this.listStgTyp = result; }) .catch(this.$fhcAlert.handleSystemError); + this.$fhcApi.factory.stv.prestudent.getBisstandort() + .then(result => result.data) + .then(result => { + this.listBisStandort = result; + }) + .catch(this.$fhcAlert.handleSystemError); }, template: `
@@ -187,7 +180,8 @@ export default { {{$p.t('lehre', 'title_zgv')}} {{modelValue.nachname}} {{modelValue.vorname}}
{{zgv.zgv_bez}}
{{mzgv.zgvmas_bez}}
-
+
{{zgv.zgvdoktor_bez}}
-
+
-
+
PrestudentIn
{{adurch.beschreibung}} {{beruf.berufstaetigkeit_bez}}
- ` + /* TODO(chris): Ausgeblendet für Testing
- - - + +
- */` - +
- + - +
- ` + /* TODO(chris): Ausgeblendet für Testing + - */`
- + +
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js index 6935810b1..1c2c37ec6 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js @@ -154,6 +154,7 @@ export default{ layoutColumnsOnNewData: false, height: 'auto', selectable: false, + //TODO(Manu) define Persistence Id to avoid empty result array if sort index not corresponding }, tabulatorEvents: [ { From e2839972939848fd888271dc9e43f8d93f28447a Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 23 Oct 2024 14:26:33 +0200 Subject: [PATCH 0029/1746] cleanUp Tasks Tab Details --- application/config/stv.php | 8 +- .../api/frontend/v1/stv/Config.php | 3 +- .../api/frontend/v1/stv/Student.php | 8 +- public/js/api/stv.js | 2 + public/js/api/stv/details.js | 10 + .../Studentenverwaltung/Details/Details.js | 176 ++++++++++------- system/phrasesupdate.php | 183 +++++++++++++++++- 7 files changed, 312 insertions(+), 78 deletions(-) create mode 100644 public/js/api/stv/details.js diff --git a/application/config/stv.php b/application/config/stv.php index 6296e8e6b..8b7792e83 100644 --- a/application/config/stv.php +++ b/application/config/stv.php @@ -2,9 +2,15 @@ $config['tabs'] = [ + 'details' => [ + //all fields can be configured to be hidden, see class attribute stv-details-details-name for name + 'hiddenFields' => [], + 'hideUDFs' => false + ], + 'prestudent' => [ - //all fields can be configured to be hidden, see class attribute stv-prestudent-prestudent-name for name + //all fields can be configured to be hidden, see class attribute stv-details-prestudent-name for name 'hiddenFields' => [ //corresponding to config-entry 'ZGV_DOKTOR_ANZEIGEN' in global.config diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index 97477fca7..fd318a79f 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -58,7 +58,8 @@ class Config extends FHCAPI_Controller $result['details'] = [ 'title' => $this->p->t('stv', 'tab_details'), - 'component' => './Stv/Studentenverwaltung/Details/Details.js' + 'component' => './Stv/Studentenverwaltung/Details/Details.js', + 'config' => $config['details'] ]; $result['notes'] = [ 'title' => $this->p->t('stv', 'tab_notes'), diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index 89c317ae4..f805be88a 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -55,7 +55,7 @@ class Student extends FHCAPI_Controller // Load language phrases $this->loadPhrases([ - 'ui' + 'ui', 'lehre' ]); } @@ -223,12 +223,10 @@ class Student extends FHCAPI_Controller // Check PKs if (count($update_lehrverband) + count($update_student) && $uid === null) { - // TODO(chris): phrase - $this->terminateWithValidationErrors(['' => "Kein/e StudentIn vorhanden!"]); + $this->terminateWithValidationErrors(['' => $this->p->t('lehre', 'error_no_student')]); } if (count($update_person) && $person_id === null) { - // TODO(chris): phrase - $this->terminateWithValidationErrors(['' => "Keine Person vorhanden!"]); + $this->terminateWithValidationErrors(['' => $this->p->t('lehre', 'error_no_person')]); } // Do Updates diff --git a/public/js/api/stv.js b/public/js/api/stv.js index 5a8316916..b66ae401e 100644 --- a/public/js/api/stv.js +++ b/public/js/api/stv.js @@ -5,6 +5,7 @@ import konto from './stv/konto.js'; import kontakt from './stv/kontakt.js'; import prestudent from './stv/prestudent.js'; import status from './stv/status.js'; +import details from './stv/details.js'; export default { verband, @@ -14,6 +15,7 @@ export default { kontakt, prestudent, status, + details, configStudent() { return this.$fhcApi.get('api/frontend/v1/stv/config/student'); }, diff --git a/public/js/api/stv/details.js b/public/js/api/stv/details.js new file mode 100644 index 000000000..bdf26739b --- /dev/null +++ b/public/js/api/stv/details.js @@ -0,0 +1,10 @@ +export default { + get(prestudent_id) { + return this.$fhcApi.post('api/frontend/v1/stv/student/get/' + prestudent_id); + }, + save(prestudent_id, data) { + return this.$fhcApi.post('api/frontend/v1/stv/student/save/' + prestudent_id, + data + ); + }, +} diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Details.js b/public/js/components/Stv/Studentenverwaltung/Details/Details.js index ae4f92b20..34ab779ac 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Details.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Details.js @@ -37,7 +37,11 @@ export default { } }, props: { - modelValue: Object + modelValue: Object, + config: { + type: Object, + default: {} + } }, data() { return { @@ -95,8 +99,7 @@ export default { methods: { updateStudent(n) { // TODO(chris): move to fhcapi.factory - this.$fhcApi - .get('api/frontend/v1/stv/student/get/' + n.prestudent_id) + return this.$fhcApi.factory.stv.details.get(n.prestudent_id) .then(result => { this.data = result.data; if (!this.data.familienstand) @@ -110,14 +113,13 @@ export default { return; this.$refs.form.clearValidation(); - this.$refs.form - .post('api/frontend/v1/stv/student/save/' + this.modelValue.prestudent_id, this.changed) + return this.$fhcApi.factory.stv.details.save(this.modelValue.prestudent_id, this.changed) .then(result => { this.original = {...this.data}; this.changed = {}; this.$refs.form.setFeedback(true, result.data); }) - .catch(this.$fhcAlert.handleSystemError) + .catch(this.$fhcAlert.handleSystemError); }, udfsLoaded(udfs) { this.original = {...(this.original || {}), ...udfs}; @@ -141,16 +143,17 @@ export default {