Compare commits

...
Author SHA1 Message Date
Manuela Thamer 531f331cd4 refactor and split function save
enable to save new studentlehrverband if there is a lehrverband with the update date and a student status in the semester
add transaction with try catch block
2026-10-13 13:46:24 +02:00
Harald Bamberger de74cefdad Merge branch 'master' into feature-78488/StudVw_Save_Student_in_transaction 2026-10-02 17:04:49 +02:00
Andreas Österreicher 293bb77179 Merge branch 'bug-44023/EingabemaskeEntwicklungsteamNamenOhneUid2' 2026-10-02 13:23:02 +02:00
Andreas Österreicher 3fe10d715d Fixed Saving of Entwicklungsteam 2026-10-02 13:14:41 +02:00
Andreas Österreicher 36064afbba Fixed Testing Projektarbeit Seeds 2026-10-01 15:33:05 +02:00
Harald Bamberger f3d031ab16 cismenu: add cis-main-menu class to main nav, add li elements to ul, style cis-main-menu ul and li to prevent interferec with cms content styles, add draggable false to cis menu entries to improve menu scrolling especially on mobile devices 2026-10-01 11:48:51 +02:00
Harald Bamberger 3d8c4fa4d0 Merge branch 'feature-77757/WidgetsBerechtigung' 2026-09-30 15:48:00 +02:00
Harald Bamberger 272014bd78 remove odd phrases 2026-09-30 15:38:43 +02:00
Harald Bamberger 76a8e00edf Merge branch 'master' into feature-77757/WidgetsBerechtigung 2026-09-30 15:23:08 +02:00
Manuela Thamer dafae33ffb add transactions to student.php 2026-09-04 09:29:42 +02:00
Johann Hoffmann d40040efd8 added new fkey to tbl_widget for system.tbl_berechtigung; check for permission status during load & in widget picker; if widget was already picked/configured but not permitted anymore -> show a generalized "missing permission" screen via fallback component during widget init; 2026-07-21 18:14:26 +02:00
14 changed files with 556 additions and 205 deletions
@@ -101,6 +101,9 @@ class Widget extends FHCAPI_Controller
$tmpsetup = json_decode($widget->setup);
$tmpsetup->file = absoluteJsImportUrl($tmpsetup->file);
$widget->setup = $tmpsetup;
$widget->permitted = empty($widget->berechtigung_kurzbz)
|| $this->permissionlib->isBerechtigt($widget->berechtigung_kurzbz);
return $widget;
}, $widgets);
@@ -182,22 +182,8 @@ class Student extends FHCAPI_Controller
return $islaufendesSemester;
}
/**
* Saves data to a prestudent
*
* @param string $prestudent_id
* @return void
*/
public function save($prestudent_id, $studiensemester_kurzbz)
protected function validateParams($prestudent_id, $studiensemester_kurzbz, $params)
{
$this->load->model('person/Person_model', 'PersonModel');
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$this->load->model('crm/Student_model', 'StudentModel');
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
$this->load->model('organisation/Lehrverband_model', 'LehrverbandModel');
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
$this->load->library('form_validation');
if (!$this->StudiensemesterModel->isValidStudiensemester($studiensemester_kurzbz))
@@ -205,9 +191,6 @@ class Student extends FHCAPI_Controller
$this->terminateWithError($studiensemester_kurzbz . ' - ' . $this->p->t('lehre', 'error_noStudiensemester'));
}
$authuid = getAuthUID();
$now = date('c');
$this->form_validation->set_rules('gebdatum', 'Geburtsdatum', 'is_valid_date');
$this->form_validation->set_rules('semester', 'Semester', 'integer', [
@@ -216,43 +199,135 @@ class Student extends FHCAPI_Controller
);
$this->form_validation->set_rules('alias', 'Alias', 'regex_match[/^[-a-z0-9\_\.]*[a-z0-9]{1,}\.[-a-z0-9\_]{1,}$/]',
[
'regex_match' => $this->p->t('ui', 'error_fieldInvalidAlias')
]);
$this->load->library('UDFLib');
$result = $this->udflib->getCiValidations($this->PersonModel, $this->input->post());
$udf_field_validations = $this->getDataOrTerminateWithError($result);
$this->form_validation->set_rules($udf_field_validations);
[
'regex_match' => $this->p->t('ui', 'error_fieldInvalidAlias')
]);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
else
return true;
}
$result = $this->StudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
$student = $this->getDataOrTerminateWithError($result);
$uid = $student ? current($student)->student_uid : null;
$studiengang_kz = $student ? current($student)->studiengang_kz : null;
$result = $this->PrestudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
$person = $this->getDataOrTerminateWithError($result);
$person_id = $person ? current($person)->person_id : null;
protected function checkifExistsLehrverband($studiengang_kz, $verband, $gruppe, $semester)
{
$this->load->model('organisation/Lehrverband_model', 'LehrverbandModel');
$result = $this->LehrverbandModel->loadWhere([
'studiengang_kz' => $studiengang_kz,
'semester' => $semester,
'verband' => $verband,
'gruppe' => $gruppe
]);
if(hasData($result))
return true;
else
return false;
}
protected function updateLehrverband($uid, $studiensemester_kurzbz, $studiengang_kz, $prestudent_id, $params)
{
$array_allowed_props_lehrverband = ['verband', 'semester', 'gruppe'];
$update_lehrverband = array();
foreach ($array_allowed_props_lehrverband as $prop) {
$val = $this->input->post($prop);
if ($val !== null) {
$update_lehrverband[$prop] = $val;
foreach ($array_allowed_props_lehrverband as $prop)
{
if (array_key_exists($prop, $params) && $params[$prop] !== null)
{
$update_lehrverband[$prop] = $params[$prop];
}
}
if(count($update_lehrverband))
{
if ($uid === null)
{
throw new Exception($this->p->t('lehre', 'error_updateLehrverband') . ": " . $this->p->t('lehre', 'error_no_student'));
}
$authuid = getAuthUID();
$now = date('c');
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
$curstudlvb = $this->StudentlehrverbandModel->load([
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'student_uid' => $uid
]);
if(!hasData($curstudlvb))
{
//check if valid status of semester
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
$result = $this->PrestudentstatusModel->loadWhere([
'prestudent_id' => $prestudent_id,
'studiensemester_kurzbz' => $studiensemester_kurzbz]);
if(!hasData($result))
{
throw new Exception($this->p->t('lehre', 'error_updateLehrverband') . ": "
. $this->p->t('lehre', 'textNoStatusInSem',['sem' => $studiensemester_kurzbz]));
}
$verband = isset($update_lehrverband['verband']) ? $update_lehrverband['verband'] : '';
$gruppe = isset($update_lehrverband['gruppe']) ? $update_lehrverband['gruppe'] : '';
$semester = isset($update_lehrverband['semester']) ? $update_lehrverband['semester'] : '';
$isExistingLvbd = $this->checkifExistsLehrverband($studiengang_kz, $verband, $gruppe, $semester);
if(!$isExistingLvbd)
{
throw new Exception($this->p->t('lehre', 'error_updateLehrverband') . ": " . $this->p->t('lehre', 'error_noLehrverband'));
}
else
{
$update_lehrverband['verband'] = isset($update_lehrverband['verband']) ? $update_lehrverband['verband'] : '';
$update_lehrverband['gruppe'] = isset($update_lehrverband['gruppe']) ? $update_lehrverband['gruppe'] : '';
$update_lehrverband['semester'] = isset($update_lehrverband['semester']) ? $update_lehrverband['semester'] : '';
}
}
else
{
$data = getData($curstudlvb);
$data = current($data);
$studiengang_kz = $data->studiengang_kz;
$verband = isset($update_lehrverband['verband']) ? $update_lehrverband['verband'] : $data->verband;
$gruppe = isset($update_lehrverband['gruppe']) ? $update_lehrverband['gruppe'] : $data->gruppe;
$semester = isset($update_lehrverband['semester']) ? $update_lehrverband['semester'] : $data->semester;
$isExistingLvbd = $this->checkifExistsLehrverband($studiengang_kz, $verband, $gruppe, $semester);
if(!$isExistingLvbd)
{
throw new Exception($this->p->t('lehre', 'error_updateLehrverband') . ": " . $this->p->t('lehre', 'error_noLehrverband'));
}
}
if(hasData($curstudlvb) && count(getData($curstudlvb)) > 0 )
{
$update_lehrverband['updatevon'] = $authuid;
$update_lehrverband['updateamum'] = $now;
$result = $this->StudentlehrverbandModel->update([
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'student_uid' => $uid
], $update_lehrverband);
}
else
{
$update_lehrverband['insertvon'] = $authuid;
$update_lehrverband['insertamum'] = $now;
$result = $this->StudentlehrverbandModel->insert(array_merge([
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'student_uid' => $uid,
'studiengang_kz' => $studiengang_kz
], $update_lehrverband));
}
if(isError($result))
{
throw new Exception($this->p->t('lehre', 'error_updateLehrverband'));
}
}
return $update_lehrverband;
}
protected function updatePerson($person_id, $params)
{
$this->load->model('person/Person_model', 'PersonModel');
$array_allowed_props_person = [
'anrede',
@@ -286,142 +361,113 @@ class Student extends FHCAPI_Controller
$array_allowed_props_person[] = $def['name'];
$update_person = array();
foreach ($array_allowed_props_person as $prop) {
$val = $this->input->post($prop);
if ($val === null)
foreach ($array_allowed_props_person as $prop)
{
if (array_key_exists($prop, $params))
{
continue;
}
if($prop == 'foto')
{
$fotoval = ($val == '') ? null : str_replace('data:image/jpeg;base64,', '', $val);
$update_person[$prop] = $fotoval;
}
else if ($prop == 'gebdatum')
{
$update_person[$prop] = ($val == '') ? null : $val;
}
else
{
$update_person[$prop] = $val;
if($params[$prop] !== null)
{
if($prop == 'gebdatum' && $params[$prop] === '')
{
$update_person [$prop] = null;
}
elseif($prop == 'foto')
{
$fotoval = ($params[$prop] == '') ? null : str_replace('data:image/jpeg;base64,', '', $params[$prop]);
$update_person[$prop] = $fotoval;
}
else
$update_person[$prop] = $params[$prop];
}
}
}
if(count($update_person))
{
if ($person_id === null)
{
throw new Exception($this->p->t('lehre', 'error_no_person'));
}
$authuid = getAuthUID();
$now = date('c');
$update_person['updatevon'] = $authuid;
$update_person['updateamum'] = $now;
$result = $this->PersonModel->update(
$person_id,
$update_person
);
if(isError($result))
{
throw new Exception($this->p->t('lehre', 'error_updatePerson'));
}
}
return $update_person;
}
protected function updateStudent($uid, $studiensemester_kurzbz, $params)
{
$array_allowed_props_student = ['matrikelnr'];
if($this->isLaufendesSemester($studiensemester_kurzbz))
{
$array_allowed_props_student = ['matrikelnr', 'verband', 'semester', 'gruppe'];
}
$update_student = array();
foreach ($array_allowed_props_student as $prop) {
$val = $this->input->post($prop);
if ($val !== null) {
$update_student[$prop] = $val;
}
}
$array_allowed_props_benutzer = ['aktiv', 'alias'];
$update_benutzer = array();
foreach ($array_allowed_props_benutzer as $prop) {
$val = $this->input->post($prop);
if ($val !== null) {
if($prop === 'alias' && $val === '')
{
$val = null;
}
$update_benutzer[$prop] = $val;
}
}
// Check PKs
if (count($update_lehrverband) + count($update_student) && $uid === null) {
$this->terminateWithValidationErrors(['' => $this->p->t('lehre', 'error_no_student')]);
}
if (count($update_person) && $person_id === null) {
$this->terminateWithValidationErrors(['' => $this->p->t('lehre', 'error_no_person')]);
}
if (count($update_benutzer) && $uid === null) {
$this->terminateWithValidationErrors(['' => $this->p->t('lehre', 'error_no_student')]);
}
// Do Updates
if (count($update_lehrverband)) {
$curstudlvb = $this->StudentlehrverbandModel->load([
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'student_uid' => $uid
]);
$data = $this->getDataOrTerminateWithError($curstudlvb);
$data = current($data);
$verbandCurrent = $data->verband;
$studiengang_kz = $data->studiengang_kz;
$semesterCurrent = $data->semester;
$gruppeCurrent = $data->gruppe;
$verband = isset($update_lehrverband['verband']) ? $update_lehrverband['verband'] : $verbandCurrent;
$gruppe = isset($update_lehrverband['gruppe']) ? $update_lehrverband['gruppe'] : $gruppeCurrent;
$semester = isset($update_lehrverband['semester']) ? $update_lehrverband['semester'] : $semesterCurrent;
//check if existing Lehrverband of new data to avoid Error
$result = $this->LehrverbandModel->loadWhere([
'verband' => $verband,
'gruppe' => $gruppe,
'semester' => $semester,
'studiengang_kz' => $studiengang_kz,
]);
if(!hasData($result))
foreach ($array_allowed_props_student as $prop)
{
if (array_key_exists($prop, $params) && $params[$prop] !== null)
{
$this->terminateWithError($this->p->t('lehre', 'error_noLehrverband'), self::ERROR_TYPE_GENERAL);
$update_student[$prop] = $params[$prop];
}
if(hasData($curstudlvb) && count(getData($curstudlvb)) > 0 )
{
$update_lehrverband['updatevon'] = $authuid;
$update_lehrverband['updateamum'] = $now;
$result = $this->StudentlehrverbandModel->update([
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'student_uid' => $uid
], $update_lehrverband);
}
else
{
$update_lehrverband['insertvon'] = $authuid;
$update_lehrverband['insertamum'] = $now;
$result = $this->StudentlehrverbandModel->insert(array_merge([
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'student_uid' => $uid,
'studiengang_kz' => $studiengang_kz
], $update_lehrverband));
}
$this->getDataOrTerminateWithError($result);
}
if (count($update_person)) {
$update_person['updatevon'] = $authuid;
$update_person['updateamum'] = $now;
$result = $this->PersonModel->update(
$person_id,
$update_person
);
$this->getDataOrTerminateWithError($result);
}
if (count($update_student))
{
if ($uid === null)
{
$this->terminateWithValidationErrors(['' => $this->p->t('lehre', 'error_no_student')]);
}
$authuid = getAuthUID();
$now = date('c');
if (count($update_student)) {
$update_student['updatevon'] = $authuid;
$update_student['updateamum'] = $now;
$this->load->model('crm/Student_model', 'StudentModel');
$result = $this->StudentModel->update(
[$uid],
$update_student
);
$this->getDataOrTerminateWithError($result);
if(isError($result))
{
throw new Exception($this->p->t('lehre', 'error_updateStudent'));
}
}
return $update_student;
}
protected function updateBenutzer($uid, $params)
{
$array_allowed_props_benutzer = ['aktiv', 'alias'];
$update_benutzer = array();
foreach ($array_allowed_props_benutzer as $prop)
{
if (array_key_exists($prop, $params) && $params[$prop] !== null)
{
$update_benutzer[$prop] = $params[$prop];
}
}
if (count($update_benutzer))
{
if ($uid === null)
{
throw new Exception($this->p->t('lehre', 'error_updateBenutzer') . ": ". $this->p->t('lehre', 'error_no_student'));
}
$authuid = getAuthUID();
$now = date('c');
if (count($update_benutzer)) {
$update_benutzer['updatevon'] = $authuid;
$update_benutzer['updateamum'] = $now;
if (array_key_exists("aktiv", $update_benutzer))
@@ -429,11 +475,61 @@ class Student extends FHCAPI_Controller
$update_benutzer['updateaktivvon'] = $authuid;
$update_benutzer['updateaktivam'] = $now;
}
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$result = $this->BenutzerModel->update(
[$uid],
$update_benutzer
);
$this->getDataOrTerminateWithError($result);
if(isError($result))
{
throw new Exception($this->p->t('lehre', 'error_updateBenutzer'));
}
}
return $update_benutzer;
}
/**
* Saves data to a prestudent
*
* @param string $prestudent_id
* @return void
*/
public function save($prestudent_id, $studiensemester_kurzbz)
{
$params = $this->input->post();
$this->validateParams($prestudent_id, $studiensemester_kurzbz, $params);
$this->load->model('crm/Student_model', 'StudentModel');
$result = $this->StudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
$student = $this->getDataOrTerminateWithError($result);
$uid = $student ? current($student)->student_uid : null;
$studiengang_kz = $student ? current($student)->studiengang_kz : null;
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$result = $this->PrestudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
$person = $this->getDataOrTerminateWithError($result);
$person_id = $person ? current($person)->person_id : null;
$this->db->trans_begin();
try
{
$update_lehrverband = $this->updateLehrverband($uid, $studiensemester_kurzbz, $studiengang_kz, $prestudent_id, $params);
$update_person = $this->updatePerson($person_id, $params);
$update_student = $this->updateStudent($uid, $studiensemester_kurzbz, $params);
$update_benutzer = $this->updateBenutzer($uid, $params);
if( $this->db->trans_status() === false )
{
throw new Exception("Transaction failed");
}
$this->db->trans_commit();
}
catch (Exception $ex)
{
$this->db->trans_rollback();
$this->terminateWithError($ex->getMessage());
}
$this->terminateWithSuccess(array_fill_keys(array_merge(
+63 -25
View File
@@ -21,6 +21,7 @@
* Manuela Thamer <[email protected]>
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/mitarbeiter.class.php');
class entwicklungsteam extends basis_db
{
@@ -43,7 +44,6 @@ class entwicklungsteam extends basis_db
public $ext_id;
public $besqual;
public $studiengang_kz_old;
/**
* Konstruktor
@@ -74,7 +74,7 @@ class entwicklungsteam extends basis_db
$qry = "SELECT * FROM bis.tbl_entwicklungsteam JOIN bis.tbl_besqual USING(besqualcode)
WHERE entwicklungsteam_id=".$this->db_add_param($entwicklungsteam_id);
$qry.=";";
$qry.=";";
if($this->db_query($qry))
{
@@ -147,6 +147,11 @@ class entwicklungsteam extends basis_db
$this->errormsg = 'Es muss ein Mitarbeiter angegeben werden';
return false;
}
if(!$this->checkIfExistingUid($this->mitarbeiter_uid))
{
$this->errormsg = 'Bitte einen Eintrag aus dem Dropdown Personensuche auswählen!';
return false;
}
if($this->studiengang_kz=='')
{
$this->errormsg = 'Es muss ein Studiengang angegeben werden';
@@ -162,6 +167,26 @@ class entwicklungsteam extends basis_db
$this->errormsg = 'Endedatum darf nicht vor Anfangsdatum liegen';
return false;
}
if($this->beginn != '')
{
$beginnParts = explode('-', $this->beginn);
if (!checkdate((int)$beginnParts[1], (int)$beginnParts[2], (int)$beginnParts[0])) {
$this->errormsg = 'Anfangsdatum ist ungültig';
return false;
}
}
if($this->ende != '')
{
$endeParts = explode('-', $this->ende);
if (!checkdate((int)$endeParts[1], (int)$endeParts[2], (int)$endeParts[0]))
{
$this->errormsg = 'Endedatum ist ungültig';
return false;
}
}
return true;
}
@@ -183,30 +208,28 @@ class entwicklungsteam extends basis_db
//Neuen Datensatz anlegen
$qry = "INSERT INTO bis.tbl_entwicklungsteam (mitarbeiter_uid, studiengang_kz, besqualcode, beginn, ende,
updateamum, updatevon, insertamum, insertvon) VALUES (".
$this->db_add_param($this->mitarbeiter_uid).', '.
$this->db_add_param($this->studiengang_kz, FHC_INTEGER).', '.
$this->db_add_param($this->besqualcode, FHC_INTEGER).', '.
$this->db_add_param($this->beginn).', '.
$this->db_add_param($this->ende).', '.
$this->db_add_param($this->updateamum).', '.
$this->db_add_param($this->updatevon).', '.
$this->db_add_param($this->insertamum).', '.
$this->db_add_param($this->insertvon).');';
$this->db_add_param($this->mitarbeiter_uid).', '.
$this->db_add_param($this->studiengang_kz, FHC_INTEGER).', '.
$this->db_add_param($this->besqualcode, FHC_INTEGER).', '.
$this->db_add_param($this->beginn).', '.
$this->db_add_param($this->ende).', '.
$this->db_add_param($this->updateamum).', '.
$this->db_add_param($this->updatevon).', '.
$this->db_add_param($this->insertamum).', '.
$this->db_add_param($this->insertvon).');';
}
else
{
if($this->studiengang_kz_old=='')
$this->studiengang_kz_old = $this->studiengang_kz;
//Bestehenden Datensatz aktualisieren
$qry= "UPDATE bis.tbl_entwicklungsteam SET".
" besqualcode=".$this->db_add_param($this->besqualcode, FHC_INTEGER).",".
" beginn=".$this->db_add_param($this->beginn).",".
" studiengang_kz=".$this->db_add_param($this->studiengang_kz, FHC_INTEGER).",".
" ende=".$this->db_add_param($this->ende).",".
" updateamum=".$this->db_add_param($this->updateamum).",".
" updatevon=".$this->db_add_param($this->updatevon).
" WHERE entwicklungsteam_id=".$this->db_add_param($this->entwicklungsteam_id).";";
" besqualcode=".$this->db_add_param($this->besqualcode, FHC_INTEGER).",".
" beginn=".$this->db_add_param($this->beginn).",".
" studiengang_kz=".$this->db_add_param($this->studiengang_kz, FHC_INTEGER).",".
" ende=".$this->db_add_param($this->ende).",".
" mitarbeiter_uid=".$this->db_add_param($this->mitarbeiter_uid).",".
" updateamum=".$this->db_add_param($this->updateamum).",".
" updatevon=".$this->db_add_param($this->updatevon).
" WHERE entwicklungsteam_id=".$this->db_add_param($this->entwicklungsteam_id).";";
}
if($this->db_query($qry))
@@ -234,7 +257,7 @@ class entwicklungsteam extends basis_db
if($studiengang_kz!=null)
$qry.=" AND studiengang_kz=".$this->db_add_param($studiengang_kz);
$qry.=";";
$qry.=";";
if($this->db_query($qry))
{
@@ -316,7 +339,7 @@ class entwicklungsteam extends basis_db
if ($sort != null)
{
$qry .= " ORDER BY ".$sort;
$qry .= " ORDER BY ".$sort;
}
$qry .= ";";
@@ -364,7 +387,7 @@ class entwicklungsteam extends basis_db
$bismeldung_jahr = $datetime->format('Y');
//laden des Datensatzes
$qry = "SELECT tbl_entwicklungsteam.*, tbl_besqual.*, tbl_studiengang.studiengang_kz, tbl_studiengang.melderelevant
$qry = "SELECT tbl_entwicklungsteam.*, tbl_besqual.*, tbl_studiengang.studiengang_kz, tbl_studiengang.melderelevant
FROM bis.tbl_entwicklungsteam
JOIN bis.tbl_besqual USING(besqualcode)
JOIN public.tbl_studiengang USING(studiengang_kz)
@@ -375,7 +398,7 @@ class entwicklungsteam extends basis_db
if($studiengang_kz!=null)
$qry.=" AND studiengang_kz=".$this->db_add_param($studiengang_kz);
$qry.=";";
$qry.=";";
if($this->db_query($qry))
{
@@ -407,5 +430,20 @@ class entwicklungsteam extends basis_db
return false;
}
}
/*
* Überprüft, ob die übergebene Uid in der Tabelle tbl_mitarbeiter vorhanden ist
* @param String $uid UID des Mitarbeiters
* @return true wenn vorhanden, false wenn nicht
*/
private function checkIfExistingUid($uid)
{
$mitarbeiter = new mitarbeiter();
if(!$mitarbeiter->checkIfExistingUid($uid))
return false;
return true;
}
}
?>
+18
View File
@@ -1995,5 +1995,23 @@ class mitarbeiter extends benutzer
return true;
}
}
/**
* Prueft ob eine existierende ma_uid übergeben wurde
* @param String $mitarbeiter_uid mitarbeiter_uid
* @return bool True wenn mitarbeiter_uid vorhanden sonst false.
*/
public function checkIfExistingUid($mitarbeiter_uid)
{
$qry = "Select 1 from public.tbl_mitarbeiter where mitarbeiter_uid =".$this->db_add_param($mitarbeiter_uid);
if ($result = $this->db_query($qry))
{
if ($this->db_num_rows($result) > 0)
return true;
else
return false;
}
}
}
?>
+17 -1
View File
@@ -853,4 +853,20 @@ html {
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 0.5rem;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
}
.cis-main-menu {
max-width: 100vw;
}
.cis-main-menu ul {
list-style: none;
margin: 0;
padding: 0;
}
.cis-main-menu ul li {
margin: 0;
padding: 0;
width: 100%;
}
+1 -1
View File
@@ -186,7 +186,7 @@ export default {
</div>
</div>
<nav id="nav-main" class="offcanvas offcanvas-start" tabindex="-1" aria-labelledby="nav-main-btn" data-bs-backdrop="false">
<nav id="nav-main" class="cis-main-menu offcanvas offcanvas-start" tabindex="-1" aria-labelledby="nav-main-btn" data-bs-backdrop="false">
<div id="nav-main-sticky">
<div class="d-flex flex-row h-100">
<div class="offcanvas-body p-0">
+5 -1
View File
@@ -162,6 +162,7 @@ export default {
<div class="btn-group w-100">
<a :target="target"
:href="(entry.menu_open && hasFullLink) ? entry.url : null"
draggable="false"
@click="toggleCollapse"
:class="{
'btn btn-default rounded-0 text-start': true,
@@ -180,12 +181,15 @@ export default {
</div>
<ul ref="children"
class="nav w-100 collapse">
<cis-menu-entry :highestMatchingUrlCount="highestMatchingUrlCount" :activeContent="activeContent" v-for="child in entry.childs" :key="child" :entry="child" :level="level + 1"/>
<li>
<cis-menu-entry :highestMatchingUrlCount="highestMatchingUrlCount" :activeContent="activeContent" v-for="child in entry.childs" :key="child" :entry="child" :level="level + 1"/>
</li>
</ul>
</template>
<a v-else
:href="entry.url"
:target="target"
draggable="false"
:class="{
'btn btn-default rounded-0 w-100 text-start': true,
['btn-level-' + level]: true,
+13 -2
View File
@@ -1,5 +1,6 @@
import BsModal from "../Bootstrap/Modal.js";
import HeightTransition from "../Tranistion/HeightTransition.js";
import MissingPermissionWidget from "../DashboardWidget/MissingPermission.js";
import { enableDragDropTouch } from "../../../../vendor/drag-drop-touch-js/dragdroptouch/dist/drag-drop-touch.esm.min.js";
@@ -112,6 +113,12 @@ export default {
isPinned() {
return this.place?.pinned ? true : false;
},
permitted() {
// widgets without a linked permission (or before the template loaded)
// are considered permitted; the backend sets permitted === false only
// when the user is missing the widget's required permission
return this.widgetTemplate?.permitted !== false;
},
ready() {
return this.component && this.arguments !== null;
}
@@ -169,7 +176,11 @@ export default {
&& this.widgetTemplate.widget_id
&& this.widgetTemplate.arguments
) {
let component = (await import(this.widgetTemplate.setup.file)).default;
// render the "missing permission" screen instead of the actual
// widget when the user does not hold the widget's linked permission
let component = this.permitted
? (await import(this.widgetTemplate.setup.file)).default
: MissingPermissionWidget;
this.$options.components["widget" + this.widgetTemplate.widget_id] = component;
this.component = "widget" + this.widgetTemplate.widget_id;
this.arguments = { ...this.widgetTemplate.arguments, ...this.config };
@@ -269,7 +280,7 @@ export default {
</template>
<!-- widget link -->
<a
v-if="widgetTemplate.setup.cis4link"
v-if="widgetTemplate.setup.cis4link && permitted"
:href="getWidgetC4Link(widgetTemplate)"
class="col-auto ms-auto"
:aria-label="$p.t('dashboard/widget_link')"
@@ -14,10 +14,14 @@ export default {
callbacks: {}
}),
computed: {
// filter widgets away the user has no permissions for
availableWidgets() {
return (this.widgets || []).filter(widget => widget.permitted !== false);
},
hasAnyWidgets() {
if (!this.widgets)
return false;
if (!this.widgets.length && !this.hiddenWidgets?.length)
if (!this.availableWidgets.length && !this.hiddenWidgets?.length)
return false;
return true;
}
@@ -54,7 +58,7 @@ export default {
<template v-slot:default>
<template v-if="widgets && hiddenWidgets">
<div
v-if="!widgets.length && !hiddenWidgets.length"
v-if="!availableWidgets.length && !hiddenWidgets.length"
class="row g-2"
>
<div>{{ $p.t('dashboard/noWidgetsAvailable') }}</div>
@@ -74,16 +78,17 @@ export default {
</div>
</div>
<div
v-if="widgets.length"
v-if="availableWidgets.length"
class="row g-2"
>
<div
v-for="widget in widgets"
<template
v-for="widget in availableWidgets"
:key="widget.widget_id"
class="widget-icon-container col-sm-6 col-md-4 col-lg-3 col-xl-2"
>
<widget-icon @select="pick" :widget="widget"></widget-icon>
</div>
<div v-if="widget.permitted" class="widget-icon-container col-sm-6 col-md-4 col-lg-3 col-xl-2">
<widget-icon @select="pick" :widget="widget"></widget-icon>
</div>
</template>
</div>
</template>
</template>
@@ -0,0 +1,21 @@
import AbstractWidget from './Abstract.js';
/**
* Fallback screen rendered in place of a widget when the current user is missing
* the permission (berechtigung_kurzbz) linked to that widget. Used for widgets
* that are already on a user's dashboard but whose required permission the user
* no longer holds.
*/
export default {
mixins: [
AbstractWidget
],
created() {
this.$emit('setConfig', false);
},
template: /*html*/`
<div class="dashboard-widget-missing-permission d-flex flex-column justify-content-center align-items-center text-center h-100 p-3 text-body-secondary">
<i class="fa-solid fa-lock fa-2x mb-2" aria-hidden="true"></i>
<p class="mb-0">{{ $p.t('dashboard/widget_missing_permission') }}</p>
</div>`
}
+1 -1
View File
@@ -103,7 +103,7 @@ require_once('dbupdate_3.4/76160_lvv_favorites.php');
require_once('dbupdate_3.4/77080_tabulator_presets_table.php');
require_once('dbupdate_3.4/78292_gehaltsanpassungtyp.php');
require_once('dbupdate_3.4/54225_reihungstest_ablauf_fuer_quereinsteiger.php');
require_once('dbupdate_3.4/77757_widgets_berechtigungen.php');
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
@@ -0,0 +1,57 @@
<?php
/* Copyright (C) 2026 fhcomplete.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Beschreibung:
* Dashboard Widgets: Verknüpfung einer (einzelnen) Berechtigung pro Widget.
* Neue Spalte dashboard.tbl_widget.berechtigung_kurzbz mit FK auf
* system.tbl_berechtigung. Ist die Spalte NULL, erfordert das Widget keine
* gesonderte Berechtigung. Benutzer denen die verknüpfte Berechtigung fehlt,
* bekommen das Widget nicht mehr zur Auswahl angezeigt bzw. sehen (falls bereits
* am Dashboard) einen "Fehlende Berechtigung"-Screen.
*/
if (! defined('DB_NAME')) exit('No direct script access allowed');
// Add column dashboard.tbl_widget.berechtigung_kurzbz (FK => system.tbl_berechtigung)
if ($result = @$db->db_query("
SELECT 1
FROM information_schema.columns
WHERE table_schema = 'dashboard'
AND table_name = 'tbl_widget'
AND column_name = 'berechtigung_kurzbz';"))
{
if ($db->db_num_rows($result) == 0)
{
$qry = "
ALTER TABLE dashboard.tbl_widget
ADD COLUMN berechtigung_kurzbz VARCHAR(32) NULL;
ALTER TABLE dashboard.tbl_widget
ADD CONSTRAINT tbl_widget_berechtigung_fk
FOREIGN KEY (berechtigung_kurzbz)
REFERENCES system.tbl_berechtigung (berechtigung_kurzbz)
ON UPDATE CASCADE ON DELETE SET NULL;";
if (!$db->db_query($qry))
{
echo '<strong>dashboard.tbl_widget: '.$db->db_last_error().'</strong><br>';
}
else
{
echo 'dashboard.tbl_widget: Spalte berechtigung_kurzbz (FK system.tbl_berechtigung) hinzugefuegt<br>';
}
}
}
+83 -1
View File
@@ -49620,6 +49620,26 @@ array(
)
)
),
array(
'app' => 'core',
'category' => 'dashboard',
'phrase' => 'widget_missing_permission',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Ihnen fehlt die erforderliche Berechtigung, um dieses Widget anzuzeigen.',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'You do not have the permission required to display this widget.',
'description' => '',
'insertvon' => 'system'
)
)
),
// CIS4 phrases from legacy code end
// FHC4 Phrases Abschlusspruefung
array(
@@ -62591,8 +62611,70 @@ I have been informed that I am under no obligation to consent to the transmissio
'insertvon' => 'system'
)
)
)
),
// ### Infocenter Onboarding END
// ### SaveStudent START
array(
'app' => 'core',
'category' => 'lehre',
'phrase' => 'error_updateBenutzer',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler bei Aktualisierung Benutzer',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Error during insert/update Benutzer',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'lehre',
'phrase' => 'error_updatePerson',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler bei Aktualisierung Person',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Error during insert/update person',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'lehre',
'phrase' => 'error_updateStudent',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler bei Aktualisierung Student',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Error during insert/update student',
'description' => '',
'insertvon' => 'system'
)
)
),
// ### SaveStudent END
);
@@ -1,9 +1,9 @@
INSERT INTO lehre.tbl_projektarbeit
(projektarbeit_id, projekttyp_kurzbz, titel, lehreinheit_id, student_uid, firma_id, note, punkte, beginn, ende, faktor, freigegeben, gesperrtbis, stundensatz, themenbereich, anmerkung, updateamum, updatevon, insertamum, insertvon, ext_id, gesamtstunden, titel_english, sprache, seitenanzahl, abgabedatum, kontrollschlagwoerter, schlagwoerter, schlagwoerter_en, abstract, abstract_en, "final") VALUES
(1, 'Bachelor', 'Auswirkung der Sonneneinstrahlung auf die Gesundheit', 46111, 's46b413', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, '2025-12-12 14:06:10.000', 'anondata', NULL, 3.0000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true),
(2, 'Bachelor', 'Neue Unterrichtsmethoden mit KI', 46111, 's46b414', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, '2025-12-12 14:06:10.000', 'anondata', NULL, 3.0000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true),
(3, 'Bachelor', 'Betrugsbekämpfung bei Anwesenheitskontrolle', 46111, 's46b415', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, '2025-12-12 14:06:10.000', 'anondata', NULL, 3.0000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true),
(4, 'Bachelor', 'Neuronale Netze', 46111, 's46b416', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, '2025-12-12 14:06:10.000', 'anondata', NULL, 3.0000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true)
(projektarbeit_id, projekttyp_kurzbz, titel, lehreinheit_id, student_uid, firma_id, note, punkte, beginn, ende, faktor, freigegeben, gesperrtbis, stundensatz, themenbereich, anmerkung, updateamum, updatevon, insertamum, insertvon, ext_id, gesamtstunden, titel_english, sprache, seitenanzahl, abgabedatum, kontrollschlagwoerter, schlagwoerter, schlagwoerter_en, abstract, abstract_en, "final", lehrveranstaltung_id, studiensemester_kurzbz) VALUES
(1, 'Bachelor', 'Auswirkung der Sonneneinstrahlung auf die Gesundheit', 46111, 's46b413', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, '2025-12-12 14:06:10.000', 'anondata', NULL, 3.0000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, 4611, NearestWintersemester(1)),
(2, 'Bachelor', 'Neue Unterrichtsmethoden mit KI', 46111, 's46b414', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, '2025-12-12 14:06:10.000', 'anondata', NULL, 3.0000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, 4611, NearestWintersemester(1)),
(3, 'Bachelor', 'Betrugsbekämpfung bei Anwesenheitskontrolle', 46111, 's46b415', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, '2025-12-12 14:06:10.000', 'anondata', NULL, 3.0000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, 4611, NearestWintersemester(1)),
(4, 'Bachelor', 'Neuronale Netze', 46111, 's46b416', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, '2025-12-12 14:06:10.000', 'anondata', NULL, 3.0000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, 4611, NearestWintersemester(1))
;
INSERT INTO lehre.tbl_projektbetreuer