Merge branch 'master' into feature-19473/VUE_Filter_Navigation_Widgets

This commit is contained in:
Paolo
2022-08-08 12:11:08 +02:00
630 changed files with 4101 additions and 94869 deletions
@@ -240,11 +240,13 @@ class LVPlanJob extends JOB_Controller
}
// Send mail to STG Assistenz
/*
$result = $this->_sendMailToStg($uidByStg_arr);
if (isError($result))
{
$this->logError(getError($result));
}
*/
// Send mail to Kompetenzfeld Leitung
$result = $this->_sendMailToKF($uidByOe_arr);
@@ -359,7 +359,7 @@ class LehrauftragJob extends JOB_Controller
for ($i = 0; $i < $data_len; $i++)
{
// Get all users entitled by organisational unit
$result = $this->BenutzerrolleModel->getBenutzerByBerechtigung(self::BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN, $data[$i]['oe_kurzbz']);
$result = $this->BenutzerrolleModel->getBenutzerByBerechtigung(self::BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN, $data[$i]['oe_kurzbz'], 'suid');
if ($berechtigung_arr = getData($result))
{
@@ -395,8 +395,12 @@ class approveAnrechnungDetail extends Auth_Controller
// Set filename to be used on downlaod
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
// Get file to be downloaded from DMS
$download = $this->dmslib->download($dms_id, $filename);
if (isError($download)) return $download;
// Download file
$this->dmslib->download($dms_id, $filename);
$this->outputFile(getData($download));
}
/**
@@ -8,13 +8,13 @@ class approveAnrechnungUebersicht extends Auth_Controller
const BERECHTIGUNG_ANRECHNUNG_ANLEGEN = 'lehre/anrechnung_anlegen';
const REVIEW_ANRECHNUNG_URI = '/lehre/anrechnung/ReviewAnrechnungUebersicht';
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
const ANRECHNUNGSTATUS_APPROVED = 'approved';
const ANRECHNUNGSTATUS_REJECTED = 'rejected';
public function __construct()
{
// Set required permissions
@@ -27,23 +27,23 @@ class approveAnrechnungUebersicht extends Auth_Controller
'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw'
)
);
// Load models
$this->load->model('education/Anrechnung_model', 'AnrechnungModel');
$this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel');
$this->load->model('content/DmsVersion_model', 'DmsVersionModel');
// Load libraries
$this->load->library('WidgetLib');
$this->load->library('PermissionLib');
$this->load->library('AnrechnungLib');
$this->load->library('DmsLib');
// Load helpers
$this->load->helper('form');
$this->load->helper('url');
$this->load->helper('hlp_sancho_helper');
// Load language phrases
$this->loadPhrases(
array(
@@ -55,23 +55,23 @@ class approveAnrechnungUebersicht extends Auth_Controller
'table'
)
);
$this->_setAuthUID();
$this->setControllerId();
}
public function index()
{
// Get study semester
$studiensemester_kurzbz = $this->input->get('studiensemester');
if (isEmptyString($studiensemester_kurzbz))
{
$result = $this->StudiensemesterModel->getNearest();
$studiensemester_kurzbz = getData($result)[0]->studiensemester_kurzbz;
}
// Get studiengaenge the user is entitled for
if (!$studiengang_kz_arr = $this->permissionlib->getSTG_isEntitledFor(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN))
{
@@ -91,10 +91,10 @@ class approveAnrechnungUebersicht extends Auth_Controller
'hasReadOnlyAccess' => $hasReadOnlyAccess,
'hasCreateAnrechnungAccess' => $hasCreateAnrechnungAccess
);
$this->load->view('lehre/anrechnung/approveAnrechnungUebersicht.php', $viewData);
}
/**
* Approve Anrechnungen.
*/
@@ -107,7 +107,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
{
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
}
// Approve Anrechnung
foreach ($data as $item)
{
@@ -120,7 +120,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
);
}
}
// Output json to ajax
if (isset($json) && !isEmptyArray($json))
{
@@ -131,20 +131,20 @@ class approveAnrechnungUebersicht extends Auth_Controller
return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.');
}
}
/**
* Reject Anrechnungen.
*/
public function reject()
{
$data = $this->input->post('data');
// Validate data
if (isEmptyArray($data))
{
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
}
// Reject Anrechnung
foreach ($data as $item)
{
@@ -157,7 +157,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
);
}
}
// Output json to ajax
if (isset($json) && !isEmptyArray($json))
{
@@ -168,22 +168,22 @@ class approveAnrechnungUebersicht extends Auth_Controller
return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.');
}
}
/**
* Request recommendation for Anrechnungen.
*/
public function requestRecommendation()
{
$data = $this->input->post('data');
if(isEmptyArray($data))
{
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
}
$retval = array();
$counter = 0;
foreach ($data as $item)
{
// Check if Anrechnungs-LV has lector
@@ -191,7 +191,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
{
// Count up LV with no lector
$counter++;
// Continue loop, if LV has no lector
continue;
}
@@ -205,7 +205,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
$empfehlungsanfrage_an = !isEmptyArray($lector_arr)
? implode(', ', array_column($lector_arr, 'fullname'))
: '';
$retval[]= array(
'anrechnung_id' => $item['anrechnung_id'],
'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR,
@@ -216,7 +216,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
);
}
}
/**
* Send mails to lectors
* NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector
@@ -226,16 +226,16 @@ class approveAnrechnungUebersicht extends Auth_Controller
{
self::_sendSanchoMailToLectors($retval);
}
// Output json to ajax
if (isEmptyArray($retval) && $counter == 0)
{
return $this->outputJsonError('Es wurden keine Empfehlungen angefordert');
}
return $this->outputJsonSuccess($retval);
}
/**
* Download and open uploaded document (Nachweisdokument).
*/
@@ -250,25 +250,28 @@ class approveAnrechnungUebersicht extends Auth_Controller
// Check if user is entitled to read dms doc
$this->_checkIfEntitledToReadDMSDoc($dms_id);
// Set filename to be used on downlaod
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
// Get file to be downloaded from DMS
$download = $this->dmslib->download($dms_id, $filename);
if (isError($download)) return $download;
// Download file
$this->dmslib->download($dms_id, $filename);
$this->outputFile(getData($download));
}
/**
* Retrieve the UID of the logged user and checks if it is valid
*/
private function _setAuthUID()
{
$this->_uid = getAuthUID();
if (!$this->_uid) show_error('User authentification failed');
}
/**
* Check if user is entitled to read dms doc
* @param $dms_id
@@ -276,31 +279,30 @@ class approveAnrechnungUebersicht extends Auth_Controller
private function _checkIfEntitledToReadDMSDoc($dms_id)
{
$result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id));
if(!$result = getData($result)[0])
{
show_error('Failed retrieving Anrechnung');
}
$result = $this->LehrveranstaltungModel->loadWhere(array(
'lehrveranstaltung_id' => $result->lehrveranstaltung_id
));
if(!$result = getData($result)[0])
{
show_error('Failed loading Lehrveranstaltung');
}
$studiengang_kz = $result->studiengang_kz;
// Check if user is entitled
if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz))
{
show_error('You are not entitled to read this document');
}
}
/**
* Send mail to lectors asking for recommendation. (first to LV-Leitung, if not present to all lectors of lv)
* @param $mail_params
@@ -310,7 +312,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
{
// Get Lehrveranstaltungen
$anrechnung_arr = array();
foreach ($mail_params as $item)
{
$this->AnrechnungModel->addSelect('lehrveranstaltung_id, studiensemester_kurzbz');
@@ -319,10 +321,10 @@ class approveAnrechnungUebersicht extends Auth_Controller
'studiensemester_kurzbz' => $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiensemester_kurzbz
);
}
$anrechnung_arr = array_unique($anrechnung_arr, SORT_REGULAR);
/**
* Get lectors (prio for LV-Leitung, if not present to all lectors of LV.
* Anyway this function will receive a unique array to avoid sending more mails to one and the same lector.
@@ -334,27 +336,27 @@ class approveAnrechnungUebersicht extends Auth_Controller
{
$to = $lector->uid;
$vorname = $lector->vorname;
// Get full name of stgl
$this->load->model('person/Person_model', 'PersonModel');
if (!$stgl_name = getData($this->PersonModel->getFullName($this->_uid)))
{
show_error ('Failed retrieving person');
}
// Link to Antrag genehmigen
$url =
CIS_ROOT. 'cis/index.php?menu='.
CIS_ROOT. 'cis/menu.php?content_id=&content='.
CIS_ROOT. index_page(). self::REVIEW_ANRECHNUNG_URI;
// Prepare mail content
$body_fields = array(
'vorname' => $vorname,
'stgl_name' => $stgl_name,
'link' => anchor($url, 'Anrechnungsanträge Übersicht')
);
sendSanchoMail(
'AnrechnungEmpfehlungAnfordern',
$body_fields,
@@ -364,7 +366,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
}
return true;
}
/**
* Get lectors (prio for LV-Leitung, if not present to all lectors of LV.
* Anyway this function will receive a unique array to avoid sending more mails to one and the same lector.
@@ -374,18 +376,18 @@ class approveAnrechnungUebersicht extends Auth_Controller
private function _getLectors($anrechnung_arr)
{
$lector_arr = array();
// Get lectors
foreach($anrechnung_arr as $anrechnung)
{
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$result = $this->LehrveranstaltungModel->getLecturersByLv($anrechnung['studiensemester_kurzbz'], $anrechnung['lehrveranstaltung_id']);
if (!hasData($result))
{
show_error('Failed retrieving lectors of Lehrveranstaltung');
}
$lecturersByLv = getData($result);
// Check if lv has LV-Leitung
@@ -401,7 +403,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
$lector_arr = array_merge($lector_arr, $lecturersByLv);
}
}
/**
* NOTE: This step is only done to make the array unique by uid, vorname and nachname in the following step
* (e.g. if same lector is ones LV-Leitung and another time not, then array_unique would leave both.
@@ -411,10 +413,10 @@ class approveAnrechnungUebersicht extends Auth_Controller
{
unset($lector->lvleiter);
}
// Now make the lector array aka mail receivers unique
$lector_arr = array_unique($lector_arr, SORT_REGULAR);
return $lector_arr;
}
}
}
@@ -205,9 +205,14 @@ class requestAnrechnung extends Auth_Controller
}
// Check if user is entitled to read dms doc
self::_checkIfEntitledToReadDMSDoc($dms_id);
$this->_checkIfEntitledToReadDMSDoc($dms_id);
$this->dmslib->download($dms_id);
// Get file to be downloaded from DMS
$download = $this->dmslib->download($dms_id, $filename);
if (isError($download)) return $download;
// Download file
$this->outputFile(getData($download));
}
/**
@@ -366,4 +371,4 @@ class requestAnrechnung extends Auth_Controller
// Upload document
return $this->dmslib->upload($dms, 'uploadfile', array('pdf'));
}
}
}
@@ -217,15 +217,18 @@ class reviewAnrechnungDetail extends Auth_Controller
}
// Check if user is entitled to read dms doc
self::_checkIfEntitledToReadDMSDoc($dms_id);
$this->_checkIfEntitledToReadDMSDoc($dms_id);
// Set filename to be used on downlaod
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
// Download file
$this->dmslib->download($dms_id, $filename);
}
// Get file to be downloaded from DMS
$download = $this->dmslib->download($dms_id, $filename);
if (isError($download)) return $download;
// Download file
$this->outputFile(getData($download));
}
/**
* Retrieve the UID of the logged user and checks if it is valid
@@ -180,13 +180,17 @@ class reviewAnrechnungUebersicht extends Auth_Controller
}
// Check if user is entitled to read dms doc
self::_checkIfEntitledToReadDMSDoc($dms_id);
$this->_checkIfEntitledToReadDMSDoc($dms_id);
// Set filename to be used on downlaod
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
// Get file to be downloaded from DMS
$download = $this->dmslib->download($dms_id, $filename);
if (isError($download)) return $download;
// Download file
$this->dmslib->download($dms_id, $filename);
$this->outputFile(getData($download));
}
+4 -4
View File
@@ -18,10 +18,10 @@ class Variables extends Auth_Controller
{
parent::__construct(
array(
'setVar' => 'basis/variable:rw',
'getVar' => 'basis/variable:rw',
'changeStudiensemesterVar' => 'basis/variable:rw',
'changeStudengangsTypVar' => 'basis/variable:rw'
'setVar' => array('basis/variable:rw','basis/variable_persoenlich:rw'),
'getVar' => array('basis/variable:rw','basis/variable_persoenlich:rw'),
'changeStudiensemesterVar' => array('basis/variable:rw','basis/variable_persoenlich:rw'),
'changeStudengangsTypVar' => array('basis/variable:rw','basis/variable_persoenlich:rw')
)
);
@@ -6,7 +6,7 @@ class Issues extends Auth_Controller
{
private $_uid;
const FUNKTION_KURZBZ = 'ass'; // // user having this funktion can see issues for oes assigned with this funktion
const FUNKTION_KURZBZ = 'ass'; // user having this funktion can see issues for oes assigned with this funktion
const BERECHTIGUNG_KURZBZ = 'system/issues_verwalten'; // user having this permission can see issues for oes assigned with this permission
public function __construct()
@@ -39,6 +39,7 @@ class Issues extends Auth_Controller
);
$this->_setAuthUID(); // sets property uid
$this->setControllerId(); // sets the controller id
}
public function index()
@@ -127,7 +128,7 @@ class Issues extends Auth_Controller
{
$all_funktionen_oe_kurzbz[$benutzerfunktion->oe_kurzbz][] = $benutzerfunktion->funktion_kurzbz;
// separate oes for the funktion needed for displaying issues
// separate oes for the additional funktion which enables displaying issues
if ($benutzerfunktion->funktion_kurzbz == self::FUNKTION_KURZBZ)
{
$oe_kurzbz_for_funktion[] = $benutzerfunktion->oe_kurzbz;
@@ -153,7 +154,9 @@ class Issues extends Auth_Controller
}
// add oes for which there is the "manage issues" Berechtigung
if (!$oe_kurzbz_berechtigt = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_KURZBZ))
$oe_kurzbz_berechtigt = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_KURZBZ);
if (!$oe_kurzbz_berechtigt)
show_error('No permission or error when checking permissions');
$all_oe_kurzbz_berechtigt = array_unique(array_merge($oe_kurzbz_for_funktion, $oe_kurzbz_berechtigt));
@@ -0,0 +1,217 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class IssuesZustaendigkeiten extends Auth_Controller
{
private $_uid;
public function __construct()
{
parent::__construct(
array(
'index' => 'admin:r',
'getApps' => 'admin:r',
'getFehlercodes' => 'admin:r',
'getNonAssignedZustaendigkeiten' => 'admin:r',
'addZustaendigkeit' => 'admin:rw',
'deleteZustaendigkeit' => 'admin:rw'
)
);
// Load libraries
$this->load->library('IssuesLib');
$this->load->library('WidgetLib');
// Load models
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
$this->load->model('system/Fehler_model', 'FehlerModel');
$this->load->model('system/Fehler_model', 'FehlerModel');
$this->load->model('system/Fehlerzustaendigkeiten_model', 'FehlerzustaendigkeitenModel');
$this->loadPhrases(
array(
'global',
'ui',
'filter',
'lehre',
'person',
'fehlermonitoring'
)
);
$this->_setAuthUID(); // sets property uid
$this->setControllerId(); // sets the controller id
}
public function index()
{
$this->load->view("system/issues/issuesZustaendigkeiten.php");
}
/**
* Loads all Apps to which Fehler exist.
*/
public function getApps()
{
$this->FehlerModel->addDistinct();
$this->FehlerModel->addSelect('app');
$this->FehlerModel->addOrder('app');
$appRes = $this->FehlerModel->load();
$this->outputJson($appRes);
}
/**
* Gets all fehlercodes, optionally by app.
*/
public function getFehlercodes()
{
$app = $this->input->get('app');
//$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz, fehlertext, fehlertyp_kurzbz');
$this->FehlerModel->addOrder('fehlercode');
$fehlerRes = isset($app) ? $this->FehlerModel->loadWhere(array('app' => $app)) : $this->FehlerModel->load();
$this->outputJson($fehlerRes);
}
/**
* Gets all Mitarbeiter, Organisationseinheiten, Funktionen not assigned to a Fehler yet.
*/
public function getNonAssignedZustaendigkeiten()
{
$fehlercode = $this->input->get('fehlercode');
$mitarbeiterRes = $this->FehlerzustaendigkeitenModel->getNonAssignedMitarbeiter($fehlercode);
if (isError($mitarbeiterRes))
{
$this->outputJsonError(getError($mitarbeiterRes));
return;
}
$this->OrganisationseinheitModel->addSelect('oe_kurzbz, bezeichnung, organisationseinheittyp_kurzbz');
$this->OrganisationseinheitModel->addOrder('organisationseinheittyp_kurzbz, bezeichnung');
$oeRes = $this->OrganisationseinheitModel->loadWhere(array('aktiv' => true));
if (isError($oeRes))
{
$this->outputJsonError(getError($oeRes));
return;
}
$oe_funktionen = array();
if (hasData($oeRes))
{
$oes = getData($oeRes);
foreach ($oes as $oe)
{
$oe->funktionen = array();
$funktionRes = $this->FehlerzustaendigkeitenModel->getNonAssignedFunktionen($fehlercode, $oe->oe_kurzbz);
if (isError($funktionRes))
{
$this->outputJsonError(getError($oeRes));
return;
}
$funktionData = getData($funktionRes);
$oe->funktionen = $funktionData;
$oe_funktionen[] = $oe;
}
}
if (isError($funktionRes))
{
$this->outputJsonError(getError($funktionRes));
return;
}
$result = array(
'mitarbeiter' => getData($mitarbeiterRes),
'oe_funktionen' => $oe_funktionen
);
$this->outputJsonSuccess($result);
}
/**
* Adds a Zuständigkeit after performing error checks.
*/
public function addZustaendigkeit()
{
$fehlercode = $this->input->post('fehlercode');
$mitarbeiter_person_id = $this->input->post('mitarbeiter_person_id');
$oe_kurzbz = $this->input->post('oe_kurzbz');
$funktion_kurzbz = $this->input->post('funktion_kurzbz');
if (isEmptyString($fehlercode))
$this->outputJsonError($this->p->t('fehlermonitoring', 'fehlercodeFehlt'));
elseif (isEmptyString($mitarbeiter_person_id) && isEmptyString($oe_kurzbz))
$this->outputJsonError($this->p->t('fehlermonitoring', 'mitarbeiterUndOeFehlt'));
elseif (!isEmptyString($mitarbeiter_person_id) && !isEmptyString($oe_kurzbz))
$this->outputJsonError($this->p->t('fehlermonitoring', 'nurOeOderMitarbeiterSetzen'));
elseif (isset($mitarbeiter_person_id) && !is_numeric($mitarbeiter_person_id))
$this->outputJsonError($this->p->t('fehlermonitoring', 'ungueltigeMitarbeiterId'));
else
{
$data = array(
'fehlercode' => $fehlercode
);
if (!isEmptyString($mitarbeiter_person_id))
$data['person_id'] = $mitarbeiter_person_id;
if (!isEmptyString($oe_kurzbz))
$data['oe_kurzbz'] = $oe_kurzbz;
if (!isEmptyString($funktion_kurzbz))
$data['funktion_kurzbz'] = $funktion_kurzbz;
$zustaendigkeitExistsRes = $this->FehlerzustaendigkeitenModel->loadWhere($data);
if (isError($zustaendigkeitExistsRes))
$this->outputJsonError(getError($zustaendigkeitExistsRes));
elseif (hasData($zustaendigkeitExistsRes))
$this->outputJsonError($this->p->t('fehlermonitoring', 'zustaendigkeitExistiert'));
else
{
$data['insertvon'] = $this->_uid;
$this->outputJson($this->FehlerzustaendigkeitenModel->insert($data));
}
}
}
/**
* Deletes a Zuständigkeit.
*/
public function deleteZustaendigkeit()
{
$fehlerzustaendigkeiten_id = $this->input->post('fehlerzustaendigkeiten_id');
// check if Id correctly passed
if (!isset($fehlerzustaendigkeiten_id) || !is_numeric($fehlerzustaendigkeiten_id))
{
$this->outputJsonError($this->p->t('fehlermonitoring', 'ungueltigeZustaendigkeitenId'));
return;
}
$this->outputJson($this->FehlerzustaendigkeitenModel->delete($fehlerzustaendigkeiten_id));
}
/**
* Retrieve the UID of the logged user and checks if it is valid
*/
private function _setAuthUID()
{
$this->_uid = getAuthUID();
if (!$this->_uid) show_error('User authentification failed');
}
}