diff --git a/application/controllers/Cis/MyLv.php b/application/controllers/Cis/MyLv.php index 49a938553..819d56b05 100644 --- a/application/controllers/Cis/MyLv.php +++ b/application/controllers/Cis/MyLv.php @@ -33,9 +33,4 @@ class MyLv extends Auth_Controller $this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'MyLv']); } - - public function Info($studien_semester,$lvid) - { - $this->load->view('Cis/LvInfo',['lvid'=> $lvid, 'studien_semester' => $studien_semester]); - } } diff --git a/application/controllers/api/frontend/v1/Abgabe.php b/application/controllers/api/frontend/v1/Abgabe.php index af598a345..43dc18d1c 100644 --- a/application/controllers/api/frontend/v1/Abgabe.php +++ b/application/controllers/api/frontend/v1/Abgabe.php @@ -511,10 +511,11 @@ class Abgabe extends FHCAPI_Controller return $projektarbeit->projektarbeit_id; }; $projektarbeiten_ids = array_map($mapFunc, $projektarbeiten->retval); - - $ret = $this->ProjektarbeitModel->getProjektarbeitenAbgabetermine($projektarbeiten_ids); - $projektabgaben = $this->getDataOrTerminateWithError($ret, 'general'); + if(count($projektarbeiten_ids) > 0) { + $ret = $this->ProjektarbeitModel->getProjektarbeitenAbgabetermine($projektarbeiten_ids); + $projektabgaben = $this->getDataOrTerminateWithError($ret, 'general'); + } forEach($projektarbeiten->retval as $pa) { @@ -846,9 +847,10 @@ class Abgabe extends FHCAPI_Controller private function getProjektbetreuerEmailByProjektarbeitID($projektarbeit_id) { $this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); $result = $this->ProjektarbeitModel->getProjektbetreuerEmail($projektarbeit_id); - $email = $this->getDataOrTerminateWithError($result, 'general'); - - return $email[0]->uid ? $email[0]->uid.'@'.DOMAIN : $email[0]->private_email; + if(count($result->retval) > 0) { + $email = getData($result); + return $email[0]->uid ? $email[0]->uid.'@'.DOMAIN : $email[0]->private_email; + } else return ''; } diff --git a/application/controllers/api/frontend/v1/Documents.php b/application/controllers/api/frontend/v1/Documents.php index 7b2fc4a15..13c0a2eba 100644 --- a/application/controllers/api/frontend/v1/Documents.php +++ b/application/controllers/api/frontend/v1/Documents.php @@ -208,7 +208,6 @@ class Documents extends FHCAPI_Controller $this->load->model('system/Vorlage_model', 'VorlageModel'); $result = $this->VorlageModel->load($xsl); - $this->addMeta("ress", $result); $vorlage = current($this->getDataOrTerminateWithError($result)); if (!$vorlage) show_404(); @@ -221,7 +220,7 @@ class Documents extends FHCAPI_Controller 'gedruckt' => true, 'insertamum' => date('c'), 'insertvon' => getAuthUID(), - 'uid' => $this->input->post_get('uid') ?: '', + 'uid' => $this->input->post_get('uid') ?: null, 'archiv' => true, 'signiert' => !!$sign_user, 'stud_selfservice' => $vorlage->stud_selfservice @@ -251,6 +250,9 @@ class Documents extends FHCAPI_Controller 'studiensemester_kurzbz' => $ss, 'student_uid' => $akteData['uid'] ]); + + if (!hasData($result)) $this->terminateWithError($this->p->t("stv", "error_noLehrverbandAssigned")); + $res = current($this->getDataOrTerminateWithError($result)); $studiengang_kz = $res->studiengang_kz; @@ -332,6 +334,7 @@ class Documents extends FHCAPI_Controller if ($prestudent_id) { $this->load->model('crm/prestudent_model', 'PrestudentModel'); $this->PrestudentModel->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT'); + $this->PrestudentModel->addSelect('tbl_prestudent.*, UPPER(typ || kurzbz) AS kuerzel'); $result = $this->PrestudentModel->load($prestudent_id); $prestudent = current($this->getDataOrTerminateWithError($result)); diff --git a/application/controllers/api/frontend/v1/notiz/NotizPerson.php b/application/controllers/api/frontend/v1/notiz/NotizPerson.php index 7f0645bc6..a047129d7 100644 --- a/application/controllers/api/frontend/v1/notiz/NotizPerson.php +++ b/application/controllers/api/frontend/v1/notiz/NotizPerson.php @@ -24,6 +24,7 @@ class NotizPerson extends Notiz_Controller //Load Models $this->load->model('person/Benutzer_model', 'BenutzerModel'); $this->load->model('crm/Student_model', 'StudentModel'); + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); //Permission checks for allowed Oes if ($this->router->method == 'addNewNotiz') @@ -38,7 +39,7 @@ class NotizPerson extends Notiz_Controller { return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL); } - $this->_checkIfBerechtigungForOneUidExists($person_id, $allowedStgs); + $this->_checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs); } if ( $this->router->method == 'updateNotiz') @@ -59,7 +60,7 @@ class NotizPerson extends Notiz_Controller $person_id = current($data)->person_id; $allowedStgs = $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: []; - $this->_checkIfBerechtigungForOneUidExists($person_id, $allowedStgs); + $this->_checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs); } if ($this->router->method == 'deleteNotiz' ) @@ -78,7 +79,7 @@ class NotizPerson extends Notiz_Controller } $allowedStgs = $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: []; - $this->_checkIfBerechtigungForOneUidExists($person_id, $allowedStgs); + $this->_checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs); } } @@ -99,44 +100,20 @@ class NotizPerson extends Notiz_Controller } //stv: if person has permission of one studiengang of person -> permission to add/update/delete Note - private function _checkIfBerechtigungForOneUidExists($person_id, $allowedStgs) + private function _checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs) { - //get all studentUids of person_id - $result = $this->BenutzerModel->loadWhere(['person_id' => $person_id]); + $result = $this->PrestudentModel->loadWhere(['person_id' => $person_id]); $data = $this->getDataOrTerminateWithError($result); $checkarray = []; foreach ($data as $item) { - //check if isStudent - $result = $this->StudentModel->isStudent($item->uid); - - $isStudent = $this->getDataOrTerminateWithError($result); - if($isStudent) + if(in_array($item->studiengang_kz, $allowedStgs)) { - $checkarray[] = $this->_checkAllowedStgsFromUid($item->uid, $allowedStgs); + return true; } - } - if (!in_array(1, $checkarray)) - return $this->terminateWithError($this->p->t('ui', 'error_keineBerechtigungStg'), self::ERROR_TYPE_GENERAL); - } - private function _checkAllowedStgsFromUid($student_uid, $allowedStgs) - { - $this->load->model('crm/Student_model', 'StudentModel'); - $result = $this->StudentModel->loadWhere(['student_uid' => $student_uid]); - - $data = $this->getDataOrTerminateWithError($result); - $studiengang_kz = current($data)->studiengang_kz; - - if (!in_array($studiengang_kz, $allowedStgs)) - { - return 0; - } - else - { - return 1; - } + $this->terminateWithError($this->p->t('ui', 'error_keineBerechtigungStg'), self::ERROR_TYPE_GENERAL); } } diff --git a/application/controllers/api/frontend/v1/stv/Dokumente.php b/application/controllers/api/frontend/v1/stv/Dokumente.php index 9f54d0aa4..b8c7830bd 100644 --- a/application/controllers/api/frontend/v1/stv/Dokumente.php +++ b/application/controllers/api/frontend/v1/stv/Dokumente.php @@ -753,6 +753,10 @@ class Dokumente extends FHCAPI_Controller ); $data = $this->getDataOrTerminateWithError($result); + if(!(is_array($data) && count($data) > 0)) + { + return null; + } $student = current($data); return $student->student_uid; diff --git a/application/controllers/jobs/AbgabetoolJob.php b/application/controllers/jobs/AbgabetoolJob.php index 9b59a72e7..b81053032 100644 --- a/application/controllers/jobs/AbgabetoolJob.php +++ b/application/controllers/jobs/AbgabetoolJob.php @@ -495,6 +495,10 @@ class AbgabetoolJob extends JOB_Controller // get all new or changed termine in interval $result = $this->_ci->PaabgabeModel->findAbgabenNewOrUpdatedSince($interval, $relevantTypes); $retval = getData($result); + if(!$retval) { + $this->_ci->logInfo("Keine Emails an Betreuer über neue oder veränderte Termine versandt"); + return; + } // group changed/new abgaben for projektarbeiten $projektarbeiten = []; @@ -557,6 +561,8 @@ class AbgabetoolJob extends JOB_Controller $anredeFillString = $data->anrede == "Herr" ? "r" : ""; $fullFormattedNameString = $data->first; + $relevantCounter = 0; // workaround to check if a betreuer needs to have any notification about relevant + // abgaben at all to avoid sending empty emails since we filter on certain conditions forEach($tupelArr as $tupel) { $projektarbeit_id = $tupel[0]; $betreuerRow = $tupel[1]; @@ -575,6 +581,8 @@ class AbgabetoolJob extends JOB_Controller continue; } + $relevantCounter++; + // format the Student Name $s = $relevantAbgaben[0]; $nameParts = []; @@ -633,6 +641,11 @@ class AbgabetoolJob extends JOB_Controller // done with building the change list, now send it $betreuerRow = $tupelArr[0][1]; + if($relevantCounter == 0) { + $this->_ci->logInfo('No Relevant Abgaben to notify Betreuer PersonID: "'.$betreuerRow->person_id.'".'); + continue; + } + $path = $this->_ci->config->item('URL_MITARBEITER'); $url = CIS_ROOT.$path; diff --git a/application/helpers/hlp_header_helper.php b/application/helpers/hlp_header_helper.php index 41d40ca0d..27dfba5a1 100644 --- a/application/helpers/hlp_header_helper.php +++ b/application/helpers/hlp_header_helper.php @@ -269,3 +269,199 @@ function absoluteJsImportUrl($relurl) } return $url; } + +/* + * Manipulate CI views includes Array to load + * - public/js/FhcApps.js via customJSs and + * - app customisation js and/or css from extensions via customJSModules + * if customJSModules contains at least one vuejs app and customisation files + * exist in extensions + */ +class ExtendableAppsHelper +{ + private static $instance = null; + + protected $extensions; + + protected $customCSSs; + protected $customJSs; + protected $customJSModules; + + protected $initialised; + protected $appscount; + + protected $extCustomCSSs; + protected $extCustomJSs; + protected $extCustomJSModules; + + private function __construct() + { + $this->extensions = array(); + $this->customCSSs = null; + $this->customJSs = null; + $this->customJSModules = null; + + $this->initialised = false; + $this->appscount = 0; + + $this->extCustomCSSs = null; + $this->extCustomJSs = null; + $this->extCustomJSModules = null; + } + + public static function getInstance() + { + if(self::$instance === null) + { + self::$instance = new ExtendableAppsHelper(); + } + return self::$instance; + } + + public function init($customCSSs, $customJSs, $customJSModules) + { + if($this->initialised) + { + return; + } + + $this->customCSSs = $customCSSs; + $this->customJSs = $customJSs; + $this->customJSModules = $customJSModules; + $this->initialised = true; + + if(!isset($this->customJSModules)) + { + return; + } + + if(!is_array($this->customJSModules)) + { + $this->customJSModules = array($this->customJSModules); + } + + if(count($this->customJSModules) < 1) + { + return; + } + + $this->buildExtensionsList(); + $this->prepareExtendedArrays(); + } + + public function getCustomCSSs() + { + if(is_null($this->extCustomCSSs)) + { + return $this->customCSSs; + } + return $this->extCustomCSSs; + } + + public function getCustomJSs() + { + if(is_null($this->extCustomJSs)) + { + return $this->customJSs; + } + return $this->extCustomJSs; + } + + public function getCustomJSModules() + { + if(is_null($this->extCustomJSModules)) + { + return $this->customJSModules; + } + return $this->extCustomJSModules; + } + + protected function buildExtensionsList() + { + $this->extensions = array(); + $fsiterator = new FilesystemIterator(FHCPATH . 'application/extensions'); + foreach ($fsiterator as $fsitem) + { + if(preg_match('/^FHC-Core-/', $fsitem->getBasename())) + { + $this->extensions[] = $fsitem->getBasename(); + } + } + } + + protected function prepareExtendedArrays() + { + $this->appscount = 0; + $this->initExtCustomCSSs(); + $this->extCustomJSModules = array(); + foreach($this->customJSModules as $item) + { + $matches = array(); + if(preg_match('#^public/(extensions/FHC-Core-.+)?js/apps/(.*)\.js$#', $item, $matches)) + { + $this->appscount++; + + $fhcextension = $matches[1]; + $app = $matches[2]; + + $extend_js_suffix = 'js/extend_app/' . $fhcextension . $app . '.js'; + $extend_css_suffix = 'css/extend_app/' . $fhcextension . $app . '.css'; + + foreach($this->extensions as $extension) + { + $extend_js = 'public/extensions/' . $extension . '/' . $extend_js_suffix; + $extend_css = 'public/extensions/' . $extension . '/' . $extend_css_suffix; + + if(is_readable(FHCPATH . $extend_js)) + { + array_push($this->extCustomJSModules, $extend_js); + } + + if(is_readable(FHCPATH . $extend_css)) + { + array_push($this->extCustomCSSs, $extend_css); + } + } + } + array_push($this->extCustomJSModules, $item); + } + + if($this->appscount > 0) + { + $this->addFhcAppsJs(); + } + } + + protected function initExtCustomCSSs() + { + if(!isset($this->customCSSs)) + { + $this->extCustomCSSs = array(); + } + elseif(!is_array($this->customCSSs)) + { + $this->extCustomCSSs = array($this->customCSSs); + } + else + { + $this->extCustomCSSs = $this->customCSSs; + } + } + + protected function addFhcAppsJs() + { + if(!isset($this->customJSs)) + { + $this->extCustomJSs = array(); + } + elseif(!is_array($this->customJSs)) + { + $this->extCustomJSs = array($this->customJSs); + } + else + { + $this->extCustomJSs = $this->customJSs; + } + array_push($this->extCustomJSs, 'public/js/FhcApps.js'); + } +} diff --git a/application/libraries/DocsboxLib.php b/application/libraries/DocsboxLib.php index f9167c379..184855ad8 100644 --- a/application/libraries/DocsboxLib.php +++ b/application/libraries/DocsboxLib.php @@ -180,7 +180,8 @@ class DocsboxLib } // Just started or still working on it elseif ($getStatusResponse->body->status == self::STATUS_WORKING - || $getStatusResponse->body->status == self::STATUS_STARTED) + || $getStatusResponse->body->status == self::STATUS_STARTED + || $getStatusResponse->body->status == self::STATUS_QUEUED) { // go on! } diff --git a/application/views/Cis/LvInfo.php b/application/views/Cis/LvInfo.php deleted file mode 100644 index 49a7b7a85..000000000 --- a/application/views/Cis/LvInfo.php +++ /dev/null @@ -1,15 +0,0 @@ - 'LvInfo', - 'customJSModules' => ['public/js/apps/Cis/LvInfo.js'] -); - -$this->load->view('templates/CISVUE-Header', $includesArray); -?> - -
- - -
- -load->view('templates/CISVUE-Footer', $includesArray); ?> diff --git a/application/views/Cis/Profil.php b/application/views/Cis/Profil.php deleted file mode 100644 index f66ebf8a9..000000000 --- a/application/views/Cis/Profil.php +++ /dev/null @@ -1,18 +0,0 @@ - 'Profil', - 'customJSModules' => ['public/js/apps/Cis/Profil.js'], - 'tabulator5' => true, - 'primevue3' => true, - 'customCSSs' => ['public/css/components/calendar.css', 'public/css/components/FilterComponent.css','public/css/components/Profil.css','public/css/components/FormUnderline.css'], - -); - -$this->load->view('templates/CISVUE-Header', $includesArray); -?> - -
- -
- -load->view('templates/CISVUE-Footer', $includesArray); ?> diff --git a/application/views/templates/FHC-Footer.php b/application/views/templates/FHC-Footer.php index c816ebf2e..d2eb229f1 100644 --- a/application/views/templates/FHC-Footer.php +++ b/application/views/templates/FHC-Footer.php @@ -17,6 +17,7 @@ $use_vuejs_dev_version = $this->config->item('use_vuejs_dev_version'); // By default set the parameters to null + $customCSSs = isset($customCSSs) ? $customCSSs : null; $customJSs = isset($customJSs) ? $customJSs : null; $customJSModules = isset($customJSModules) ? $customJSModules : null; @@ -191,12 +192,13 @@ // NOTE: keep it as the last but one if ($addons === true) generateAddonsJSsInclude($calledPath.'/'.$calledMethod); - - + $extapphelper = ExtendableAppsHelper::getInstance(); + $extapphelper->init($customCSSs, $customJSs, $customJSModules); + // Eventually required JS // NOTE: keep it as the latest - generateJSsInclude($customJSs); - generateJSModulesInclude($customJSModules); + generateJSsInclude($extapphelper->getCustomJSs()); + generateJSModulesInclude($extapphelper->getCustomJSModules()); ?> diff --git a/application/views/templates/FHC-Header.php b/application/views/templates/FHC-Header.php index f7b5491a1..7b53cbf5d 100644 --- a/application/views/templates/FHC-Header.php +++ b/application/views/templates/FHC-Header.php @@ -9,6 +9,8 @@ $title = isset($title) ? $title : null; $refresh = isset($refresh) ? $refresh : null; $customCSSs = isset($customCSSs) ? $customCSSs : null; + $customJSs = isset($customJSs) ? $customJSs : null; + $customJSModules = isset($customJSModules) ? $customJSModules : null; $skipID = isset($skipID) ? $skipID : null; ?> @@ -132,8 +134,11 @@ //Tags if ($tags === true) generateCSSsInclude('public/css/tags.css'); + $extapphelper = ExtendableAppsHelper::getInstance(); + $extapphelper->init($customCSSs, $customJSs, $customJSModules); + // Eventually required CSS - generateCSSsInclude($customCSSs); // Eventually required CSS + generateCSSsInclude($extapphelper->getCustomCSSs()); // Eventually required CSS ?> diff --git a/cis/private/lehre/notenliste.xls.php b/cis/private/lehre/notenliste.xls.php index 6c8db5246..25f353c12 100644 --- a/cis/private/lehre/notenliste.xls.php +++ b/cis/private/lehre/notenliste.xls.php @@ -264,7 +264,7 @@ else tbl_bisio.bisio_id, tbl_bisio.bis, tbl_bisio.von, tbl_zeugnisnote.note,tbl_mobilitaet.mobilitaetstyp_kurzbz, (CASE WHEN bis.tbl_mobilitaet.studiensemester_kurzbz = vw_student_lehrveranstaltung.studiensemester_kurzbz THEN '1' ELSE '' END) as doubledegree, - tbl_note.lkt_ueberschreibbar, tbl_note.anmerkung + tbl_note.lkt_ueberschreibbar, tbl_note.anmerkung, tbl_zeugnisnote.punkte FROM campus.vw_student_lehrveranstaltung JOIN public.tbl_benutzer USING(uid) JOIN public.tbl_person USING(person_id) JOIN public.tbl_student ON(uid=student_uid) @@ -306,7 +306,14 @@ else && $elem->von < $stsemdatumbis && (anzahlTage($elem->von, $elem->bis) >= 30)) $inc.=' (o)'; - $note = $elem->note; + if(defined('CIS_GESAMTNOTE_PUNKTE') && CIS_GESAMTNOTE_PUNKTE==true) + { + $note = $elem->punkte; + } + else + { + $note = $elem->note; + } if($elem->lkt_ueberschreibbar == 'f') // angerechnet / intern angerechnet / nicht zugelassen { @@ -339,20 +346,23 @@ else { $worksheet->write($lines,8, trim($elem->matrikelnr), $format_highlight); $pr = new Pruefung(); - $pr->getPruefungen($elem->uid, "Termin2", $lvid, $sem); + $pr->getPruefungen($elem->uid, "Termin2", $lvid, $stsem); $output2 = $pr->result; if ($output2) { $resultPr = $output2[0]; $worksheet->write($lines,9, date('d.m.Y', strtotime($resultPr->datum)), $format_highlightright_date); - $worksheet->write($lines,10, $resultPr->note, $format_highlightright); + if(defined('CIS_GESAMTNOTE_PUNKTE') && CIS_GESAMTNOTE_PUNKTE==true) + $worksheet->write($lines,10, $resultPr->punkte, $format_highlightright); + else + $worksheet->write($lines,10, $resultPr->note, $format_highlightright); + } + else + { + $worksheet->write($lines,9, '', $format_highlightright_date); + $worksheet->write($lines,10, '', $format_highlightright); } - else - { - $worksheet->write($lines,9, '', $format_highlightright_date); - $worksheet->write($lines,10, '', $format_highlightright); - } } // Nachprüfung @@ -360,20 +370,23 @@ else { $worksheet->write($lines,12, trim($elem->matrikelnr), $format_highlight); $pr = new Pruefung(); - $pr->getPruefungen($elem->uid, "Termin3", $lvid, $sem); + $pr->getPruefungen($elem->uid, "Termin3", $lvid, $stsem); $output3 = $pr->result; if ($output3) { $resultPr = $output3[0]; $worksheet->write($lines,13, date('d.m.Y', strtotime($resultPr->datum)), $format_highlightright_date); - $worksheet->write($lines,14, $resultPr->note, $format_highlightright); + if(defined('CIS_GESAMTNOTE_PUNKTE') && CIS_GESAMTNOTE_PUNKTE==true) + $worksheet->write($lines,14, $resultPr->punkte, $format_highlightright); + else + $worksheet->write($lines,14, $resultPr->note, $format_highlightright); + } + else + { + $worksheet->write($lines,13, '', $format_highlightright_date); + $worksheet->write($lines,14, '', $format_highlightright); } - else - { - $worksheet->write($lines,13, '', $format_highlightright_date); - $worksheet->write($lines,14, '', $format_highlightright); - } } $i++; diff --git a/content/student/studentdetailoverlay.xul.php b/content/student/studentdetailoverlay.xul.php index 36740d209..c3bf8c191 100644 --- a/content/student/studentdetailoverlay.xul.php +++ b/content/student/studentdetailoverlay.xul.php @@ -798,6 +798,10 @@ echo ''; class="sortDirectionIndicator" sort="rdf:http://www.technikum-wien.at/prestudentrolle/rdf#updatevon" /> +