Merge branch 'feature-4026/TabulatorWidget' into feature-3994/Digitaler_Lehrauftrag

This commit is contained in:
Paolo
2019-11-04 16:58:19 +01:00
338 changed files with 26029 additions and 45106 deletions
@@ -0,0 +1,15 @@
<?php
class Bisiozweck_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'bis.tbl_bisio_zweck';
$this->pk = array('bisio_id', 'zweck_code');
$this->hasSequence = false;
}
}
+2 -4
View File
@@ -10,6 +10,8 @@ class Prestudent_model extends DB_Model
parent::__construct();
$this->dbTable = 'public.tbl_prestudent';
$this->pk = 'prestudent_id';
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
}
/**
@@ -208,7 +210,6 @@ class Prestudent_model extends DB_Model
return error('prestudent could not be loaded');
//Prestudentstatus
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
if ($lastStatus->error)
@@ -310,8 +311,6 @@ class Prestudent_model extends DB_Model
if (!hasData($prestudents))
return $bewerbungen;
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
foreach ($prestudents->retval as $prestudent)
{
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent->prestudent_id, $studiensemester_kurzbz);
@@ -424,7 +423,6 @@ class Prestudent_model extends DB_Model
if (!hasData($prestudent))
return false;
$this->load->model('prestudentstatus_model', 'PrestudentstatusModel');
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id, null, 'Interessent');
if (!hasData($lastStatus))
@@ -98,8 +98,8 @@ class Lehreinheitgruppe_model extends DB_Model
'semester' => $lvadata->semester,
'bezeichnung' => $bezeichnung,
'aktiv' => true,
'mailgrp' => false,
'sichtbar' => true,
'mailgrp' => true,
'sichtbar' => false,
'generiert' => false,
'insertamum' => date('Y-m-d H:i:s'),
'insertvon' => $loggedInUser,
@@ -10,6 +10,9 @@ class Lehrveranstaltung_model extends DB_Model
parent::__construct();
$this->dbTable = 'lehre.tbl_lehrveranstaltung';
$this->pk = 'lehrveranstaltung_id';
$this->load->model('organisation/studiengang_model', 'StudiengangModel');
$this->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
}
/**
@@ -22,8 +25,6 @@ class Lehrveranstaltung_model extends DB_Model
*/
public function getLehrveranstaltungGroupNames($studiensemester_kurzbz, $ausbildungssemester = null, $studiengang_kz = null, $lehrveranstaltung_ids = null)
{
$this->load->model('organisation/studiengang_model', 'StudiengangModel');
$studiengang_kz_arr = array();
$ausbildungssemester_arr = array();
$lehrveranstaltung_id_arr = array();
@@ -59,7 +60,6 @@ class Lehrveranstaltung_model extends DB_Model
}
else
{
$this->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
foreach ($studiengang_kz_arr as $studiengang_kz_item)
{
$result = $this->StudiensemesterModel->getAusbildungssemesterByStudiensemesterAndStudiengang($studiensemester_kurzbz, $studiengang_kz_item);
@@ -214,8 +214,6 @@ class Lehrveranstaltung_model extends DB_Model
*/
public function getLvsWithIncomingPlaces($studiensemester_kurzbz)
{
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
$studsemres = $this->StudiensemesterModel->load($studiensemester_kurzbz);
if (!hasData($studsemres))
@@ -19,7 +19,7 @@ class Studienplan_model extends DB_Model
return $this->loadWhere(array("studiengang_kz" => $studiengang_kz));
}
public function getStudienplaeneBySemester($studiengang_kz, $studiensemester_kurzbz, $ausbildungssemester = null, $orgform_kurzbz = null)
public function getStudienplaeneBySemester($studiengang_kz, $studiensemester_kurzbz, $ausbildungssemester = null, $orgform_kurzbz = null, $sprache = null)
{
$this->addJoin("lehre.tbl_studienordnung", "studienordnung_id");
$this->addJoin("lehre.tbl_studienplan_semester", "studienplan_id");
@@ -40,6 +40,11 @@ class Studienplan_model extends DB_Model
$whereArray["orgform_kurzbz"] = $orgform_kurzbz;
}
if(!is_null($sprache))
{
$whereArray["tbl_studienplan.sprache"] = $sprache;
}
return $this->StudienplanModel->loadWhere($whereArray);
}
@@ -77,7 +77,7 @@ class Studiensemester_model extends DB_Model
start,
ende
FROM public.tbl_studiensemester
WHERE start > (
WHERE start >= (
SELECT ende
FROM public.tbl_studiensemester
WHERE studiensemester_kurzbz = ?
@@ -88,6 +88,26 @@ class Studiensemester_model extends DB_Model
return $this->execQuery($query, array($studiensemester_kurzbz));
}
/**
* getPreviousFrom
*/
public function getPreviousFrom($studiensemester_kurzbz)
{
$query = 'SELECT studiensemester_kurzbz,
start,
ende
FROM public.tbl_studiensemester
WHERE ende <= (
SELECT start
FROM public.tbl_studiensemester
WHERE studiensemester_kurzbz = ?
)
ORDER BY start DESC
LIMIT 1';
return $this->execQuery($query, array($studiensemester_kurzbz));
}
/**
* getNearest
*/
+3 -3
View File
@@ -10,6 +10,9 @@ class Person_model extends DB_Model
parent::__construct();
$this->dbTable = 'public.tbl_person';
$this->pk = 'person_id';
$this->load->model('person/kontakt_model', 'KontaktModel');
$this->load->model('person/adresse_model', 'AdresseModel');
}
/**
@@ -162,9 +165,6 @@ class Person_model extends DB_Model
if(count($person->retval) < 1)
return success(null);
$this->load->model('person/kontakt_model', 'KontaktModel');
$this->load->model('person/adresse_model', 'AdresseModel');
$this->KontaktModel->addDistinct();
$this->KontaktModel->addSelect('kontakttyp, anmerkung, kontakt, zustellung');
$this->KontaktModel->addOrder('kontakttyp');
+169
View File
@@ -0,0 +1,169 @@
<?php
class FAS_UDF_model extends DB_Model
{
// String values of booleans
const STRING_NULL = 'null';
const STRING_TRUE = 'true';
const STRING_FALSE = 'false';
const UDF_DROPDOWN_TYPE = 'dropdown';
const UDF_MULTIPLEDROPDOWN_TYPE = 'multipledropdown';
/**
* Methods to save data from FAS
*/
public function saveUDFs($udfs)
{
$result = error('No way man!');
$resultPerson = success('person');
$resultPrestudent = success('prestudent');
$person_id = null;
if (isset($udfs['person_id'])) $person_id = $udfs['person_id'];
unset($udfs['person_id']);
$prestudent_id = null;
if (isset($udfs['prestudent_id'])) $prestudent_id = $udfs['prestudent_id'];
unset($udfs['prestudent_id']);
$jsons = array();
//
if (isset($person_id))
{
// Load model Person_model
$this->load->model('person/Person_model', 'PersonModel');
$result = $this->load(array('public', 'tbl_person'));
if (isSuccess($result) && count($result->retval) == 1)
{
$jsons = json_decode($result->retval[0]->jsons);
}
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
$resultPerson = $this->PersonModel->update($person_id, $udfs);
}
//
if (isset($prestudent_id))
{
// Load model Prestudent_model
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$result = $this->load(array('public', 'tbl_prestudent'));
if (isSuccess($result) && count($result->retval) == 1)
{
$jsons = json_decode($result->retval[0]->jsons);
}
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
$resultPrestudent = $this->PrestudentModel->update($prestudent_id, $udfs);
}
if (isSuccess($resultPerson) && isSuccess($resultPrestudent))
{
$result = success(array($resultPerson->retval, $resultPrestudent->retval));
}
else if(isError($resultPerson))
{
$result = $resultPerson;
}
else if(isError($resultPrestudent))
{
$result = $resultPrestudent;
}
return $result;
}
/**
*
*/
private function _fillMissingChkboxUDF($udfs, $jsons)
{
$_fillMissingChkboxUDF = $udfs;
foreach($jsons as $udfDescription)
{
if ($udfDescription->{UDFLib::TYPE} == UDFLib::CHKBOX_TYPE)
{
if (!isset($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}]))
{
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = false;
}
else
{
if ($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_FALSE)
{
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = false;
}
else if ($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_TRUE)
{
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = true;
}
}
}
}
return $_fillMissingChkboxUDF;
}
/**
*
*/
private function _fillMissingDropdownUDF($udfs, $jsons)
{
$_fillMissingDropdownUDF = $udfs;
foreach($jsons as $udfDescription)
{
if ($udfDescription->{UDFLib::TYPE} == UDF_model::UDF_DROPDOWN_TYPE
|| $udfDescription->{UDFLib::TYPE} == UDF_model::UDF_MULTIPLEDROPDOWN_TYPE)
{
if (!isset($_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}]))
{
$_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] = null;
}
else if($_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_NULL)
{
$_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] = null;
}
}
}
return $_fillMissingDropdownUDF;
}
/**
*
*/
private function _fillMissingTextUDF($udfs, $jsons)
{
$_fillMissingTextUDF = $udfs;
foreach($jsons as $udfDescription)
{
if ($udfDescription->{UDFLib::TYPE} == 'textarea'
|| $udfDescription->{UDFLib::TYPE} == 'textfield')
{
if (!isset($_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}]))
{
$_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}] = null;
}
else if(trim($_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}]) == '')
{
$_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}] = null;
}
}
}
return $_fillMissingTextUDF;
}
}
-168
View File
@@ -2,14 +2,6 @@
class UDF_model extends DB_Model
{
// String values of booleans
const STRING_NULL = 'null';
const STRING_TRUE = 'true';
const STRING_FALSE = 'false';
const UDF_DROPDOWN_TYPE = 'dropdown';
const UDF_MULTIPLEDROPDOWN_TYPE = 'multipledropdown';
/**
* Constructor
*/
@@ -38,164 +30,4 @@ class UDF_model extends DB_Model
return $udfResults;
}
// ------------------------------------------------------------------------------------
// These methods work only with the this version of FAS, not with the future versions
/**
* Methods to save data from FAS
*/
public function saveUDFs($udfs)
{
$result = error('No way man!');
$resultPerson = success('person');
$resultPrestudent = success('prestudent');
$person_id = null;
if (isset($udfs['person_id'])) $person_id = $udfs['person_id'];
unset($udfs['person_id']);
$prestudent_id = null;
if (isset($udfs['prestudent_id'])) $prestudent_id = $udfs['prestudent_id'];
unset($udfs['prestudent_id']);
$jsons = array();
//
if (isset($person_id))
{
// Load model Person_model
$this->load->model('person/Person_model', 'PersonModel');
$result = $this->load(array('public', 'tbl_person'));
if (isSuccess($result) && count($result->retval) == 1)
{
$jsons = json_decode($result->retval[0]->jsons);
}
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
$resultPerson = $this->PersonModel->update($person_id, $udfs);
}
//
if (isset($prestudent_id))
{
// Load model Prestudent_model
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$result = $this->load(array('public', 'tbl_prestudent'));
if (isSuccess($result) && count($result->retval) == 1)
{
$jsons = json_decode($result->retval[0]->jsons);
}
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
$resultPrestudent = $this->PrestudentModel->update($prestudent_id, $udfs);
}
if (isSuccess($resultPerson) && isSuccess($resultPrestudent))
{
$result = success(array($resultPerson->retval, $resultPrestudent->retval));
}
else if(isError($resultPerson))
{
$result = $resultPerson;
}
else if(isError($resultPrestudent))
{
$result = $resultPrestudent;
}
return $result;
}
/**
*
*/
private function _fillMissingChkboxUDF($udfs, $jsons)
{
$_fillMissingChkboxUDF = $udfs;
foreach($jsons as $udfDescription)
{
if ($udfDescription->{UDFLib::TYPE} == UDFLib::CHKBOX_TYPE)
{
if (!isset($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}]))
{
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = false;
}
else
{
if ($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_FALSE)
{
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = false;
}
else if ($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_TRUE)
{
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = true;
}
}
}
}
return $_fillMissingChkboxUDF;
}
/**
*
*/
private function _fillMissingDropdownUDF($udfs, $jsons)
{
$_fillMissingDropdownUDF = $udfs;
foreach($jsons as $udfDescription)
{
if ($udfDescription->{UDFLib::TYPE} == UDF_model::UDF_DROPDOWN_TYPE
|| $udfDescription->{UDFLib::TYPE} == UDF_model::UDF_MULTIPLEDROPDOWN_TYPE)
{
if (!isset($_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}]))
{
$_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] = null;
}
else if($_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_NULL)
{
$_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] = null;
}
}
}
return $_fillMissingDropdownUDF;
}
/**
*
*/
private function _fillMissingTextUDF($udfs, $jsons)
{
$_fillMissingTextUDF = $udfs;
foreach($jsons as $udfDescription)
{
if ($udfDescription->{UDFLib::TYPE} == 'textarea'
|| $udfDescription->{UDFLib::TYPE} == 'textfield')
{
if (!isset($_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}]))
{
$_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}] = null;
}
else if(trim($_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}]) == '')
{
$_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}] = null;
}
}
}
return $_fillMissingTextUDF;
}
}
@@ -10,5 +10,92 @@ class Variable_model extends DB_Model
parent::__construct();
$this->dbTable = 'public.tbl_variable';
$this->pk = array('uid', 'name');
$this->hasSequence = false;
$this->load->model('system/Variablenname_model', 'VariablennameModel');
}
/**
* Gets user variables and values for a uid.
* If no value found in tbl_variable, default as defined in variablename_model is retrieved.
* @param $uid
* @param null $names optionally get only certain variables
* @return array
*/
public function getVariables($uid, $names = null)
{
if (isEmptyString($uid) || (isset($names) && !is_array($names)))
$result = error('wrong parameters passed');
else
{
$vardata = array();
$qry = "SELECT name, wert FROM public.tbl_variable WHERE uid = ?";
if (isset($names))
{
$qry .= " AND name IN ('".implode(',', $names)."')";
}
$qry .= ";";
$varresults = $this->execQuery($qry, array($uid));
if (hasData($varresults))
{
$varresults = getData($varresults);
foreach ($varresults as $varresult)
{
if (isset($varresult->wert))
$vardata[$varresult->name] = $varresult->wert;
}
}
$vardefaults = $this->VariablennameModel->getDefaults($names);
if (hasData($vardefaults))
{
$vardefaults = getData($vardefaults);
foreach ($vardefaults as $vardefault)
{
if (!isset($vardata[$vardefault->name]) && isset($vardefault->defaultwert))
{
$vardata[$vardefault->name] = $vardefault->defaultwert;
}
}
}
$result = success($vardata);
}
return $result;
}
/**
* Sets a variable value for a uid. Adds new entry if not present, updates entry otherwise.
* @param $uid
* @param $name
* @param $wert
* @return array
*/
public function setVariable($uid, $name, $wert)
{
$result = error('error when setting variable!');
if (!isEmptyString($uid) && !isEmptyString($name) && !isEmptyString($wert))
{
$varres = $this->loadWhere(array('uid' => $uid, 'name' => $name));
if (isSuccess($varres))
{
if (hasData($varres))
{
$result = $this->VariableModel->update(array('uid' => $uid, 'name' => $name), array('wert' => $wert));
}
else
$result = $this->VariableModel->insert(array('uid' => $uid, 'name' => $name, 'wert' => $wert));
}
}
return $result;
}
}
@@ -0,0 +1,78 @@
<?php
class Variablenname_model extends DB_Model
{
// Contains SQL queries retrieving default variable values if no default is set.
private $_dynamic_defaults = array(
'semester_aktuell' => 'SELECT studiensemester_kurzbz FROM public.tbl_studiensemester WHERE ende>now() ORDER BY start LIMIT 1',
'infocenter_studiensemester' => 'SELECT studiensemester_kurzbz FROM (
SELECT DISTINCT ON (studienjahr_kurzbz) start, studiensemester_kurzbz
FROM public.tbl_studiensemester
ORDER BY studienjahr_kurzbz, start
) sem
WHERE start > now()
LIMIT 1;'
);
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_variablenname';
$this->pk ='name';
}
/**
* Gets defaults for user variables.
* If no default value present in table, SQL can be executed for retrieving the value.
* @param null $names optionally get only defaults for certain variables
* @return array
*/
public function getDefaults($names = null)
{
$defaults = array();
$qry = "SELECT name, defaultwert FROM public.tbl_variablenname";
if (isset($names) && is_array($names))
{
$qry .= " WHERE name IN ('".implode(',', $names)."')";
}
$qry .= ";";
$defaultsres = $this->execQuery($qry);
if (hasData($defaultsres))
{
$defaults = getData($defaultsres);
foreach ($defaults as $default)
{
if (!isset($default->defaultwert))
{
if (isset($this->_dynamic_defaults[$default->name]))
{
$dyndefault = $this->execQuery($this->_dynamic_defaults[$default->name]);
if (hasData($dyndefault))
{
$dyndefault = getData($dyndefault);
if (count($dyndefault) === 1)
{
foreach ($dyndefault[0] as $value)
{
$default->defaultwert = $value;
break;
}
}
}
}
}
}
}
return success($defaults);
}
}
@@ -1,13 +1,14 @@
<?php
class Webservicelog_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'system.tbl_webservicelog';
$this->pk = 'webservicelog_id';
}