From 0a4906c5ac743158a705e4d8886b6c27077a509a Mon Sep 17 00:00:00 2001 From: adisposkofh Date: Wed, 13 May 2026 16:07:43 +0200 Subject: [PATCH] added course-specific mailing lists --- application/libraries/ProfilLib.php | 53 +++++++++++++++++++++++++++++ system/phrasesupdate.php | 23 ++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/application/libraries/ProfilLib.php b/application/libraries/ProfilLib.php index 97cb8ce5d..43a110b85 100644 --- a/application/libraries/ProfilLib.php +++ b/application/libraries/ProfilLib.php @@ -263,6 +263,59 @@ class ProfilLib{ $element->mailto = "mailto:" . $element->gruppe_kurzbz . "@" . DOMAIN; return $element; }, $mailverteiler_res); + + $this->ci->load->model("crm/Student_model", "StudentModel"); + $this->ci->StudentModel->addJoin("tbl_benutzer", "tbl_benutzer.uid = tbl_student.student_uid"); + $this->ci->StudentModel->addJoin("tbl_person", "tbl_benutzer.person_id = tbl_person.person_id"); + $this->ci->StudentModel->addJoin("tbl_studiengang", "tbl_student.studiengang_kz = tbl_studiengang.studiengang_kz"); + $this->ci->StudentModel->addSelect("matr_nr, semester, verband, gruppe, kurzbzlang"); + + $studentResult = $this->ci->StudentModel->loadWhere(["student_uid" => $uid]); + if (isError($studentResult)) { + return error(getData($studentResult)); + } + + $studentResultData = getData($studentResult); + $studentData = null; + if (is_array($studentResultData) && count($studentResultData)) { + $studentData = $studentResultData[0]; + } + + if ($studentData && $studentData->matr_nr) { + $this->ci->load->library("phrasesLib", ["profil"], "phrases"); + $standardCourseVerteiler = trim($studentData->kurzbzlang) . "_STD"; + $mailverteiler_res[] = [ + "beschreibung" => $this->ci->phrases->t('profil', 'alleStudentenVon') . " " . $standardCourseVerteiler, + "gruppe_kurzbz" => $standardCourseVerteiler, + "mailto" => "mailto:" . strtolower($standardCourseVerteiler) . "@" . DOMAIN, + ]; + + $semesterVerteiler = trim($studentData->kurzbzlang) . trim($studentData->semester); + $mailverteiler_res[] = [ + "beschreibung" => $this->ci->phrases->t('profil', 'alleStudentenVon') . " " . $semesterVerteiler, + "gruppe_kurzbz" => $semesterVerteiler, + "mailto" => "mailto:" . strtolower($semesterVerteiler) . "@" . DOMAIN, + ]; + + if ($studentData->verband && strlen(trim($studentData->verband))) { + $verbandVerteiler = $semesterVerteiler . trim($studentData->verband); + $mailverteiler_res[] = [ + "beschreibung" => $this->ci->phrases->t('profil', 'alleStudentenVon') . " " . $verbandVerteiler, + "gruppe_kurzbz" => $verbandVerteiler, + "mailto" => "mailto:" . strtolower($verbandVerteiler) . "@" . DOMAIN, + ]; + + if ($studentData->gruppe && strlen(trim($studentData->gruppe))) { + $gruppeVerteiler = $verbandVerteiler . trim($studentData->gruppe); + $mailverteiler_res[] = [ + "beschreibung" => $this->ci->phrases->t('profil', 'alleStudentenVon') . " " . $gruppeVerteiler, + "gruppe_kurzbz" => $gruppeVerteiler, + "mailto" => "mailto:" . strtolower($gruppeVerteiler) . "@" . DOMAIN, + ]; + } + } + } + return $mailverteiler_res; } diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 5f6269365..b3180cd90 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -29562,7 +29562,8 @@ array( 'insertvon' => 'system' ) ) - ), array( + ), + array( 'app' => 'core', 'category' => 'profil', 'phrase' => 'sem_short', @@ -29582,6 +29583,26 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'profil', + 'phrase' => 'alleStudentenVon', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Alle StudentInnen aus', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'All students from', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), //Profil Phrasen ende // LvPlan Phrasen start array(