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 @@ +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/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/DB_Model.php b/application/core/DB_Model.php index 36de01a4a..c3a609f3d 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -991,8 +991,8 @@ class DB_Model extends CI_Model // Find and replace all the occurrences of the provided encrypted columns // with the postgresql decryption function - $query = str_replace( - $encryptedColumn, + $query = preg_replace( + '/\b' . $encryptedColumn . '\b/', sprintf( self::CRYPT_WHERE_TEMPLATE, $encryptedColumn, @@ -1106,8 +1106,8 @@ class DB_Model extends CI_Model { // Find and replace all the occurrences of the provided encrypted columns // with the postgresql decryption function - $where = str_replace( - $encryptedColumn, + $where = preg_replace( + '/\b' . $encryptedColumn . '\b/', sprintf( self::CRYPT_WHERE_TEMPLATE, $encryptedColumn, 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/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)).'