diff --git a/application/controllers/api/frontend/v1/LvMenu.php b/application/controllers/api/frontend/v1/LvMenu.php index 328ef194d..393c4d5c3 100644 --- a/application/controllers/api/frontend/v1/LvMenu.php +++ b/application/controllers/api/frontend/v1/LvMenu.php @@ -58,6 +58,22 @@ class LvMenu extends FHCAPI_Controller //------------------------------------------------------------------------------------------------------------------ // Public methods + + /** + * alternative function to get multiple lvMenus with a single http request + */ + public function getMultipleLvMenu($lvMenuOptionList){ + $result =[]; + foreach($lvMenuOptionList as $lvMenuOptions){ + $lvMenu = $this->getLvMenu($lvMenuOptions['lvid'],$lvMenuOptions['studiensemester_kurzbz']); + if(isError($lvMenu)){ + // TODO: some lvMenu threw an error, handle error here + } + $result[$lvMenuOptions['lvid']]=$lvMenu; + } + $this->terminateWithSuccess($result); + } + /** * */ @@ -91,20 +107,24 @@ class LvMenu extends FHCAPI_Controller $lvres = $this->Lehrveranstaltung_model->load($lvid); if(!hasData($lvres)) { - $this->terminateWithError('LV ' . $lvid . ' not found.'); + $this->terminateWithError('LV ' . $lvid . ' not found.'); } $lv = (getData($lvres))[0]; - + $this->addMeta('lvInfo',$lv); // define studiengang_kz / semester / lehrverzeichnis $studiengang_kz = $lv->studiengang_kz; $semester = $lv->semester; $short = $lv->lehreverzeichnis; + // return empty menu for studiengang_kz = 0 + if($studiengang_kz == 0){ + $this->terminateWithSuccess("organisatorische_einheit"); + } // load studiengang - $stgres = $this->Studiengang_model->load($lv->studiengang_kz); + $stgres = $this->Studiengang_model->load(strval($studiengang_kz)); if(!hasData($stgres)) { - $this->terminateWithError('Stg ' . $lv->studiengang_kz . ' nof found.'); + $this->terminateWithError('Stg ' . $lv->studiengang_kz . ' not found.'); } $stg = (getData($stgres))[0]; $kurzbz = strtoupper($stg->typ . $stg->kurzbz); 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/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/helpers/hlp_header_helper.php b/application/helpers/hlp_header_helper.php index ea1795ad5..bba8f9fc3 100644 --- a/application/helpers/hlp_header_helper.php +++ b/application/helpers/hlp_header_helper.php @@ -87,18 +87,28 @@ function generateCSSsInclude($CSSs) */ function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod) { + $ci =& get_instance(); + $ci->load->model('system/Sprache_model','SpracheModel'); + $server_language = getData($ci->SpracheModel->loadWhere(['content' => true])); + $server_language = array_map(function($language){ + return ['sprache'=>$language->sprache, 'locale'=>$language->locale, 'bezeichnung'=>$language->bezeichnung[$language->index-1]]; + }, $server_language); $user_language = getUserLanguage(); + $FHC_JS_DATA_STORAGE_OBJECT = array( + 'app_root' => APP_ROOT, + 'ci_router' => $indexPage, + 'called_path' => $calledPath, + 'called_method' => $calledMethod, + 'server_languages' => $server_language, + 'user_language' => $user_language, + 'timezone' => date_default_timezone_get(), + ); + $toPrint = "\n"; $toPrint .= ''; $toPrint .= "\n\n"; 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/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/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-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/include/lehrveranstaltung_faktor.class.php b/include/lehrveranstaltung_faktor.class.php new file mode 100644 index 000000000..49459321b --- /dev/null +++ b/include/lehrveranstaltung_faktor.class.php @@ -0,0 +1,258 @@ +load($lehrveranstaltung_faktor_id); + } + + + public function load($lehrveranstaltung_faktor_id) + { + if (!is_numeric($lehrveranstaltung_faktor_id)) + { + $this->errormsg = 'Lehrveranstaltung_faktor_id muss eine gueltige Zahl sein'; + return false; + } + + $qry = "SELECT * FROM lehre.tbl_lehrveranstaltung_faktor + WHERE lehrveranstaltung_faktor_id=".$this->db_add_param($lehrveranstaltung_faktor_id, FHC_INTEGER); + + if (!$this->db_query($qry)) { + $this->errormsg = 'Datensatz konnte nicht geladen werden'; + return false; + } + + if ($row = $this->db_fetch_object()) + { + $this->lehrveranstaltung_faktor_id = $row->lehrveranstaltung_faktor_id; + $this->lehrveranstaltung_id = $row->lehrveranstaltung_id; + $this->faktor = $row->faktor; + $this->studiensemester_kurzbz_von = $row->studiensemester_kurzbz_von; + $this->studiensemester_kurzbz_bis = $row->studiensemester_kurzbz_bis; + } + + return true; + } + + public function loadByLV($lv_id, $von = null, $bis = null, $id = null) + { + + if (!is_numeric($lv_id)) + { + $this->errormsg = 'Lehrveranstaltung_faktor_id muss eine gueltige Zahl sein'; + return false; + } + $qry = "SELECT * + FROM lehre.tbl_lehrveranstaltung_faktor + LEFT JOIN public.tbl_studiensemester vonstsem + ON tbl_lehrveranstaltung_faktor.studiensemester_kurzbz_von = vonstsem.studiensemester_kurzbz + LEFT JOIN public.tbl_studiensemester bisstem + ON tbl_lehrveranstaltung_faktor.studiensemester_kurzbz_bis = bisstem.studiensemester_kurzbz + WHERE lehrveranstaltung_id = ".$this->db_add_param($lv_id, FHC_INTEGER); + + if(!empty($von)) + { + $qry .= " + AND (bisstem.ende >= ( + SELECT start + FROM public.tbl_studiensemester + WHERE studiensemester_kurzbz = " . $this->db_add_param($von, FHC_STRING) . " + ) + OR bisstem.ende IS NULL + )"; + } + + if(!empty($bis) && $bis !== "") + { + $qry .= " + AND + (vonstsem.start <= ( + SELECT ende + FROM public.tbl_studiensemester + WHERE studiensemester_kurzbz = " . $this->db_add_param($bis, FHC_STRING) . " + )) + "; + } + + if (!empty($id) && $id !== "") + { + $qry .= " + AND + lehrveranstaltung_faktor_id != ". $this->db_add_param($id, FHC_INTEGER); + } + + if (!$result = $this->db_query($qry)) { + $this->errormsg = 'Datensatz konnte nicht geladen werden'; + return false; + } + + while ($row = $this->db_fetch_object($result)) + { + $lv_faktor_objekt = new lehrveranstaltung_faktor(); + + $lv_faktor_objekt->lehrveranstaltung_faktor_id = $row->lehrveranstaltung_faktor_id; + $lv_faktor_objekt->lehrveranstaltung_id = $row->lehrveranstaltung_id; + $lv_faktor_objekt->faktor = $row->faktor; + $lv_faktor_objekt->studiensemester_kurzbz_von = $row->studiensemester_kurzbz_von; + $lv_faktor_objekt->studiensemester_kurzbz_bis = $row->studiensemester_kurzbz_bis; + + $this->lv_faktoren[] = $lv_faktor_objekt; + } + + return true; + } + + public function addFaktor($lv_id, $faktor, $von, $bis = NULL) + { + $qry = 'INSERT INTO lehre.tbl_lehrveranstaltung_faktor (lehrveranstaltung_id, faktor, studiensemester_kurzbz_von, studiensemester_kurzbz_bis) + VALUES ('. $this->db_add_param($lv_id, FHC_INTEGER) . ', '. + $this->db_add_param($faktor, FHC_INTEGER) . ', '. + $this->db_add_param($von, FHC_STRING) . ', '. + $this->db_add_param($bis, FHC_STRING) . ');'; + + if ($this->db_query($qry)) + { + $qry_id = "SELECT currval('lehre.lehrveranstaltung_faktor_id_seq') as id;"; + if($this->db_query($qry_id)) + { + if($row = $this->db_fetch_object()) + { + $this->db_query('COMMIT'); + return [ + 'id' => $row->id, + 'lv_id' => $lv_id, + 'faktor' => $faktor, + 'von' => $von, + 'bis' => $bis + ]; + } + else + { + $this->db_query('ROLLBACK'); + return [ + 'status' => 'error', + 'message' => 'Fehler beim Einfügen in die Datenbank:' + ]; + } + } + else + { + $this->db_query('ROLLBACK'); + return [ + 'status' => 'error', + 'message' => 'Fehler beim Einfügen in die Datenbank:' + ]; + } + } + else + { + return [ + 'status' => 'error', + 'message' => 'Fehler beim Einfügen in die Datenbank:' + ]; + } + } + + public function updateFaktor($id, $faktor, $von, $bis) + { + $qry = "UPDATE lehre.tbl_lehrveranstaltung_faktor + SET faktor = ". $this->db_add_param($faktor) ." , + studiensemester_kurzbz_von = ". $this->db_add_param($von) .", + studiensemester_kurzbz_bis = ". $this->db_add_param($bis) ." + WHERE lehrveranstaltung_faktor_id = ". $this->db_add_param($id, FHC_INTEGER); + + if ($this->db_query($qry)) + { + return true; + } + else + { + return [ + 'status' => 'error', + 'message' => 'Fehler beim Einfügen in die Datenbank:' + ]; + } + } + + public function getAkt($lv_id) + { + if (!is_numeric($lv_id)) + { + $this->errormsg = 'Lehrveranstaltung_id muss eine gueltige Zahl sein'; + return false; + } + + $qry = "SELECT * + FROM lehre.tbl_lehrveranstaltung_faktor + LEFT JOIN public.tbl_studiensemester vonstsem + ON tbl_lehrveranstaltung_faktor.studiensemester_kurzbz_von = vonstsem.studiensemester_kurzbz + LEFT JOIN public.tbl_studiensemester bisstem + ON tbl_lehrveranstaltung_faktor.studiensemester_kurzbz_bis = bisstem.studiensemester_kurzbz + WHERE lehrveranstaltung_id = ".$this->db_add_param($lv_id, FHC_INTEGER) . " + AND (vonstsem.start <= now() OR vonstsem.start IS NULL) + AND (bisstem.ende >= now() OR bisstem.ende IS NULL) + ORDER BY vonstsem.start DESC LIMIT 1 + "; + + + if (!$this->db_query($qry)) { + $this->errormsg = 'Datensatz konnte nicht geladen werden'; + return false; + } + + if ($row = $this->db_fetch_object()) + { + $this->lehrveranstaltung_faktor_id = $row->lehrveranstaltung_faktor_id; + $this->lehrveranstaltung_id = $row->lehrveranstaltung_id; + $this->faktor = $row->faktor; + $this->studiensemester_kurzbz_von = $row->studiensemester_kurzbz_von; + $this->studiensemester_kurzbz_bis = $row->studiensemester_kurzbz_bis; + } + + return true; + } + + + public function deleteFaktor($id) + { + $qry = "DELETE FROM lehre.tbl_lehrveranstaltung_faktor + WHERE lehrveranstaltung_faktor_id = ". $this->db_add_param($id, FHC_INTEGER); + + if ($this->db_query($qry)) + { + return true; + } + else + { + return [ + 'status' => 'error', + 'message' => 'Fehler beim Löschen aus der Datenbank:' + ]; + } + } +} +?> diff --git a/include/mitarbeiter.class.php b/include/mitarbeiter.class.php index 836e2e6a7..1517122c2 100644 --- a/include/mitarbeiter.class.php +++ b/include/mitarbeiter.class.php @@ -1237,7 +1237,7 @@ class mitarbeiter extends benutzer ".$this->db_add_param($datumvon)." BETWEEN COALESCE(vbskarenz.von, '1970-01-01') AND COALESCE(vbskarenz.bis, '2170-12-31') OR ".$this->db_add_param($datumbis)." BETWEEN COALESCE(vbskarenz.von, '1970-01-01') AND COALESCE(vbskarenz.bis, '2170-12-31') - ) + ) LIMIT 1 ) NULLS FIRST LIMIT 1 ) diff --git a/include/notiz.class.php b/include/notiz.class.php index 5d237e2b8..c2e4c4ebf 100644 --- a/include/notiz.class.php +++ b/include/notiz.class.php @@ -325,7 +325,7 @@ class notiz extends basis_db FROM public.tbl_notiz LEFT JOIN public.tbl_notizzuordnung USING(notiz_id) - WHERE 1=1"; + WHERE 1=1 AND tbl_notiz.typ IS NULL "; if(!is_null($erledigt)) { @@ -523,7 +523,7 @@ class notiz extends basis_db FROM public.tbl_notiz LEFT JOIN public.tbl_notizzuordnung USING(notiz_id) - WHERE 1=1"; + WHERE 1=1 AND tbl_notiz.typ IS NULL "; if(!is_null($erledigt)) { diff --git a/public/css/components/searchbar/searchbar.css b/public/css/components/searchbar/searchbar.css index a4476e7c5..3250a20c7 100644 --- a/public/css/components/searchbar/searchbar.css +++ b/public/css/components/searchbar/searchbar.css @@ -26,6 +26,7 @@ width: 100%; left: 0; right: 0; + box-shadow: 2px 2px 4px rgba(0, 0, 0, .4); } .searchbar_results_scroller { @@ -109,3 +110,7 @@ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* IE/Edge */ } + +.searchbar_inaktiv { + opacity: .6; +} \ No newline at end of file diff --git a/public/css/tags.css b/public/css/tags.css new file mode 100644 index 000000000..8cf306626 --- /dev/null +++ b/public/css/tags.css @@ -0,0 +1,100 @@ +.tag { + display: inline-block; + padding: 5px 10px; + margin-right: 5px; + border-radius: 3px; + color: white; + font-size: .75em; + font-weight: 700; + line-height: 1; + text-align: center; + white-space: nowrap; + vertical-align: baseline; +} + +.tag:hover +{ + transform: scale(1.15); +} + +.tag_rot { + background-color: #ff0000ff; +} + +.tag_gelb { + background-color: #ffff00ff; + color: black; +} +.tag_gruen { + background-color: #008000ff; +} + +.tag_rosa { + background-color: #FFC1C1; + color: black; +} + +.tag_aprikose { + background-color: #4f7596; +} + +.tag_pfirsich { + background-color: #a15f95; +} + +.tag_orange { + background-color: #ffA500ff; +} + + +.tag_braun { + background-color: #6d4c41; +} + +.tag_blau { + background-color: #508498; +} + +.tag_lavendel { + background-color: #C7A3FF; +} + +.tag_limette { + background-color: #D3FFCE; +} + +.tag_done { + text-decoration: line-through; +} + +.display_all { + background-color: darkgrey !important; + border: none; +} + +.dropdown_list { + list-style: none; + background-color: white; + border: 1px solid #ccc; + border-radius: 5px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + z-index: 1000; + position: absolute; + padding: 10px 10px 10px; + max-width: 200px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + cursor: pointer; +} + +.plus_button_container.disabled { + pointer-events: none; + opacity: 0.5; +} + +.modificationdate { + font-style: italic; + font-size: 0.7em; + text-align: left; +} diff --git a/public/js/apps/Cis.js b/public/js/apps/Cis.js index 777998c97..35aa5c6b2 100644 --- a/public/js/apps/Cis.js +++ b/public/js/apps/Cis.js @@ -18,6 +18,7 @@ const app = Vue.createApp({ calcheightonly: true, types: [ "mitarbeiter", + "student", "raum", "organisationunit" ], @@ -33,6 +34,17 @@ const app = Vue.createApp({ }, childactions: [] }, + student: { + defaultaction: { + type: "link", + action: function (data) { + return FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + + "/Cis/Profil/View/" + data.uid; + + } + }, + childactions: [] + }, raum: { defaultaction: { type: "link", diff --git a/public/js/components/Calendar/Day.js b/public/js/components/Calendar/Day.js index af6a3d44d..afee386a6 100644 --- a/public/js/components/Calendar/Day.js +++ b/public/js/components/Calendar/Day.js @@ -13,7 +13,7 @@ export default { }, computed: { title() { - return this.focusDate.format({ year: 'numeric' }) + ' KW ' + this.focusDate.w; + return this.focusDate.wYear + ' KW ' + this.focusDate.w; } }, methods: { diff --git a/public/js/components/Calendar/Day/Page.js b/public/js/components/Calendar/Day/Page.js index 68ddc419a..ef0108090 100644 --- a/public/js/components/Calendar/Day/Page.js +++ b/public/js/components/Calendar/Day/Page.js @@ -102,9 +102,9 @@ export default { dayText(){ if(!this.size || !this.day)return {}; return { - heading: this.day.toLocaleString(this.$p.user_language_locale_identifier.value, { dateStyle: 'short' }), - tag: this.day.toLocaleString(this.$p.user_language_locale_identifier.value, { weekday: this.size < 2 ? 'narrow' : (this.size < 3 ? 'short' : 'long') }), - datum: this.day.toLocaleString(this.$p.user_language_locale_identifier.value, [{ day: 'numeric', month: 'numeric' }, { day: 'numeric', month: 'numeric' }, { day: 'numeric', month: 'numeric' }, { dateStyle: 'short' }][this.size]), + heading: this.day.toLocaleString(this.$p.user_locale.value, { dateStyle: 'short' }), + tag: this.day.toLocaleString(this.$p.user_locale.value, { weekday: this.size < 2 ? 'narrow' : (this.size < 3 ? 'short' : 'long') }), + datum: this.day.toLocaleString(this.$p.user_locale.value, [{ day: 'numeric', month: 'numeric' }, { day: 'numeric', month: 'numeric' }, { day: 'numeric', month: 'numeric' }, { dateStyle: 'short' }][this.size]), } }, dayGridStyle() { diff --git a/public/js/components/Calendar/Month.js b/public/js/components/Calendar/Month.js index 65ac83a72..b1050c75d 100644 --- a/public/js/components/Calendar/Month.js +++ b/public/js/components/Calendar/Month.js @@ -17,7 +17,7 @@ export default { }, computed: { title() { - return this.focusDate.format({month: ['short','long','long','long'][this.size], year: 'numeric'}, this.$p.user_language_locale_identifier.value); + return this.focusDate.format({month: ['short','long','long','long'][this.size], year: 'numeric'}, this.$p.user_locale.value); } }, methods: { diff --git a/public/js/components/Calendar/Month/Page.js b/public/js/components/Calendar/Month/Page.js index adcb8e911..e7bdcf4b0 100644 --- a/public/js/components/Calendar/Month/Page.js +++ b/public/js/components/Calendar/Month/Page.js @@ -32,7 +32,7 @@ export default { if (!this.size || !this.weeks[0]?.days) return {}; let dayTextMap ={}; this.weeks[0].days.forEach((day)=>{ - dayTextMap[day] = day.toLocaleString(this.$p.user_language_locale_identifier.value, { weekday: this.size < 1 ? 'narrow' : (this.size < 3 ? 'short' : 'long') }); + dayTextMap[day] = day.toLocaleString(this.$p.user_locale.value, { weekday: this.size < 1 ? 'narrow' : (this.size < 3 ? 'short' : 'long') }); }); return dayTextMap; }, diff --git a/public/js/components/Calendar/Months.js b/public/js/components/Calendar/Months.js index ab49e9a9c..6ef9b1bb1 100644 --- a/public/js/components/Calendar/Months.js +++ b/public/js/components/Calendar/Months.js @@ -17,7 +17,7 @@ export default { return this.focusDate.format({year: 'numeric'}); }, months() { - return this.monthIndices.map(i => (new Date(0, i, 1)).toLocaleString(this.$p.user_language_locale_identifier.value, {month: this.size < 2 ? 'short' : 'long'})); + return this.monthIndices.map(i => (new Date(0, i, 1)).toLocaleString(this.$p.user_locale.value, {month: this.size < 2 ? 'short' : 'long'})); } }, template: ` diff --git a/public/js/components/Calendar/Week.js b/public/js/components/Calendar/Week.js index 36d012b27..f17a09511 100644 --- a/public/js/components/Calendar/Week.js +++ b/public/js/components/Calendar/Week.js @@ -12,7 +12,7 @@ export default { }, computed: { title() { - return this.focusDate.format({ year: 'numeric' }) + ' KW ' + this.focusDate.w; + return this.focusDate.wYear + ' KW ' + this.focusDate.w; } }, methods: { diff --git a/public/js/components/Calendar/Week/Page.js b/public/js/components/Calendar/Week/Page.js index 8cc657cb1..15c17f8ea 100644 --- a/public/js/components/Calendar/Week/Page.js +++ b/public/js/components/Calendar/Week/Page.js @@ -61,9 +61,9 @@ export default { let dayTextMap ={}; this.days.forEach((day)=>{ dayTextMap[day] = { - heading: day.toLocaleString(this.$p.user_language_locale_identifier.value, { dateStyle: 'short' }), - tag: day.toLocaleString(this.$p.user_language_locale_identifier.value, { weekday: this.size < 2 ? 'narrow' : (this.size < 3 ? 'short' : 'long') }), - datum: day.toLocaleString(this.$p.user_language_locale_identifier.value, [{ day: 'numeric', month: 'numeric' }, { day: 'numeric', month: 'numeric' }, { day: 'numeric', month: 'numeric' }, { dateStyle: 'short' }][this.size]), + heading: day.toLocaleString(this.$p.user_locale.value, { dateStyle: 'short' }), + tag: day.toLocaleString(this.$p.user_locale.value, { weekday: this.size < 2 ? 'narrow' : (this.size < 3 ? 'short' : 'long') }), + datum: day.toLocaleString(this.$p.user_locale.value, [{ day: 'numeric', month: 'numeric' }, { day: 'numeric', month: 'numeric' }, { day: 'numeric', month: 'numeric' }, { dateStyle: 'short' }][this.size]), }; }); return dayTextMap; diff --git a/public/js/components/Cis/Mylv/Semester/Studiengang/Lv.js b/public/js/components/Cis/Mylv/Semester/Studiengang/Lv.js index 832b0c0e7..147062f62 100644 --- a/public/js/components/Cis/Mylv/Semester/Studiengang/Lv.js +++ b/public/js/components/Cis/Mylv/Semester/Studiengang/Lv.js @@ -39,6 +39,12 @@ export default { } }, computed: { + is_organisatorische_einheit(){ + return this.menu == "organisatorische_einheit"; + }, + emptyMenu(){ + return !this.menu || !Array.isArray(this.menu) || Array.isArray(this.menu) && this.menu.length == 0; + }, bodyStyle() {return {}; const bodyStyle = {}; if (this.farbe) @@ -53,6 +59,17 @@ export default { }, }, methods: { + fetchMenu(lehrveranstaltung_id = this.lehrveranstaltung_id, studien_semester = this.studien_semester){ + return this.$fhcApi.factory.addons.getLvMenu(lehrveranstaltung_id, studien_semester) + .then(res => { + this.menu = res.data; + }) + .catch((error) => { + this.$fhcAlert.handleSystemError(error); + this.menu = []; + }); + }, + c4_link(menuItem) { if (!menuItem) return null; if (Array.isArray(menuItem.c4_moodle_links) && menuItem.c4_moodle_links.length) { @@ -103,11 +120,7 @@ export default { }, watch:{ studien_semester(newValue){ - this.$fhcApi.factory.addons.getLvMenu(this.lehrveranstaltung_id, newValue) - .then(res => { - this.menu = res.data; - }) - .catch((error) => this.$fhcAlert.handleSystemError); + this.fetchMenu(this.lehrveranstaltung_id, newValue); } }, created(){ @@ -119,14 +132,7 @@ export default { }, mounted() { - this.$fhcApi.factory.addons.getLvMenu(this.lehrveranstaltung_id, this.studien_semester) - .then(res => { - this.menu = res.data; - }) - .catch((error) => { - this.$fhcAlert.handleSystemError(error); - this.menu = []; - }); + this.fetchMenu(this.lehrveranstaltung_id, this.studien_semester); }, template: /*html*/`