diff --git a/application/config/cis.php b/application/config/cis.php index 028e9899a..b7330ef29 100644 --- a/application/config/cis.php +++ b/application/config/cis.php @@ -5,3 +5,5 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); // CMS Content Id for CIS4 Menu Root $config['cis_menu_root_content_id'] = 11066; +// send Mails for ProfilUpdate +$config['cis_send_profil_update_mails'] = true; diff --git a/application/config/javascript.php b/application/config/javascript.php new file mode 100644 index 000000000..5e9aa270a --- /dev/null +++ b/application/config/javascript.php @@ -0,0 +1,7 @@ + ['basis/cis:r'], ]); + $this->load->config('cis'); $this->load->model('person/Profil_update_model', 'ProfilUpdateModel'); $this->load->model('person/Kontakt_model', 'KontaktModel'); @@ -111,6 +112,10 @@ class ProfilUpdate extends Auth_Controller private function sendEmail_onProfilUpdate_response($uid, $topic, $status) { + if($this->config->item('cis_send_profil_update_mails') === false) + { + return; + } $this->load->helper('hlp_sancho_helper'); $email = $uid . "@" . DOMAIN; @@ -138,6 +143,10 @@ class ProfilUpdate extends Auth_Controller private function sendEmail_onProfilUpdate_insertion($uid, $profil_update_id, $topic) { + if($this->config->item('cis_send_profil_update_mails') === false) + { + return; + } $this->load->helper('hlp_sancho_helper'); $emails = []; diff --git a/application/controllers/Cis4.php b/application/controllers/Cis4.php index 84aedc5f2..9197fd388 100644 --- a/application/controllers/Cis4.php +++ b/application/controllers/Cis4.php @@ -28,14 +28,12 @@ class Cis4 extends Auth_Controller public function index() { $this->load->model('person/Person_model','PersonModel'); - $begruesung = $this->PersonModel->getFirstName(getAuthUID()); - if(isError($begruesung)) - { - show_error("name couldn't be loaded for username ".getAuthUID()); - } - $begruesung = getData($begruesung); + $personData = getData($this->PersonModel->getByUid(getAuthUID()))[0]; + $viewData = array( - 'name' => $begruesung + 'uid' => getAuthUID(), + 'name' => $personData->vorname, + 'person_id' => $personData->person_id ); $this->load->view('CisVue/Dashboard.php',['viewData' => $viewData]); diff --git a/application/controllers/api/frontend/v1/Cms.php b/application/controllers/api/frontend/v1/Cms.php index 16142532b..e41196f45 100644 --- a/application/controllers/api/frontend/v1/Cms.php +++ b/application/controllers/api/frontend/v1/Cms.php @@ -125,7 +125,7 @@ class Cms extends FHCAPI_Controller //get the data or terminate with error $news = $this->getDataOrTerminateWithError($news); - + // collect the content of the news foreach($news as $news_element){ $this->addMeta("content_id",$news_element->content_id); @@ -134,12 +134,17 @@ class Cms extends FHCAPI_Controller $this->NewsModel->resetQuery(); $content = $this->cmslib->getContent($news_element->content_id); - $content = $this->getDataOrTerminateWithError($content); + $content = getData($content); $news_element->content_obj = $content; } + $withContent = function($news) { + return $news->content_obj != null; + }; + + $newsWithContent = array_filter($news, $withContent); - $this->terminateWithSuccess($news); + $this->terminateWithSuccess($newsWithContent); } diff --git a/application/controllers/api/frontend/v1/Phrasen.php b/application/controllers/api/frontend/v1/Phrasen.php index 317f515e0..3509e6630 100644 --- a/application/controllers/api/frontend/v1/Phrasen.php +++ b/application/controllers/api/frontend/v1/Phrasen.php @@ -29,7 +29,9 @@ class Phrasen extends FHCAPI_Controller { parent::__construct([ 'loadModule' => self::PERM_ANONYMOUS, - 'setLanguage' => self::PERM_ANONYMOUS + 'setLanguage' => self::PERM_ANONYMOUS, + 'getLanguage' => self::PERM_ANONYMOUS, + 'getAllLanguages' => self::PERM_ANONYMOUS, ]); $this->load->helper('hlp_language'); @@ -60,4 +62,23 @@ class Phrasen extends FHCAPI_Controller $phrases = $this->p->setPhrases($categories, $language); $this->terminateWithSuccess($phrases); } + + // gets the langauge of the currently logged in user session and otherwhise the system language + public function getLanguage() + { + $lang = getUserLanguage(); + $this->terminateWithSuccess($lang); + } + + // gets all languages that are set as active in the database + public function getAllLanguages() + { + $langs = getDBActiveLanguages(); + $langs = $this->getDataOrTerminateWithError($langs); + $langs = array_map(function($lang){ + return $lang->sprache; + }, $langs); + $this->terminateWithSuccess($langs); + } + } \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/Profil.php b/application/controllers/api/frontend/v1/Profil.php index a82b3ddfc..576a2a8ed 100644 --- a/application/controllers/api/frontend/v1/Profil.php +++ b/application/controllers/api/frontend/v1/Profil.php @@ -88,7 +88,7 @@ class Profil extends FHCAPI_Controller $res->data = $this->studentProfil(); $res->data->pid = $this->pid; } - + // editing your own profil - true $editAllowed = true; } // UID is availabe when accessing Profil/View/:uid @@ -495,12 +495,11 @@ class Profil extends FHCAPI_Controller */ private function getPersonInfo($uid, $geburtsInfo = null) { - $selectClause = ["foto", "anrede", "titelpost as postnomen", "titelpre as titel", "vorname", "nachname"]; + $selectClause = ["foto", "foto_sperre", "anrede", "titelpost as postnomen", "titelpre as titel", "vorname", "nachname"]; /** @param integer $geburtsInfo */ if ($geburtsInfo) { array_push($selectClause, "gebort"); array_push($selectClause, "gebdatum"); - array_push($selectClause, "foto_sperre"); } $this->BenutzerModel->addSelect($selectClause); $this->BenutzerModel->addJoin("tbl_person", "person_id"); @@ -512,6 +511,12 @@ class Profil extends FHCAPI_Controller $person_res = hasData($person_res) ? getData($person_res)[0] : null; } + if( ($person_res->foto === null) || (($this->uid !== $uid) && ($person_res->foto_sperre !== false)) ) + { + $dummy_foto = base64_encode(file_get_contents(DOC_ROOT.'skin/images/profilbild_dummy.jpg')); + $person_res->foto = $dummy_foto; + } + return $person_res; } diff --git a/application/controllers/api/frontend/v1/ProfilUpdate.php b/application/controllers/api/frontend/v1/ProfilUpdate.php index 35b7e4e64..827654d21 100644 --- a/application/controllers/api/frontend/v1/ProfilUpdate.php +++ b/application/controllers/api/frontend/v1/ProfilUpdate.php @@ -47,6 +47,8 @@ class ProfilUpdate extends FHCAPI_Controller 'show' => self::PERM_LOGGED, ]); + $this->load->config('cis'); + // Load language phrases $this->loadPhrases( array( @@ -504,6 +506,10 @@ class ProfilUpdate extends FHCAPI_Controller private function sendEmail_onProfilUpdate_insertion($uid, $profil_update_id, $topic) { + if($this->config->item('cis_send_profil_update_mails') === false) + { + return; + } $this->load->helper('hlp_sancho_helper'); $emails = []; @@ -573,6 +579,11 @@ class ProfilUpdate extends FHCAPI_Controller private function sendEmail_onProfilUpdate_response($uid, $topic, $status) { + if($this->config->item('cis_send_profil_update_mails') === false) + { + return; + } + $this->load->helper('hlp_sancho_helper'); $email = $uid . "@" . DOMAIN; diff --git a/application/controllers/api/frontend/v1/Stundenplan.php b/application/controllers/api/frontend/v1/Stundenplan.php index 116854930..c14ea4315 100644 --- a/application/controllers/api/frontend/v1/Stundenplan.php +++ b/application/controllers/api/frontend/v1/Stundenplan.php @@ -151,7 +151,12 @@ class Stundenplan extends FHCAPI_Controller // getting the student_lehrverbaende of the student in the different studiensemester $student_lehrverband = $this->fetchStudentlehrverbandFromStudiensemester($semester_range); - $stundenplan_data = $this->StundenplanModel->stundenplanGruppierung($this->StundenplanModel->getStundenplanQuery($start_date, $end_date, $semester_range, $benutzer_gruppen, $student_lehrverband)); + $stundenplan_query = $this->StundenplanModel->getStundenplanQuery($start_date, $end_date, $semester_range, $benutzer_gruppen, $student_lehrverband); + if(!$stundenplan_query) + { + $this->terminateWithSuccess([]); + } + $stundenplan_data = $this->StundenplanModel->stundenplanGruppierung($stundenplan_query); $stundenplan_data = $this->getDataOrTerminateWithError($stundenplan_data) ?? []; $this->expand_object_information($stundenplan_data); diff --git a/application/controllers/person/Gruppenmanagement.php b/application/controllers/person/Gruppenmanagement.php index 1a4c341a4..099871676 100644 --- a/application/controllers/person/Gruppenmanagement.php +++ b/application/controllers/person/Gruppenmanagement.php @@ -29,6 +29,7 @@ class Gruppenmanagement extends Auth_Controller $this->load->model('person/benutzer_model', 'BenutzerModel'); $this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel'); $this->load->model('person/benutzergruppe_model', 'BenutzergruppeModel'); + $this->load->model('person/gruppe_manager_model', 'GruppemanagerModel'); $this->load->model('system/Log_model', 'LogModel'); $this->load->library('WidgetLib'); @@ -117,6 +118,27 @@ class Gruppenmanagement extends Auth_Controller $result = error('Uid missing'); else { + $this->GruppemanagerModel->addSelect('1'); + $isManagerRes = $this->GruppemanagerModel->loadWhere( + array( + 'uid' => $this->_uid, + 'gruppe_kurzbz' => $gruppe_kurzbz + ) + ); + + if (isError($isManagerRes)) + { + $this->outputJsonError(getError($isManagerRes)); + return; + } + + if (!hasData($isManagerRes)) + { + $this->outputJsonError($this->p->t('gruppenmanagement', 'nichtZumEditierenDerGruppeBerechtigt')); + return; + } + + $this->BenutzergruppeModel->addSelect('1'); $benutzerExistsRes = $this->BenutzergruppeModel->loadWhere( array( 'uid' => $uid, @@ -170,6 +192,26 @@ class Gruppenmanagement extends Auth_Controller $result = error('Uid missing'); else { + $this->GruppemanagerModel->addSelect('1'); + $isManagerRes = $this->GruppemanagerModel->loadWhere( + array( + 'uid' => $this->_uid, + 'gruppe_kurzbz' => $gruppe_kurzbz + ) + ); + + if (isError($isManagerRes)) + { + $this->outputJsonError(getError($isManagerRes)); + return; + } + + if (!hasData($isManagerRes)) + { + $this->outputJsonError($this->p->t('gruppenmanagement', 'nichtZumEditierenDerGruppeBerechtigt')); + return; + } + $result = $this->BenutzergruppeModel->delete( array( 'uid' => $uid, diff --git a/application/core/Tag_Controller.php b/application/core/Tag_Controller.php new file mode 100644 index 000000000..6f6cef31b --- /dev/null +++ b/application/core/Tag_Controller.php @@ -0,0 +1,187 @@ + self::BERECHTIGUNG_KURZBZ, + 'getTags' => self::BERECHTIGUNG_KURZBZ, + 'addTag' => self::BERECHTIGUNG_KURZBZ, + + 'updateTag' => self::BERECHTIGUNG_KURZBZ, + 'doneTag' => self::BERECHTIGUNG_KURZBZ, + 'deleteTag' => self::BERECHTIGUNG_KURZBZ, + ]; + + $merged_permissions = array_merge($default_permissions, $permissions); + + parent::__construct($merged_permissions); + + $this->_setAuthUID(); + $this->load->model('person/Notiz_model', 'NotizModel'); + $this->load->model('system/Notiztyp_model', 'NotiztypModel'); + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + } + + public function getTag() + { + $id = $this->input->get('id'); + + $this->NotizModel->addSelect( + 'tbl_notiz.titel, + tbl_notiz.text, + array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung, + tbl_notiz.notiz_id, + tbl_notiz_typ.style, + tbl_notiz.erledigt as done, + tbl_notiz.insertamum, + tbl_notiz.updateamum, + tbl_notiz.insertvon, + tbl_notiz.updatevon + ' + ); + $this->NotizModel->addJoin('public.tbl_notiz_typ', 'public.tbl_notiz.typ = public.tbl_notiz_typ.typ_kurzbz'); + $notiz = $this->NotizModel->loadWhere(array('notiz_id' => $id)); + + $this->terminateWithSuccess(hasData($notiz) ? getData($notiz)[0] : array()); + } + + public function getTags() + { + $this->NotiztypModel->addSelect( + 'typ_kurzbz as tag_typ_kurzbz, + array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung, + style, + beschreibung, + tag + ' + ); + $this->NotiztypModel->addOrder('prioritaet'); + $notiztypen = $this->NotiztypModel->loadWhere(array('aktiv' => true)); + $this->terminateWithSuccess(hasData($notiztypen) ? getData($notiztypen) : array()); + } + + public function addTag($withZuordnung = true) + { + $postData = $this->getPostJson(); + + $checkTyp = $this->NotiztypModel->loadWhere(array('typ_kurzbz' => $postData->tag_typ_kurzbz)); + + if (!hasData($checkTyp)) + $this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL); + + + if ($withZuordnung) + { + $return = array(); + $checkZuordnungType = $this->NotizzuordnungModel->isValidType($postData->zuordnung_typ); + if (!isSuccess($checkZuordnungType)) + $this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL); + + $values = array_unique($postData->values); + + foreach ($values as $value) + { + $insertResult = $this->addNotiz($postData); + + if (isError($insertResult)) + $this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL); + + $insertZuordnung = $this->NotizzuordnungModel->insert(array( + 'notiz_id' => $insertResult->retval, + $postData->zuordnung_typ => $value + )); + + if (isError($insertZuordnung)) + $this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL); + + $return[] = [$postData->zuordnung_typ => $value, 'id' => $insertResult->retval]; + } + $this->terminateWithSuccess($return); + } + else + { + $insertResult = $this->addNotiz($postData); + if (isError($insertResult)) + $this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL); + + return $insertResult->retval; + } + } + + private function addNotiz($postData) + { + return $this->NotizModel->insert(array( + 'titel' => 'TAG', //TODO klären + 'text' => $postData->notiz, + 'verfasser_uid' => $this->_uid, + 'erledigt' => false, + 'insertamum' => date('Y-m-d H:i:s'), + 'insertvon' => $this->_uid, + 'typ' => $postData->tag_typ_kurzbz + )); + + } + public function updateTag() + { + $postData = $this->getPostJson(); + $updateData = $this->NotizModel->update(array('notiz_id' => $postData->id), + array('text' => $postData->notiz) + ); + $this->terminateWithSuccess($updateData); + } + public function doneTag() + { + $postData = $this->getPostJson(); + $updateData = $this->NotizModel->update(array('notiz_id' => $postData->id), + array('erledigt' => !$postData->done) + ); + + $this->terminateWithSuccess($updateData); + } + + public function deleteTag($withZuordnung = true) + { + $postData = $this->getPostJson(); + + $deleteNotiz = ""; + if ($withZuordnung) + { + $deleteZuordnung = $this->NotizzuordnungModel->delete(array( + 'notiz_id' => $postData->id + )); + + if (isSuccess($deleteZuordnung)) + { + $deleteNotiz = $this->NotizModel->delete(array( + 'notiz_id' => $postData->id + )); + } + } + else + { + $deleteNotiz = $this->NotizModel->delete(array( + 'notiz_id' => $postData->id + )); + } + $this->terminateWithSuccess($deleteNotiz); + } + + private function _setAuthUID() + { + $this->_uid = getAuthUID(); + + if (!$this->_uid) + show_error('User authentification failed'); + } + + +} \ No newline at end of file diff --git a/application/libraries/SearchBarLib.php b/application/libraries/SearchBarLib.php index 573bd7451..13b0efdbb 100644 --- a/application/libraries/SearchBarLib.php +++ b/application/libraries/SearchBarLib.php @@ -33,7 +33,7 @@ class SearchBarLib const ERROR_NOT_AUTH = 'ERR005'; // List of allowed types of search - const ALLOWED_TYPES = ['mitarbeiter', 'mitarbeiter_ohne_zuordnung', 'organisationunit', 'raum', 'person', 'student', 'prestudent', 'document', 'cms']; + const ALLOWED_TYPES = ['mitarbeiter', 'mitarbeiter_ohne_zuordnung', 'organisationunit', 'raum', 'person', 'student','studentStv', 'prestudent', 'document', 'cms']; const PHOTO_IMG_URL = '/cis/public/bild.php?src=person&person_id='; @@ -362,17 +362,26 @@ EOSC; private function _student($searchstr, $type) { $dbModel = new DB_Model(); - + $gesperrtes_foto = base64_encode(file_get_contents(DOC_ROOT.'skin/images/profilbild_dummy.jpg')); $students = $dbModel->execReadOnlyQuery(' SELECT \''.$type.'\' AS type, s.student_uid AS uid, + CONCAT(s.student_uid,\'@'.DOMAIN.'\') AS email, s.matrikelnr, + CONCAT(UPPER(stg.typ),UPPER(stg.kurzbz),\'-\',s.semester,s.verband) as verband, + stg.bezeichnung AS studiengang, p.person_id AS person_id, p.vorname || \' \' || p.nachname AS name, - k.kontakt as email , - p.foto + CASE + when s.student_uid = \''.getAuthUID().'\' then p.foto + when p.foto IS NULL then \''.$gesperrtes_foto.'\' + when p.foto_sperre = false then p.foto + else \''.$gesperrtes_foto.'\' + end as foto, + b.aktiv FROM public.tbl_student s + JOIN public.tbl_studiengang stg USING(studiengang_kz) JOIN public.tbl_benutzer b ON(b.uid = s.student_uid) JOIN public.tbl_person p USING(person_id) LEFT JOIN ( @@ -380,10 +389,57 @@ EOSC; FROM public.tbl_kontakt WHERE kontakttyp = \'email\' ) as k USING(person_id) - WHERE b.uid ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\' + WHERE + b.aktiv = TRUE + AND (b.uid ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\' + OR p.vorname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\' + OR p.nachname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\') + GROUP BY type, s.student_uid, s.matrikelnr, p.person_id, name, + email, p.foto, s.verband, s.semester, stg.bezeichnung, + stg.typ, stg.kurzbz, b.aktiv + ORDER BY b.aktiv DESC, p.nachname ASC, p.vorname ASC + '); + + // If something has been found then return it + if (hasData($students)) return getData($students); + + // Otherwise return an empty array + return array(); + } + + private function _studentStv($searchstr, $type) + { + $dbModel = new DB_Model(); + + $students = $dbModel->execReadOnlyQuery(' + SELECT + \''.$type.'\' AS type, + s.student_uid AS uid, + s.matrikelnr, + CONCAT(UPPER(stg.typ),UPPER(stg.kurzbz),\'-\',s.semester,s.verband) as verband, + stg.bezeichnung AS studiengang, + p.person_id AS person_id, + p.vorname || \' \' || p.nachname AS name, + k.kontakt AS email, + p.foto, + b.aktiv + FROM public.tbl_student s + JOIN public.tbl_studiengang stg USING(studiengang_kz) + JOIN public.tbl_benutzer b ON(b.uid = s.student_uid) + JOIN public.tbl_person p USING(person_id) + LEFT JOIN ( + SELECT kontakt, person_id + FROM public.tbl_kontakt + WHERE kontakttyp = \'email\' + ) as k USING(person_id) + WHERE + b.uid ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\' OR p.vorname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\' OR p.nachname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\' - GROUP BY type, s.student_uid, s.matrikelnr, p.person_id, name, email, p.foto + GROUP BY type, s.student_uid, s.matrikelnr, p.person_id, name, + k.kontakt, p.foto, s.verband, s.semester, stg.bezeichnung, + stg.typ, stg.kurzbz, b.aktiv + ORDER BY b.aktiv DESC, p.nachname ASC, p.vorname ASC '); // If something has been found then return it diff --git a/application/models/education/LehrveranstaltungFaktor_model.php b/application/models/education/LehrveranstaltungFaktor_model.php new file mode 100644 index 000000000..c8a0c8aa8 --- /dev/null +++ b/application/models/education/LehrveranstaltungFaktor_model.php @@ -0,0 +1,14 @@ +dbTable = 'lehre.tbl_lehrveranstaltung_faktor'; + $this->pk = 'lehrveranstaltung_faktor_id'; + } +} diff --git a/application/models/person/Gruppe_manager_model.php b/application/models/person/Gruppe_manager_model.php new file mode 100644 index 000000000..93d45bd1f --- /dev/null +++ b/application/models/person/Gruppe_manager_model.php @@ -0,0 +1,14 @@ +dbTable = 'public.tbl_gruppe_manager'; + $this->pk = 'gruppe_manager_id'; + } +} diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index 349eaac60..2d1e054c3 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -142,7 +142,7 @@ class Notiz_model extends DB_Model $this->addSelect('public.tbl_notiz.*'); $this->addJoin('public.tbl_notizzuordnung', 'notiz_id'); - return $this->loadWhere(array('person_id' => $person_id)); + return $this->loadWhere(array('person_id' => $person_id, 'tbl_notiz.typ' => NULL)); } /** diff --git a/application/models/project/Projects_employees_model.php b/application/models/project/Projects_employees_model.php new file mode 100644 index 000000000..a12e3961c --- /dev/null +++ b/application/models/project/Projects_employees_model.php @@ -0,0 +1,22 @@ +dbTable = 'sync.tbl_projects_employees'; + $this->pk = 'projects_employees_id'; + } + + public function deleteByProjectTaskId($ids) + { + $qry = "DELETE FROM " . $this->dbTable . " + WHERE project_task_id IN ?"; + + return $this->execQuery($qry, array($ids)); + } +} diff --git a/application/models/ressource/Stundenplan_model.php b/application/models/ressource/Stundenplan_model.php index 01d8dd792..8cb07a3bb 100644 --- a/application/models/ressource/Stundenplan_model.php +++ b/application/models/ressource/Stundenplan_model.php @@ -135,7 +135,7 @@ class Stundenplan_model extends DB_Model /** - * function that takes a query that fetches lehre.vw_stundenplan rows and groups them so that they can be displayed in a calendar + * groups rows of a subquery that fetches data from the lehre.vw_stundenplan table * @param string $stundenplanViewQuery the subquery used to group the result * * @return stdClass @@ -190,7 +190,7 @@ class Stundenplan_model extends DB_Model * NO STANDALONE FUNCTION - Generates a SQL query string to fetch 'stundenplan' events for a specific student within the current semester. * @param string $uid the user id that is used to fetch the stundenplan rows from the lehre.vw_stundenplan table * - * @return string + * @return mixed */ public function getStundenplanQuery($start_date, $end_date,$semester,$gruppen,$studentlehrverbaende){ @@ -206,7 +206,13 @@ class Stundenplan_model extends DB_Model } return $result; }; - + + // if both the gruppen and the studentlehrverbaende are empty we early return + if($emptyCheck($gruppen) && $emptyCheck($studentlehrverbaende)) + { + return false; + } + $query = "select sp.* from lehre.vw_stundenplan sp @@ -233,15 +239,15 @@ class Stundenplan_model extends DB_Model // converts the array of gruppen strings into a sql IN (_,_,_) chain $query .="(sp.gruppe_kurzbz IN (" .implode(',',$gruppen[$sem_date]).") AND sp.datum BETWEEN ".$this->escape($sem_date_range->start)." AND ".$this->escape($sem_date_range->ende)." )"; - // adds the OR sql chain only if the $studentlehrverbaende array is not empty - // DOES not include the sql OR if the $studentlehrverbaende are empty and it is the last gruppen element in the iteration - if(key($semester) != $sem || !$emptyCheck($studentlehrverbaende)) - { - $query .="OR"; - } - + $query .="OR"; } } + + // if there are no studentlehrverbaende and the gruppen are not empty, we can remove the last OR added after the groups + if($emptyCheck($studentlehrverbaende) && !$emptyCheck($gruppen)) + { + $query = substr($query, 0, -2); + } foreach($semester as $sem=>$semester_date_range) { @@ -253,20 +259,24 @@ class Stundenplan_model extends DB_Model } foreach($studentlehrverbaende[$sem_date] as $key=>$lehrverband) { - // adds the OR sql chain only if its not the first element in the first semester of the $studentlehrverbaende array - if($sem != array_keys($semester)[0] || $key != array_keys($semester)[0]) - { - $query .="OR"; - } $query .= "((sp.studiengang_kz = ".$this->escape($lehrverband->studiengang_kz)." AND sp.semester = ".$this->escape($lehrverband->semester)." AND sp.verband = ".$this->escape($lehrverband->verband)." AND sp.gruppe = ".$this->escape($lehrverband->gruppe)." AND sp.datum BETWEEN ".$this->escape($sem_date_range->start)." AND ".$this->escape($sem_date_range->ende).")"; // Eintraege fuer den ganzen Verband $query .= "OR (sp.studiengang_kz = ".$this->escape($lehrverband->studiengang_kz)." AND sp.semester = ".$this->escape($lehrverband->semester)." AND sp.verband = ".$this->escape($lehrverband->verband)." AND (sp.gruppe is null OR sp.gruppe='') AND sp.datum BETWEEN ".$this->escape($sem_date_range->start)." AND ".$this->escape($sem_date_range->ende).")"; // Eintraege fuer das ganze Semester $query .= "OR (sp.studiengang_kz = ".$this->escape($lehrverband->studiengang_kz)." AND sp.semester = ".$this->escape($lehrverband->semester)." AND (sp.verband is null OR sp.verband='') AND sp.datum BETWEEN ".$this->escape($sem_date_range->start)." AND ".$this->escape($sem_date_range->ende).") AND gruppe_kurzbz is null)"; + + $query .="OR"; + } } } + // if the studentlehrverbaende is not empty we can remove the last OR that was added to the query + if(!$emptyCheck($studentlehrverbaende)) + { + $query = substr($query, 0, -2); + } + // closes the AND sql chain only if it was opened previously if(!$emptyCheck($gruppen) || !$emptyCheck($studentlehrverbaende)) { diff --git a/application/models/ressource/Stundensatz_model.php b/application/models/ressource/Stundensatz_model.php index c397d8573..10f5a6aa1 100644 --- a/application/models/ressource/Stundensatz_model.php +++ b/application/models/ressource/Stundensatz_model.php @@ -13,5 +13,33 @@ class Stundensatz_model extends DB_Model $this->pk = 'stundensatz_id'; $this->hasSequence = true; } - + + public function getStundensatzByDatum($uid, $beginn, $ende = null, $typ = null) + { + $qry = "SELECT + * + FROM + hr.tbl_stundensatz + WHERE + uid = ? + AND (gueltig_bis >= ? OR gueltig_bis is null)"; + + $params = array($uid, $beginn); + + if (!is_null($ende)) + { + $qry .= " AND (gueltig_von <= ?)"; + $params[] = $ende; + } + + if (!is_null($typ)) + { + $qry .= " AND stundensatztyp = ?"; + $params[] = $typ; + } + + $qry .= " ORDER BY gueltig_bis DESC NULLS FIRST, gueltig_von DESC NULLS LAST LIMIT 1;"; + + return $this->execQuery($qry, $params); + } } \ No newline at end of file diff --git a/application/models/system/Notiztyp_model.php b/application/models/system/Notiztyp_model.php new file mode 100644 index 000000000..b173377e6 --- /dev/null +++ b/application/models/system/Notiztyp_model.php @@ -0,0 +1,14 @@ +dbTable = 'public.tbl_notiz_typ'; + $this->pk = 'typ_kurzbz'; + } +} diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index 61dc5a575..956ad80d4 100644 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -7,6 +7,7 @@ $STUDIENGANG_TYP = '\''.$this->variablelib->getVar('infocenter_studiensgangtyp').'\''; $TAETIGKEIT_KURZBZ = '\'bewerbung\', \'kommunikation\''; $LOGDATA_NAME = '\'Login with code\', \'Login with user\', \'Interessent rejected\', \'Attempt to register with existing mailadress\', \'Access code sent\', \'Personal data saved\''; + $LOGDATA_DELETED_BY_USER = '\'% deleted by user\''; $POSTPONE_STATUS_PARKED = '\'parked\''; $STATUS_KURZBZ = '\'Wartender\', \'Bewerber\', \'Aufgenommener\', \'Student\''; $ADDITIONAL_STG = $this->config->item('infocenter_studiengang_kz'); @@ -283,6 +284,7 @@ FROM system.tbl_log l WHERE l.taetigkeit_kurzbz IN ('.$TAETIGKEIT_KURZBZ.') AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.') + AND l.logdata->>\'message\' NOT LIKE ('.$LOGDATA_DELETED_BY_USER.') AND l.person_id = p.person_id ORDER BY l.log_id DESC LIMIT 1 diff --git a/application/views/templates/FHC-Common.php b/application/views/templates/FHC-Common.php index dd399f354..245432f46 100644 --- a/application/views/templates/FHC-Common.php +++ b/application/views/templates/FHC-Common.php @@ -45,3 +45,4 @@ $tablewidget = isset($tablewidget) ? $tablewidget : false; $udfs = isset($udfs) ? $udfs : false; $widgets = isset($widgets) ? $widgets : false; + $tags = isset($tags) ? $tags : false; diff --git a/application/views/templates/FHC-Footer.php b/application/views/templates/FHC-Footer.php index bf3475a04..9387cf92c 100644 --- a/application/views/templates/FHC-Footer.php +++ b/application/views/templates/FHC-Footer.php @@ -13,6 +13,9 @@ $calledPath = $this->router->directory.$this->router->class; $calledMethod = $this->router->method; + $this->load->config('javascript'); + $use_vuejs_dev_version = $this->config->item('use_vuejs_dev_version'); + // By default set the parameters to null $customJSs = isset($customJSs) ? $customJSs : null; $customJSModules = isset($customJSModules) ? $customJSModules : null; @@ -110,7 +113,14 @@ // Vue 3 JS if ($vue3 === true) { - generateJSsInclude('vendor/vuejs/vuejs3/vue.global.prod.js'); + if($use_vuejs_dev_version && $use_vuejs_dev_version === true) + { + generateJSsInclude('vendor/vuejs/vuejs3_dev/vue.global.js'); + } + else + { + generateJSsInclude('vendor/vuejs/vuejs3/vue.global.prod.js'); + } generateJSsInclude('vendor/vuejs/vuerouter4/vue-router.global.js'); } diff --git a/application/views/templates/FHC-Header.php b/application/views/templates/FHC-Header.php index 3ad161ef2..bca75512f 100644 --- a/application/views/templates/FHC-Header.php +++ b/application/views/templates/FHC-Header.php @@ -119,6 +119,9 @@ // CIS if ($cis === true) generateCSSsInclude(defined('CIS4') ? 'public/css/cis4.css' : 'public/css/cis_bs5.css'); + //Tags + if ($tags === true) generateCSSsInclude('public/css/tags.css'); + // Eventually required CSS generateCSSsInclude($customCSSs); // Eventually required CSS ?> diff --git a/cis/private/lvplan/index.php b/cis/private/lvplan/index.php index 7e7e8e28e..5af3c1b51 100644 --- a/cis/private/lvplan/index.php +++ b/cis/private/lvplan/index.php @@ -98,6 +98,7 @@ if(!$result_ort) die("ort not found!"); $num_rows_ort=$db->db_num_rows($result_ort); + /*$sql_query="SELECT student_uid FROM public.tbl_student ORDER BY student_uid"; $result_lektor=$db->db_query($sql_query); if(!$result_lektor) @@ -531,7 +532,6 @@ if(!defined('CIS_LVPLAN_ZUSATZMENUE_ANZEIGEN') || CIS_LVPLAN_ZUSATZMENUE_ANZEIGE echo '
'.$p->t('lvplan/fehlerUndFeedback').' '.$p->t('lvplan/lvKoordinationsstelle').'.
+echo ''.$p->t('lvplan/FragenZuLvPlan', array(MAIL_LVPLAN)).'