Merge branch 'master' into feature-40430/updateamum_von_im_AntragLib

This commit is contained in:
Harald Bamberger
2025-05-19 10:29:28 +02:00
675 changed files with 66649 additions and 8117 deletions
+11 -17
View File
@@ -935,7 +935,7 @@ class AntragLib
public function createWiederholung($prestudent_id, $studiensemester_kurzbz, $insertvon, $repeat)
{
$result = $this->_ci->StudierendenantragModel->loadIdAndStatusWhere([
'prestudent_id' => $prestudent_id,
'tbl_studierendenantrag.prestudent_id' => $prestudent_id,
'studiensemester_kurzbz'=> $studiensemester_kurzbz,
'typ' => Studierendenantrag_model::TYP_WIEDERHOLUNG
]);
@@ -1365,7 +1365,7 @@ class AntragLib
if (!in_array($result->status_kurzbz, $this->_ci->config->item('antrag_prestudentstatus_whitelist_abmeldung'))) {
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere([
'prestudent_id' => $prestudent_id,
'tbl_studierendenantrag.prestudent_id' => $prestudent_id,
's.studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_APPROVED
], [
Studierendenantrag_model::TYP_ABMELDUNG,
@@ -1377,7 +1377,7 @@ class AntragLib
return success(-1);
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere([
'prestudent_id' => $prestudent_id,
'tbl_studierendenantrag.prestudent_id' => $prestudent_id,
's.studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_PAUSE
], [
Studierendenantrag_model::TYP_ABMELDUNG,
@@ -1391,7 +1391,7 @@ class AntragLib
return success(0);
}
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['prestudent_id' => $prestudent_id]);
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['tbl_studierendenantrag.prestudent_id' => $prestudent_id]);
if (isError($result))
return $result;
if (!hasData($result))
@@ -1452,7 +1452,7 @@ class AntragLib
&& $result->status_kurzbz != 'Unterbrecher') {
return success(0);
}
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['prestudent_id' => $prestudent_id]);
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['tbl_studierendenantrag.prestudent_id' => $prestudent_id]);
if (isError($result))
return $result;
if (!hasData($result))
@@ -1468,12 +1468,6 @@ class AntragLib
elseif($antrag->status == Studierendenantragstatus_model::STATUS_APPROVED && $antrag->datum > $datumStatus)
return success(-2);
}
if ($antrag->typ == Studierendenantrag_model::TYP_UNTERBRECHUNG)
{
// NOTE(chris): Ignore canceled ones
if ($antrag->status == Studierendenantragstatus_model::STATUS_CANCELLED)
continue;
}
if ($antrag->typ == Studierendenantrag_model::TYP_WIEDERHOLUNG)
{
if($antrag->status == Studierendenantragstatus_model::STATUS_PASS)
@@ -1534,7 +1528,7 @@ class AntragLib
$datumStatus = $result->datum;
if (!in_array($result->status_kurzbz, $this->_ci->config->item('antrag_prestudentstatus_whitelist'))) {
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere([
'prestudent_id' => $prestudent_id,
'tbl_studierendenantrag.prestudent_id' => $prestudent_id,
'typ' => Studierendenantrag_model::TYP_WIEDERHOLUNG,
's.studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_APPROVED
]);
@@ -1544,7 +1538,7 @@ class AntragLib
return success(-1);
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere([
'prestudent_id' => $prestudent_id,
'tbl_studierendenantrag.prestudent_id' => $prestudent_id,
'typ' => Studierendenantrag_model::TYP_WIEDERHOLUNG,
's.studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_DEREGISTERED
]);
@@ -1554,7 +1548,7 @@ class AntragLib
return success(-1);
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere([
'prestudent_id' => $prestudent_id,
'tbl_studierendenantrag.prestudent_id' => $prestudent_id,
'typ' => Studierendenantrag_model::TYP_WIEDERHOLUNG,
's.studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_PAUSE
]);
@@ -1565,7 +1559,7 @@ class AntragLib
return success(0);
}
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['prestudent_id' => $prestudent_id]);
$result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['tbl_studierendenantrag.prestudent_id' => $prestudent_id]);
if (isError($result))
return $result;
if (!hasData($result))
@@ -1618,7 +1612,7 @@ class AntragLib
public function getDetailsForLastAntrag($prestudent_id, $typ = null)
{
$where = [
'prestudent_id' => $prestudent_id
'tbl_studierendenantrag.prestudent_id' => $prestudent_id
];
$types = null;
if ($typ) {
@@ -2204,4 +2198,4 @@ class AntragLib
$result = $this->_ci->StudierendenantraglehrveranstaltungModel->getLvsForPrestudent($prestudent_id, $studiensemester_kurzbz);
return $result;
}
}
}
+309
View File
@@ -0,0 +1,309 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
use \DateTime as DateTime;
use \DOMDocument as DOMDocument;
use \XSLTProcessor as XSLTProcessor;
/**
* TODO(chris): NEWS: edit & delete button links and confirm
* TODO(chris): NEWS: news_infoscreen xlst
*/
class CmsLib
{
/**
* @var object
*/
protected $ci;
/**
* Constructor
*/
public function __construct()
{
$this->ci =& get_instance();
// Load Models
$this->ci->load->model('content/Content_model', 'ContentModel');
$this->ci->load->model('content/Contentgruppe_model', 'ContentgruppeModel');
$this->ci->load->model('content/Template_model', 'TemplateModel');
if (defined('LOG_CONTENT') && LOG_CONTENT)
$this->ci->load->model('system/Webservicelog_model', 'WebservicelogModel');
}
// -----------------------------------------------------------------------------------------------------------------
// Public methods
/**
* @param int $content_id
* @param int $version
* @param string $sprache
* @param boolean $sichtbar
*
* @return stdClass
*/
public function getContent($content_id, $version = null, $sprache = null, $sichtbar = true)
{
if (!is_numeric($content_id))
return error('ContentID ist ungueltig');
if ($sprache === null)
$sprache = getUserLanguage();
$islocked = $this->ci->ContentgruppeModel->loadWhere(['content_id' => $content_id]);
if (isError($islocked))
return $islocked;
if (getData($islocked)) {
$uid = getAuthUID();
$isberechtigt = $this->ci->ContentgruppeModel->berechtigt($content_id, $uid);
if (isError($isberechtigt))
return $isberechtigt;
if (!getData($isberechtigt))
return error('global/keineBerechtigungFuerDieseSeite');
}
$content = $this->ci->ContentModel->getContent($content_id, $sprache, $version, $sichtbar, true);
if (isError($content))
return $content;
// Legt einen Logeintrag für die Klickstatistik an
if (defined('LOG_CONTENT') && LOG_CONTENT) {
// Nur eingeloggte User werden geloggt, das sonst auch alle Infoscreenaufrufe und dgl. mitgeloggt werden
if (isLogged()) {
$request_data = 'content_id=' . $content_id;
if ($version !== null)
$request_data .= '&version=' . $version;
if ($sichtbar !== true)
$request_data .= '&sichtbar=' . $sichtbar;
$this->ci->WebservicelogModel->insert([
'webservicetyp_kurzbz' => 'content',
'request_id' => $content_id,
'beschreibung' => 'content',
'request_data' => $request_data . '&sprache=' . $sprache,
'execute_time' => 'now()',
'execute_user' => getAuthUID()
]);
}
}
$content = getData($content);
//XSLT Vorlage laden
$template = $this->ci->TemplateModel->load($content->template_kurzbz);
if (isError($template))
return $template;
$template = current(getData($template));
$XML = new DOMDocument();
$XML->loadXML($content->content);
if($content->titel){
$betreff = $content->titel;
}else{
//DomDocument getElementsByTagName returns a DomNodeList
$betreff = $XML->getElementsByTagName('betreff');
//check if any betreff was found and if it is not empty
if($betreff->length > 0 && !empty($betreff->item(0)->nodeValue))
{
//DomNodeList item() return a DomNode, property nodeValue contains the value of the node
$betreff = $betreff->item(0)->nodeValue;
}
else
{
return error('no betreff found for the content');
}
}
$xsltemplate = new DOMDocument();
$xsltemplate->loadXML($template->xslt_xhtml_c4);
//Transformation
$processor = new XSLTProcessor();
$processor->importStylesheet($xsltemplate);
$transformed_content = $processor->transformToXML($XML);
//replaces all the dms.php with the new CIS4 Controller
$transformed_content = str_replace('dms.php', APP_ROOT . 'cms/dms.php', $transformed_content);
//replaces all the cms.php with the new CIS4 Controller
$transformed_content = preg_replace('/content\.php\?content\_id\=([0-9]+)/', APP_ROOT.'cis.php/CisVue/Cms/content/$1', $transformed_content);
return success([
"betreff"=>$betreff,
"type"=>$content->template_kurzbz,
"content"=>$transformed_content
]);
}
/**
* @param stdClass $stg_obj
*
* @return stdClass
*/
protected function getNewsExtras($stg_obj, $semester)
{
$this->ci->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
$stg_ltg = $this->ci->StudiengangModel->getLeitungDetailed($stg_obj->studiengang_kz);
if (isError($stg_ltg))
return $stg_ltg;
$stg_ltg = getData($stg_ltg) ?: [];
$gf_ltg = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('gLtg', $stg_obj->oe_kurzbz);
if (isError($gf_ltg))
return $gf_ltg;
$gf_ltg = getData($gf_ltg) ?: [];
$stv_ltg = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('stvLtg', $stg_obj->oe_kurzbz);
if (isError($stv_ltg))
return $stv_ltg;
$stv_ltg = getData($stv_ltg) ?: [];
$ass = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('ass', $stg_obj->oe_kurzbz);
if (isError($ass))
return $ass;
$ass = getData($ass) ?: [];
$hochschulvertr = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('hsv');
if (isError($hochschulvertr))
return $hochschulvertr;
$hochschulvertr = getData($hochschulvertr) ?: [];
$stdv = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('stdv', $stg_obj->oe_kurzbz);
if (isError($stdv))
return $stdv;
$stdv = getData($stdv) ?: [];
$jahrgangsvertr = $this->ci->BenutzerfunktionModel->getBenutzerFunktionenDetailed('jgv', $stg_obj->oe_kurzbz, $semester);
if (isError($jahrgangsvertr))
return $jahrgangsvertr;
$jahrgangsvertr = getData($jahrgangsvertr) ?: [];
return success($this->ci->load->view('Cis/Cms/News/Xml/NewsExtras', [
'studiengang' => $stg_obj,
'semester' => $semester,
'stg_ltg' => $stg_ltg,
'gf_ltg' => $gf_ltg,
'stv_ltg' => $stv_ltg,
'ass' => $ass,
'hochschulvertr' => $hochschulvertr,
'stdv' => $stdv,
'jahrgangsvertr' => $jahrgangsvertr
], true));
}
/**
* @param string $studiengang_kz
* @param string $semester
*
* @return array queried studiengang_kz and semester
*/
public function getStgAndSem($studiengang_kz, $semester)
{
$this->ci->load->model('crm/Student_model', 'StudentModel');
//Zum anzeigen der Studiengang-Details neben den News
$student = $this->ci->StudentModel->loadWhere(['student_uid' => getAuthUID()]);
if (isError($student))
return $student;
if (getData($student)) {
$student = current(getData($student));
if ($studiengang_kz === null)
$studiengang_kz = $student->studiengang_kz;
if ($semester === null)
$semester = $student->semester;
}
return [$studiengang_kz, $semester];
}
/**
* @param boolean $infoscreen
* @param string | null $studiengang_kz
* @param int | null $semester
* @param boolean $mischen
* @param string $titel
* @param boolean $edit
* @param boolean $sichtbar
*
* @return void
*/
public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true, $page = 1, $page_size = 10, $sprache)
{
$this->ci->load->model('organisation/Studiengang_model', 'StudiengangModel');
list($studiengang_kz, $semester) = $this->getStgAndSem($studiengang_kz, $semester);
$all = $edit;
$xml = '<?xml version="1.0" encoding="UTF-8"?><content>';
$this->ci->load->model('content/News_model', 'NewsModel');
$news = $this->ci->NewsModel->getNewsWithContent($sprache, $studiengang_kz, $semester, null, $sichtbar, 0, $page, $page_size, $all, $mischen);
if (isError($news))
return $news;
$news = getData($news);
foreach ($news as $newsobj) {
if ($studiengang_kz && $edit && !$newsobj->studiengang_kz)
continue;
$date = new DateTime($newsobj->datum);
$datum = '<datum><![CDATA[' . $date->format('d.m.Y') . ']]></datum>';
$datum .= '<datumdetail><![CDATA[' . $date->format('Y-m-d H:i') . ']]></datumdetail>';
$id = $edit ? '<news_id><![CDATA[' . $newsobj->news_id . ']]></news_id>' : '';
$xml .= "<newswrapper>" . $newsobj->content . $datum . $id . "</newswrapper>";
}
/* if ($studiengang_kz != 0) {
$stg_obj = $this->ci->StudiengangModel->load($studiengang_kz);
if (isError($stg_obj))
return $stg_obj;
$stg_obj = current(getData($stg_obj) ?: []);
if ($stg_obj) {
if (!$edit && !$infoscreen) {
$extras = $this->getNewsExtras($stg_obj, $semester);
if (isError($extras))
return $extras;
$xml .= getData($extras);
}
$xml .= '<studiengang_bezeichnung><![CDATA[' . $stg_obj->bezeichnung . ']]></studiengang_bezeichnung>';
}
} */
if ($titel != '') {
$xml .= '<news_titel>' . $titel . '</news_titel>';
}
$xml .= '</content>';
//XSLT Vorlage laden
$template = $this->ci->TemplateModel->load($infoscreen ? 'news_infoscreen' : 'news');
if (isError($template))
return $template;
$template = current(getData($template));
$XML = new DOMDocument();
$XML->loadXML($xml);
$xsltemplate = new DOMDocument();
$xsltemplate->loadXML($template->xslt_xhtml_c4);
//Transformation
$processor = new XSLTProcessor();
$processor->importStylesheet($xsltemplate);
$content = $processor->transformToDoc($XML);
$content->formatOutput = true;
$content = $content->saveHTML();
$content = str_replace('dms.php', APP_ROOT . 'cms/dms.php', $content);
return success($content);
}
}
+714
View File
@@ -0,0 +1,714 @@
<?php
/* Copyright (C) 2024 fhcomplete.net
*
* 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.
*
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
use stdClass as stdClass;
use DOMDocument as DOMDocument;
use XSLTProcessor as XSLTProcessor;
use SimpleXMLElement as SimpleXMLElement;
/**
* This library replaces the old document_export.class except for the convert
* function which is located in the DocumentLib library.
*
* The usage differs a little bit from the old library:
* In the old library you had to call create() then some optional function
* for adding data (addDataArray()/addDataXML()/addDataURL()/setFilename()),
* modifiing said data (sign()/setXMLTag_archivierbar()) or adding
* images (addImage()) and then call output() and close().
* Now the create, output and close functions are combined into one function and adding data and images is done via parameters.
* There are now two functions getContent() and showContent() where showContent() equals to output(false) and getContent equals to output(true)
* Instead of calling addDataArray, addDataXML or addDataURL just call
* getDataArray, getDataXML or getDataURL respectevily and use the return
* value as $xml_data parameter in the showContent and getContent calls.
* Instead of calling addImages just create an array and pass it as $images
* parameter to the showContent/getContent function.
* The old setFilename() function is now a parameter in showContent(). It is
* not needed in getContent() since that function does not do anything that
* requires a filename.
* To get/show a signed document just pass a valid uid as $sign_user
* parameter.
*
* Example:
* Old:
* $doc = new document_export($vorlage->vorlage_kurzbz, $oe_kurzbz, $version);
* $doc->setFilename($filename);
* $doc->addDataXML($data);
* $doc->addImage($imagepath, $imagename, $imagecontenttype);
* $doc->create($outputformat);
* $doc->output(true);
* $doc->close();
*
* New:
* $xml_data = $this->documentexportlib->getDataXML($data);
* $images = [[
* 'path' => $imagepath,
* 'name' => $imagename,
* 'contenttype' => $imagecontenttype
* ]];
* $this->documentexportlib->showContent(
* $filename,
* $vorlage,
* $xml_data,
* $oe_kurzbz,
* $version,
* $outputformat,
* null,
* null,
* $images
* );
*/
class DocumentExportLib
{
private $unoconv_version;
/**
* Constructor
*/
public function __construct()
{
// Gets CI instance
$this->ci =& get_instance();
// Load Phrases
$this->ci->load->library('PhrasesLib', ['document_export', null], 'documentExportPhrases');
// Which document converter has to be used
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
{
// Use docsbox!!
}
else
{
exec('unoconv --version', $ret_arr);
if(isset($ret_arr[0]))
{
$hlp = explode(' ', $ret_arr[0]);
if(isset($hlp[1]))
{
$this->unoconv_version = $hlp[1];
}
else
show_error($this->ci->documentExportPhrases->t("document_export", "error_unoconv_version"));
}
else
show_error($this->ci->documentExportPhrases->t("document_export", "error_unoconv"));
}
}
/**
* Laedt die XML Daten fuer die XSL Transformation anhand eines Arrays
*
* @param array $data Array mit Daten
* @param string $root Bezeichnung des Root Nodes
*
* @return DOMDocument
*/
public function getDataArray($data, $root)
{
$xml_data = new DOMDocument();
$xml_data->loadXML($this->convertArrayToXML($data, $root));
return $xml_data;
}
/**
* XML Daten fuer die XSL Transformation
*
* @param string $xml
*
* @return DOMDocument
*/
public function getDataXML($xml)
{
$xml_data = new DOMDocument();
$xml_data->loadXML($xml);
return $xml_data;
}
/**
* URL zu XML Datei die fuer XSLTransformation verwendet werden soll
*
* @param string $xml URL to XML
* @param string $params GET parameter
*
* @return stdClass
*/
public function getDataURL($xml, $params)
{
$xml_found = false;
$aktive_addons = array_filter(array_map('trim', explode(";", ACTIVE_ADDONS)));
foreach($aktive_addons as $addon) {
$xmlfile = DOC_ROOT . 'addons/' . $addon . '/rdf/' . $xml;
if (file_exists($xmlfile)) {
$xml_found = true;
$xml_url = XML_ROOT . '../addons/' . $addon . '/rdf/' . $xml . '?' . $params;
break;
}
}
if (!$xml_found)
$xml_url = XML_ROOT . $xml . '?' . $params;
// Load the XML source
$xml_data = new DOMDocument;
if (!$xml_data->load($xml_url))
return error($this->ci->documentExportPhrases->t("document_export", "error_xml_load", [
"url" => $xml_url,
"xml" => $xml,
"params" => $params
]));
return success($xml_data);
}
/**
* Adds a XML Tag for signatur to the document
*
* @param DomDocument $xml_data
*
* @return void
*/
protected function addSignToData($xml_data)
{
$signblock = $xml_data->createElement("signed", "true");
$xml_data->documentElement->appendChild($signblock);
}
/**
* Adds a XML Tag for archive to the document
*
* @param DomDocument $xml_data
*
* @return void
*/
public function addArchiveToData($xml_data)
{
$archiv = $xml_data->createElement("archivierbar", "true");
$xml_data->documentElement->appendChild($archiv);
}
/**
* Get the contents of a Document
*
* @param stdClass $vorlage A db entry from tbl_vorlage
* @param DomDocument $xml_data
* @param string $oe_kurzbz
* @param integer|null $version (optional)
* @param string $outputformat (optional)
* @param string $sign_user (optional) Must be a valid uid
* @param string $sign_profile (optional) Signatureprofile for signing
* @param array $images (optional) Each element should have a property path, name & contenttype which are all strings
*
* @return stdClass
*/
public function getContent(
$vorlage,
$xml_data,
$oe_kurzbz,
$version = null,
$outputformat = null,
$sign_user = null,
$sign_profile = null,
$images = []
) {
$source_folder = getcwd();
$temp_folder = sys_get_temp_dir() . '/fhcunoconv-' . uniqid();
$outputformat = $this->getDefaultOutputFormat($outputformat, $vorlage->mimetype);
$result = $this->createAndSignContent(
$temp_folder,
$outputformat,
$vorlage,
$oe_kurzbz,
$version,
$xml_data,
$images,
$sign_user,
$sign_profile
);
if (isError($result)) {
$this->close($temp_folder, $source_folder);
return $result;
}
$temp_filename = getData($result);
$fsize = filesize($temp_filename);
$handle = fopen($temp_filename, 'r');
if (!$handle)
return error($this->ci->documentExportPhrases->t("document_export", "error_file_load"));
$result = fread($handle, $fsize);
fclose($handle);
$this->close($temp_folder, $source_folder);
return success($result);
}
/**
* Sets the headers and displays the Document.
* On failure the exit() function will be called
*
* @param string $filename
* @param stdClass $vorlage A db entry from tbl_vorlage
* @param DomDocument $xml_data
* @param string $oe_kurzbz
* @param integer|null $version (optional)
* @param string $outputformat (optional)
* @param string $sign_user (optional) Must be a valid uid
* @param string $sign_profile (optional) Signatureprofile for signing
* @param array $images (optional) Each element should have a property path, name & contenttype which are all strings
*
* @return void
*/
public function showContent(
$filename,
$vorlage,
$xml_data,
$oe_kurzbz,
$version = null,
$outputformat = null,
$sign_user = null,
$sign_profile = null,
$images = []
) {
$source_folder = getcwd();
$temp_folder = sys_get_temp_dir() . '/fhcunoconv-' . uniqid();
$outputformat = $this->getDefaultOutputFormat($outputformat, $vorlage->mimetype);
$result = $this->createAndSignContent(
$temp_folder,
$outputformat,
$vorlage,
$oe_kurzbz,
$version,
$xml_data,
$images,
$sign_user,
$sign_profile
);
if (isError($result)) {
$this->close($temp_folder, $source_folder);
exit(getError($result));
}
$temp_filename = getData($result);
$fsize = filesize($temp_filename);
$handle = fopen($temp_filename, 'r');
if (!$handle) {
$this->close($temp_folder, $source_folder);
exit($this->ci->documentExportPhrases->t("document_export", "error_file_load"));
}
if (headers_sent()) {
$this->close($temp_folder, $source_folder);
exit($this->ci->documentExportPhrases->t("document_export", "error_headers"));
}
switch ($outputformat) {
case 'pdf':
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="' . $filename . '.pdf"');
header('Content-Length: ' . $fsize);
break;
case 'doc':
header('Content-type: application/vnd.ms-word');
header('Content-Disposition: attachment; filename="' . $filename . '.doc"');
header('Content-Length: ' . $fsize);
break;
case 'odt':
header('Content-type: application/vnd.oasis.opendocument.text');
header('Content-Disposition: attachment; filename="' . $filename . '.odt"');
header('Content-Length: ' . $fsize);
break;
default:
$this->close($temp_folder, $source_folder);
exit($this->ci->documentExportPhrases->t("document_export", "error_outputformat_missing"));
}
while (!feof($handle)) {
echo fread($handle, 8192);
}
fclose($handle);
$this->close($temp_folder, $source_folder);
}
/**
* Helper function for getContent and showContent.
* Creates the temp folder and calls create and sign functions.
*
* @param string $temp_folder
* @param string $outputformat
* @param stdClass $vorlage
* @param string $oe_kurzbz
* @param integer $version
* @param DomDocument $xml_data
* @param array $images Each element should have a property path, name and contenttype which are all strings
* @param string $sign_user Must be a valid uid
* @param string $sign_profile Signatureprofile for signing
*
* @return stdClass
*/
protected function createAndSignContent(
$temp_folder,
$outputformat,
$vorlage,
$oe_kurzbz,
$version,
$xml_data,
$images,
$sign_user,
$sign_profile
) {
mkdir($temp_folder);
chdir($temp_folder);
$this->ci->load->model('system/Vorlagestudiengang_model', 'VorlagestudiengangModel');
$result = $this->ci->VorlagestudiengangModel->getCurrent($vorlage->vorlage_kurzbz, $oe_kurzbz, $version);
if (isError($result))
return $result;
if (!hasData($result))
return error($this->ci->documentExportPhrases->t("document_export", "error_template_missing"));
$vorlage_stg = current(getData($result));
foreach ($vorlage_stg as $k => $v)
$vorlage->$k = $v;
$result = $this->create($temp_folder, $outputformat, $vorlage, $xml_data, $images);
if (isError($result))
return $result;
$temp_filename = getData($result);
if ($sign_user) {
$this->addSignToData($xml_data);
$result = $this->sign($temp_folder, $temp_filename, $outputformat, $sign_user, $sign_profile);
if (isError($result))
return $result;
$temp_filename = getData($result);
}
return success($temp_filename);
}
/**
* Helper function for createAndSignContent.
* Creates the files in the temp folder.
*
* @param string $temp_folder
* @param string $outputformat
* @param stdClass $vorlage
* @param DomDocument $xml_data
* @param array $images Each element should have a property path, name and contenttype which are all strings
*
* @return stdClass
*/
protected function create($temp_folder, $outputformat, $vorlage, $xml_data, $images)
{
$content_xsl = new DOMDocument();
if (!$content_xsl->loadXML($vorlage->text))
return error($this->ci->documentExportPhrases->t("document_export", "error_xsl_load"));
$proc = new XSLTProcessor();
$proc->importStyleSheet($content_xsl);
$contentbuffer = $proc->transformToXml($xml_data);
file_put_contents($temp_folder . '/content.xml', $contentbuffer);
if ($xml_data->firstChild->tagName == 'error')
return error($xml_data->firstChild->textContent);
// styles.xml erstellen
if ($vorlage->style) {
$styles_xsl = new DOMDocument();
if (!$styles_xsl->loadXML($vorlage->style))
return error($this->ci->documentExportPhrases->t("document_export", "error_styles_load"));
$style_proc = new XSLTProcessor();
$style_proc->importStyleSheet($styles_xsl);
$stylesbuffer = $style_proc->transformToXml($xml_data);
file_put_contents($temp_folder . '/styles.xml', $stylesbuffer);
}
// Template holen
$vorlage_found = false;
$vorlage_filename = $vorlage->vorlage_kurzbz . ($vorlage->mimetype == 'application/vnd.oasis.opendocument.spreadsheet' ? '.ods' : '.odt');
$aktive_addons = array_filter(array_map('trim', explode(";", ACTIVE_ADDONS)));
foreach($aktive_addons as $addon) {
$zipfile = DOC_ROOT . 'addons/' . $addon . '/system/vorlage_zip/' . $vorlage_filename;
if (file_exists($zipfile)) {
$vorlage_found = true;
break;
}
}
if (!$vorlage_found)
$zipfile = DOC_ROOT . 'system/vorlage_zip/' . $vorlage_filename;
$tempname_zip = $temp_folder . '/out.zip';
if (!copy($zipfile, $tempname_zip))
return error($this->ci->documentExportPhrases->t("document_export", "error_file_copy"));
exec("zip $tempname_zip content.xml");
if (!is_null($styles_xsl))
exec("zip $tempname_zip styles.xml");
// bilder hinzufuegen
if (count($images) > 0)
{
// Unterordner fuer die Bilder erstellen
mkdir('Pictures');
// Manifest Datei holen
exec('unzip ' . $tempname_zip . ' META-INF/manifest.xml');
// Bild zur Manifest Datei hinzufuegen
$manifest = file_get_contents('META-INF/manifest.xml');
$manifest_xml = new DOMDocument;
if (!$manifest_xml->loadXML($manifest))
return error($this->ci->documentExportPhrases->t("document_export", "error_manifest"));
//root-node holen
$root = $manifest_xml->getElementsByTagName('manifest')->item(0);
foreach ($images as $bild) {
copy($bild['path'], 'Pictures/' . $bild['name']);
//Neues Element unterhalb des Root Nodes anlegen
$node = $manifest_xml->createElement("manifest:file-entry");
$node->setAttribute("manifest:full-path", 'Pictures/' . $bild['name']);
$node->setAttribute("manifest:media-type", $bild['contenttype']);
$root->appendChild($node);
}
$out = $manifest_xml->saveXML();
//geaenderte Manifest Datei speichern und wieder ins Zip packen
file_put_contents('META-INF/manifest.xml', $out);
exec('zip ' . $tempname_zip . ' META-INF/*');
// Bilder zum ZIP-File hinzufuegen
exec('zip ' . $tempname_zip . ' Pictures/*');
}
clearstatcache();
switch ($outputformat) {
case 'pdf':
case 'doc':
$ret = 0;
$temp_filename = $temp_folder . '/out.' . $outputformat;
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) {
// Use docsbox
$this->ci->load->library("DocsboxLib");
$docboxlib = get_class($this->ci->docboxlib);
$ret = $docboxlib::convert($tempname_zip, $temp_filename, $outputformat);
} else {
// Use unoconv
// Unoconv Version 0.6 hat eine Bug wodurch die Berechtigungen des PDF/Doc nicht korrekt gesetzt
// werden. Deshalb wird dies hier speziell behandelt.
// Die 2. Variante hat den Vorteil dass hier eine bessere Fehlerbehandlung moeglich ist
if ($this->unoconv_version == '0.6')
$command = 'unoconv -e IsSkipEmptyPages=false -f ' . $outputformat . ' %2$s > %1$s';
else
$command = 'unoconv -e IsSkipEmptyPages=false -f ' . $outputformat . ' --output %s %s 2>&1';
$command = sprintf($command, $temp_filename, $tempname_zip);
exec($command, $out, $ret);
}
if ($ret)
return error($this->ci->documentExportPhrases->t("document_export", "error_conv_timeout"));
break;
case 'odt':
default:
$temp_filename = $tempname_zip;
}
return success($temp_filename);
}
/**
* Helper function for createAndSignContent.
* Signs the main file in the temp folder.
*
* @param string $temp_folder
* @param string $temp_filename
* @param string $outputformat
* @param string $user Must be a valid uid
* @param string $profile Signatureprofile for signing
*
* @return stdClass
*/
protected function sign($temp_folder, $temp_filename, $outputformat, $user, $profile)
{
if ($outputformat != 'pdf')
return error($this->ci->documentExportPhrases->t("document_export", "error_sign_pdf"));
// Load the File
$file_data = file_get_contents($temp_filename);
$data = new stdClass();
$data->document = base64_encode($file_data);
// Signatur Profil
if (!is_null($profile))
$data->profile = $profile;
else
$data->profile = SIGNATUR_DEFAULT_PROFILE;
// Username des Endusers der die Signatur angefordert hat
$data->user = $user;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, SIGNATUR_URL . '/' . SIGNATUR_SIGN_API);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 7);
curl_setopt($ch, CURLOPT_USERAGENT, "FH-Complete");
// SSL Zertifikatsprüfung deaktivieren
// Besser ist es das Zertifikat am Server zu installieren!
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data_string = json_encode($data, JSON_FORCE_OBJECT);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Content-Length:' . mb_strlen($data_string),
'Authorization: Basic ' . base64_encode(SIGNATUR_USER . ":" . SIGNATUR_PASSWORD)
]);
$result = curl_exec($ch);
if (curl_errno($ch)) {
curl_close($ch);
return error($this->ci->documentExportPhrases->t("document_export", "error_sign_timeout"));
}
curl_close($ch);
$resultdata = json_decode($result);
// If it is success
if (isset($resultdata->error) && $resultdata->error == 0) {
$signed_filename = $temp_folder . '/signed.pdf';
file_put_contents($signed_filename, base64_decode($resultdata->retval));
return success($signed_filename);
}
// otherwise if it is an error
return error($resultdata->retval ?? $this->ci->documentExportPhrases->t("global", "unknown_error", ["error" => $result]));
}
/**
* Deletes all files in the $temp_folder and changes back to the source_folder
*
* @param string $temp_folder
* @param string $source_folder
*
* @return void
*/
protected function close($temp_folder, $source_folder)
{
$files = glob($temp_folder . '/*'); // get all file names
foreach ($files as $file)
if (is_file($file))
unlink($file);
chdir($source_folder);
rmdir($temp_folder);
}
/**
* Convert an array to XML
*
* @param array $data
* @param string $root
* @param SimpleXMLElement $xml_data
*
* @return string|boolean
*/
private function convertArrayToXML($data, $root = null, $xml_data = null)
{
$_xml_data = $xml_data;
if ($_xml_data === null)
$_xml_data = new SimpleXMLElement($root !== null ? '<' . $root . ' />' : '<root/>');
foreach ($data as $key => $value) {
if (is_array($value)) {
if (is_numeric($key)) {
$key = 'item' . $key; // dealing with <0/>..<n/> issues
$this->convertArrayToXML($value, null, $_xml_data);
} else {
$subnode = $_xml_data->addChild($key);
$this->convertArrayToXML($value, null, $subnode);
}
} else {
// Remove UTF8 Control Characters (breaking XML)
$value = preg_replace('/[\x00-\x1F\x7F]/u', '', $value);
$_xml_data->addChild((string)$key, htmlspecialchars("$value"));
}
}
return $_xml_data->asXML();
}
/**
* Get default outputformat from mimetype if its not set
*
* @param string $outputformat
* @param string $mimetype
*
* @return string
*/
private function getDefaultOutputFormat($outputformat, $mimetype)
{
if ($outputformat)
return $outputformat;
if ($mimetype == 'application/vnd.oasis.opendocument.spreadsheet')
return 'ods';
if ($mimetype == 'application/vnd.oasis.opendocument.text')
return 'odt';
return 'pdf';
}
}
+10 -10
View File
@@ -371,21 +371,21 @@ class FilterCmptLib
foreach ($filterFields as $filterField)
{
// If not an empty array
if ($filterField != null)
if (!isEmptyArray($filterField))
{
//
if (isset($filterField->name) && isset($filterField->operation) && isset($filterField->condition)
&& !isEmptyString($filterField->name) && !isEmptyString($filterField->operation)
&& !isEmptyString($filterField->condition))
if (isset($filterField['name']) && isset($filterField['operation']) && isset($filterField['condition'])
&& !isEmptyString($filterField['name']) && !isEmptyString($filterField['operation'])
&& !isEmptyString((string)$filterField['condition']))
{
// Fine
$filter = new stdClass();
$filter->name = $filterField->name;
$filter->operation = $filterField->operation;
$filter->condition = $filterField->condition;
if (isset($filterField->option) && !isEmptyString($filterField->option))
$filter->name = $filterField['name'];
$filter->operation = $filterField['operation'];
$filter->condition = $filterField['condition'];
if (isset($filterField['option']) && !isEmptyString($filterField['option']))
{
$filter->option = $filterField->option;
$filter->option = $filterField['option'];
}
else
{
@@ -565,6 +565,7 @@ class FilterCmptLib
getAuthPersonId()
);
// If filters were loaded
if (hasData($filters))
{
@@ -1173,4 +1174,3 @@ class FilterCmptLib
return $filterName;
}
}
+21 -15
View File
@@ -246,7 +246,27 @@ class IssuesLib
$fehlertext = vsprintf($fehlertextVorlage, $fehlertext_params);
}
$openIssuesCountRes = $this->_ci->IssueModel->getOpenIssueCount($fehlercode, $person_id, $oe_kurzbz, $fehlercode_extern);
if (isset($resolution_params))
{
if (is_array($resolution_params))
{
foreach ($resolution_params as $resolution_key => $resolution_param)
{
if (!is_string($resolution_key))
return error("Invalid parameter for resolution, must be an associative array");
}
}
else
return error("Invalid parameters for resolution");
}
$openIssuesCountRes = $this->_ci->IssueModel->getOpenIssueCount(
$fehlercode,
$person_id,
$oe_kurzbz,
$fehlercode_extern,
$resolution_params
);
if (hasData($openIssuesCountRes))
{
@@ -256,20 +276,6 @@ class IssuesLib
if ($openIssueCount == 0)
{
if (isset($resolution_params))
{
if (is_array($resolution_params))
{
foreach ($resolution_params as $resolution_key => $resolution_param)
{
if (!is_string($resolution_key))
return error("Invalid parameter for resolution, must be an associative array");
}
}
else
return error("Invalid parameters for resolution");
}
// insert new issue
return $this->_ci->IssueModel->insert(
array(
+27
View File
@@ -95,6 +95,33 @@ class PermissionLib
return $isBerechtigt;
}
/**
* Prueft ob die Berechtigung zumindest fuer eine der angegebenen OE vorhanden ist.
* @param $berechtigung_kurzbz
* @param $oe_kurzbz
* @param $art
* @param $kostenstelle_id
* @return boolean
*/
public function isBerechtigtMultipleOe($berechtigung_kurzbz, $oe_kurzbz, $art=null, $kostenstelle_id=null)
{
$results = array();
foreach($oe_kurzbz as $value)
{
$results[] = $this->isBerechtigt($berechtigung_kurzbz, $art, $value, $kostenstelle_id);
}
if(!in_array(true, $results))
{
return false;
}
else
{
return true;
}
}
/**
* Checks if the caller is allowed to access to this content with the given permissions
* - if it's called from command line than it's trusted
+13 -1
View File
@@ -200,6 +200,17 @@ class PhrasesLib
return '<< PHRASE '.$phrase.' >>';
}
/**
* Workaround to reload the phrases array on an already constructed library.
* @parameters -> look for _setPhrases docs
*/
public function setPhrases($categories, $language)
{
if (count($categories) > 0) $this->_setPhrases($categories, $language);
return $this->_phrases;
}
// -----------------------------------------------------------------------------------------------------------------
// Private methods
@@ -319,6 +330,7 @@ class PhrasesLib
{
$this->_phrases = $phrases->retval;
}
}
/**
@@ -329,4 +341,4 @@ class PhrasesLib
{
return json_encode($this->_phrases);
}
}
}
+30 -1
View File
@@ -254,7 +254,7 @@ class PrestudentLib
$studiengang = current(getData($res));
$prestudent_status = current($result);
if($prestudent_status->ausbildungssemester + 1 < $studiengang->max_semester)
if ($prestudent_status->status_kurzbz != Prestudentstatus_model::STATUS_UNTERBRECHER && $prestudent_status->ausbildungssemester + 1 < $studiengang->max_semester)
$ausbildungssemester_plus = 1;
if(!$result)
@@ -264,6 +264,35 @@ class PrestudentLib
'studiensemester_kurzbz' => $studiensemester_kurzbz
]));
}
} elseif (current($result)->status_kurzbz == Prestudentstatus_model::STATUS_UNTERBRECHER) {
if ($studierendenantrag_id)
{
$resultAntrag = $this->_ci->StudierendenantragModel->load($studierendenantrag_id);
if (isError($resultAntrag))
return $resultAntrag;
$resultAntrag = getData($resultAntrag);
if (!$resultAntrag)
return error($this->_ci->p->t('studierendenantrag', 'error_no_antrag_found', ['id' => $studierendenantrag_id]));
$antrag = current($resultAntrag);
$anmerkung = current($result)->anmerkung . ' Wiedereinstieg ' . $antrag->datum_wiedereinstieg;
$result = $this->_ci->PrestudentstatusModel->update([
'prestudent_id' => $prestudent_id,
'status_kurzbz' => Prestudentstatus_model::STATUS_UNTERBRECHER,
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'ausbildungssemester' => current($result)->ausbildungssemester
], [
'updatevon' => $insertvon,
'updateamum' => date('c'),
'anmerkung'=> $anmerkung
]);
if (isError($result))
return $result;
}
return success();
}
$prestudent_status = current($result);
+141 -8
View File
@@ -33,7 +33,7 @@ class SearchBarLib
const ERROR_NOT_AUTH = 'ERR005';
// List of allowed types of search
const ALLOWED_TYPES = ['mitarbeiter', 'mitarbeiter_ohne_zuordnung', 'organisationunit', 'raum', 'person', 'student', 'prestudent', 'document', 'cms'];
const ALLOWED_TYPES = ['mitarbeiter', 'mitarbeiter_ohne_zuordnung', 'organisationunit', 'raum', 'person', 'student','studentStv', 'prestudent', 'document', 'cms'];
const PHOTO_IMG_URL = '/cis/public/bild.php?src=person&person_id=';
@@ -178,6 +178,7 @@ class SearchBarLib
protected function buildSearchClause(DB_Model $dbModel, array $columns, $searchstr)
{
$searchstr = preg_replace('/[[:punct:]]/', ' ', $searchstr);
$document = implode(' || \' \' || ', $columns);
$query = '\'' . implode(':* & ', explode(' ', trim($searchstr))) . ':*\'';
$reversequery = '\'*:' . implode(' & *:', explode(' ', trim($searchstr))) . '\'';
@@ -297,13 +298,15 @@ EOSC;
AND (datum_bis IS NULL OR datum_bis >= NOW())
AND b.aktiv = TRUE
) bfLeader ON(bfLeader.oe_kurzbz = o.oe_kurzbz)
WHERE ' .
WHERE
o.aktiv = true
AND (' .
$this->buildSearchClause(
$dbModel,
array('o.oe_kurzbz', 'o.bezeichnung', 'ot.bezeichnung'),
$searchstr
) .
'
')
GROUP BY type, o.oe_kurzbz, o.bezeichnung, ot.bezeichnung, oParent.oe_kurzbz, oParent.bezeichnung, otParent.bezeichnung
');
@@ -359,17 +362,26 @@ EOSC;
private function _student($searchstr, $type)
{
$dbModel = new DB_Model();
$gesperrtes_foto = base64_encode(file_get_contents(DOC_ROOT.'skin/images/profilbild_dummy.jpg'));
$students = $dbModel->execReadOnlyQuery('
SELECT
\''.$type.'\' AS type,
s.student_uid AS uid,
CONCAT(s.student_uid,\'@'.DOMAIN.'\') AS email,
s.matrikelnr,
CONCAT(UPPER(stg.typ),UPPER(stg.kurzbz),\'-\',s.semester,s.verband) as verband,
stg.bezeichnung AS studiengang,
p.person_id AS person_id,
p.vorname || \' \' || p.nachname AS name,
k.kontakt as email ,
p.foto
CASE
when s.student_uid = \''.getAuthUID().'\' then p.foto
when p.foto IS NULL then \''.$gesperrtes_foto.'\'
when p.foto_sperre = false then p.foto
else \''.$gesperrtes_foto.'\'
end as foto,
b.aktiv
FROM public.tbl_student s
JOIN public.tbl_studiengang stg USING(studiengang_kz)
JOIN public.tbl_benutzer b ON(b.uid = s.student_uid)
JOIN public.tbl_person p USING(person_id)
LEFT JOIN (
@@ -377,10 +389,57 @@ EOSC;
FROM public.tbl_kontakt
WHERE kontakttyp = \'email\'
) as k USING(person_id)
WHERE b.uid ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
WHERE
b.aktiv = TRUE
AND (b.uid ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR p.vorname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR p.nachname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\')
GROUP BY type, s.student_uid, s.matrikelnr, p.person_id, name,
email, p.foto, s.verband, s.semester, stg.bezeichnung,
stg.typ, stg.kurzbz, b.aktiv
ORDER BY b.aktiv DESC, p.nachname ASC, p.vorname ASC
');
// If something has been found then return it
if (hasData($students)) return getData($students);
// Otherwise return an empty array
return array();
}
private function _studentStv($searchstr, $type)
{
$dbModel = new DB_Model();
$students = $dbModel->execReadOnlyQuery('
SELECT
\''.$type.'\' AS type,
s.student_uid AS uid,
s.matrikelnr,
CONCAT(UPPER(stg.typ),UPPER(stg.kurzbz),\'-\',s.semester,s.verband) as verband,
stg.bezeichnung AS studiengang,
p.person_id AS person_id,
p.vorname || \' \' || p.nachname AS name,
k.kontakt AS email,
p.foto,
b.aktiv
FROM public.tbl_student s
JOIN public.tbl_studiengang stg USING(studiengang_kz)
JOIN public.tbl_benutzer b ON(b.uid = s.student_uid)
JOIN public.tbl_person p USING(person_id)
LEFT JOIN (
SELECT kontakt, person_id
FROM public.tbl_kontakt
WHERE kontakttyp = \'email\'
) as k USING(person_id)
WHERE
b.uid ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR p.vorname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR p.nachname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
GROUP BY type, s.student_uid, s.matrikelnr, p.person_id, name, email, p.foto
GROUP BY type, s.student_uid, s.matrikelnr, p.person_id, name,
k.kontakt, p.foto, s.verband, s.semester, stg.bezeichnung,
stg.typ, stg.kurzbz, b.aktiv
ORDER BY b.aktiv DESC, p.nachname ASC, p.vorname ASC
');
// If something has been found then return it
@@ -454,6 +513,80 @@ EOSC;
*/
private function _raum($searchstr, $type)
{
$dbModel = new DB_Model();
$rooms = $dbModel->execReadOnlyQuery('
SELECT
\''.$type.'\' AS type,
COALESCE(ort.ort_kurzbz, \'N/A\') as ort_kurzbz,
COALESCE(ort.gebteil, \'N/A\') as building,
COALESCE(ort.ausstattung, \'N/A\') as austattung,
COALESCE(CAST(ort.stockwerk AS VARCHAR), \'N/A\') as floor,
COALESCE(CAST(ort.dislozierung AS VARCHAR), \'N/A\') as room_number,
COALESCE(CAST(ort.content_id AS VARCHAR), \'N/A\') as content_id,
CASE
WHEN standort.plz IS NULL OR standort.ort IS NULL THEN
CASE
WHEN standort.strasse IS NULL THEN
CASE
WHEN ort.stockwerk IS NULL THEN \'N/A\'
ELSE CONCAT(ort.stockwerk,\' Stockwerk\')
END
ELSE
CASE
WHEN ort.stockwerk IS NULL THEN standort.strasse
ELSE CONCAT(standort.strasse,\' / \',ort.stockwerk,\' Stockwerk\')
END
END
ELSE
CASE
WHEN standort.strasse IS NULL THEN
CASE
WHEN ort.stockwerk IS NULL THEN CONCAT(standort.plz,\' \',standort.ort)
ELSE CONCAT(standort.plz,\' \',standort.ort,\' / \',ort.stockwerk,\' Stockwerk\')
END
ELSE
CASE
WHEN ort.stockwerk IS NULL THEN CONCAT(standort.plz,\' \',standort.ort,\' / \',standort.strasse)
ELSE CONCAT(standort.plz,\' \',standort.ort,\', \',standort.strasse,\' / \',ort.stockwerk,\' Stockwerk\')
END
END
END as standort,
CASE
WHEN ort.max_person IS NULL OR ort.arbeitsplaetze IS NULL THEN \'N/A\'
ELSE CONCAT(ort.max_person,\', davon \',ort.arbeitsplaetze,\' PC-Plätze\')
END as sitzplaetze
FROM public.tbl_ort as ort
LEFT JOIN (
select ort,standort_id,strasse, plz
FROM public.tbl_standort
LEFT JOIN public.tbl_adresse USING(adresse_id)
) standort USING(standort_id)
WHERE
ort.aktiv = true
AND
ort.lehre = true
AND (' .
$this->buildSearchClause(
$dbModel,
array('ort.ort_kurzbz', 'ort.bezeichnung'),
$searchstr
) .
')'
);
// If something has been found
if (hasData($rooms))
{
// Returns the dataset
return getData($rooms);
}
// Otherwise return an empty array
return array();
}
}
+2
View File
@@ -26,6 +26,8 @@ class TableWidgetLib
{
const TABLE_UNIQUE_ID = 'tableUniqueId'; // TableWidget unique id
const TABLE_BOOTSTRAP_VERSION = 'bootstrapVersion'; // TableWidget bootstrap version
// TableWidget session name
const SESSION_NAME = 'FHC_TABLE_WIDGET';
@@ -0,0 +1,232 @@
<?php
defined('BASEPATH') || exit('No direct script access allowed');
use \stdClass as stdClass;
/**
* Description of DashboardLib
*
* @author bambi
*/
class DashboardLib
{
const WIDGET_ID_RANDOM_BYTES = 16;
const DEFAULT_DASHBOARD_KURZBZ = 'fhcomplete';
const SECTION_IF_FUNKTION_KURZBZ_IS_NULL = 'general';
const USEROVERRIDE_SECTION = 'custom';
private $_ci; // CI instance
public function __construct()
{
// Loads CI instance
$this->_ci =& get_instance();
$this->_ci->load->model('dashboard/Dashboard_model', 'DashboardModel');
$this->_ci->load->model('dashboard/Dashboard_Preset_model', 'DashboardPresetModel');
$this->_ci->load->model('dashboard/Dashboard_Override_model', 'DashboardOverrideModel');
}
public function generateWidgetId($dashboard_kurzbz = '')
{
$dashboard_kurzbz = (!empty($dashboard_kurzbz)) ? $dashboard_kurzbz : self::DEFAULT_DASHBOARD_KURZBZ;
$widgetid_input = time() . '_' . $dashboard_kurzbz . '_' . bin2hex(random_bytes(self::WIDGET_ID_RANDOM_BYTES));
$widgetid = md5($widgetid_input);
return $widgetid;
}
public function getDashboardByKurzbz($dashboard_kurzbz)
{
$result = $this->_ci->DashboardModel->getDashboardByKurzbz($dashboard_kurzbz);
if (hasData($result))
{
return current(getData($result));
}
return null;
}
public function getMergedConfig($dashboard_id, $uid)
{
$defaultconfig = $this->getDefaultConfig($dashboard_id, $uid);
$userconfig = $this->getUserConfig($dashboard_id, $uid);
$mergedconfig = array_replace_recursive($defaultconfig, $userconfig);
return $mergedconfig;
}
public function getDefaultConfig($dashboard_id, $uid)
{
$res_presets = $this->_ci->DashboardPresetModel->getPresets($dashboard_id, $uid);
$defaultconfig = array();
if (hasData($res_presets))
{
$presets = getData($res_presets);
foreach ($presets as $presetobj)
{
$preset = json_decode($presetobj->preset, true);
if (null !== $preset)
{
$defaultconfig = array_replace_recursive($defaultconfig, $preset);
}
}
}
return $defaultconfig;
}
public function getUserConfig($dashboard_id, $uid)
{
$res_userconfig = $this->_ci->DashboardOverrideModel->getOverride($dashboard_id, $uid);
if (hasData($res_userconfig))
{
$data = getData($res_userconfig);
$decodedconfig = json_decode(current($data)->override, true);
if (null !== $decodedconfig)
{
return $decodedconfig;
}
}
return [];
}
public function getOverrideOrCreateEmptyOverride($dashboard_kurzbz, $uid)
{
$override = $this->getOverride($dashboard_kurzbz, $uid);
if (null !== $override) {
return $override;
}
$dashboard = $this->getDashboardByKurzbz($dashboard_kurzbz);
$emptyoverride = new stdClass();
$emptyoverride->dashboard_id = $dashboard->dashboard_id;
$emptyoverride->uid = $uid;
$emptyoverride->override = '{"widgets": {"' . self::USEROVERRIDE_SECTION . '": {}}}';
return $emptyoverride;
}
public function getPresetOrCreateEmptyPreset($dashboard_kurzbz, $funktion_kurzbz)
{
if ($funktion_kurzbz === self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL)
$funktion_kurzbz = null;
$preset = $this->getPreset($dashboard_kurzbz, $funktion_kurzbz);
if (null !== $preset) {
return $preset;
}
$dashboard = $this->getDashboardByKurzbz($dashboard_kurzbz);
$emptypreset = new stdClass();
$emptypreset->dashboard_id = $dashboard->dashboard_id;
$emptypreset->funktion_kurzbz = $funktion_kurzbz;
$section = ($funktion_kurzbz !== null) ? $funktion_kurzbz : self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL;
$emptypreset->preset = '{"widgets": {"' . $section . '": {}}}';
return $emptypreset;
}
public function getPreset($dashboard_kurzbz, $section)
{
$dashboard = $this->getDashboardByKurzbz($dashboard_kurzbz);
$funktion_kurzbz = ($section === self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL) ? null : $section;
$result = $this->_ci->DashboardPresetModel
->getPresetByDashboardAndFunktion($dashboard->dashboard_id, $funktion_kurzbz);
if (hasData($result))
{
return current(getData($result));
}
return null;
}
public function getOverride($dashboard_kurzbz, $uid)
{
$dashboard = $this->getDashboardByKurzbz($dashboard_kurzbz);
$result = $this->_ci->DashboardOverrideModel
->getOverride($dashboard->dashboard_id, $uid);
if (hasData($result))
{
return current(getData($result));
}
return null;
}
public function insertOrUpdatePreset($preset)
{
if (isset($preset->preset_id) && $preset->preset_id > 0)
{
$result = $this->_ci->DashboardPresetModel->update($preset->preset_id, $preset);
}
else
{
$result = $this->_ci->DashboardPresetModel->insert($preset);
}
return $result;
}
public function insertOrUpdateOverride($override)
{
if (isset($override->override_id) && $override->override_id > 0)
{
$result = $this->_ci->DashboardOverrideModel->update($override->override_id, $override);
}
else
{
$result = $this->_ci->DashboardOverrideModel->insert($override);
}
return $result;
}
public function addWidgetsToWidgets(&$widgets, $dashboard_kurzbz, $section, $addwigets)
{
foreach ($addwigets as $widget)
{
if(!isset($widget->widgetid))
{
$widget->widgetid = $this->generateWidgetId($dashboard_kurzbz);
}
$this->addWidgetToWidgets($widgets, $section, $widget, $widget->widgetid);
}
}
public function addWidgetToWidgets(&$widgets, $section, $widget, $widgetid)
{
$section = ($section !== null) ? $section : self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL;
if (!isset($widgets[$section]) || !is_array($widgets[$section]))
{
$widgets[$section] = array();
}
$widgets[$section][$widgetid] = $widget;
}
public function removeWidgetFromWidgets(&$widgets, $section, $widgetid)
{
$section = ($section !== null) ? $section : self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL;
if (isset($widgets[$section]) && isset($widgets[$section][$widgetid]))
{
unset($widgets[$section][$widgetid]);
if(empty($widgets[$section]) && $section !== self::USEROVERRIDE_SECTION) {
unset($widgets[$section]);
}
return true;
}
else {
return false;
}
}
}
@@ -15,7 +15,6 @@ class PlausicheckDefinitionLib
'AktSemesterNull' => 'AktSemesterNull',
'AktiverStudentOhneStatus' => 'AktiverStudentOhneStatus',
'AusbildungssemPrestudentUngleichAusbildungssemStatus' => 'AusbildungssemPrestudentUngleichAusbildungssemStatus',
'BewerberNichtZumRtAngetreten' => 'BewerberNichtZumRtAngetreten',
'DatumAbschlusspruefungFehlt' => 'DatumAbschlusspruefungFehlt',
'DatumSponsionFehlt' => 'DatumSponsionFehlt',
'DatumStudiensemesterFalscheReihenfolge' => 'DatumStudiensemesterFalscheReihenfolge',
@@ -36,6 +35,7 @@ class PlausicheckDefinitionLib
'StudentstatusNachAbbrecher' => 'StudentstatusNachAbbrecher',
'DualesStudiumOhneMarkierung' => 'DualesStudiumOhneMarkierung'
//'StudienplanUngueltig' => 'StudienplanUngueltig'
//'BewerberNichtZumRtAngetreten' => 'BewerberNichtZumRtAngetreten'
);
/**
@@ -12,18 +12,25 @@ class PlausicheckProducerLib
private $_ci; // ci instance
private $_extensionName; // name of extension
private $_konfiguration = array(); // configuration parameters
private $_konfiguration = []; // configuration parameters
private $_fehlerLibMappings = []; // mappings of fehler and libraries for producing them
private $_isForResolutionCheck = false; // mappings of fehler and libraries for producing them
public function __construct($params = null)
{
// set extension name if called from extension
if (isset($params['extensionName'])) $this->_extensionName = $params['extensionName'];
if (isset($params['fehlerLibMappings'])) $this->_fehlerLibMappings = $params['fehlerLibMappings'];
if (isset($params['isForResolutionCheck'])) $this->_isForResolutionCheck = $params['isForResolutionCheck'];
// set application
$app = isset($params['app']) ? $params['app'] : null;
$this->_ci =& get_instance(); // get ci instance
// load libraries
$this->_ci->load->library('IssuesLib');
// load models
$this->_ci->load->model('system/Fehlerkonfiguration_model', 'FehlerkonfigurationModel');
@@ -41,6 +48,52 @@ class PlausicheckProducerLib
}
}
/**
* Produces multiple plausicheck issues at once and saved them to db.
* @param array $params passed to each plausicheck
* @return result object with occured error and info
*/
public function producePlausicheckIssues($params)
{
$result = new StdClass();
$result->errors = [];
$result->infos = [];
foreach ($this->_fehlerLibMappings as $fehler_kurzbz => $libName)
{
$plausicheckRes = $this->producePlausicheckIssue(
$libName,
$fehler_kurzbz,
$params
);
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;
// write the issue
$addIssueRes = $this->_ci->issueslib->addFhcIssue($fehler_kurzbz, $person_id, $oe_kurzbz, $fehlertext_params, $resolution_params);
// log if error, or log info if inserted new issue
if (isError($addIssueRes))
$result->errors[] = getError($addIssueRes);
elseif (hasData($addIssueRes) && is_integer(getData($addIssueRes)))
$result->infos[] = "Plausicheck issue " . $fehler_kurzbz . " successfully produced, person_id: " . $person_id;
}
}
}
return $result;
}
/**
* Executes plausicheck using a given library, returns the result.
* @param $libName string name of library producing the issue
@@ -66,7 +119,10 @@ class PlausicheckProducerLib
$config = isset($this->_konfiguration[$fehler_kurzbz]) ? $this->_konfiguration[$fehler_kurzbz] : null;
// load library connected to fehlercode
$this->_ci->load->library($issuesLibPath . $libName, $config);
$this->_ci->load->library(
$issuesLibPath . $libName,
['configurationParams' => $config, 'isForResolutionCheck' => $this->_isForResolutionCheck]
);
$lowercaseLibName = mb_strtolower($libName);
@@ -0,0 +1,136 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class PlausicheckResolverLib
{
const CI_PATH = 'application';
const CI_LIBRARY_FOLDER = 'libraries';
const EXTENSIONS_FOLDER = 'extensions';
const ISSUE_RESOLVERS_FOLDER = 'issues/resolvers';
const CHECK_ISSUE_RESOLVED_METHOD_NAME = 'checkIfIssueIsResolved';
private $_ci; // ci instance
private $_extensionName; // name of extension
private $_codeLibMappings = []; // mappings for issues which explicitly defined resolver
private $_codeProducerLibMappings = []; // mappings for issues which are resolved as produced
public function __construct($params = null)
{
// set extension name if called from extension
if (isset($params['extensionName'])) $this->_extensionName = $params['extensionName'];
if (isset($params['codeLibMappings'])) $this->_codeLibMappings = $params['codeLibMappings'];
if (isset($params['codeProducerLibMappings'])) $this->_codeProducerLibMappings = $params['codeProducerLibMappings'];
$this->_ci =& get_instance(); // get ci instance
$this->_ci->load->library('IssuesLib');
$this->_ci->load->library('issues/PlausicheckProducerLib', ['extensionName' => $this->_extensionName, 'isForResolutionCheck' => true]);
}
/**
* Reseolves multiple plausicheck issues at once.
* @param array $codeLibMappings contains fehler type to check and library responsible for check (fehlercode => libName)
* @param array $openIssues passed issues to resolve
* @return result object with occured error and info
*/
public function resolvePlausicheckIssues($openIssues)
{
$result = new StdClass();
$result->errors = [];
$result->infos = [];
foreach ($openIssues as $issue)
{
// add person id and oe kurzbz automatically as params, merge it with additional params
// decode bewerbung_parameter into assoc array
$params = array_merge(
array('issue_id' => $issue->issue_id, 'issue_person_id' => $issue->person_id, 'issue_oe_kurzbz' => $issue->oe_kurzbz),
isset($issue->behebung_parameter) ? json_decode($issue->behebung_parameter, true) : array()
);
$issueResolved = false;
// ignore if Fehlercode is not in libmappings (shouldn't be checked)
if (isset($this->_codeLibMappings[$issue->fehlercode]))
{
$libName = $this->_codeLibMappings[$issue->fehlercode];
// if called from extension (extension name set), path includes extension names
$libRootPath = isset($this->_extensionName) ? self::EXTENSIONS_FOLDER . '/' . $this->_extensionName . '/' : '';
// path for loading issue library
$issuesLibPath = $libRootPath . self::ISSUE_RESOLVERS_FOLDER . '/';
// file path of library for check if file exists
$issuesLibFilePath = DOC_ROOT . self::CI_PATH
. '/' . $libRootPath . self::CI_LIBRARY_FOLDER . '/' . self::ISSUE_RESOLVERS_FOLDER . '/' . $libName . '.php';
// check if library file exists
if (!file_exists($issuesLibFilePath))
{
// log error and continue with next issue if not
$result->errors[] = "Issue library file " . $issuesLibFilePath . " does not exist";
continue;
}
// load library connected to fehlercode
$this->_ci->load->library($issuesLibPath . $libName);
$lowercaseLibName = mb_strtolower($libName);
// check if method is defined in library class
if (!is_callable(array($this->_ci->{$lowercaseLibName}, self::CHECK_ISSUE_RESOLVED_METHOD_NAME)))
{
// log error and continue with next issue if not
$result->errors[] = "Method " . self::CHECK_ISSUE_RESOLVED_METHOD_NAME . " is not defined in library $lowercaseLibName";
continue;
}
// call the function for checking for issue resolution
$issueResolvedRes = $this->_ci->{$lowercaseLibName}->{self::CHECK_ISSUE_RESOLVED_METHOD_NAME}($params);
if (isError($issueResolvedRes))
{
$result->errors[] = getError($issueResolvedRes);
}
else
{
$issueResolved = getData($issueResolvedRes) === true;
}
}
elseif (isset($this->_codeProducerLibMappings[$issue->fehlercode]))
{
$libName = $this->_codeProducerLibMappings[$issue->fehlercode];
$issueResolvedRes = $this->_ci->plausicheckproducerlib->producePlausicheckIssue(
$libName,
$issue->fehler_kurzbz,
$params
);
if (isError($issueResolvedRes))
{
$result->errors[] = getError($issueResolvedRes);
}
else
{
$issueResolved = !hasData($issueResolvedRes);
}
}
// set issue to resolved if needed
if ($issueResolved)
{
$behobenRes = $this->_ci->issueslib->setBehoben($issue->issue_id, null);
if (isError($behobenRes))
$result->errors[] = getError($behobenRes);
else
$result->infos[] = "Issue " . $issue->issue_id . " successfully resolved";
}
}
return $result;
}
}
@@ -9,83 +9,21 @@ require_once('PlausiChecker.php');
*/
class AbbrecherAktiv extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
protected $_base_sql = "
SELECT
pre.person_id, pre.prestudent_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz
FROM
public.tbl_prestudentstatus pre_status
JOIN public.tbl_prestudent pre USING(prestudent_id)
JOIN public.tbl_student student USING(prestudent_id)
JOIN public.tbl_benutzer benutzer on(benutzer.uid=student.student_uid)
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
WHERE
pre_status.status_kurzbz ='Abbrecher'
AND benutzer.aktiv=true";
// get parameters from config
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
// pass parameters needed for plausicheck
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->getAbbrecherAktiv($studiengang_kz, null, $exkludierte_studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
);
}
}
// return the results
return success($results);
}
/**
* Abbrecher cannot be active.
* @param studiengang_kz int if check is to be executed for certain Studiengang
* @param prestudent_id int if check is to be executed only for one prestudent
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
* @return success with prestudents or error
*/
public function getAbbrecherAktiv($studiengang_kz = null, $prestudent_id = null, $exkludierte_studiengang_kz = null)
{
$params = array();
$qry = "
SELECT
pre.person_id, pre.prestudent_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz
FROM
public.tbl_prestudentstatus pre_status
JOIN public.tbl_prestudent pre USING(prestudent_id)
JOIN public.tbl_student student USING(prestudent_id)
JOIN public.tbl_benutzer benutzer on(benutzer.uid=student.student_uid)
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
WHERE
pre_status.status_kurzbz ='Abbrecher'
AND benutzer.aktiv=true";
if (isset($studiengang_kz))
{
$qry .= " AND stg.studiengang_kz = ?";
$params[] = $studiengang_kz;
}
if (isset($prestudent_id))
{
$qry .= " AND pre.prestudent_id = ?";
$params[] = $prestudent_id;
}
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
{
$qry .= " AND stg.studiengang_kz NOT IN ?";
$params[] = $exkludierte_studiengang_kz;
}
return $this->_db->execReadOnlyQuery($qry, $params);
}
protected $_config_params = ['exkludierteStudiengaenge' => " AND stg.studiengang_kz NOT IN ?"];
protected $_params_for_checking = ['studiengang_kz' => " AND stg.studiengang_kz = ?", 'prestudent_id' => " AND pre.prestudent_id = ?"];
protected $_fehlertext_params = ['prestudent_id'];
protected $_resolution_params = ['prestudent_id'];
}
@@ -6,15 +6,25 @@
abstract class PlausiChecker
{
protected $_ci; // code igniter instance
protected $_config; // configuration parameters for this plausicheck
protected $_config; // all applicable configuration parameters for this plausicheck
protected $_db; // database for queries
public function __construct($configurationParams = null)
protected $_isForResolutionCheck; // if true, additional parameters only needed for resolution are checked
protected $_config_params = []; // name of all config params which should be applied for this plausicheck, with sql [name] => [sql]
protected $_params_for_checking = []; // name of all passed params for checking, with sql [name] => [sql]
protected $_fehlertext_params = []; // parameter names for fehlertext params used for this plausicheck
protected $_resolution_params = []; // parameter names for resolution params used for this plausicheck
public function __construct($params = null)
{
$this->_ci =& get_instance(); // get code igniter instance
// set configuration
$this->_config = $configurationParams;
$this->_config = $params['configurationParams'] ?? [];
$this->_isForResolutionCheck = $params['isForResolutionCheck'] ?? false;
// get database for queries
$this->_db = new DB_Model();
@@ -25,5 +35,83 @@ abstract class PlausiChecker
* @param $paramsForChecking array parameters needed for executing the check
* @return array with objects which failed the plausi check
*/
abstract public function executePlausiCheck($paramsForChecking);
public function executePlausiCheck($paramsForChecking)
{
$results = [];
$params = [];
$qry = $this->_base_sql;
if ($this->_isForResolutionCheck == true)
{
foreach ($this->_resolution_params as $resParam)
{
if (!isset($paramsForChecking[$resParam]))
return error("$resParam missing".(isset($paramsForChecking['issue_id']) ? ", issue ID: ".$paramsForChecking['issue_id'] : ""));
}
}
// add config params to query
if (isset($this->_config_params) && !isEmptyArray($this->_config_params))
{
foreach ($this->_config_params as $param_name => $param_sql)
{
if (isset($this->_config[$param_name]))
{
$qry .= $param_sql;
$params[] = $this->_config[$param_name];
}
}
}
// add check params to query
if (isset($this->_params_for_checking) && !isEmptyArray($this->_params_for_checking))
{
foreach ($this->_params_for_checking as $param_name => $param_sql)
{
if (isset($paramsForChecking[$param_name]))
{
$qry .= $param_sql;
$params[] = $paramsForChecking[$param_name];
}
}
}
$result = $this->_db->execReadOnlyQuery($qry, $params);
if (isError($result)) return $result;
if (hasData($result))
{
$data = getData($result);
// populate results with data necessary for writing issues
foreach ($data as $d)
{
$fehlertext_params = [];
$resolution_params = [];
// add params for error texts
foreach ($this->_fehlertext_params as $param)
{
if (isset($d->{$param})) $fehlertext_params[$param] = $d->{$param};
}
// add params for resolution of issue
foreach ($this->_resolution_params as $param)
{
if (isset($d->{$param})) $resolution_params[$param] = $d->{$param};
}
$results[] = array(
'person_id' => $d->person_id,
'oe_kurzbz' => $d->prestudent_stg_oe_kurzbz,
'fehlertext_params' => $fehlertext_params,
'resolution_params' => $resolution_params
);
}
}
// return the results
return success($results);
}
}
@@ -201,6 +201,10 @@ class Gehaltsbestandteil extends AbstractBestandteil implements \JsonSerializabl
public function setGrundbetrag($grundbetrag)
{
if(is_float($grundbetrag))
{
$grundbetrag = number_format($grundbetrag, 2, '.', '');
}
$this->markDirty('grundbetrag', $this->grundbetrag, $grundbetrag);
$this->grundbetrag = $grundbetrag;
return $this;
@@ -208,6 +212,10 @@ class Gehaltsbestandteil extends AbstractBestandteil implements \JsonSerializabl
public function setBetrag_valorisiert($betrag_valorisiert)
{
if(is_float($betrag_valorisiert))
{
$betrag_valorisiert = number_format($betrag_valorisiert, 2, '.', '');
}
$this->markDirty('betrag_valorisiert', $this->betrag_valorisiert, $betrag_valorisiert);
$this->betrag_valorisiert = $betrag_valorisiert;
return $this;
@@ -28,9 +28,17 @@ class GehaltsbestandteilLib
$this->GehaltsbestandteilModel = $this->CI->GehaltsbestandteilModel;
}
public function fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false)
public function fetchGehaltsbestandteileValorisiertForChart($dienstverhaeltnis_id, $stichtag=null, $includefuture=false)
{
return $this->GehaltsbestandteilModel->getGehaltsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture);
return $this->GehaltsbestandteilModel->getGehaltsbestandteileValorisiertForChart($dienstverhaeltnis_id, $stichtag, $includefuture);
}
public function fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null,
$includefuture=false, $withvalorisationhistory=true)
{
return $this->GehaltsbestandteilModel->getGehaltsbestandteile(
$dienstverhaeltnis_id, $stichtag, $includefuture, $withvalorisationhistory
);
}
public function fetchGehaltsbestandteil($gehaltsbestandteil_id)
@@ -26,6 +26,8 @@ class VertragsbestandteilLib
{
const INCLUDE_FUTURE = true;
const DO_NOT_INCLUDE_FUTURE = false;
const WITH_VALORISATION_HISTORY = true;
const NOT_WITH_VALORISATION_HISTORY = false;
protected $CI;
/** @var Dienstverhaeltnis_model */
@@ -90,10 +92,15 @@ class VertragsbestandteilLib
return $dv;
}
public function fetchVertragsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false)
public function fetchVertragsbestandteile($dienstverhaeltnis_id, $stichtag=null,
$includefuture=false, $withvalorisationhistory=true)
{
$vbs = $this->VertragsbestandteilModel->getVertragsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture);
$gbs = $this->GehaltsbestandteilLib->fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture);
$vbs = $this->VertragsbestandteilModel->getVertragsbestandteile(
$dienstverhaeltnis_id, $stichtag, $includefuture
);
$gbs = $this->GehaltsbestandteilLib->fetchGehaltsbestandteile(
$dienstverhaeltnis_id, $stichtag, $includefuture, $withvalorisationhistory
);
$gbsByVBid = array();
foreach( $gbs as $gb )