From ea2be8026b463c8cf9c7132197aea82831aa9886 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 12 Mar 2025 08:06:23 +0100 Subject: [PATCH 01/23] filter hidden from kontakttyp, show typ.beschreibung in dropdown --- .../controllers/api/frontend/v1/stv/Kontakt.php | 15 ++++++++------- .../Details/Kontakt/Contact.js | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Kontakt.php b/application/controllers/api/frontend/v1/stv/Kontakt.php index fd16fff06..1c3c0c95d 100644 --- a/application/controllers/api/frontend/v1/stv/Kontakt.php +++ b/application/controllers/api/frontend/v1/stv/Kontakt.php @@ -439,6 +439,7 @@ class Kontakt extends FHCAPI_Controller $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); } $this->terminateWithSuccess((getData($result) ?: [])); + } public function getKontakttypen() @@ -446,13 +447,13 @@ class Kontakt extends FHCAPI_Controller $this->load->model('person/Kontakttyp_model', 'KontakttypModel'); $result = $this->KontakttypModel->load(); - if (isError($result)) { - $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - else - { - $this->terminateWithSuccess(getData($result) ?: []); - } + + $data = $this->getDataOrTerminateWithError($result); + + $filteredData = array_filter($data, function ($item) { + return $item->kontakttyp !== "hidden"; + }); + $this->terminateWithSuccess($filteredData); } public function loadContact() diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js index 87dc70eb1..0bda648a9 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js @@ -322,7 +322,7 @@ export default{ v-model="contactData.kontakttyp"> > - + From 31f0be35c876a39eb7d2bcfaae57039e9932dfa7 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 2 Jul 2025 12:53:54 +0200 Subject: [PATCH 02/23] selbe person auch wenn nicht abbrecher --- application/models/person/Person_model.php | 116 +++++++++------------ 1 file changed, 52 insertions(+), 64 deletions(-) diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 997048972..3947378cf 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -307,72 +307,60 @@ class Person_model extends DB_Model public function checkDuplicate($person_id) { - $qry = "SELECT person_id - FROM public.tbl_prestudent p - JOIN - ( - SELECT DISTINCT ON(prestudent_id) * - FROM public.tbl_prestudentstatus - WHERE prestudent_id IN - ( - SELECT prestudent_id - FROM public.tbl_prestudent - WHERE person_id IN - ( - SELECT p2.person_id - FROM public.tbl_person p - JOIN public.tbl_person p2 - ON lower(p.vorname) = lower(p2.vorname) - AND lower(p.nachname) = lower(p2.nachname) - AND p.gebdatum = p2.gebdatum - AND p.person_id = ? - ) - ) - ORDER BY prestudent_id, datum DESC, insertamum DESC - ) ps USING(prestudent_id) - JOIN public.tbl_status USING(status_kurzbz) + $qry = " + WITH person AS ( + SELECT * + FROM public.tbl_person + WHERE person_id = ? + ), + allePersonen AS ( + SELECT p.person_id + FROM public.tbl_person p + JOIN person + ON lower(p.vorname) = lower(person.vorname) + AND lower(p.nachname) = lower(person.nachname) + AND p.gebdatum = person.gebdatum + ), + lastStatus AS ( + SELECT DISTINCT ON (tbl_prestudentstatus.prestudent_id) + tbl_prestudentstatus.prestudent_id, + tbl_prestudentstatus.status_kurzbz, + tbl_prestudent.studiengang_kz, + tbl_prestudent.person_id + FROM public.tbl_prestudentstatus + JOIN public.tbl_prestudent USING (prestudent_id) + WHERE tbl_prestudent.person_id IN (SELECT person_id FROM allePersonen) + ORDER BY tbl_prestudentstatus.prestudent_id, tbl_prestudentstatus.datum DESC, tbl_prestudentstatus.insertamum DESC + ), + interessenten AS ( + SELECT * + FROM lastStatus WHERE status_kurzbz = 'Interessent' - AND studiengang_kz IN - ( - SELECT studiengang_kz - FROM public.tbl_prestudent p - JOIN - ( - SELECT DISTINCT ON(prestudent_id) * - FROM public.tbl_prestudentstatus - WHERE prestudent_id IN - ( - SELECT prestudent_id - FROM public.tbl_prestudent - WHERE person_id IN - ( - SELECT p2.person_id - FROM public.tbl_person p - JOIN public.tbl_person p2 - ON lower(p.vorname) = lower(p2.vorname) - AND lower(p.nachname) = lower(p2.nachname) - AND p.gebdatum = p2.gebdatum - AND p.person_id = ? - ) - ) - ORDER BY prestudent_id, datum DESC, insertamum DESC - ) ps USING(prestudent_id) - JOIN public.tbl_status USING(status_kurzbz) - WHERE status_kurzbz = 'Abbrecher' - ) - - UNION - + ), + keineInteressenten AS ( + SELECT * + FROM lastStatus + WHERE status_kurzbz != 'Interessent' + ), + doppeltePerson AS ( SELECT p2.person_id - FROM tbl_person p1 - JOIN tbl_prestudent ps ON p1.person_id = ps.person_id - INNER JOIN ( - SELECT vorname, nachname, gebdatum, person.person_id - FROM tbl_person person - JOIN tbl_prestudent sps ON person.person_id = sps.person_id - ) p2 - ON (lower(p1.vorname) = lower(p2.vorname) AND lower(p1.nachname) = lower(p2.nachname) AND p1.gebdatum = p2.gebdatum) - WHERE p1.person_id != p2.person_id AND (p1.person_id = ?)"; + FROM public.tbl_person p1 + JOIN public.tbl_prestudent ps1 ON ps1.person_id = p1.person_id + JOIN public.tbl_person p2 + ON lower(p1.vorname) = lower(p2.vorname) + AND lower(p1.nachname) = lower(p2.nachname) + AND p1.gebdatum = p2.gebdatum + WHERE p1.person_id = ? + AND p1.person_id <> p2.person_id + ) + SELECT DISTINCT(interessenten.person_id) + FROM interessenten + JOIN keineInteressenten + ON interessenten.studiengang_kz = keineInteressenten.studiengang_kz + WHERE interessenten.person_id = ? + UNION + SELECT DISTINCT person_id + FROM doppeltePerson"; return $this->execQuery($qry, array($person_id, $person_id, $person_id)); } From aca49114be9f54a4b814d125967af6e991b47987 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Mon, 7 Jul 2025 09:56:34 +0200 Subject: [PATCH 03/23] anmerkung zur bewerbung weiterleiten --- .../views/system/infocenter/anmerkungenZurBewerbung.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/views/system/infocenter/anmerkungenZurBewerbung.php b/application/views/system/infocenter/anmerkungenZurBewerbung.php index ca012ff3e..3ffe5f9a2 100644 --- a/application/views/system/infocenter/anmerkungenZurBewerbung.php +++ b/application/views/system/infocenter/anmerkungenZurBewerbung.php @@ -18,6 +18,9 @@ kurzbzlang)) ?: print_r('(' . nl2br($notiz->kurzbzlang) . ') - ') ?> text) ?> + + + From 34a239a823ffdea8b6dac04b5471d0e0bcb74179 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 13 Aug 2025 14:54:43 +0200 Subject: [PATCH 04/23] Set Foto to null instead of empty String when Deleted --- application/controllers/api/frontend/v1/stv/Student.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index ac09f39bb..70970d8b5 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -276,9 +276,14 @@ class Student extends FHCAPI_Controller $update_person = array(); foreach ($array_allowed_props_person as $prop) { $val = $this->input->post($prop); - if ($val !== null) { + if ($val !== null) + { $update_person[$prop] = $val; } + if($prop == 'foto' && $val == '') + { + $update_person[$prop] = null; + } } $array_allowed_props_student = ['matrikelnr']; From 045b764d654d44229fc97112673f712013384659 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Tue, 26 Aug 2025 12:40:27 +0200 Subject: [PATCH 05/23] studentenverwaltung im infocenter verlinkt --- application/controllers/system/infocenter/InfoCenter.php | 2 ++ application/views/system/infocenter/infocenterDetails.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 1fc49c72f..1a4f566e6 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -362,6 +362,8 @@ class InfoCenter extends Auth_Controller $data[self::ORIGIN_PAGE] = $origin_page; $data[self::PREV_FILTER_ID] = $this->input->get(self::PREV_FILTER_ID); + $data['studiensemester'] = $this->variablelib->getVar('infocenter_studiensemester'); + $this->load->view('system/infocenter/infocenterDetails.php', $data); } diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index 51b913b6c..fb023c5fd 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -57,7 +57,7 @@
From 7e6643c0ff6e6bc7fbdaa4864b91afb56a717e4b Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 27 Aug 2025 09:51:34 +0200 Subject: [PATCH 06/23] phrase typo --- public/js/components/LVVerwaltung/Lektor/Table.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/components/LVVerwaltung/Lektor/Table.js b/public/js/components/LVVerwaltung/Lektor/Table.js index 373a8955c..237554be9 100644 --- a/public/js/components/LVVerwaltung/Lektor/Table.js +++ b/public/js/components/LVVerwaltung/Lektor/Table.js @@ -199,7 +199,7 @@ export default{ table-only :side-menu="false" reload - :new-btn-label="$p.t('lehre', 'addlektor')" + :new-btn-label="$p.t('lehre', 'addLektor')" new-btn-show @click:new="showAutocomplete = !showAutocomplete" > From 34528bb01446fb9f522589a63b2e310d4037f3c5 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Fri, 29 Aug 2025 13:19:00 +0200 Subject: [PATCH 07/23] iframe content hinzugefuegt --- public/js/components/Cis/Cms/Content.js | 5 ++ system/dbupdate_3.4.php | 1 + .../63436_cis4_iframe_component.php | 81 +++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 system/dbupdate_3.4/63436_cis4_iframe_component.php diff --git a/public/js/components/Cis/Cms/Content.js b/public/js/components/Cis/Cms/Content.js index 470a0fa62..ec1bc8a76 100644 --- a/public/js/components/Cis/Cms/Content.js +++ b/public/js/components/Cis/Cms/Content.js @@ -2,6 +2,8 @@ import raum_contentmittitel from './Content_types/Raum_contentmittitel.js' import general from './Content_types/General.js' import BsConfirm from "../../Bootstrap/Confirm.js"; import news_content from './Content_types/News_content.js'; +import iframe_content from './Content_types/Iframe_content.js'; + import ApiCms from '../../../api/factory/cms.js'; export default { @@ -24,6 +26,7 @@ export default { raum_contentmittitel, news_content, general, + iframe_content }, data() { return { @@ -83,6 +86,8 @@ export default { return "raum_contentmittitel"; case "news": return "news_content"; + case "iframe": + return "iframe_content"; default: return "general"; }; diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index cf2f40ca8..23ad5ffcd 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -77,6 +77,7 @@ require_once('dbupdate_3.4/55614_perm_verwaltetoe.php'); require_once('dbupdate_3.4/25999_C4_dashboard.php'); require_once('dbupdate_3.4/61730_Dashboard_Anpassungen.php'); require_once('dbupdate_3.4/40128_search.php'); +require_once('dbupdate_3.4/63436_cis4_iframe_component.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/system/dbupdate_3.4/63436_cis4_iframe_component.php b/system/dbupdate_3.4/63436_cis4_iframe_component.php new file mode 100644 index 000000000..abff4b7e1 --- /dev/null +++ b/system/dbupdate_3.4/63436_cis4_iframe_component.php @@ -0,0 +1,81 @@ + + + + + + + + + +EOD; + +$xslt_xhtml= << + + + + + + + +
Keine URL im Inhalt gefunden.
+
+
+
+ +EOD; + +$xslt_xhtml_c4= << + + + + + + + +
Keine URL im Inhalt gefunden.
+
+
+
+ +EOD; + + +if ($result = @$db->db_query("SELECT * FROM campus.tbl_template WHERE template_kurzbz='iframe2'")) +{ + if ($db->db_num_rows($result) == 0) + { + $sql= <<db_query($sql)) + { + echo 'campus.tbl_template: ' . $db->db_last_error() . '
'; + } + else + { + echo ' campus.tbl_template: Template "iframe" hinzugefügt.
'; + } + + } +} \ No newline at end of file From 396251b0613d8fea526f8382d5702fd1b1fb44a2 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Tue, 2 Sep 2025 13:35:15 +0200 Subject: [PATCH 08/23] lvverwaltung einschraenkung bei den tags erledigte tags werden in der header suche nicht beruecksichtigt --- application/config/lvverwaltung.php | 11 ++ .../controllers/api/frontend/v1/lv/Gruppe.php | 2 +- .../controllers/api/frontend/v1/lv/Tags.php | 26 +++ application/core/Tag_Controller.php | 150 +++++++++++++++--- .../models/education/Lehreinheit_model.php | 23 ++- public/js/components/Tag/Tag.js | 10 +- .../tabulator/filters/extendedHeaderFilter.js | 3 +- 7 files changed, 193 insertions(+), 32 deletions(-) create mode 100644 application/config/lvverwaltung.php diff --git a/application/config/lvverwaltung.php b/application/config/lvverwaltung.php new file mode 100644 index 000000000..466f5c7ab --- /dev/null +++ b/application/config/lvverwaltung.php @@ -0,0 +1,11 @@ + ['readonly' => false], + 'hinweis' => ['readonly' => false], + 'hinweis_assistenz' => ['readonly' => false], + 'finished_stg' => ['readonly' => false], + + 'finished_kf' => ['readonly' => true], + 'inwork_kf' => ['readonly' => true], +]; diff --git a/application/controllers/api/frontend/v1/lv/Gruppe.php b/application/controllers/api/frontend/v1/lv/Gruppe.php index 4a1e68656..83a4fb696 100644 --- a/application/controllers/api/frontend/v1/lv/Gruppe.php +++ b/application/controllers/api/frontend/v1/lv/Gruppe.php @@ -116,7 +116,7 @@ class Gruppe extends FHCAPI_Controller bezeichnung, gid, \'false\' as lehrverband'); - $gruppen_result = $this->_ci->GruppeModel->loadWhere(array('sichtbar' => true, 'aktiv' => true, 'lehre' => true, 'direktinskription' => false)); + $gruppen_result = $this->_ci->GruppeModel->loadWhere(array('sichtbar' => true, 'aktiv' => true, 'lehre' => true, 'direktinskription' => false, 'semester IS NOT NULL' => null)); $gruppen_array = array(); diff --git a/application/controllers/api/frontend/v1/lv/Tags.php b/application/controllers/api/frontend/v1/lv/Tags.php index 234ab3cba..a22a4c82e 100644 --- a/application/controllers/api/frontend/v1/lv/Tags.php +++ b/application/controllers/api/frontend/v1/lv/Tags.php @@ -20,5 +20,31 @@ class Tags extends Tag_Controller 'doneLehre' => self::BERECHTIGUNG_KURZBZ, 'deleteLehre' => self::BERECHTIGUNG_KURZBZ, ]); + + $this->config->load('lvverwaltung'); + } + public function getTag($readonly_tags = null) + { + parent::getTag($this->config->item('lvverwaltung_tags')); + } + public function getTags($tags = null) + { + parent::getTags($this->config->item('lvverwaltung_tags')); + } + public function addTag($withZuordnung = true, $updatable_tags = null) + { + parent::addTag(true, $this->config->item('lvverwaltung_tags')); + } + public function updateTag($updatable_tags = null) + { + parent::updateTag($this->config->item('lvverwaltung_tags')); + } + public function deleteTag($withZuordnung = true, $updatable_tags = null) + { + parent::deleteTag(true, $this->config->item('lvverwaltung_tags')); + } + public function doneTag($updatable_tags = null) + { + parent::doneTag($this->config->item('lvverwaltung_tags')); } } \ No newline at end of file diff --git a/application/core/Tag_Controller.php b/application/core/Tag_Controller.php index 10e54780e..5b9bac6c5 100644 --- a/application/core/Tag_Controller.php +++ b/application/core/Tag_Controller.php @@ -29,13 +29,36 @@ class Tag_Controller extends FHCAPI_Controller $this->load->model('person/Notiz_model', 'NotizModel'); $this->load->model('system/Notiztyp_model', 'NotiztypModel'); $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + + $this->loadPhrases([ + 'ui' + ]); } - public function getTag() + public function getTag($readonly_tags = null) { $language = $this->_getLanguageIndex(); $id = $this->input->get('id'); + if (is_array($readonly_tags) && !isEmptyArray($readonly_tags)) + { + $readonly_tags = $this->_filterTag($readonly_tags, true); + + foreach ($readonly_tags as $key => $tag) + { + $readonly_tags[$key] = $this->NotizModel->db->escape($tag); + } + $tags = '(' . implode(',', $readonly_tags) . ')'; + + $this->NotizModel->addSelect(" + CASE + WHEN tbl_notiz_typ.typ_kurzbz IN $tags + THEN TRUE + ELSE FALSE + END as readonly + "); + } + $this->NotizModel->addSelect( "tbl_notiz.titel, tbl_notiz.text, @@ -54,7 +77,7 @@ class Tag_Controller extends FHCAPI_Controller $this->NotizModel->addJoin('public.tbl_benutzer verfasserbenutzer', 'tbl_notiz.verfasser_uid = verfasserbenutzer.uid', 'LEFT'); $this->NotizModel->addJoin('public.tbl_person verfasserperson', 'verfasserbenutzer.person_id = verfasserperson.person_id', 'LEFT'); - $this->NotizModel->addJoin('public.tbl_benutzer bearbeiterbenutzer', 'tbl_notiz.verfasser_uid = bearbeiterbenutzer.uid', 'LEFT'); + $this->NotizModel->addJoin('public.tbl_benutzer bearbeiterbenutzer', 'tbl_notiz.bearbeiter_uid = bearbeiterbenutzer.uid', 'LEFT'); $this->NotizModel->addJoin('public.tbl_person bearbeiterperson', 'bearbeiterbenutzer.person_id = bearbeiterperson.person_id', 'LEFT'); $notiz = $this->NotizModel->loadWhere(array('notiz_id' => $id)); @@ -62,7 +85,7 @@ class Tag_Controller extends FHCAPI_Controller $this->terminateWithSuccess(hasData($notiz) ? getData($notiz)[0] : array()); } - public function getTags() + public function getTags($tags = null) { $this->NotiztypModel->addSelect( 'typ_kurzbz as tag_typ_kurzbz, @@ -73,19 +96,36 @@ class Tag_Controller extends FHCAPI_Controller ' ); $this->NotiztypModel->addOrder('prioritaet'); + + if (is_array($tags) && !isEmptyArray($tags)) + { + $tags = $this->_filterTag($tags, false); + $this->NotiztypModel->db->where_in('typ_kurzbz', $tags); + } + $notiztypen = $this->NotiztypModel->loadWhere(array('aktiv' => true)); $this->terminateWithSuccess(hasData($notiztypen) ? getData($notiztypen) : array()); } - public function addTag($withZuordnung = true) + public function addTag($withZuordnung = true, $updatable_tags = null) { $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 (isError($checkTyp)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + if (!hasData($checkTyp)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (is_array($updatable_tags) && !isEmptyArray($updatable_tags)) + { + $tags = $this->_filterTag($updatable_tags, false); + + if (!in_array($postData->tag_typ_kurzbz, $tags)) + $this->terminateWithError($this->p->t('ui', 'keineBerechtigung')); + } if ($withZuordnung) { @@ -125,48 +165,88 @@ class Tag_Controller extends FHCAPI_Controller } } - 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() + public function updateTag($updatable_tags = null) { $postData = $this->getPostJson(); + $post_tag = $this->NotizModel->loadWhere(array('notiz_id' => $postData->id)); + + if (isError($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (!hasData($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (is_array($updatable_tags) && !isEmptyArray($updatable_tags)) + { + $tags = $this->_filterTag($updatable_tags, false); + + $post_tag_typ = getData($post_tag)[0]->typ; + + if (!in_array($post_tag_typ, $tags)) + $this->terminateWithError($this->p->t('ui', 'keineBerechtigung')); + } + $updateData = $this->NotizModel->update(array('notiz_id' => $postData->id), array('text' => $postData->notiz, 'updateamum' => date('Y-m-d H:i:s'), 'updatevon' => $this->_uid, 'bearbeiter_uid' => $this->_uid, - ) + ) ); $this->terminateWithSuccess($updateData); } - public function doneTag() + public function doneTag($updatable_tags = null) { $postData = $this->getPostJson(); + $post_tag = $this->NotizModel->loadWhere(array('notiz_id' => $postData->id)); + + if (isError($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (!hasData($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (is_array($updatable_tags) && !isEmptyArray($updatable_tags)) + { + $tags = $this->_filterTag($updatable_tags, false); + + $post_tag_typ = getData($post_tag)[0]->typ; + + if (!in_array($post_tag_typ, $tags)) + $this->terminateWithError($this->p->t('ui', 'keineBerechtigung')); + } + $updateData = $this->NotizModel->update(array('notiz_id' => $postData->id), array('erledigt' => !$postData->done, + 'text' => $postData->notiz, 'updateamum' => date('Y-m-d H:i:s'), 'updatevon' => $this->_uid, 'bearbeiter_uid' => $this->_uid, ) ); - $this->terminateWithSuccess($updateData); } - public function deleteTag($withZuordnung = true) + public function deleteTag($withZuordnung = true, $updatable_tags = null) { $postData = $this->getPostJson(); + $post_tag = $this->NotizModel->loadWhere(array('notiz_id' => $postData->id)); + + if (isError($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (!hasData($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (is_array($updatable_tags) && !isEmptyArray($updatable_tags)) + { + $tags = $this->_filterTag($updatable_tags, false); + + $post_tag_typ = getData($post_tag)[0]->typ; + + if (!in_array($post_tag_typ, $tags)) + $this->terminateWithError($this->p->t('ui', 'keineBerechtigung')); + } $deleteNotiz = ""; if ($withZuordnung) @@ -208,5 +288,27 @@ class Tag_Controller extends FHCAPI_Controller return hasData($result) ? getData($result)[0]->index : 1; } + private function _filterTag($tags, $readonly = true) + { + $filtered_tags = array_filter($tags, function ($tag) use ($readonly) + { + return isset($tag['readonly']) && $tag['readonly'] === $readonly; + }); + + return array_keys($filtered_tags); + } + + 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 + )); + } } \ No newline at end of file diff --git a/application/models/education/Lehreinheit_model.php b/application/models/education/Lehreinheit_model.php index c373f5449..9b850f0d0 100644 --- a/application/models/education/Lehreinheit_model.php +++ b/application/models/education/Lehreinheit_model.php @@ -689,10 +689,26 @@ EOSQL; private function _getTagsCTE() { + $this->load->config('lvverwaltung'); + $tags = $this->config->item('tags'); + + $whereTags = ''; + if (is_array($tags) && !isEmptyArray($tags)) + { + $tags = array_keys($tags); + + foreach ($tags as $key => $tag) + { + $tags[$key] = $this->db->escape($tag); + } + + $whereTags = " AND tbl_notiz_typ.typ_kurzbz IN (" . implode(",", $tags) . ")"; + } + return "tag_data_agg AS ( SELECT lehreinheit_id, - COALESCE(json_agg(tag ORDER BY id), '[]'::json) AS tags + COALESCE(json_agg(tag ORDER BY done), '[]'::json) AS tags FROM ( SELECT DISTINCT ON (public.tbl_notiz.notiz_id) tbl_notiz.notiz_id AS id, @@ -705,8 +721,9 @@ EOSQL; FROM public.tbl_notizzuordnung JOIN public.tbl_notiz ON tbl_notizzuordnung.notiz_id = tbl_notiz.notiz_id JOIN public.tbl_notiz_typ ON tbl_notiz.typ = tbl_notiz_typ.typ_kurzbz - WHERE lehreinheit_id IN (SELECT lehreinheit_id FROM lehreinheiten) - ) AS tag + WHERE lehreinheit_id IN (SELECT lehreinheit_id FROM lehreinheiten)" + . $whereTags. + ") AS tag GROUP BY lehreinheit_id )"; } diff --git a/public/js/components/Tag/Tag.js b/public/js/components/Tag/Tag.js index a3243ed47..a7c7a61ab 100644 --- a/public/js/components/Tag/Tag.js +++ b/public/js/components/Tag/Tag.js @@ -86,6 +86,7 @@ export default { this.tagData.updateamum = this.formatDateTime(item.updateamum) this.tagData.bearbeiter = item.bearbeiter; this.tagData.verfasser = item.verfasser; + this.tagData.readonly = item.readonly; if (item && item.notiz_id) { @@ -154,7 +155,8 @@ export default { let postData = { id: this.selectedTagId, - done: !this.tagData.done + done: !this.tagData.done, + notiz: this.tagData.notiz, } this.$api.call(this.endpoint.doneTag(postData)) this.$emit("updated", this.tagData); @@ -182,7 +184,8 @@ export default { verfasser: "", updateamum: "", bearbeiter: "", - response: "" + response: "", + readonly: false }; this.selectedTagId = null; this.mode = "create"; @@ -230,6 +233,7 @@ export default { v-model="tagData.notiz" type="textarea" field="notiz" + :readonly="tagData.readonly" placeholder="Notiz..." >
@@ -243,7 +247,7 @@ export default {
-