Merge branch 'master' into feature-13011/installation_on_multiple_servers

This commit is contained in:
Paolo
2023-03-21 17:47:15 +01:00
1135 changed files with 31146 additions and 100447 deletions
@@ -1,4 +1,20 @@
<?php
/**
* Copyright (C) 2022 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 3 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, see <https://www.gnu.org/licenses/>.
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
@@ -0,0 +1,44 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Test Search Vue Component
*/
class TestSearch extends Auth_Controller
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct(
array(
'index' => 'system/developer:r'
)
);
// Loads WidgetLib
$this->load->library('WidgetLib');
// Loads phrases system
$this->loadPhrases(
array(
'global',
'ui',
'filter'
)
);
}
// -----------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Everything has a beginning
*/
public function index()
{
$this->load->view('system/logs/testSearch.php');
}
}
+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')
)
);
@@ -88,6 +88,12 @@ class InfoCenter extends Auth_Controller
'message' => 'Type of Document %s was updated, set to %s',
'success' => null
),
'deletedoc' => array(
'logtype' => 'Action',
'name' => 'Document deleted',
'message' => 'Document %s deleted',
'success' => null
),
);
// Name of Interessentenstatus
@@ -115,6 +121,7 @@ class InfoCenter extends Auth_Controller
'unlockPerson' => 'infocenter:rw',
'saveFormalGeprueft' => 'infocenter:rw',
'saveDocTyp' => 'infocenter:rw',
'updateStammdaten' => 'infocenter:rw',
'saveNachreichung' => 'infocenter:rw',
'getPrestudentData' => 'infocenter:r',
'getLastPrestudentWithZgvJson' => 'infocenter:r',
@@ -125,12 +132,13 @@ class InfoCenter extends Auth_Controller
'zgvStatusUpdate' => 'lehre/zgvpruefung:rw',
'saveAbsage' => 'infocenter:rw',
'saveFreigabe' => 'infocenter:rw',
'getNotiz' => 'infocenter:r',
'getNotiz' => array('infocenter:r', 'lehre/zgvpruefung:r'),
'saveNotiz' => array('infocenter:rw', 'lehre/zgvpruefung:rw'),
'updateNotiz' => 'infocenter:rw',
'updateNotiz' => array('infocenter:rw', 'lehre/zgvpruefung:rw'),
'reloadZgvPruefungen' => 'infocenter:r',
'reloadMessages' => 'infocenter:r',
'reloadDoks' => 'infocenter:r',
'reloadUebersichtDoks' => 'infocenter:r',
'reloadNotizen' => array('infocenter:r', 'lehre/zgvpruefung:r'),
'reloadLogs' => 'infocenter:r',
'outputAkteContent' => array('infocenter:r', 'lehre/zgvpruefung:r'),
@@ -142,7 +150,9 @@ class InfoCenter extends Auth_Controller
'getStudienjahrEnd' => array('infocenter:r', 'lehre/zgvpruefung:r'),
'setNavigationMenuArrayJson' => 'infocenter:r',
'getAbsageData' => 'infocenter:r',
'saveAbsageForAll' => 'infocenter:rw'
'saveAbsageForAll' => 'infocenter:rw',
'deleteDoc' => 'infocenter:rw',
'getStudienartData' => 'infocenter:rw'
)
);
@@ -159,11 +169,20 @@ class InfoCenter extends Auth_Controller
$this->load->model('system/Message_model', 'MessageModel');
$this->load->model('system/Filters_model', 'FiltersModel');
$this->load->model('system/PersonLock_model', 'PersonLockModel');
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
$this->load->model('codex/Zgv_model', 'ZgvModel');
$this->load->model('codex/Zgvmaster_model', 'ZgvmasterModel');
$this->load->model('codex/Nation_model', 'NationModel');
$this->load->model('person/Kontakt_model', 'KontaktModel');
$this->load->model('person/Geschlecht_model', 'GeschlechtModel');
$this->load->model('person/adresse_model', 'AdresseModel');
// Loads libraries
$this->load->library('PersonLogLib');
$this->load->library('WidgetLib');
$this->load->config('infocenter');
$this->loadPhrases(
array(
'global',
@@ -398,6 +417,35 @@ class InfoCenter extends Auth_Controller
$this->outputJsonSuccess(array($json));
}
public function deleteDoc($person_id)
{
$akte_id = $this->input->post('akteid');
if (isset($akte_id) && isset($person_id))
{
$this->load->library('AkteLib');
$akte = $this->aktelib->get($akte_id);
if (hasData($akte))
{
$akte = getData($akte);
if ($akte->person_id === (int)$person_id)
{
$result = $this->aktelib->remove($akte_id);
if (isError($result))
{
$this->terminateWithJsonError('Error deleting document');
}
$this->_log($person_id, 'deletedoc', array($akte->bezeichnung));
$this->outputJsonSuccess('success');
}
}
}
}
/**
* Gets prestudent data for a person in json format
* @param $person_id
@@ -1069,11 +1117,22 @@ class InfoCenter extends Auth_Controller
public function reloadDoks($person_id)
{
$dokumente_nachgereicht = $this->AkteModel->getAktenWithDokInfo($person_id, null, true);
$dokumente_nachgereicht = $this->AkteModel->getAktenWithDokInfo($person_id, null, true, false);
$this->load->view('system/infocenter/dokNachzureichend.php', array('dokumente_nachgereicht' => $dokumente_nachgereicht->retval));
}
public function reloadUebersichtDoks($person_id)
{
$dokumente = $this->AkteModel->getAktenWithDokInfo($person_id, null, false, false);
$this->DokumentModel->addOrder('bezeichnung');
$dokumentdata = array('dokumententypen' => (getData($this->DokumentModel->load())));
$data = array_merge($dokumentdata, ['dokumente' => $dokumente->retval]);
$this->load->view('system/infocenter/dokpruefung.php', $data);
}
/**
* Outputs content of an Akte, sends appropriate headers (so the document can be downloaded)
* @param $akte_id
@@ -1267,6 +1326,126 @@ class InfoCenter extends Auth_Controller
$this->outputJsonSuccess('success');
}
public function updateStammdaten()
{
if (isEmptyString($this->input->post('nachname')) ||
isEmptyString($this->input->post('geschlecht')) ||
isEmptyString($this->input->post('gebdatum')))
{
$this->terminateWithJsonError($this->p->t('infocenter', 'stammdatenFeldFehlt'));
}
$datum = explode('.', $this->input->post('gebdatum'));
if (!checkdate($datum[1], $datum[0], $datum[2]))
{
$this->terminateWithJsonError($this->p->t('infocenter', 'datumUngueltig'));
}
$person_id = $this->input->post('personid');
$update = $this->PersonModel->update(
array
(
'person_id' => $person_id
),
array
(
'titelpre' => isEmptyString($this->input->post('titelpre')) ? null : $this->input->post('titelpre'),
'vorname' => isEmptyString($this->input->post('vorname')) ? null : $this->input->post('vorname'),
'nachname' => $this->input->post('nachname'),
'titelpost' => isEmptyString($this->input->post('titelpost')) ? null : $this->input->post('titelpost'),
'gebdatum' => isEmptyString($this->input->post('gebdatum')) ? null : date("Y-m-d", strtotime($this->input->post('gebdatum'))),
'svnr' => isEmptyString($this->input->post('svnr')) ? null : $this->input->post('svnr'),
'staatsbuergerschaft' => isEmptyString($this->input->post('buergerschaft')) ? null : $this->input->post('buergerschaft'),
'geschlecht' => $this->input->post('geschlecht'),
'geburtsnation' => isEmptyString($this->input->post('gebnation')) ? null : $this->input->post('gebnation'),
'gebort' => isEmptyString($this->input->post('gebort')) ? null : $this->input->post('gebort'),
'updateamum' => date('Y-m-d H:i:s'),
'updatevon' => $this->_uid
)
);
if (isError($update))
$this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern'));
$kontakte = $this->input->post('kontakt');
foreach ($kontakte as $kontakt)
{
$kontaktExists = $this->KontaktModel->loadWhere(array(
'kontakt_id' => $kontakt['id'],
'person_id' => $person_id,
));
if (hasData($kontaktExists))
{
$kontaktExists = getData($kontaktExists)[0];
if ($kontaktExists->kontakt === $kontakt['value'])
continue;
$update = $this->KontaktModel->update(
array
(
'kontakt_id' => $kontakt['id']
),
array
(
'kontakt' => isEmptyString($kontakt['value']) ? null : $kontakt['value'],
'updateamum' => date('Y-m-d H:i:s'),
'updatevon' => $this->_uid
)
);
if (isError($update))
$this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern'));
}
}
$adressen = $this->input->post('adresse');
foreach ($adressen as $adresse)
{
$adresseExists = $this->AdresseModel->loadWhere(array(
'adresse_id' => $adresse['id'],
'person_id' => $person_id,
));
if (hasData($adresseExists))
{
$adresse = $adresse['value'];
$adresseExists = getData($adresseExists)[0];
if ($adresseExists->strasse !== $adresse['strasse'] ||
$adresseExists->plz !== $adresse['plz'] ||
$adresseExists->ort !== $adresse['ort'] ||
$adresseExists->nation !== $adresse['nation'])
{
$update = $this->AdresseModel->update(
array
(
'adresse_id' => $adresseExists->adresse_id
),
array
(
'strasse' => isEmptyString($adresse['strasse']) ? null : $adresse['strasse'],
'plz' => isEmptyString($adresse['plz']) ? null : $adresse['plz'],
'ort' => isEmptyString($adresse['ort']) ? null : $adresse['ort'],
'nation' => isEmptyString($adresse['nation']) ? null : $adresse['nation'],
'updateamum' => date('Y-m-d H:i:s'),
'updatevon' => $this->_uid
)
);
if (isError($update))
$this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern'));
}
}
}
$this->outputJsonSuccess('Success');
}
public function saveNachreichung($person_id)
{
$nachreichungAm = $this->input->post('nachreichungAm');
@@ -1741,14 +1920,14 @@ class InfoCenter extends Auth_Controller
if (!isset($stammdaten->retval))
return null;
$dokumente = $this->AkteModel->getAktenWithDokInfo($person_id, null, false);
$dokumente = $this->AkteModel->getAktenWithDokInfo($person_id, null, false, false);
if (isError($dokumente))
{
show_error(getError($dokumente));
}
$dokumente_nachgereicht = $this->AkteModel->getAktenWithDokInfo($person_id, null, true);
$dokumente_nachgereicht = $this->AkteModel->getAktenWithDokInfo($person_id, null, true, false);
if (isError($dokumente_nachgereicht))
{
@@ -1932,10 +2111,33 @@ class InfoCenter extends Auth_Controller
$abwstatusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
$intstatusgruende = $this->StatusgrundModel->getStatus(self::INTERESSENTSTATUS)->retval;
$studienArtBerechtigung = array_column($this->getStudienArtBerechtigung(), 'typ');
$this->ZgvModel->addOrder('zgv_bez');
$allZGVs = getData($this->ZgvModel->load());
$this->ZgvModel->addOrder('zgvmas_bez');
$allZGVsMaster = getData($this->ZgvmasterModel->load());
$this->NationModel->addOrder('langtext');
$allNations = getData($this->NationModel->load());
$additional_stg = explode(',', ($this->config->item('infocenter_studiengang_kz')));
$this->GeschlechtModel->addOrder('sort');
$allGenders = getData($this->GeschlechtModel->load());
$data = array (
'zgvpruefungen' => $zgvpruefungen,
'abwstatusgruende' => $abwstatusgruende,
'intstatusgruende' => $intstatusgruende
'intstatusgruende' => $intstatusgruende,
'studienArtBerechtigung' => $studienArtBerechtigung,
'all_zgvs' => $allZGVs,
'all_zgvs_master' => $allZGVsMaster,
'all_nations' => $allNations,
'additional_stg' => $additional_stg,
'all_genders' => $allGenders
);
return $data;
@@ -2096,8 +2298,8 @@ class InfoCenter extends Auth_Controller
$prestudentstatus = $prestudent->prestudentstatus;
$person_id = $prestudent->person_id;
$person = $this->PersonModel->getPersonStammdaten($person_id, true)->retval;
$dokumente = $this->AkteModel->getAktenWithDokInfo($person_id, null, false)->retval;
$dokumenteNachzureichen = $this->AkteModel->getAktenWithDokInfo($person_id, null, true)->retval;
$dokumente = $this->AkteModel->getAktenWithDokInfo($person_id, null, false, false)->retval;
$dokumenteNachzureichen = $this->AkteModel->getAktenWithDokInfo($person_id, null, true, false)->retval;
//fill mail variables
$interessentbez = $person->geschlecht == 'm' ? 'Ein Interessent' : 'Eine Interessentin';
@@ -2194,18 +2396,35 @@ class InfoCenter extends Auth_Controller
public function getAbsageData()
{
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
$stg_typ = $this->getStudienArtBerechtigung(['b', 'm']);
$statusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
$studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
$studiengaenge = $this->StudiengangModel->getStudiengaengeWithOrgForm(['b', 'm'], $studienSemester);
if (!is_null($stg_typ))
{
$statusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
$studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
$studiengaenge = $this->StudiengangModel->getStudiengaengeWithOrgForm(array_column($stg_typ, 'typ'), $studienSemester);
$data = array (
'statusgruende' => $statusgruende,
'studiengaenge' => $studiengaenge->retval
);
$data = array (
'statusgruende' => $statusgruende,
'studiengaenge' => $studiengaenge->retval
);
$this->outputJsonSuccess($data);
$this->outputJsonSuccess($data);
}
else
$this->outputJsonSuccess(null);
}
public function getStudienArtBerechtigung($typ = null)
{
$studiengang_kz_all = $this->permissionlib->getSTG_isEntitledFor('infocenter');
$stg_typ = $this->StudiengangModel->getStudiengangTyp($studiengang_kz_all, $typ);
return getData($stg_typ);
}
public function getStudienartData()
{
$this->outputJsonSuccess($this->getStudienArtBerechtigung(['b', 'm', 'l']));
}
public function saveAbsageForAll()
@@ -4,6 +4,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
class ZGVUeberpruefung extends Auth_Controller
{
const BERECHTIGUNG_KURZBZ = 'lehre/zgvpruefung';
/**
* Constructor
*/
@@ -12,14 +14,15 @@ class ZGVUeberpruefung extends Auth_Controller
// Set required permissions
parent::__construct(
array(
'index' => 'lehre/zgvpruefung:r',
'getZgvStatusByPrestudent' => 'lehre/zgvpruefung:r'
'index' => self::BERECHTIGUNG_KURZBZ.':r',
'getZgvStatusByPrestudent' => self::BERECHTIGUNG_KURZBZ.':r'
)
);
$this->load->model('crm/ZGVPruefungStatus_model', 'ZGVPruefungStatusModel');
$this->load->model('crm/ZGVPruefung_model', 'ZGVPruefungModel');
$this->load->library('WidgetLib');
$this->load->library('PermissionLib');
$this->setControllerId();
$this->loadPhrases(
@@ -31,7 +34,14 @@ class ZGVUeberpruefung extends Auth_Controller
public function index()
{
$this->load->view('system/infocenter/infocenterZgvUeberpruefung.php');
$oeKurzbz = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_KURZBZ);
if (!$oeKurzbz)
show_error('Keine Berechtigung.');
$data['oeKurz'] = $oeKurzbz;
$this->load->view('system/infocenter/infocenterZgvUeberpruefung.php', $data);
}
public function getZgvStatusByPrestudent()
@@ -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()
@@ -80,7 +81,7 @@ class Issues extends Auth_Controller
}
if (isEmptyString($changeIssueMethod))
$errors[] = error("Invalid issue status given");
$errors[] = "Invalid issue status given";
else
{
$issueRes = $this->issueslib->{$changeIssueMethod}($issue_id, $user);
@@ -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');
}
}
@@ -0,0 +1,133 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class Plausichecks extends Auth_Controller
{
public function __construct()
{
parent::__construct(
array(
'index' => array('system/issues_verwalten:r'),
'runChecks' => array('system/issues_verwalten:r')
)
);
// Load libraries
$this->load->library('issues/PlausicheckProducerLib');
$this->load->library('WidgetLib');
// Load models
$this->load->model('system/Fehler_model', 'FehlerModel');
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
}
/*
* Get data for filtering the plausichecks and load the view.
*/
public function index()
{
$filterData = $this->_getFilterData();
$this->load->view('system/issues/plausichecks', $filterData);
}
/**
* Initiate plausichecks run.
*/
public function runChecks()
{
$studiensemester_kurzbz = $this->input->get('studiensemester_kurzbz');
$studiengang_kz = $this->input->get('studiengang_kz');
$fehler_kurzbz = $this->input->get('fehler_kurzbz');
// issues array for passing issue texts
$issueTexts = array();
// all fehler kurzbz which are going to be checked
$fehlerKurzbz = !isEmptyString($fehler_kurzbz) ? array($fehler_kurzbz) : $this->plausicheckproducerlib->getFehlerKurzbz();
// set Studiengang to null if not passed
if (isEmptyString($studiengang_kz)) $studiengang_kz = null;
// get the data returned by Plausicheck
foreach ($fehlerKurzbz as $fehler_kurzbz)
{
// execute the check
$issueTexts[$fehler_kurzbz] = array();
$plausicheckRes = $this->plausicheckproducerlib->producePlausicheckIssue($fehler_kurzbz, $studiensemester_kurzbz, $studiengang_kz);
if (isError($plausicheckRes)) $this->terminateWithJsonError(getError($plausicheckRes));
if (hasData($plausicheckRes))
{
$plausicheckData = getData($plausicheckRes);
foreach ($plausicheckData as $plausiData)
{
// get the data needed for issue production
$person_id = isset($plausiData['person_id']) ? $plausiData['person_id'] : null;
$oe_kurzbz = isset($plausiData['oe_kurzbz']) ? $plausiData['oe_kurzbz'] : null;
$fehlertext_params = isset($plausiData['fehlertext_params']) ? $plausiData['fehlertext_params'] : null;
$resolution_params = isset($plausiData['resolution_params']) ? $plausiData['resolution_params'] : null;
// get Text of the Fehler
$this->FehlerModel->addSelect('fehlertext');
$fehlerRes = $this->FehlerModel->loadWhere(array('fehler_kurzbz' => $fehler_kurzbz));
if (isError($fehlerRes)) $this->outputJsonError(getError($fehlerRes));
// optionally replace fehler parameters in text, output the fehlertext
if (hasData($fehlerRes))
{
$fehlerText = getData($fehlerRes)[0]->fehlertext;
if (!isEmptyArray($fehlertext_params))
{
if (count($fehlertext_params) != substr_count($fehlerText, '%s'))
$this->terminateWithJsonError('Wrong number of parameters for Fehlertext, fehler_kurzbz ' . $fehler_kurzbz);
$fehlerText = vsprintf($fehlerText, $fehlertext_params);
}
if (isset($person_id)) $fehlerText .= "; person_id: $person_id";
if (isset($oe_kurzbz)) $fehlerText .= "; oe_kurzbz: $oe_kurzbz";
$issueTexts[$fehler_kurzbz][] = $fehlerText;
}
}
}
}
$this->outputJsonSuccess($issueTexts);
}
/**
* Get the data needed for filtering for limiting checks.
*/
private function _getFilterData()
{
$this->StudiensemesterModel->addOrder('start', 'DESC');
$studiensemesterRes = $this->StudiensemesterModel->load();
if (isError($studiensemesterRes)) show_error(getError($studiensemesterRes));
$currSemRes = $this->StudiensemesterModel->getAkt();
if (isError($currSemRes)) show_error(getError($currSemRes));
$this->StudiengangModel->addSelect('studiengang_kz, tbl_studiengang.bezeichnung, tbl_studiengang.typ,
tbl_studiengangstyp.bezeichnung AS typbezeichnung, UPPER(tbl_studiengang.typ::varchar(1) || tbl_studiengang.kurzbz) as kuerzel');
$this->StudiengangModel->addJoin('public.tbl_studiengangstyp', 'typ');
$this->StudiengangModel->addOrder('kuerzel, tbl_studiengang.bezeichnung, studiengang_kz');
$studiengaengeRes = $this->StudiengangModel->loadWhere(array('aktiv' => true));
if (isError($studiengaengeRes)) show_error(getError($studiengaengeRes));
$fehlerKurzbz = $this->plausicheckproducerlib->getFehlerKurzbz();
return array(
'semester' => hasData($studiensemesterRes) ? getData($studiensemesterRes) : array(),
'currsemester' => hasData($currSemRes) ? getData($currSemRes) : array(),
'studiengaenge' => hasData($studiengaengeRes) ? getData($studiengaengeRes) : array(),
'fehler' => $fehlerKurzbz
);
}
}