Merge branch 'master' into feature-54920/DB_Model_encrypted_columns_spaltenname_enthaelt_anderen_spaltennamen

This commit is contained in:
Harald Bamberger
2024-12-11 11:52:50 +01:00
37 changed files with 729 additions and 256 deletions
+2
View File
@@ -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;
@@ -36,6 +36,7 @@ class ProfilUpdate extends Auth_Controller
'getTopic' => ['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 = [];
+5 -7
View File
@@ -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]);
@@ -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);
}
@@ -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);
}
}
@@ -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;
@@ -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);
@@ -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))
{