Merge remote-tracking branch 'origin/master' into feature-15490/lehrauftragsliste_stammkostenstelle_bei_fix_angestellten

This commit is contained in:
ma0048
2022-11-04 10:49:27 +01:00
1452 changed files with 89631 additions and 166318 deletions
+1
View File
@@ -24,6 +24,7 @@ application/logs/
application/models/extensions/ application/models/extensions/
application/views/extensions/ application/views/extensions/
application/widgets/extensions/ application/widgets/extensions/
application/components/extensions/
public/extensions/ public/extensions/
@@ -0,0 +1,19 @@
<?php
$filterCmptArray = array(
'app' => 'core',
'datasetName' => 'logs',
//'filterKurzbz' => 'jobs48hours', // REMOVE ME
'query' => '
SELECT wsl.webservicelog_id AS "LogId",
wsl.request_id AS "RequestId",
wsl.execute_time AS "ExecutionTime",
wsl.execute_user AS "ExecutedBy",
wsl.beschreibung AS "Description",
wsl.request_data AS "Data",
wsl.webservicetyp_kurzbz AS "WebserviceType"
FROM system.tbl_webservicelog wsl
ORDER BY wsl.execute_time DESC
',
'requiredPermissions' => 'admin'
);
+2 -2
View File
@@ -7,8 +7,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
$config['interval_blocking_application'] = 'P1M'; $config['interval_blocking_application'] = 'P1M';
// Application submission period given by start- and enddate. // Application submission period given by start- and enddate.
$config['submit_application_start'] = '01.02.2021'; $config['submit_application_start'] = '05.09.2022';
$config['submit_application_end'] = '22.02.2021'; $config['submit_application_end'] = '22.09.2022';
// Lehrveranstaltungen with these grades will be blocked for application // Lehrveranstaltungen with these grades will be blocked for application
$config['grades_blocking_application'] = array( $config['grades_blocking_application'] = array(
+46 -14
View File
@@ -15,7 +15,7 @@ $config['navigation_header'] = array(
'description' => 'Organisation', 'description' => 'Organisation',
'sort' => 20, 'sort' => 20,
'requiredPermissions' => 'basis/vilesci:r', 'requiredPermissions' => 'basis/vilesci:r',
'children'=> array( 'children' => array(
'vilesci' => array( 'vilesci' => array(
'link' => base_url('vilesci'), 'link' => base_url('vilesci'),
'icon' => '', 'icon' => '',
@@ -27,7 +27,7 @@ $config['navigation_header'] = array(
'oehbeitragsverwaltung' => array( 'oehbeitragsverwaltung' => array(
'link' => site_url('codex/Oehbeitrag'), 'link' => site_url('codex/Oehbeitrag'),
'icon' => '', 'icon' => '',
'description' => hbeitragsverwaltung', 'description' => H-Beitragsverwaltung',
'expand' => true, 'expand' => true,
'sort' => 20, 'sort' => 20,
'requiredPermissions' => 'admin:w' 'requiredPermissions' => 'admin:w'
@@ -40,7 +40,7 @@ $config['navigation_header'] = array(
'description' => 'Lehre', 'description' => 'Lehre',
'sort' => 30, 'sort' => 30,
'requiredPermissions' => 'basis/vilesci:r', 'requiredPermissions' => 'basis/vilesci:r',
'children'=> array( 'children' => array(
'cis' => array( 'cis' => array(
'link' => CIS_ROOT, 'link' => CIS_ROOT,
'icon' => '', 'icon' => '',
@@ -71,6 +71,16 @@ $config['navigation_header'] = array(
'lehre/lehrauftrag_erteilen:r' 'lehre/lehrauftrag_erteilen:r'
) )
), ),
'zverfueg' => array(
'link' => site_url('lehre/lvplanung/AdminZeitverfuegbarkeit'),
'description' => 'Zeitverf&uuml;gbarkeit',
'expand' => true,
'sort' => 45,
'requiredPermissions' => array(
'lehre/zeitverfuegbarkeit:rw',
'lehre/zeitverfuegbarkeit:rw'
)
),
'zgvueberpruefung' => array( 'zgvueberpruefung' => array(
'link' => site_url('system/infocenter/ZGVUeberpruefung'), 'link' => site_url('system/infocenter/ZGVUeberpruefung'),
'description' => 'ZGV Überprüfung', 'description' => 'ZGV Überprüfung',
@@ -88,7 +98,7 @@ $config['navigation_header'] = array(
'description' => 'Personen', 'description' => 'Personen',
'sort' => 40, 'sort' => 40,
'requiredPermissions' => 'basis/vilesci:r', 'requiredPermissions' => 'basis/vilesci:r',
'children'=> array( 'children' => array(
'messages' => array( 'messages' => array(
'link' => site_url('system/messages/MessageClient/read'), 'link' => site_url('system/messages/MessageClient/read'),
'icon' => '', 'icon' => '',
@@ -102,6 +112,20 @@ $config['navigation_header'] = array(
'description' => 'BPK Wartung', 'description' => 'BPK Wartung',
'sort' => 20, 'sort' => 20,
'requiredPermissions' => 'admin:r' 'requiredPermissions' => 'admin:r'
),
'errormonitoring' => array(
'link' => site_url('system/issues/Issues'),
'description' => 'Fehler Monitoring',
'expand' => true,
'sort' => 30,
'requiredPermissions' => 'system/issues_verwalten:r'
),
'gruppenmanagement' => array(
'link' => site_url('person/Gruppenmanagement'),
'description' => 'Gruppenmanagement',
'expand' => true,
'sort' => 40,
'requiredPermissions' => 'lehre/gruppenmanager:r'
) )
) )
), ),
@@ -112,7 +136,7 @@ $config['navigation_header'] = array(
'expand' => false, 'expand' => false,
'sort' => 50, 'sort' => 50,
'requiredPermissions' => 'admin:r', 'requiredPermissions' => 'admin:r',
'children'=> array( 'children' => array(
'extensions' => array( 'extensions' => array(
'link' => site_url('system/extensions/Manager'), 'link' => site_url('system/extensions/Manager'),
'description' => 'Extensions Manager', 'description' => 'Extensions Manager',
@@ -133,13 +157,6 @@ $config['navigation_header'] = array(
'expand' => true, 'expand' => true,
'sort' => 20, 'sort' => 20,
'requiredPermissions' => 'system/developer:r' 'requiredPermissions' => 'system/developer:r'
),
'errormonitoring' => array(
'link' => site_url('system/issues/Issues'),
'description' => 'Fehler Monitoring',
'expand' => true,
'sort' => 20,
'requiredPermissions' => 'system/issues_verwalten:r'
) )
) )
) )
@@ -184,7 +201,8 @@ $config['navigation_menu']['lehre/lehrauftrag/Lehrauftrag/*'] = array(
'icon' => 'dashboard', 'icon' => 'dashboard',
'sort' => 1, 'sort' => 1,
'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r','lehre/lehrauftrag_erteilen:r') 'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r','lehre/lehrauftrag_erteilen:r')
),'lehrauftragBestellen' => array( ),
'lehrauftragBestellen' => array(
'link' => site_url('lehre/lehrauftrag/Lehrauftrag'), 'link' => site_url('lehre/lehrauftrag/Lehrauftrag'),
'description' => 'Lehrauftrag bestellen', 'description' => 'Lehrauftrag bestellen',
'icon' => '', 'icon' => '',
@@ -206,6 +224,7 @@ $config['navigation_menu']['lehre/lehrauftrag/Lehrauftrag/*'] = array(
'requiredPermissions' => array('lehre/lehrauftrag_erteilen:r') 'requiredPermissions' => array('lehre/lehrauftrag_erteilen:r')
) )
); );
$config['navigation_menu']['lehre/lehrauftrag/LehrauftragErteilen/*'] = array( $config['navigation_menu']['lehre/lehrauftrag/LehrauftragErteilen/*'] = array(
'lehrauftragDashboard' => array( 'lehrauftragDashboard' => array(
'link' => site_url('lehre/lehrauftrag/Lehrauftrag/Dashboard'), 'link' => site_url('lehre/lehrauftrag/Lehrauftrag/Dashboard'),
@@ -213,7 +232,8 @@ $config['navigation_menu']['lehre/lehrauftrag/LehrauftragErteilen/*'] = array(
'icon' => 'dashboard', 'icon' => 'dashboard',
'sort' => 1, 'sort' => 1,
'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r','lehre/lehrauftrag_erteilen:r') 'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r','lehre/lehrauftrag_erteilen:r')
),'lehrauftragBestellen' => array( ),
'lehrauftragBestellen' => array(
'link' => site_url('lehre/lehrauftrag/Lehrauftrag'), 'link' => site_url('lehre/lehrauftrag/Lehrauftrag'),
'description' => 'Lehrauftrag bestellen', 'description' => 'Lehrauftrag bestellen',
'icon' => '', 'icon' => '',
@@ -235,3 +255,15 @@ $config['navigation_menu']['lehre/lehrauftrag/LehrauftragErteilen/*'] = array(
'requiredPermissions' => array('lehre/lehrauftrag_erteilen:r') 'requiredPermissions' => array('lehre/lehrauftrag_erteilen:r')
) )
); );
$config['navigation_menu']['system/issues/Issues/*'] = array(
'fehlerzustaendigkeiten' => array(
'link' => site_url('system/issues/IssuesZustaendigkeiten'),
'description' => 'Fehler Zuständigkeiten',
'icon' => 'cogs',
'sort' => 100,
'target' => '_blank',
'requiredPermissions' => array('admin:rw')
)
);
+23
View File
@@ -60,3 +60,26 @@ $route['api/v1/organisation/[G|g]eschaeftsjahr/(:any)'] = 'api/v1/organisation/g
$route['api/v1/organisation/[O|o]rganisationseinheit/(:any)'] = 'api/v1/organisation/organisationseinheit2/$1'; $route['api/v1/organisation/[O|o]rganisationseinheit/(:any)'] = 'api/v1/organisation/organisationseinheit2/$1';
$route['api/v1/ressource/[B|b]etriebsmittelperson/(:any)'] = 'api/v1/ressource/betriebsmittelperson2/$1'; $route['api/v1/ressource/[B|b]etriebsmittelperson/(:any)'] = 'api/v1/ressource/betriebsmittelperson2/$1';
$route['api/v1/system/[S|s]prache/(:any)'] = 'api/v1/system/sprache2/$1'; $route['api/v1/system/[S|s]prache/(:any)'] = 'api/v1/system/sprache2/$1';
// load routes from extensions
$subdir = 'application/config/extensions';
$dirlist = scandir($subdir);
if ($dirlist)
{
$files = array_diff($dirlist, array('.','..'));
foreach ($files as &$item)
{
if (is_dir($subdir . DIRECTORY_SEPARATOR . $item))
{
$routes_file = $subdir . DIRECTORY_SEPARATOR . $item . DIRECTORY_SEPARATOR . 'routes.php';
if (file_exists($routes_file))
{
require($routes_file);
}
}
}
}
+9 -1
View File
@@ -4,7 +4,7 @@ if (! defined("BASEPATH")) exit("No direct script access allowed");
class Oehbeitrag extends Auth_Controller class Oehbeitrag extends Auth_Controller
{ {
const STUDIENSEMESTER_START = 'WS2020'; const STUDIENSEMESTER_START = 'WS2020'; // Öhbeitrage can be assigned beginning with this Studiensemester
public function __construct() public function __construct()
{ {
@@ -23,6 +23,14 @@ class Oehbeitrag extends Auth_Controller
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
$this->load->library('WidgetLib'); $this->load->library('WidgetLib');
$this->loadPhrases(
array(
'global',
'ui',
'oehbeitrag'
)
);
} }
public function index() public function index()
@@ -0,0 +1,207 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* This controller operates between (interface) the JS (GUI) and the FilterCmptLib (back-end)
* Provides data to the ajax get calls about the filter component
* Listens to ajax post calls to change the filter data
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
* NOTE: extends the FHC_Controller instead of the Auth_Controller because the FilterCmpt has its
* own permissions check
*/
class Filter extends FHC_Controller
{
const FILTER_UNIQUE_ID = 'filterUniqueId'; // Name of the filter cmpt unique id (mandatory)
const FILTER_TYPE = 'filterType'; // The filter type (PHP filter definition) used (mandatory)
const FILTER_ID = 'filterId'; // The id of the used filter (optional)
/**
* Calls the parent's constructor and loads the FilterCmptLib
*/
public function __construct()
{
parent::__construct();
// Loads authentication library and starts authentication
$this->load->library('AuthLib');
// Loads the FilterCmptLib with HTTP GET/POST parameters
$this->_startFilterCmptLib();
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Retrieves data about the current filter from the session and will be written on the output in JSON format
*/
public function getFilter()
{
$this->outputJsonSuccess($this->filtercmptlib->getSession());
}
/**
* Remove an applied filter (SQL where condition) from the current filter
*/
public function removeFilterField()
{
$request = $this->getPostJSON();
if (property_exists($request, 'filterField')
&& $this->filtercmptlib->removeFilterField($request->filterField) == true)
{
$this->outputJsonSuccess('Field removed');
}
else
{
$this->outputJsonError('Error occurred');
}
}
/**
* Add a filter (SQL where clause) to be applied to the current filter
*/
public function addFilterField()
{
$request = $this->getPostJSON();
if (property_exists($request, 'filterField')
&& $this->filtercmptlib->addFilterField($request->filterField) == true)
{
$this->outputJsonSuccess('Field added');
}
else
{
$this->outputJsonError('Error occurred');
}
}
/**
* Apply the filter changes
*/
public function applyFilterFields()
{
$request = $this->getPostJSON();
if (property_exists($request, 'filterFields')
&& $this->filtercmptlib->applyFilterFields($request->filterFields) == true)
{
$this->outputJsonSuccess('Applied');
}
else
{
$this->outputJsonError('Error occurred');
}
}
/**
* Save the current filter as a custom filter for this user with the given description
*/
public function saveCustomFilter()
{
$request = $this->getPostJSON();
if (property_exists($request, 'customFilterName')
&& $this->filtercmptlib->saveCustomFilter($request->customFilterName) == true)
{
$this->outputJsonSuccess('Saved');
}
else
{
$this->outputJsonError('An error occurred while saving a custom filter');
}
}
/**
* Remove a custom filter by its filterId
*/
public function removeCustomFilter()
{
$request = $this->getPostJSON();
if (property_exists($request, 'filterId')
&& $this->filtercmptlib->removeCustomFilter($request->filterId) == true)
{
$this->outputJsonSuccess('Removed');
}
else
{
$this->outputJsonError('Wrong parameter');
}
}
/**
* Reloads the dataset
*/
public function reloadDataset()
{
$this->filtercmptlib->reloadDataset();
$this->outputJsonSuccess('Success');
}
//------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Loads the FilterCmptLib with the FILTER_UNIQUE_ID parameter
* If the parameter FILTER_UNIQUE_ID is not given then the execution of the controller is terminated and
* an error message is printed
*/
private function _startFilterCmptLib()
{
$filterUniqueId = null;
$filterType = null;
$filterId = null;
// Try to get the POSTed JSON
$postJSON = $this->getPostJSON();
// POSTed JSON
if ($postJSON != null)
{
// If the mandatory parameters FILTER_UNIQUE_ID and FILTER_TYPE have been provided
if (property_exists($postJSON, self::FILTER_UNIQUE_ID) && property_exists($postJSON, self::FILTER_TYPE))
{
// Retrives them from the POSTed JSON
$filterUniqueId = $postJSON->{self::FILTER_UNIQUE_ID};
$filterType = $postJSON->{self::FILTER_TYPE};
}
// If the optional parameter FILTER_ID has been provided
if (property_exists($postJSON, self::FILTER_ID)) $filterId = $postJSON->{self::FILTER_ID};
}
else // otherwise it is an HTTP GET call
{
// If the mandatory parameters FILTER_UNIQUE_ID and FILTER_TYPE have been provided
if (isset($_GET[self::FILTER_UNIQUE_ID]) && isset($_GET[self::FILTER_TYPE]))
{
// Retrives them from the HTTP GET
$filterUniqueId = $this->input->get(self::FILTER_UNIQUE_ID);
$filterType = $this->input->get(self::FILTER_TYPE);
}
// If the optional parameter FILTER_ID has been provided
if (isset($_GET[self::FILTER_ID])) $filterId = $filterId = $this->input->get(self::FILTER_ID);
}
// If the mandatory parameters have _not_ been provided, then terminate the execution and return an error
if ($filterUniqueId == null) $this->terminateWithJsonError('Parameter "'.self::FILTER_UNIQUE_ID.'" not provided!');
if ($filterType == null) $this->terminateWithJsonError('Parameter "'.self::FILTER_TYPE.'" not provided!');
// Loads the FilterCmptLib that contains all the used logic
$this->load->library(
'FilterCmptLib',
array(
'filterUniqueId' => $filterUniqueId,
'filterType' => $filterType,
'filterId' => $filterId
)
);
// Start the component
$this->filtercmptlib->start();
}
}
@@ -0,0 +1,51 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class SearchBar extends FHC_Controller
{
const SEARCHSTR_PARAM = 'searchstr';
const TYPES_PARAM = 'types';
/**
* Object initialization
*/
public function __construct()
{
parent::__construct();
// Load the library SearchBarLib
$this->load->library('SearchBarLib');
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Gets a JSON body via HTTP POST and provides the parameters
*/
public function search()
{
$json = json_decode($this->input->raw_input_stream);
// Checks if the searchstr and the types parameters are in the POSTed JSON
if (isset($json->{self::SEARCHSTR_PARAM}) && isset($json->{self::TYPES_PARAM}))
{
// Convert to json the result from searchbarlib->search
$this->outputJson(
$this->searchbarlib->search(
$json->{self::SEARCHSTR_PARAM},
$json->{self::TYPES_PARAM}
)
);
}
else // otherwise return an error in JSON format
{
$this->outputJsonError(SearchBarLib::ERROR_WRONG_JSON);
}
}
}
+106 -20
View File
@@ -16,9 +16,11 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class AnrechnungJob extends JOB_Controller class AnrechnungJob extends JOB_Controller
{ {
const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht'; const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht';
const REVIEW_ANRECHNUNG_URI = '/lehre/anrechnung/ReviewAnrechnungUebersicht';
const ANRECHNUNGSTATUS_APPROVED = 'approved'; const ANRECHNUNGSTATUS_APPROVED = 'approved';
const ANRECHNUNGSTATUS_REJECTED = 'rejected'; const ANRECHNUNGSTATUS_REJECTED = 'rejected';
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL = 'AnrechnungNotizSTGL'; const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL = 'AnrechnungNotizSTGL';
/** /**
@@ -33,6 +35,8 @@ class AnrechnungJob extends JOB_Controller
$this->load->helper('url'); $this->load->helper('url');
$this->load->helper('hlp_sancho_helper'); $this->load->helper('hlp_sancho_helper');
$this->load->library('AnrechnungLib');
} }
/** /**
@@ -188,7 +192,7 @@ class AnrechnungJob extends JOB_Controller
$studiengang_bezeichnung = $this->StudiengangModel->load($studiengang_kz)->retval[0]->stg_bezeichnung; $studiengang_bezeichnung = $this->StudiengangModel->load($studiengang_kz)->retval[0]->stg_bezeichnung;
// Get STGL mail address // Get STGL mail address
list ($to, $vorname) = self::_getSTGLMailAddress($studiengang_kz); $stglMailReceiver_arr = self::_getSTGLMailAddress($studiengang_kz);
// Get HTML table with new Anrechnungen of that STG plus amount of them // Get HTML table with new Anrechnungen of that STG plus amount of them
list ($anrechnungen_amount, $anrechnungen_table) = self::_getSTGLMailDataTable($studiengang_kz, $anrechnungen); list ($anrechnungen_amount, $anrechnungen_table) = self::_getSTGLMailDataTable($studiengang_kz, $anrechnungen);
@@ -199,22 +203,25 @@ class AnrechnungJob extends JOB_Controller
CIS_ROOT. 'cis/menu.php?content_id=&content='. CIS_ROOT. 'cis/menu.php?content_id=&content='.
CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI; CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI;
foreach ($stglMailReceiver_arr as $stgl)
{
// Prepare mail content // Prepare mail content
$body_fields = array( $body_fields = array(
'vorname' => $vorname, 'vorname' => $stgl['vorname'],
'studiengang' => $studiengang_bezeichnung, 'studiengang' => $studiengang_bezeichnung,
'anzahl' => $anrechnungen_amount, 'anzahl' => $anrechnungen_amount,
'datentabelle' => $anrechnungen_table, 'datentabelle' => $anrechnungen_table,
'link' => anchor($url, 'Anrechnungsanträge Übersicht') 'link' => anchor($url, 'Anrechnungsanträge Übersicht')
); );
// Send mail // Send mail
sendSanchoMail( sendSanchoMail(
'AnrechnungAntragStellen', 'AnrechnungAntragStellen',
$body_fields, $body_fields,
$to, $stgl['to'],
'Anerkennung nachgewiesener Kenntnisse: Neuer Antrag wurde gestellt' 'Anerkennung nachgewiesener Kenntnisse: Neuer Antrag wurde gestellt'
); );
}
} }
$this->logInfo('SUCCEDED: Sending emails to STGL about yesterdays new Anrechnungen succeded.'); $this->logInfo('SUCCEDED: Sending emails to STGL about yesterdays new Anrechnungen succeded.');
@@ -339,18 +346,97 @@ html;
} }
/**
* Send Sancho mail to remind lecturers to provide their recommendation if not done until one week after request.
*/
public function sendMailRemindRecommendation(){
$this->logInfo('Start AnrechnungJob sendMailRemindRecommendation to remind lecturers to provide their recommendation.');
// Get Anrechnungen with pending recommendations, that were requested 1 week before today.
// Restrict query for Anrechnungen of actual semester.
$this->AnrechnungModel->addSelect('astat.anrechnung_id, astat.datum, astat.insertamum');
$this->AnrechnungModel->addDistinct('astat.anrechnung_id');
$this->AnrechnungModel->addJoin('lehre.tbl_anrechnung_anrechnungstatus astat', 'anrechnung_id');
$result = $this->AnrechnungModel->loadWhere('
studiensemester_kurzbz = (
SELECT studiensemester_kurzbz FROM tbl_studiensemester WHERE now()::date BETWEEN start AND ende)
)
AND genehmigt_von IS NULL
AND empfehlung_anrechnung IS NULL
AND status_kurzbz = '. $this->db->escape(self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR) .' -- in Bearbeitung durch Lektor
AND NOW()::date = (astat.datum + interval \'1 week\') -- eine Woche nach Empfehlungsanfrage
ORDER BY astat.anrechnung_id, astat.datum DESC, astat.insertamum DESC -- nur letzten status dabei prüfen
');
// Exit if there are no pending recommendations
if (!hasData($result))
{
$this->logInfo('End AnrechnungJob sendMailRemindRecommendation, because no recommendations to be done.');
exit;
}
$anrechnung_id_arr = array_column(getData($result), 'anrechnung_id');
$arr_lvLector_arr = array();
foreach ($anrechnung_id_arr as $anrechnung_id)
{
$arr_lvLector_arr[]= $this->anrechnunglib->getLectors($anrechnung_id); // Returns LV Leitung. If not present, then all lectors of LV.
}
// Unique lector array to send only one mail per lector
$arr_lvLector_arr = array_unique($arr_lvLector_arr, SORT_REGULAR);
// Link to 'Anrechnungen prüfen' dashboard
$url =
CIS_ROOT. 'cis/index.php?menu='.
CIS_ROOT. 'cis/menu.php?content_id=&content='.
CIS_ROOT. index_page(). self::REVIEW_ANRECHNUNG_URI;
foreach ($arr_lvLector_arr as $lvLector_arr)
{
foreach ($lvLector_arr as $lector)
{
// Prepare mail content
$fields = array(
'vorname' => $lector->vorname,
'stgl_name' => 'Die Studiengangsleitung',
'link' => anchor($url, 'Anrechnungsanträge Übersicht')
);
// Send mail
sendSanchoMail(
'AnrechnungEmpfehlungAnfordern',
$fields,
$lector->uid. '@'. DOMAIN,
'Erinnerung: Deine Empfehlung wird benötigt zur Anerkennung nachgewiesener Kenntnisse'
);
}
}
$this->logInfo('SUCCEDED AnrechnungJob sendMailRemindRecommendation');
}
// Get STGL mail address // Get STGL mail address
private function _getSTGLMailAddress($studiengang_kz) private function _getSTGLMailAddress($studiengang_kz)
{ {
$stglMailAdress_arr = array();
$result = $this->StudiengangModel->getLeitung($studiengang_kz); $result = $this->StudiengangModel->getLeitung($studiengang_kz);
// Get STGL mail address // Get STGL mail address
if (hasData($result)) if (hasData($result))
{ {
return array( foreach (getData($result) as $stgl)
$result->retval[0]->uid. '@'. DOMAIN, {
$result->retval[0]->vorname $stglMailAdress_arr[]= array(
); 'to' => $stgl->uid. '@'. DOMAIN,
'vorname' => $stgl->vorname
);
}
return $stglMailAdress_arr;
} }
// If not available, get assistance mail address // If not available, get assistance mail address
else else
+28
View File
@@ -0,0 +1,28 @@
<?php
/**
* Job for resolving core issues
*/
class IssueResolver extends IssueResolver_Controller
{
public function __construct()
{
parent::__construct();
// set fehler codes which can be resolved by the job
// structure: fehlercode => class (library) name for resolving
$this->_codeLibMappings = array(
'CORE_ZGV_0001' => 'CORE_ZGV_0001',
'CORE_ZGV_0002' => 'CORE_ZGV_0002',
'CORE_ZGV_0003' => 'CORE_ZGV_0003',
'CORE_ZGV_0004' => 'CORE_ZGV_0004',
'CORE_ZGV_0005' => 'CORE_ZGV_0005',
'CORE_INOUT_0001' => 'CORE_INOUT_0001',
'CORE_INOUT_0002' => 'CORE_INOUT_0002',
'CORE_INOUT_0003' => 'CORE_INOUT_0003',
'CORE_INOUT_0004' => 'CORE_INOUT_0004',
'CORE_INOUT_0005' => 'CORE_INOUT_0005',
'CORE_INOUT_0006' => 'CORE_INOUT_0006'
);
}
}
+312 -1
View File
@@ -19,7 +19,7 @@
*/ */
if (!defined('BASEPATH')) exit('No direct script access allowed'); if (!defined('BASEPATH')) exit('No direct script access allowed');
class LVPlanJob extends CLI_Controller class LVPlanJob extends JOB_Controller
{ {
/** /**
* Initialize LVPlanJob Class * Initialize LVPlanJob Class
@@ -149,4 +149,315 @@ class LVPlanJob extends CLI_Controller
echo "Failed ".$fail."\n"; echo "Failed ".$fail."\n";
} }
} }
/**
* Send Mail to STGL, Kompetenzfeld and LV Planung about todays updated Zeitwuensche.
* STGL gets list only of lectors who updated future assigend courses concerning their STG.
* Kompetenzleitung gets list only of lectors who updated future assigend courses concerning their KF.
* LVPlanung gets list of lectors who updated future assigend courses.
*/
public function mailUpdatedZeitwuensche()
{
// Load models
$this->load->model('ressource/Stundenplandev_model', 'StundenplandevModel');
$this->load->model('organisation/Studiensemester_model', 'StundiensemesterModel');
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$this->load->model('person/Person_model', 'PersonModel');
// Load libs
$this->load->library('MailLib');
// Load helpers
$this->load->helper('hlp_sancho_helper');
// Start Log Message
$this->logInfo('Mail updated Zeitwuensche started.');
// Get all lectors, who updated their Zeitwunsch today
$db = new DB_Model();
$result = $db->execReadOnlyQuery('
SELECT
zwg.mitarbeiter_uid, tbl_lehrveranstaltung.studiengang_kz, tbl_lehrveranstaltung.oe_kurzbz
FROM
campus.tbl_zeitwunsch_gueltigkeit zwg
JOIN lehre.tbl_stundenplandev stpl
ON(
stpl.mitarbeiter_uid=zwg.mitarbeiter_uid
AND stpl.datum BETWEEN zwg.von AND COALESCE(zwg.bis, \'2999-12-31\')
AND (zwg.insertamum::date = (NOW()-\'1 days\'::interval)::date
OR
zwg.updateamum::date = (NOW()-\'1 days\'::interval)::date)
AND stpl.datum > now()
)
JOIN lehre.tbl_lehreinheit USING(lehreinheit_id)
JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id)
GROUP BY
zwg.mitarbeiter_uid, tbl_lehrveranstaltung.studiengang_kz, tbl_lehrveranstaltung.oe_kurzbz
');
if (!hasData($result))
{
return; // No updated Zeitwuensche today
}
$uidByStg_arr = array(); // Mail data for Studiengang
$uidByOe_arr = array(); // Mail data for Kompetenzfeld
$uid_arr = array(); // Mail data for Kompetenzfeld
// Loop through lectors, who updated their Zeitwunsch today
$changed_arr = getData($result);
foreach ($changed_arr as $row)
{
// Add unique lector array
if (!in_array($row->mitarbeiter_uid, $uid_arr))
{
$uid_arr[]= $row->mitarbeiter_uid;
}
// Build unique Studiengang array
if (!array_key_exists($row->studiengang_kz, $uidByStg_arr))
{
$uidByStg_arr[$row->studiengang_kz] = array($row->mitarbeiter_uid);
}
elseif (!in_array($row->mitarbeiter_uid, $uidByStg_arr[$row->studiengang_kz]))
{
$uidByStg_arr[$row->studiengang_kz][]= $row->mitarbeiter_uid;
}
// Build unique Kompetenzfeld array
if (!array_key_exists($row->oe_kurzbz, $uidByOe_arr))
{
$uidByOe_arr[$row->oe_kurzbz] = array($row->mitarbeiter_uid);
}
elseif (!in_array($row->mitarbeiter_uid, $uidByOe_arr[$row->oe_kurzbz]))
{
$uidByOe_arr[$row->oe_kurzbz][]= $row->mitarbeiter_uid;
}
}
// Send mail to STG Assistenz
/*
$result = $this->_sendMailToStg($uidByStg_arr);
if (isError($result))
{
$this->logError(getError($result));
}
*/
// Send mail to Kompetenzfeld Leitung
$result = $this->_sendMailToKF($uidByOe_arr);
if (isError($result))
{
$this->logError(getError($result));
}
// Send mail to LV Planung
$result = $this->_sendMailToLvPlanung($uid_arr);
if (isError($result))
{
$this->logError(getError($result));
}
// End Log Message
$this->logInfo('Mail updated Zeitwuensche ended.');
}
/**
* Send Mail to STGL Assistance about lectors, who teach LV assigend to the STG, and who updated Zeitwuensche.
*
* @param $data_arr
* @param $stg_bezeichnung
*/
private function _sendMailToStg($data_arr)
{
foreach ($data_arr as $stg_kurzbz => $uid_arr)
{
// Get STG eMail
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
$result = $this->StudiengangModel->load($stg_kurzbz);
$stgMail = $result->retval[0]->email;
$lektorenTabelle = '
<table><thead>
<tr>
<th style="text-align:left">Name</th>
<th style="text-align:left">UID</th>
</tr>
</thead><tbody>
';
foreach($uid_arr as $uid)
{
$person = $this->PersonModel->getByUid($uid);
$lektorenTabelle.= '
<tr>
<td style="text-align:left">'. getData($person)[0]->vorname. ' '. getData($person)[0]->nachname. '</td>
<td style="text-align:left">['. $uid. ']</td>
</tr>
';
}
$lektorenTabelle.= '</tbody></table>';
$contentData_arr = array(
'datentabelle' => $lektorenTabelle
);
// Send mail
if (!sendSanchoMail(
'ZeitwunschUpdateMail',
$contentData_arr,
$stgMail,
'Änderung von Zeitwünschen',
'sancho_header_min_bw.jpg',
'sancho_footer_min_bw.jpg'
))
{
$errorReceiverUid_arr[]= $stgMail;
}
}
if (isset($errorReceiverUid_arr))
{
return error('Mail updated Zeitwuensche could not be sent to :'. implode($errorReceiverUid_arr, ','));
}
return success();
}
/**
* Send Mail to Kompetenzfeld about lectors, who teach LV assigend to the Kompetenzfeld, and who updated Zeitwuensche.
*
* @param $data_arr
* @param $stg_bezeichnung
*/
private function _sendMailToKF($data_arr)
{
// Send mail to Komepetenzfeld Leitung
foreach ($data_arr as $oe_kurzbz => $uid_arr)
{
// Get KF Leitung eMail
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
$result = $this->BenutzerfunktionModel->getBenutzerFunktionen(
'Leitung',
$oe_kurzbz,
$activeoeonly = true,
$activebenonly = true
);
if(isSuccess($result) && hasData($result))
{
$empfaenger = array();
foreach(getData($result) as $row)
$empfaenger[] = $row->uid. '@'. DOMAIN;
$kfMail = implode(',',$empfaenger);
$lektorenTabelle = '
<table><thead>
<tr>
<th style="text-align:left">Name</th>
<th style="text-align:left">UID</th>
</tr>
</thead><tbody>
';
foreach($uid_arr as $uid)
{
$person = $this->PersonModel->getByUid($uid);
$lektorenTabelle.= '
<tr>
<td style="text-align:left">'. getData($person)[0]->vorname. ' '. getData($person)[0]->nachname. '</td>
<td style="text-align:left">['. $uid. ']</td>
</tr>
';
}
$lektorenTabelle.= '</tbody></table>';
$contentData_arr = array(
'datentabelle' => $lektorenTabelle
);
// Send mail
if (!sendSanchoMail(
'ZeitwunschUpdateMail',
$contentData_arr,
$kfMail,
'Änderung von Zeitwünschen',
'sancho_header_min_bw.jpg',
'sancho_footer_min_bw.jpg'
))
{
$errorReceiverUid_arr[]= $kfMail;
}
}
}
if (isset($errorReceiverUid_arr))
{
return error('Mail updated Zeitwuensche could not be sent to :'. implode($errorReceiverUid_arr, ','));
}
return success();
}
/**
* Send Mail to LV Planung about all lectors who updated Zeitwuensche.
*
* @param $data_arr
* @param $stg_bezeichnung
*/
private function _sendMailToLvPlanung($data_arr)
{
$lektorenTabelle = '
<table><thead>
<tr>
<th style="text-align:left">Name</th>
<th style="text-align:left">UID</th>
</tr>
</thead><tbody>
';
foreach($data_arr as $lector)
{
$person = $this->PersonModel->getByUid($lector);
$lektorenTabelle.= '
<tr>
<td style="text-align:left">'. getData($person)[0]->vorname. ' '. getData($person)[0]->nachname. '</td>
<td style="text-align:left">['. $lector. ']</td>
</tr>
';
}
$lektorenTabelle.= '</tbody></table>';
$contentData_arr = array(
'datentabelle' => $lektorenTabelle
);
// Send mail
if (!sendSanchoMail(
'ZeitwunschUpdateMail',
$contentData_arr,
MAIL_LVPLAN,
'Änderung von Zeitwünschen',
'sancho_header_min_bw.jpg',
'sancho_footer_min_bw.jpg'
))
{
$errorReceiver = MAIL_LVPLAN;
}
if (isset($errorReceiver))
{
return error('Mail updated Zeitwuensche could not be sent to :'. $errorReceiver);
}
return success();
}
} }
@@ -359,7 +359,7 @@ class LehrauftragJob extends JOB_Controller
for ($i = 0; $i < $data_len; $i++) for ($i = 0; $i < $data_len; $i++)
{ {
// Get all users entitled by organisational unit // Get all users entitled by organisational unit
$result = $this->BenutzerrolleModel->getBenutzerByBerechtigung(self::BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN, $data[$i]['oe_kurzbz']); $result = $this->BenutzerrolleModel->getBenutzerByBerechtigung(self::BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN, $data[$i]['oe_kurzbz'], 'suid');
if ($berechtigung_arr = getData($result)) if ($berechtigung_arr = getData($result))
{ {
@@ -22,8 +22,8 @@ class approveAnrechnungDetail extends Auth_Controller
// Set required permissions // Set required permissions
parent::__construct( parent::__construct(
array( array(
'index' => 'lehre/anrechnung_genehmigen:rw', 'index' => 'lehre/anrechnung_genehmigen:r',
'download' => 'lehre/anrechnung_genehmigen:rw', 'download' => 'lehre/anrechnung_genehmigen:r',
'approve' => 'lehre/anrechnung_genehmigen:rw', 'approve' => 'lehre/anrechnung_genehmigen:rw',
'reject' => 'lehre/anrechnung_genehmigen:rw', 'reject' => 'lehre/anrechnung_genehmigen:rw',
'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw', 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw',
@@ -81,7 +81,7 @@ class approveAnrechnungDetail extends Auth_Controller
} }
// Check if user is entitled to read the Anrechnung // Check if user is entitled to read the Anrechnung
self::_checkIfEntitledToReadAnrechnung($anrechnung_id); $this->_checkIfEntitledToReadAnrechnung($anrechnung_id);
// Get Anrechung data // Get Anrechung data
$anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id); $anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id);
@@ -99,11 +99,16 @@ class approveAnrechnungDetail extends Auth_Controller
// Get Genehmigung data // Get Genehmigung data
$genehmigungData = $this->anrechnunglib->getGenehmigungData($anrechnung_id); $genehmigungData = $this->anrechnunglib->getGenehmigungData($anrechnung_id);
$hasReadOnlyAccess =
$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $antragData->studiengang_kz)
&& !$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 'suid', $antragData->studiengang_kz);
$viewData = array( $viewData = array(
'antragData' => $antragData, 'antragData' => $antragData,
'anrechnungData' => $anrechnungData, 'anrechnungData' => $anrechnungData,
'empfehlungData' => $empfehlungData, 'empfehlungData' => $empfehlungData,
'genehmigungData' => $genehmigungData 'genehmigungData' => $genehmigungData,
'hasReadOnlyAccess' => $hasReadOnlyAccess
); );
$this->load->view('lehre/anrechnung/approveAnrechnungDetail.php', $viewData); $this->load->view('lehre/anrechnung/approveAnrechnungDetail.php', $viewData);
@@ -385,13 +390,17 @@ class approveAnrechnungDetail extends Auth_Controller
} }
// Check if user is entitled to read dms doc // Check if user is entitled to read dms doc
self::_checkIfEntitledToReadDMSDoc($dms_id); $this->_checkIfEntitledToReadDMSDoc($dms_id);
// Set filename to be used on downlaod // Set filename to be used on downlaod
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
// Get file to be downloaded from DMS
$download = $this->dmslib->download($dms_id, $filename);
if (isError($download)) return $download;
// Download file // Download file
$this->dmslib->download($dms_id, $filename); $this->outputFile(getData($download));
} }
/** /**
@@ -412,32 +421,22 @@ class approveAnrechnungDetail extends Auth_Controller
{ {
$result = $this->AnrechnungModel->load($anrechnung_id); $result = $this->AnrechnungModel->load($anrechnung_id);
if(!$result = getData($result)[0]) if(!hasData($result))
{ {
show_error('Failed loading Anrechnung'); show_error('Failed loading Anrechnung');
} }
$result = $this->LehrveranstaltungModel->loadWhere(array( $result = $this->LehrveranstaltungModel->loadWhere(array(
'lehrveranstaltung_id' => $result->lehrveranstaltung_id 'lehrveranstaltung_id' => getData($result)[0]->lehrveranstaltung_id
)); ));
if(!$result = getData($result)[0]) $studiengang_kz = getData($result)[0]->studiengang_kz;
{
show_error('Failed loading Lehrveranstaltung');
}
// Get STGL // Check if user is entitled
$result = $this->StudiengangModel->getLeitung($result->studiengang_kz); if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz))
{
if($result = getData($result)[0]) show_error('You are not entitled to read this page');
{ }
if ($result->uid == $this->_uid)
{
return;
}
}
show_error('You are not entitled to read this Anrechnung');
} }
/** /**
@@ -457,23 +456,13 @@ class approveAnrechnungDetail extends Auth_Controller
'lehrveranstaltung_id' => $result->lehrveranstaltung_id 'lehrveranstaltung_id' => $result->lehrveranstaltung_id
)); ));
if(!$result = getData($result)[0]) $studiengang_kz = getData($result)[0]->studiengang_kz;
{
show_error('Failed loading Lehrveranstaltung');
}
// Get STGL // Check if user is entitled
$result = $this->StudiengangModel->getLeitung($result->studiengang_kz); if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz))
{
if($result = getData($result)[0]) show_error('You are not entitled to read this document');
{ }
if ($result->uid == $this->_uid)
{
return;
}
}
show_error('You are not entitled to read this document');
} }
/** /**
@@ -5,44 +5,45 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
class approveAnrechnungUebersicht extends Auth_Controller class approveAnrechnungUebersicht extends Auth_Controller
{ {
const BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN = 'lehre/anrechnung_genehmigen'; const BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN = 'lehre/anrechnung_genehmigen';
const BERECHTIGUNG_ANRECHNUNG_ANLEGEN = 'lehre/anrechnung_anlegen';
const REVIEW_ANRECHNUNG_URI = '/lehre/anrechnung/ReviewAnrechnungUebersicht'; const REVIEW_ANRECHNUNG_URI = '/lehre/anrechnung/ReviewAnrechnungUebersicht';
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP'; const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF'; const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor'; const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
const ANRECHNUNGSTATUS_APPROVED = 'approved'; const ANRECHNUNGSTATUS_APPROVED = 'approved';
const ANRECHNUNGSTATUS_REJECTED = 'rejected'; const ANRECHNUNGSTATUS_REJECTED = 'rejected';
public function __construct() public function __construct()
{ {
// Set required permissions // Set required permissions
parent::__construct( parent::__construct(
array( array(
'index' => 'lehre/anrechnung_genehmigen:rw', 'index' => 'lehre/anrechnung_genehmigen:r',
'download' => 'lehre/anrechnung_genehmigen:rw', 'download' => 'lehre/anrechnung_genehmigen:r',
'approve' => 'lehre/anrechnung_genehmigen:rw', 'approve' => 'lehre/anrechnung_genehmigen:rw',
'reject' => 'lehre/anrechnung_genehmigen:rw', 'reject' => 'lehre/anrechnung_genehmigen:rw',
'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw' 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw'
) )
); );
// Load models // Load models
$this->load->model('education/Anrechnung_model', 'AnrechnungModel'); $this->load->model('education/Anrechnung_model', 'AnrechnungModel');
$this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel'); $this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel');
$this->load->model('content/DmsVersion_model', 'DmsVersionModel'); $this->load->model('content/DmsVersion_model', 'DmsVersionModel');
// Load libraries // Load libraries
$this->load->library('WidgetLib'); $this->load->library('WidgetLib');
$this->load->library('PermissionLib'); $this->load->library('PermissionLib');
$this->load->library('AnrechnungLib'); $this->load->library('AnrechnungLib');
$this->load->library('DmsLib'); $this->load->library('DmsLib');
// Load helpers // Load helpers
$this->load->helper('form'); $this->load->helper('form');
$this->load->helper('url'); $this->load->helper('url');
$this->load->helper('hlp_sancho_helper'); $this->load->helper('hlp_sancho_helper');
// Load language phrases // Load language phrases
$this->loadPhrases( $this->loadPhrases(
array( array(
@@ -54,37 +55,46 @@ class approveAnrechnungUebersicht extends Auth_Controller
'table' 'table'
) )
); );
$this->_setAuthUID(); $this->_setAuthUID();
$this->setControllerId(); $this->setControllerId();
} }
public function index() public function index()
{ {
// Get study semester // Get study semester
$studiensemester_kurzbz = $this->input->get('studiensemester'); $studiensemester_kurzbz = $this->input->get('studiensemester');
if (isEmptyString($studiensemester_kurzbz)) if (isEmptyString($studiensemester_kurzbz))
{ {
$result = $this->StudiensemesterModel->getNearest(); $result = $this->StudiensemesterModel->getNearest();
$studiensemester_kurzbz = getData($result)[0]->studiensemester_kurzbz; $studiensemester_kurzbz = getData($result)[0]->studiensemester_kurzbz;
} }
// Get studiengaenge the user is entitled for // Get studiengaenge the user is entitled for
if (!$studiengang_kz_arr = $this->permissionlib->getSTG_isEntitledFor(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN)) if (!$studiengang_kz_arr = $this->permissionlib->getSTG_isEntitledFor(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN))
{ {
show_error(getError($studiengang_kz_arr)); show_error(getError($studiengang_kz_arr));
} }
$hasReadOnlyAccess =
$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's')
&& !$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 'suid');
// This permission is checked here to disable create Anrechnung button, if permission is not given
$hasCreateAnrechnungAccess = $this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_ANLEGEN, 's');
$viewData = array( $viewData = array(
'studiensemester_selected' => $studiensemester_kurzbz, 'studiensemester_selected' => $studiensemester_kurzbz,
'studiengaenge_entitled' => $studiengang_kz_arr 'studiengaenge_entitled' => $studiengang_kz_arr,
'hasReadOnlyAccess' => $hasReadOnlyAccess,
'hasCreateAnrechnungAccess' => $hasCreateAnrechnungAccess
); );
$this->load->view('lehre/anrechnung/approveAnrechnungUebersicht.php', $viewData); $this->load->view('lehre/anrechnung/approveAnrechnungUebersicht.php', $viewData);
} }
/** /**
* Approve Anrechnungen. * Approve Anrechnungen.
*/ */
@@ -97,22 +107,30 @@ class approveAnrechnungUebersicht extends Auth_Controller
{ {
return $this->outputJsonError('Fehler beim Übertragen der Daten.'); return $this->outputJsonError('Fehler beim Übertragen der Daten.');
} }
$json = array(
'status_kurzbz' => self::ANRECHNUNGSTATUS_APPROVED,
'status_bezeichnung' => $this->anrechnunglib->getStatusbezeichnung(self::ANRECHNUNGSTATUS_APPROVED),
'prestudenten' => []
);
// Approve Anrechnung // Approve Anrechnung
foreach ($data as $item) foreach ($data as $item)
{ {
if ($this->anrechnunglib->approveAnrechnung($item['anrechnung_id'])) // Get Prestudent
$this->AnrechnungModel->addSelect('prestudent_id');
$result = $this->AnrechnungModel->load($item['anrechnung_id']);
$prestudent_id = getData($result)[0]->prestudent_id;
// Approve
if ($this->anrechnunglib->approveAnrechnung($item['anrechnung_id']))
{ {
$json[]= array( $json['prestudenten'][$prestudent_id][] = $item['anrechnung_id'];
'anrechnung_id' => $item['anrechnung_id'],
'status_kurzbz' => self::ANRECHNUNGSTATUS_APPROVED,
'status_bezeichnung' => $this->anrechnunglib->getStatusbezeichnung(self::ANRECHNUNGSTATUS_APPROVED)
);
} }
} }
// Output json to ajax // Output json to ajax
if (isset($json) && !isEmptyArray($json)) if (isset($json) && !isEmptyArray($json['prestudenten']))
{ {
return $this->outputJsonSuccess($json); return $this->outputJsonSuccess($json);
} }
@@ -121,20 +139,20 @@ class approveAnrechnungUebersicht extends Auth_Controller
return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.'); return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.');
} }
} }
/** /**
* Reject Anrechnungen. * Reject Anrechnungen.
*/ */
public function reject() public function reject()
{ {
$data = $this->input->post('data'); $data = $this->input->post('data');
// Validate data // Validate data
if (isEmptyArray($data)) if (isEmptyArray($data))
{ {
return $this->outputJsonError('Fehler beim Übertragen der Daten.'); return $this->outputJsonError('Fehler beim Übertragen der Daten.');
} }
// Reject Anrechnung // Reject Anrechnung
foreach ($data as $item) foreach ($data as $item)
{ {
@@ -147,7 +165,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
); );
} }
} }
// Output json to ajax // Output json to ajax
if (isset($json) && !isEmptyArray($json)) if (isset($json) && !isEmptyArray($json))
{ {
@@ -158,22 +176,22 @@ class approveAnrechnungUebersicht extends Auth_Controller
return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.'); return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.');
} }
} }
/** /**
* Request recommendation for Anrechnungen. * Request recommendation for Anrechnungen.
*/ */
public function requestRecommendation() public function requestRecommendation()
{ {
$data = $this->input->post('data'); $data = $this->input->post('data');
if(isEmptyArray($data)) if(isEmptyArray($data))
{ {
return $this->outputJsonError('Fehler beim Übertragen der Daten.'); return $this->outputJsonError('Fehler beim Übertragen der Daten.');
} }
$retval = array(); $retval = array();
$counter = 0; $counter = 0;
foreach ($data as $item) foreach ($data as $item)
{ {
// Check if Anrechnungs-LV has lector // Check if Anrechnungs-LV has lector
@@ -181,7 +199,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
{ {
// Count up LV with no lector // Count up LV with no lector
$counter++; $counter++;
// Continue loop, if LV has no lector // Continue loop, if LV has no lector
continue; continue;
} }
@@ -195,7 +213,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
$empfehlungsanfrage_an = !isEmptyArray($lector_arr) $empfehlungsanfrage_an = !isEmptyArray($lector_arr)
? implode(', ', array_column($lector_arr, 'fullname')) ? implode(', ', array_column($lector_arr, 'fullname'))
: ''; : '';
$retval[]= array( $retval[]= array(
'anrechnung_id' => $item['anrechnung_id'], 'anrechnung_id' => $item['anrechnung_id'],
'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR, 'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR,
@@ -206,7 +224,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
); );
} }
} }
/** /**
* Send mails to lectors * Send mails to lectors
* NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector * NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector
@@ -216,16 +234,16 @@ class approveAnrechnungUebersicht extends Auth_Controller
{ {
self::_sendSanchoMailToLectors($retval); self::_sendSanchoMailToLectors($retval);
} }
// Output json to ajax // Output json to ajax
if (isEmptyArray($retval) && $counter == 0) if (isEmptyArray($retval) && $counter == 0)
{ {
return $this->outputJsonError('Es wurden keine Empfehlungen angefordert'); return $this->outputJsonError('Es wurden keine Empfehlungen angefordert');
} }
return $this->outputJsonSuccess($retval); return $this->outputJsonSuccess($retval);
} }
/** /**
* Download and open uploaded document (Nachweisdokument). * Download and open uploaded document (Nachweisdokument).
*/ */
@@ -239,26 +257,29 @@ class approveAnrechnungUebersicht extends Auth_Controller
} }
// Check if user is entitled to read dms doc // Check if user is entitled to read dms doc
self::_checkIfEntitledToReadDMSDoc($dms_id); $this->_checkIfEntitledToReadDMSDoc($dms_id);
// Set filename to be used on downlaod // Set filename to be used on downlaod
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
// Get file to be downloaded from DMS
$download = $this->dmslib->download($dms_id, $filename);
if (isError($download)) return $download;
// Download file // Download file
$this->dmslib->download($dms_id, $filename); $this->outputFile(getData($download));
} }
/** /**
* Retrieve the UID of the logged user and checks if it is valid * Retrieve the UID of the logged user and checks if it is valid
*/ */
private function _setAuthUID() private function _setAuthUID()
{ {
$this->_uid = getAuthUID(); $this->_uid = getAuthUID();
if (!$this->_uid) show_error('User authentification failed'); if (!$this->_uid) show_error('User authentification failed');
} }
/** /**
* Check if user is entitled to read dms doc * Check if user is entitled to read dms doc
* @param $dms_id * @param $dms_id
@@ -266,36 +287,30 @@ class approveAnrechnungUebersicht extends Auth_Controller
private function _checkIfEntitledToReadDMSDoc($dms_id) private function _checkIfEntitledToReadDMSDoc($dms_id)
{ {
$result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id)); $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id));
if(!$result = getData($result)[0]) if(!$result = getData($result)[0])
{ {
show_error('Failed retrieving Anrechnung'); show_error('Failed retrieving Anrechnung');
} }
$result = $this->LehrveranstaltungModel->loadWhere(array( $result = $this->LehrveranstaltungModel->loadWhere(array(
'lehrveranstaltung_id' => $result->lehrveranstaltung_id 'lehrveranstaltung_id' => $result->lehrveranstaltung_id
)); ));
if(!$result = getData($result)[0]) if(!$result = getData($result)[0])
{ {
show_error('Failed loading Lehrveranstaltung'); show_error('Failed loading Lehrveranstaltung');
} }
// Get STGL $studiengang_kz = $result->studiengang_kz;
$result = $this->StudiengangModel->getLeitung($result->studiengang_kz);
// Check if user is entitled
if($result = getData($result)[0]) if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz))
{ {
if ($result->uid == $this->_uid) show_error('You are not entitled to read this document');
{ }
return;
}
}
show_error('You are not entitled to read this document');
} }
/** /**
* Send mail to lectors asking for recommendation. (first to LV-Leitung, if not present to all lectors of lv) * Send mail to lectors asking for recommendation. (first to LV-Leitung, if not present to all lectors of lv)
* @param $mail_params * @param $mail_params
@@ -305,7 +320,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
{ {
// Get Lehrveranstaltungen // Get Lehrveranstaltungen
$anrechnung_arr = array(); $anrechnung_arr = array();
foreach ($mail_params as $item) foreach ($mail_params as $item)
{ {
$this->AnrechnungModel->addSelect('lehrveranstaltung_id, studiensemester_kurzbz'); $this->AnrechnungModel->addSelect('lehrveranstaltung_id, studiensemester_kurzbz');
@@ -314,10 +329,10 @@ class approveAnrechnungUebersicht extends Auth_Controller
'studiensemester_kurzbz' => $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiensemester_kurzbz 'studiensemester_kurzbz' => $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiensemester_kurzbz
); );
} }
$anrechnung_arr = array_unique($anrechnung_arr, SORT_REGULAR); $anrechnung_arr = array_unique($anrechnung_arr, SORT_REGULAR);
/** /**
* Get lectors (prio for LV-Leitung, if not present to all lectors of LV. * Get lectors (prio for LV-Leitung, if not present to all lectors of LV.
* Anyway this function will receive a unique array to avoid sending more mails to one and the same lector. * Anyway this function will receive a unique array to avoid sending more mails to one and the same lector.
@@ -329,27 +344,27 @@ class approveAnrechnungUebersicht extends Auth_Controller
{ {
$to = $lector->uid; $to = $lector->uid;
$vorname = $lector->vorname; $vorname = $lector->vorname;
// Get full name of stgl // Get full name of stgl
$this->load->model('person/Person_model', 'PersonModel'); $this->load->model('person/Person_model', 'PersonModel');
if (!$stgl_name = getData($this->PersonModel->getFullName($this->_uid))) if (!$stgl_name = getData($this->PersonModel->getFullName($this->_uid)))
{ {
show_error ('Failed retrieving person'); show_error ('Failed retrieving person');
} }
// Link to Antrag genehmigen // Link to Antrag genehmigen
$url = $url =
CIS_ROOT. 'cis/index.php?menu='. CIS_ROOT. 'cis/index.php?menu='.
CIS_ROOT. 'cis/menu.php?content_id=&content='. CIS_ROOT. 'cis/menu.php?content_id=&content='.
CIS_ROOT. index_page(). self::REVIEW_ANRECHNUNG_URI; CIS_ROOT. index_page(). self::REVIEW_ANRECHNUNG_URI;
// Prepare mail content // Prepare mail content
$body_fields = array( $body_fields = array(
'vorname' => $vorname, 'vorname' => $vorname,
'stgl_name' => $stgl_name, 'stgl_name' => $stgl_name,
'link' => anchor($url, 'Anrechnungsanträge Übersicht') 'link' => anchor($url, 'Anrechnungsanträge Übersicht')
); );
sendSanchoMail( sendSanchoMail(
'AnrechnungEmpfehlungAnfordern', 'AnrechnungEmpfehlungAnfordern',
$body_fields, $body_fields,
@@ -359,7 +374,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
} }
return true; return true;
} }
/** /**
* Get lectors (prio for LV-Leitung, if not present to all lectors of LV. * Get lectors (prio for LV-Leitung, if not present to all lectors of LV.
* Anyway this function will receive a unique array to avoid sending more mails to one and the same lector. * Anyway this function will receive a unique array to avoid sending more mails to one and the same lector.
@@ -369,33 +384,34 @@ class approveAnrechnungUebersicht extends Auth_Controller
private function _getLectors($anrechnung_arr) private function _getLectors($anrechnung_arr)
{ {
$lector_arr = array(); $lector_arr = array();
// Get lectors // Get lectors
foreach($anrechnung_arr as $anrechnung) foreach($anrechnung_arr as $anrechnung)
{ {
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$result = $this->LehrveranstaltungModel->getLecturersByLv($anrechnung['studiensemester_kurzbz'], $anrechnung['lehrveranstaltung_id']); $result = $this->LehrveranstaltungModel->getLecturersByLv($anrechnung['studiensemester_kurzbz'], $anrechnung['lehrveranstaltung_id']);
if (!$result = getData($result)) if (!hasData($result))
{ {
show_error('Failed retrieving lectors of Lehrveranstaltung'); show_error('Failed retrieving lectors of Lehrveranstaltung');
} }
$lecturersByLv = getData($result);
// Check if lv has LV-Leitung // Check if lv has LV-Leitung
$key = array_search(true, array_column($result, 'lvleiter')); $key = array_search(true, array_column($lecturersByLv, 'lvleiter'));
// If lv has LV-Leitung, keep only the one // If lv has LV-Leitung, keep only the one
if ($key !== false) if ($key !== false)
{ {
$lector_arr[]= $result[$key]; $lector_arr[]= $lecturersByLv[$key];
} }
// ...otherwise keep all lectors // ...otherwise keep all lectors
else else
{ {
$lector_arr = array_merge($lector_arr, $result); $lector_arr = array_merge($lector_arr, $lecturersByLv);
} }
} }
/** /**
* NOTE: This step is only done to make the array unique by uid, vorname and nachname in the following step * NOTE: This step is only done to make the array unique by uid, vorname and nachname in the following step
* (e.g. if same lector is ones LV-Leitung and another time not, then array_unique would leave both. * (e.g. if same lector is ones LV-Leitung and another time not, then array_unique would leave both.
@@ -405,10 +421,10 @@ class approveAnrechnungUebersicht extends Auth_Controller
{ {
unset($lector->lvleiter); unset($lector->lvleiter);
} }
// Now make the lector array aka mail receivers unique // Now make the lector array aka mail receivers unique
$lector_arr = array_unique($lector_arr, SORT_REGULAR); $lector_arr = array_unique($lector_arr, SORT_REGULAR);
return $lector_arr; return $lector_arr;
} }
} }
@@ -6,13 +6,13 @@ class requestAnrechnung extends Auth_Controller
{ {
const REQUEST_ANRECHNUNG_URI = '/lehre/anrechnung/RequestAnrechnung'; const REQUEST_ANRECHNUNG_URI = '/lehre/anrechnung/RequestAnrechnung';
const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht'; const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht';
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP'; const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF'; const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor'; const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
const ANRECHNUNGSTATUS_APPROVED = 'approved'; const ANRECHNUNGSTATUS_APPROVED = 'approved';
const ANRECHNUNGSTATUS_REJECTED = 'rejected'; const ANRECHNUNGSTATUS_REJECTED = 'rejected';
public function __construct() public function __construct()
{ {
// Set required permissions // Set required permissions
@@ -23,22 +23,22 @@ class requestAnrechnung extends Auth_Controller
'download' => 'student/anrechnung_beantragen:rw', 'download' => 'student/anrechnung_beantragen:rw',
) )
); );
// Load models // Load models
$this->load->model('education/Anrechnung_model', 'AnrechnungModel'); $this->load->model('education/Anrechnung_model', 'AnrechnungModel');
$this->load->model('content/DmsVersion_model', 'DmsVersionModel'); $this->load->model('content/DmsVersion_model', 'DmsVersionModel');
// Load libraries // Load libraries
$this->load->library('WidgetLib'); $this->load->library('WidgetLib');
$this->load->library('PermissionLib'); $this->load->library('PermissionLib');
$this->load->library('AnrechnungLib'); $this->load->library('AnrechnungLib');
$this->load->library('DmsLib'); $this->load->library('DmsLib');
// Load helpers // Load helpers
$this->load->helper('form'); $this->load->helper('form');
$this->load->helper('url'); $this->load->helper('url');
$this->load->helper('hlp_sancho_helper'); $this->load->helper('hlp_sancho_helper');
// Load configs // Load configs
$this->load->config('anrechnung'); $this->load->config('anrechnung');
@@ -80,7 +80,7 @@ class requestAnrechnung extends Auth_Controller
$prestudent_id = getData($result)[0]->prestudent_id; $prestudent_id = getData($result)[0]->prestudent_id;
// Check if application deadline is expired // Check if application deadline is expired
$is_expired = self::_checkAntragDeadline( $is_expired = self::_isExpired(
$this->config->item('submit_application_start'), $this->config->item('submit_application_start'),
$this->config->item('submit_application_end'), $this->config->item('submit_application_end'),
$studiensemester_kurzbz $studiensemester_kurzbz
@@ -119,7 +119,7 @@ class requestAnrechnung extends Auth_Controller
// Validate data // Validate data
if (empty($_FILES['uploadfile']['name'])) if (empty($_FILES['uploadfile']['name']))
{ {
return $this->outputJsonError($this->p->t('ui', 'errorUploadFehlt')); return $this->outputJsonError($this->p->t('ui', 'errorUploadFehltOderZuGross'));
} }
if (isEmptyString($begruendung_id) || if (isEmptyString($begruendung_id) ||
@@ -205,9 +205,14 @@ class requestAnrechnung extends Auth_Controller
} }
// Check if user is entitled to read dms doc // Check if user is entitled to read dms doc
self::_checkIfEntitledToReadDMSDoc($dms_id); $this->_checkIfEntitledToReadDMSDoc($dms_id);
$this->dmslib->download($dms_id); // Get file to be downloaded from DMS
$download = $this->dmslib->download($dms_id);
if (isError($download)) return $download;
// Download file
$this->outputFile(getData($download));
} }
/** /**
@@ -216,23 +221,23 @@ class requestAnrechnung extends Auth_Controller
private function _setAuthUID() private function _setAuthUID()
{ {
$this->_uid = getAuthUID(); $this->_uid = getAuthUID();
if (!$this->_uid) show_error('User authentification failed'); if (!$this->_uid) show_error('User authentification failed');
} }
/** /**
* Check if application deadline is expired. * Check if application deadline is expired.
* *
* @param $start Start date for application submission. * @param $start Start date for application submission.
* @param $ende End date for application submission. * @param $ende End date for application submission.
* @param $studiensemester_kurzbz * @param $studiensemester_kurzbz
* @return bool True if today is not during the start- and ending deadlines (= if is expired) * @return bool True if deadline is expired
* @throws Exception * @throws Exception
*/ */
private function _checkAntragDeadline($start, $ende, $studiensemester_kurzbz) private function _isExpired($start, $ende, $studiensemester_kurzbz)
{ {
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
// If start is not given, set to Semesterstart. // If start is not given, set to Semesterstart.
if (!isset($start) || isEmptyString($start)) if (!isset($start) || isEmptyString($start))
{ {
@@ -240,7 +245,7 @@ class requestAnrechnung extends Auth_Controller
$result = $this->StudiensemesterModel->load($studiensemester_kurzbz); $result = $this->StudiensemesterModel->load($studiensemester_kurzbz);
$start = getData($result)[0]->start; $start = getData($result)[0]->start;
} }
// If ende is not given, set to Semesterende. // If ende is not given, set to Semesterende.
if (!isset($ende) || isEmptyString($ende)) if (!isset($ende) || isEmptyString($ende))
{ {
@@ -248,15 +253,15 @@ class requestAnrechnung extends Auth_Controller
$result = $this->StudiensemesterModel->load($studiensemester_kurzbz); $result = $this->StudiensemesterModel->load($studiensemester_kurzbz);
$ende = getData($result)[0]->ende; $ende = getData($result)[0]->ende;
} }
$today = new DateTime('today midnight'); $today = new DateTime('today midnight');
$start = new DateTime($start); $start = new DateTime($start);
$ende = new DateTime($ende); $ende = new DateTime($ende);
// True if today is not during the start- and ending deadlines (= if is expired) // True if expired
return ($today <= $start || $today >= $ende); return ($today < $start || $today > $ende);
} }
/** /**
* Check if user is entitled to read dms doc. * Check if user is entitled to read dms doc.
* *
@@ -268,9 +273,9 @@ class requestAnrechnung extends Auth_Controller
{ {
show_error('Failed loading Student'); show_error('Failed loading Student');
} }
$result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id)); $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id));
if($result = getData($result)[0]) if($result = getData($result)[0])
{ {
if ($result->prestudent_id == $student->prestudent_id) if ($result->prestudent_id == $student->prestudent_id)
@@ -278,10 +283,10 @@ class requestAnrechnung extends Auth_Controller
return; return;
} }
} }
show_error('You are not entitled to read this document'); show_error('You are not entitled to read this document');
} }
/** /**
* Check if application already exists. * Check if application already exists.
* *
@@ -297,15 +302,15 @@ class requestAnrechnung extends Auth_Controller
'studiensemester_kurzbz' => $studiensemester_kurzbz, 'studiensemester_kurzbz' => $studiensemester_kurzbz,
'prestudent_id' => $prestudent_id 'prestudent_id' => $prestudent_id
)); ));
if (isError($result)) if (isError($result))
{ {
show_error(getError($result)); show_error(getError($result));
} }
return hasData($result); return hasData($result);
} }
/** /**
* Check if applications' study semester is actual study semester. * Check if applications' study semester is actual study semester.
* *
@@ -317,26 +322,26 @@ class requestAnrechnung extends Auth_Controller
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
$result = $this->StudiensemesterModel->getNearest(); $result = $this->StudiensemesterModel->getNearest();
$actual_ss = getData($result)[0]->studiensemester_kurzbz; $actual_ss = getData($result)[0]->studiensemester_kurzbz;
return $studiensemester_kurzbz == $actual_ss; return $studiensemester_kurzbz == $actual_ss;
} }
private function _LVhasBlockingGrades($studiensemester_kurzbz, $lehrveranstaltung_id) private function _LVhasBlockingGrades($studiensemester_kurzbz, $lehrveranstaltung_id)
{ {
// Get Note of Lehrveranstaltung // Get Note of Lehrveranstaltung
$this->load->model('education/Lvgesamtnote_model', 'LvgesamtnoteModel'); $this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel');
$result = $this->LvgesamtnoteModel->load(array( $result = $this->ZeugnisnoteModel->load(array(
'student_uid' => $this->_uid, 'student_uid' => $this->_uid,
'studiensemester_kurzbz' => $studiensemester_kurzbz, 'studiensemester_kurzbz' => $studiensemester_kurzbz,
'lehrveranstaltung_id' => $lehrveranstaltung_id 'lehrveranstaltung_id' => $lehrveranstaltung_id
) )
); );
// If Lehrveranstaltung has Note // If Lehrveranstaltung has Note
if (hasData($result)) if (hasData($result))
{ {
$note = getData($result)[0]->note; $note = getData($result)[0]->note;
// Check if Note is a blocking grade // Check if Note is a blocking grade
if (in_array($note, $this->config->item('grades_blocking_application'))) if (in_array($note, $this->config->item('grades_blocking_application')))
{ {
@@ -345,7 +350,7 @@ class requestAnrechnung extends Auth_Controller
} }
return false; return false;
} }
/** /**
* Upload file via DMS library. * Upload file via DMS library.
* *
@@ -362,8 +367,8 @@ class requestAnrechnung extends Auth_Controller
'insertamum' => (new DateTime())->format('Y-m-d H:i:s'), 'insertamum' => (new DateTime())->format('Y-m-d H:i:s'),
'insertvon' => $this->_uid 'insertvon' => $this->_uid
); );
// Upload document // Upload document
return $this->dmslib->upload($dms, 'uploadfile', array('pdf')); return $this->dmslib->upload($dms, 'uploadfile', array('pdf'));
} }
} }
@@ -79,7 +79,7 @@ class reviewAnrechnungDetail extends Auth_Controller
// Get Anrechung data // Get Anrechung data
$anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id); $anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id);
// Get Antrag data // Get Antrag data
$antragData = $this->anrechnunglib->getAntragData( $antragData = $this->anrechnunglib->getAntragData(
$anrechnungData->prestudent_id, $anrechnungData->prestudent_id,
@@ -110,7 +110,7 @@ class reviewAnrechnungDetail extends Auth_Controller
{ {
return $this->outputJsonError('Fehler beim Übertragen der Daten.'); return $this->outputJsonError('Fehler beim Übertragen der Daten.');
} }
// Get lectors person data // Get lectors person data
if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0]) if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0])
{ {
@@ -217,15 +217,18 @@ class reviewAnrechnungDetail extends Auth_Controller
} }
// Check if user is entitled to read dms doc // Check if user is entitled to read dms doc
self::_checkIfEntitledToReadDMSDoc($dms_id); $this->_checkIfEntitledToReadDMSDoc($dms_id);
// Set filename to be used on downlaod // Set filename to be used on downlaod
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
// Download file
$this->dmslib->download($dms_id, $filename);
}
// Get file to be downloaded from DMS
$download = $this->dmslib->download($dms_id, $filename);
if (isError($download)) return $download;
// Download file
$this->outputFile(getData($download));
}
/** /**
* Retrieve the UID of the logged user and checks if it is valid * Retrieve the UID of the logged user and checks if it is valid
@@ -319,15 +322,10 @@ class reviewAnrechnungDetail extends Auth_Controller
// Send mail to STGL of each studiengang // Send mail to STGL of each studiengang
foreach ($studiengang_kz_arr as $studiengang_kz) foreach ($studiengang_kz_arr as $studiengang_kz)
{ {
// Get STGL mail address, if available, otherwise get assistance mail address
list ($to, $vorname) = $this->_getSTGLMailAddress($studiengang_kz);
// Get full name of lector // Get full name of lector
$this->load->model('person/Person_model', 'PersonModel'); $this->load->model('person/Person_model', 'PersonModel');
if (!$lector_name = getData($this->PersonModel->getFullName($this->_uid))) $result = $this->PersonModel->getFullName($this->_uid);
{ $lector_name = hasData($result) ? getData($result) : 'Ein Lektor';
show_error ('Failed retrieving person');
}
// Link to Antrag genehmigen // Link to Antrag genehmigen
$url = $url =
@@ -335,22 +333,26 @@ class reviewAnrechnungDetail extends Auth_Controller
CIS_ROOT. 'cis/menu.php?content_id=&content='. CIS_ROOT. 'cis/menu.php?content_id=&content='.
CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI; CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI;
// Prepare mail content // Get STGL mail address, if available, otherwise get assistance mail address
$body_fields = array( if( !$result = $this->_getSTGLMailAddress($studiengang_kz)) return false;
'vorname' => $vorname, foreach ($result as $stgl)
'lektor_name' => $lector_name, {
'empfehlung' => $empfehlung ? 'positive' : 'negative', // Prepare mail content
'link' => anchor($url, 'Anrechnungsanträge Übersicht') $body_fields = array(
); 'vorname' => $stgl['vorname'],
'lektor_name' => $lector_name,
'empfehlung' => $empfehlung ? 'positive' : 'negative',
'link' => anchor($url, 'Anrechnungsanträge Übersicht')
);
sendSanchoMail( sendSanchoMail(
'AnrechnungEmpfehlungAbgeben', 'AnrechnungEmpfehlungAbgeben',
$body_fields, $body_fields,
$to, $stgl['to'],
'Anerkennung nachgewiesener Kenntnisse: Empfehlung wurde abgegeben' 'Anerkennung nachgewiesener Kenntnisse: Empfehlung wurde abgegeben'
); );
}
} }
return true; return true;
} }
@@ -361,13 +363,18 @@ class reviewAnrechnungDetail extends Auth_Controller
$result = $this->StudiengangModel->getLeitung($stg_kz); $result = $this->StudiengangModel->getLeitung($stg_kz);
// Get STGL mail address, if available // Get STGL mail address, if available
if (hasData($result)) if (hasData($result))
{ {
return array( foreach (getData($result) as $stgl)
$result->retval[0]->uid. '@'. DOMAIN, {
$result->retval[0]->vorname $stglMailAdress_arr[]= array(
); 'to' => $stgl->uid. '@'. DOMAIN,
} 'vorname' => $stgl->vorname
);
}
return $stglMailAdress_arr;
}
// ...otherwise get assistance mail address // ...otherwise get assistance mail address
else else
{ {
@@ -380,6 +387,10 @@ class reviewAnrechnungDetail extends Auth_Controller
'' ''
); );
} }
else
{
return false;
}
} }
} }
@@ -5,15 +5,15 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
class reviewAnrechnungUebersicht extends Auth_Controller class reviewAnrechnungUebersicht extends Auth_Controller
{ {
const BERECHTIGUNG_ANRECHNUNG_EMPFEHLEN = 'lehre/anrechnung_empfehlen'; const BERECHTIGUNG_ANRECHNUNG_EMPFEHLEN = 'lehre/anrechnung_empfehlen';
const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht'; const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht';
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP'; const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF'; const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor'; const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
const ANRECHNUNGSTATUS_APPROVED = 'approved'; const ANRECHNUNGSTATUS_APPROVED = 'approved';
const ANRECHNUNGSTATUS_REJECTED = 'rejected'; const ANRECHNUNGSTATUS_REJECTED = 'rejected';
public function __construct() public function __construct()
{ {
// Set required permissions // Set required permissions
@@ -25,24 +25,24 @@ class reviewAnrechnungUebersicht extends Auth_Controller
'dontRecommend' => 'lehre/anrechnung_empfehlen:rw' 'dontRecommend' => 'lehre/anrechnung_empfehlen:rw'
) )
); );
// Load models // Load models
$this->load->model('education/Anrechnung_model', 'AnrechnungModel'); $this->load->model('education/Anrechnung_model', 'AnrechnungModel');
$this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel'); $this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel');
$this->load->model('content/DmsVersion_model', 'DmsVersionModel'); $this->load->model('content/DmsVersion_model', 'DmsVersionModel');
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
// Load libraries // Load libraries
$this->load->library('WidgetLib'); $this->load->library('WidgetLib');
$this->load->library('PermissionLib'); $this->load->library('PermissionLib');
$this->load->library('AnrechnungLib'); $this->load->library('AnrechnungLib');
$this->load->library('DmsLib'); $this->load->library('DmsLib');
// Load helpers // Load helpers
$this->load->helper('form'); $this->load->helper('form');
$this->load->helper('url'); $this->load->helper('url');
$this->load->helper('hlp_sancho_helper'); $this->load->helper('hlp_sancho_helper');
// Load language phrases // Load language phrases
$this->loadPhrases( $this->loadPhrases(
array( array(
@@ -54,12 +54,12 @@ class reviewAnrechnungUebersicht extends Auth_Controller
'table' 'table'
) )
); );
$this->_setAuthUID(); $this->_setAuthUID();
$this->setControllerId(); $this->setControllerId();
} }
public function index() public function index()
{ {
// Get study semester // Get study semester
@@ -70,14 +70,14 @@ class reviewAnrechnungUebersicht extends Auth_Controller
$result = $this->StudiensemesterModel->getNearest(); $result = $this->StudiensemesterModel->getNearest();
$studiensemester_kurzbz = getData($result)[0]->studiensemester_kurzbz; $studiensemester_kurzbz = getData($result)[0]->studiensemester_kurzbz;
} }
$viewData = array( $viewData = array(
'studiensemester_selected' => $studiensemester_kurzbz 'studiensemester_selected' => $studiensemester_kurzbz
); );
$this->load->view('lehre/anrechnung/reviewAnrechnungUebersicht.php', $viewData); $this->load->view('lehre/anrechnung/reviewAnrechnungUebersicht.php', $viewData);
} }
/** /**
* Recommend Anrechnungen. * Recommend Anrechnungen.
*/ */
@@ -103,7 +103,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller
); );
} }
} }
// Output json to ajax // Output json to ajax
if (isset($json) && !isEmptyArray($json)) if (isset($json) && !isEmptyArray($json))
{ {
@@ -123,19 +123,19 @@ class reviewAnrechnungUebersicht extends Auth_Controller
return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt'));
} }
} }
/** /**
* Dont recommend Anrechnungen. * Dont recommend Anrechnungen.
*/ */
public function dontRecommend() public function dontRecommend()
{ {
$data = $this->input->post('data'); $data = $this->input->post('data');
if(isEmptyArray($data)) if(isEmptyArray($data))
{ {
return $this->outputJsonError('Fehler beim Übertragen der Daten.'); return $this->outputJsonError('Fehler beim Übertragen der Daten.');
} }
foreach ($data as $item) foreach ($data as $item)
{ {
// Approve Anrechnung // Approve Anrechnung
@@ -149,7 +149,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller
); );
} }
} }
// Output json to ajax // Output json to ajax
if (isset($json) && !isEmptyArray($json)) if (isset($json) && !isEmptyArray($json))
{ {
@@ -158,7 +158,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller
{ {
show_error('Failed sending emails'); show_error('Failed sending emails');
} }
return $this->outputJsonSuccess($json); return $this->outputJsonSuccess($json);
} }
else else
@@ -166,7 +166,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller
return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt'));
} }
} }
/** /**
* Download and open uploaded document (Nachweisdokument). * Download and open uploaded document (Nachweisdokument).
*/ */
@@ -178,28 +178,32 @@ class reviewAnrechnungUebersicht extends Auth_Controller
{ {
show_error('Wrong parameter'); show_error('Wrong parameter');
} }
// Check if user is entitled to read dms doc // Check if user is entitled to read dms doc
self::_checkIfEntitledToReadDMSDoc($dms_id); $this->_checkIfEntitledToReadDMSDoc($dms_id);
// Set filename to be used on downlaod // Set filename to be used on downlaod
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
// Get file to be downloaded from DMS
$download = $this->dmslib->download($dms_id, $filename);
if (isError($download)) return $download;
// Download file // Download file
$this->dmslib->download($dms_id, $filename); $this->outputFile(getData($download));
} }
/** /**
* Retrieve the UID of the logged user and checks if it is valid * Retrieve the UID of the logged user and checks if it is valid
*/ */
private function _setAuthUID() private function _setAuthUID()
{ {
$this->_uid = getAuthUID(); $this->_uid = getAuthUID();
if (!$this->_uid) show_error('User authentification failed'); if (!$this->_uid) show_error('User authentification failed');
} }
/** /**
* Check if user is entitled to read dms doc * Check if user is entitled to read dms doc
* @param $dms_id * @param $dms_id
@@ -207,15 +211,15 @@ class reviewAnrechnungUebersicht extends Auth_Controller
private function _checkIfEntitledToReadDMSDoc($dms_id) private function _checkIfEntitledToReadDMSDoc($dms_id)
{ {
$result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id)); $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id));
if(!$result = getData($result)[0]) if(!$result = getData($result)[0])
{ {
show_error('Failed retrieving Anrechnung'); show_error('Failed retrieving Anrechnung');
} }
$result = $this->LehrveranstaltungModel $result = $this->LehrveranstaltungModel
->getLecturersByLv($result->studiensemester_kurzbz, $result->lehrveranstaltung_id); ->getLecturersByLv($result->studiensemester_kurzbz, $result->lehrveranstaltung_id);
if($result = getData($result)) if($result = getData($result))
{ {
$entitled_lector_arr = array_column($result, 'uid'); $entitled_lector_arr = array_column($result, 'uid');
@@ -225,10 +229,10 @@ class reviewAnrechnungUebersicht extends Auth_Controller
return; return;
} }
} }
show_error('You are not entitled to read this document'); show_error('You are not entitled to read this document');
} }
/** /**
* Send mails to STGL (if not present then to STGL assistance) * Send mails to STGL (if not present then to STGL assistance)
* @param $mail_params * @param $mail_params
@@ -239,74 +243,78 @@ class reviewAnrechnungUebersicht extends Auth_Controller
{ {
// Get studiengaenge // Get studiengaenge
$studiengang_kz_arr = array(); $studiengang_kz_arr = array();
foreach ($mail_params as $item) foreach ($mail_params as $item)
{ {
$this->AnrechnungModel->addSelect('studiengang_kz'); $this->AnrechnungModel->addSelect('studiengang_kz');
$this->AnrechnungModel->addJoin('public.tbl_prestudent', 'prestudent_id'); $this->AnrechnungModel->addJoin('public.tbl_prestudent', 'prestudent_id');
$studiengang_kz_arr[]= $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiengang_kz; $studiengang_kz_arr[]= $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiengang_kz;
} }
$studiengang_kz_arr = array_unique($studiengang_kz_arr); $studiengang_kz_arr = array_unique($studiengang_kz_arr);
// Send mail to STGL of each studiengang // Send mail to STGL of each studiengang
foreach ($studiengang_kz_arr as $studiengang_kz) foreach ($studiengang_kz_arr as $studiengang_kz)
{ {
// Get STGL mail address, if available, otherwise get assistance mail address
list ($to, $vorname) = $this->_getSTGLMailAddress($studiengang_kz);
// Get full name of lector // Get full name of lector
$this->load->model('person/Person_model', 'PersonModel'); $this->load->model('person/Person_model', 'PersonModel');
if (!$lector_name = getData($this->PersonModel->getFullName($this->_uid))) $result = $this->PersonModel->getFullName($this->_uid);
{ $lector_name = hasData($result) ? getData($result) : 'Ein Lektor';
show_error ('Failed retrieving person');
}
// Link to Antrag genehmigen // Link to Antrag genehmigen
$url = $url =
CIS_ROOT. 'cis/index.php?menu='. CIS_ROOT. 'cis/index.php?menu='.
CIS_ROOT. 'cis/menu.php?content_id=&content='. CIS_ROOT. 'cis/menu.php?content_id=&content='.
CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI; CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI;
// Prepare mail content // Get STGL mail address, if available, otherwise get assistance mail address
$body_fields = array( if (!$result = $this->_getSTGLMailAddress($studiengang_kz)) return false;
'vorname' => $vorname, foreach ($result as $stgl)
'lektor_name' => $lector_name, {
'empfehlung' => $empfehlung ? 'positive' : 'negative', // Prepare mail content
'link' => anchor($url, 'Anrechnungsanträge Übersicht') $body_fields = array(
); 'vorname' => $stgl['vorname'],
'lektor_name' => $lector_name,
sendSanchoMail( 'empfehlung' => $empfehlung ? 'positive' : 'negative',
'AnrechnungEmpfehlungAbgeben', 'link' => anchor($url, 'Anrechnungsanträge Übersicht')
$body_fields, );
$to,
'Anerkennung nachgewiesener Kenntnisse: Empfehlung wurde abgegeben' sendSanchoMail(
); 'AnrechnungEmpfehlungAbgeben',
$body_fields,
$stgl['to'],
'Anerkennung nachgewiesener Kenntnisse: Empfehlung wurde abgegeben'
);
}
} }
return true; return true;
} }
// Get STGL mail address, if available, otherwise get assistance mail address // Get STGL mail address, if available, otherwise get assistance mail address
private function _getSTGLMailAddress($stg_kz) private function _getSTGLMailAddress($stg_kz)
{ {
$this->load->model('organisation/Studiengang_model', 'StudiengangModel'); $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
$result = $this->StudiengangModel->getLeitung($stg_kz); $result = $this->StudiengangModel->getLeitung($stg_kz);
// Get STGL mail address, if available // Get STGL mail address, if available
if (hasData($result)) if (hasData($result))
{ {
return array( foreach (getData($result) as $stgl)
$result->retval[0]->uid. '@'. DOMAIN, {
$result->retval[0]->vorname $stglMailAdress_arr[]= array(
); 'to' => $stgl->uid. '@'. DOMAIN,
} 'vorname' => $stgl->vorname
);
}
return $stglMailAdress_arr;
}
// ...otherwise get assistance mail address // ...otherwise get assistance mail address
else else
{ {
$result = $this->StudiengangModel->load($stg_kz); $result = $this->StudiengangModel->load($stg_kz);
if (hasData($result)) if (hasData($result))
{ {
return array( return array(
@@ -314,7 +322,11 @@ class reviewAnrechnungUebersicht extends Auth_Controller
'' ''
); );
} }
else
{
return false;
}
} }
} }
} }
@@ -0,0 +1,310 @@
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class AdminZeitverfuegbarkeit extends Auth_Controller
{
const BERECHTIGUNG_ZEITVERFUEGBARKEIT = 'lehre/zeitverfuegbarkeit';
private $_uid; // uid of the logged user
public function __construct()
{
// Set required permissions
parent::__construct(
array(
'index' => 'lehre/zeitverfuegbarkeit:rw',
'saveZeitverfuegbarkeit' => 'lehre/zeitverfuegbarkeit:rw',
'deleteZeitverfuegbarkeit' => 'lehre/zeitverfuegbarkeit:rw'
)
);
// Load models
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$this->load->model('person/Person_model', 'PersonModel');
$this->load->model('ressource/Zeitsperre_model', 'ZeitsperreModel');
// Load libraries
$this->load->library('PermissionLib');
$this->load->library('AuthLib');
$this->load->library('WidgetLib');
// Load helpers
$this->load->helper('array');
// Load language phrases
$this->loadPhrases(
array(
'global',
'ui',
'lehre'
)
);
$this->_setAuthUID(); // sets property uid
$this->setControllerId(); // sets the controller id
}
// -----------------------------------------------------------------------------------------------------------------
// Public methods
public function index()
{
// Get Studiengaenge the user is entitled for
$result = $this->permissionlib->getSTG_isEntitledFor(self::BERECHTIGUNG_ZEITVERFUEGBARKEIT);
$studiengang_kz_arr = !isEmptyArray($result) ? $result : array();
// Get lectors of that Studiengaenge
$result = $this->_getLehreinheitmitarbeiterByStg($studiengang_kz_arr);
$lektor_arr = hasData($result) ? getData($result) : array();
// Get available Stundenplan Stunden
$result = $this->_getStunden();
$stunde_arr = hasData($result) ? getData($result) : array();
// Get actual Studiensemester to set min-limit Datepicker
$result = $this->StudiensemesterModel->getAkt();
$studsemStart = hasData($result) ? getData($result)[0]->start : '';
$view_data = array(
'studiengang_kz_arr' => $studiengang_kz_arr,
'lektor_arr' => $lektor_arr,
'stunde_arr' => $stunde_arr,
'studsemStart' => $studsemStart
);
$this->load->view('lehre/lvplanung/adminZeitverfuegbarkeit.php', $view_data);
}
/**
* Save or update Zeitverfuegbarkeit.
*/
public function saveZeitverfuegbarkeit()
{
$zeitsperre_id = $this->input->post('zeitsperre_id');
$mitarbeiter_uid = $this->input->post('mitarbeiter_uid');
$zeitsperretyp_kurzbz = $this->input->post('zeitsperretyp_kurzbz');
$bezeichnung = $this->input->post('bezeichnung');
$vonDatum = $this->input->post('vondatum');
$vonStunde = isEmptyString($this->input->post('vonstunde')) ? null : $this->input->post('vonstunde');
$bisDatum = $this->input->post('bisdatum');
$bisStunde = isEmptyString($this->input->post('bisstunde')) ? null : $this->input->post('bisstunde');
$result = $this->_validate($this->input->post());
if (isSuccess($result))
{
if (is_numeric($zeitsperre_id))
{
$result = $this->ZeitsperreModel->update(
$zeitsperre_id,
array(
'vondatum' => $vonDatum,
'vonstunde' => $vonStunde,
'bisdatum' => $bisDatum,
'bisstunde' => $bisStunde,
'bezeichnung' => $bezeichnung
)
);
}
else
{
$result = $this->ZeitsperreModel->save(
$zeitsperretyp_kurzbz,
$mitarbeiter_uid,
$vonDatum,
$bisDatum,
$vonStunde,
$bisStunde,
$bezeichnung
);
}
}
if (isError($result))
{
$this->terminateWithJsonError(getError($result));
}
$zeitsperre_id = getData($result);
// Success response to AJAX
$this->outputJsonSuccess(array(
'zeitsperre_id' => $zeitsperre_id,
'msg' => $this->p->t('ui', 'gespeichert')
));
}
/**
* Delete Zeitverfuegbarkeit.
*/
public function deleteZeitverfuegbarkeit()
{
$zeitsperre_id = $this->input->post('zeitsperre_id');
if (!is_numeric($zeitsperre_id))
{
$this->terminateWithJsonError('Wählen Sie einen Lehrenden aus der Zeitverfügbarkeit-Tabelle aus.');
}
// Load Zeitsperre
$result = $this->ZeitsperreModel->load($zeitsperre_id);
$delZsp = getData($result)[0];
// Delete
$result = $this->ZeitsperreModel->delete($zeitsperre_id);
if (isError($result))
{
$this->terminateWithJsonError(getError($result));
}
// Store Deletion query
$delQry = $this->db->last_query();
// Log deletion
$this->_logDeletion($delZsp, $delQry);
$this->outputJsonSuccess(array('msg' => $this->p->t('ui', 'geloescht')));
}
// -----------------------------------------------------------------------------------------------------------------
// Private methods
/**
* 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');
}
/**
* Get all lectors that are assigend to Lehreinheiten in actual or future semester.
*
* @param $studiengang_kz_arr Restrict only to given stg-
* @return mixed
*/
private function _getLehreinheitmitarbeiterByStg($studiengang_kz_arr)
{
$this->MitarbeiterModel->addSelect('lema.mitarbeiter_uid, nachname, vorname');
$this->MitarbeiterModel->addDistinct('lema.mitarbeiter_uid');
$this->MitarbeiterModel->addJoin('lehre.tbl_lehreinheitmitarbeiter lema', 'tbl_mitarbeiter.mitarbeiter_uid = lema.mitarbeiter_uid');
$this->MitarbeiterModel->addJoin('public.tbl_benutzer b', 'lema.mitarbeiter_uid = b.uid');
$this->MitarbeiterModel->addJoin('public.tbl_person p', 'person_id');
$this->MitarbeiterModel->addJoin('lehre.tbl_lehreinheit le', 'lehreinheit_id');
$this->MitarbeiterModel->addJoin('lehre.tbl_lehrveranstaltung lv', 'lehrveranstaltung_id');
$this->MitarbeiterModel->addJoin('public.tbl_studiensemester ss', 'studiensemester_kurzbz');
$this->MitarbeiterModel->addOrder('lema.mitarbeiter_uid');
// Return lektoren assigned to actual or future lehreinheiten
return $this->MitarbeiterModel->loadWhere('
lv.studiengang_kz IN (' . implode(', ', $studiengang_kz_arr) . ')
AND b.aktiv
AND personalnummer > 0
AND NOW() <= ss.ende'
);
}
/**
* Get all available Stunden of Stundentabelle.
*
* @return mixed
*/
private function _getStunden()
{
$this->load->model('ressource/Stunde_model', 'StundeModel');
$this->StundeModel->addOrder('stunde');
return $this->StundeModel->load();
}
/**
* Validaton checks performed on post data.
*
* @param $post
* @return array|stdClass
* @throws Exception
*/
private function _validate($post)
{
if (isEmptyString($post['mitarbeiter_uid']))
{
return (error('LektorIn fehlt'));
}
if (isEmptyString($post['bezeichnung']))
{
return (error('Notiz fehlt'));
}
if (isEmptyString($post['vondatum']))
{
return error('Startdatum fehlt');
}
if (isEmptyString($post['bisdatum']))
{
return error('Endedatum fehlt');
}
if (new DateTime($post['bisdatum']) < new DateTime($post['vondatum']))
{
return error('Endedatum darf nicht VOR dem Startdatum liegen');
}
// Check bisstunde not after vonstunde within same day
if (new DateTime($post['bisdatum']) == new DateTime($post['vondatum']))
{
if (is_numeric($post['vonstunde']) && is_numeric($post['bisstunde'])
&& $post['bisstunde'] < $post['vonstunde'])
{
return error('Am gleichen Tag darf Endstunde nicht VOR der Startstunde liegen');
}
}
// Check dates are > then start of actual Studiensemester
$result = $this->StudiensemesterModel->getAkt();
$studsemStart = hasData($result) ? getData($result)[0]->start : '';
if (new DateTime($post['vondatum']) < new DateTime($studsemStart) ||
new DateTime($post['bisdatum']) < new DateTime($studsemStart))
{
return error('Start- und Endedatum können nur für das aktuelle oder künftige Studiensemester geplant werden');
}
return success();
}
/**
* Log information of deleted Zeitsperre into log table.
*
* @param $delZsp object of deleted Zeitsperre
* @param $delQry string of performed delete query
* @return mixed
* @throws Exception
*/
private function _logDeletion($delZsp, $delQry)
{
$beschreibung = 'Zeitverfügbarkeitlöschung '
. $delZsp->mitarbeiter_uid. ' '
. (new DateTime($delZsp->vondatum))->format('d.m.Y')
. (is_null($delZsp->vonstunde) ? '(*)' : '('. $delZsp->vonstunde. ')')
. '-'
. (new DateTime($delZsp->bisdatum))->format('d.m.Y')
. (is_null($delZsp->bisstunde) ? '(*)' : '('. $delZsp->bisstunde. ')')
. '';
$this->load->model('system/Log_model', 'LogModel');
return $this->LogModel->insert(array(
'mitarbeiter_uid' => $this->_uid,
'beschreibung' => substr($beschreibung, 0, 64),
'sql' => $delQry
));
}
}
@@ -138,7 +138,7 @@ class Studiensemester extends Auth_Controller
$start = $this->input->post("semstart"); $start = $this->input->post("semstart");
$ende = $this->input->post("semende"); $ende = $this->input->post("semende");
$studienjahr_kurzbz = $this->input->post("studienjahrkurzbz"); $studienjahr_kurzbz = $this->input->post("studienjahrkurzbz");
$beschreibung = $this->input->post("beschreibung"); $beschreibung = isEmptyString($this->input->post("beschreibung")) ? null : $this->input->post("beschreibung");
$onlinebewerbung = $this->input->post("onlinebewerbung"); $onlinebewerbung = $this->input->post("onlinebewerbung");
$onlinebewerbung = isset($onlinebewerbung); $onlinebewerbung = isset($onlinebewerbung);
@@ -7,8 +7,6 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
*/ */
class BPKWartung extends Auth_Controller class BPKWartung extends Auth_Controller
{ {
private $_uid; // contains the UID of the logged user
/** /**
* Constructor * Constructor
*/ */
@@ -46,7 +44,7 @@ class BPKWartung extends Auth_Controller
// Public methods // Public methods
/** /**
* Main page of the InfoCenter tool * Main page of the bPK Wartung.
*/ */
public function index() public function index()
{ {
@@ -56,9 +54,7 @@ class BPKWartung extends Auth_Controller
} }
/** /**
* Personal details page of the InfoCenter tool * bPK Details initialization function, gets person data and loads the view with the data.
* Initialization function, gets person and prestudent data and loads the view with the data
* @param $person_id
*/ */
public function showDetails() public function showDetails()
{ {
@@ -85,8 +81,7 @@ class BPKWartung extends Auth_Controller
} }
/** /**
* Saves a ZGV for a prestudent, includes Ort, Datum, Nation for bachelor and master * Saves a bPK for a person.
* @param $prestudent_id
*/ */
public function saveBPK() public function saveBPK()
{ {
@@ -112,7 +107,7 @@ class BPKWartung extends Auth_Controller
// Private methods // Private methods
/** /**
* Loads all necessary Person data: Stammdaten (name, svnr, contact, ...), Dokumente, Logs and Notizen * Loads all necessary Person data.
* @param $person_id * @param $person_id
* @return array * @return array
*/ */
@@ -0,0 +1,254 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Page for managing groups of which user is the manager
*/
class Gruppenmanagement extends Auth_Controller
{
private $_uid; // contains the UID of the logged user
/**
* Constructor
*/
public function __construct()
{
parent::__construct(
array(
'index' => 'lehre/gruppenmanager:r',
'showBenutzergruppe' => 'lehre/gruppenmanager:r',
'getBenutzer' => 'lehre/gruppenmanager:r',
'getAllBenutzer' => 'lehre/gruppenmanager:r',
'addBenutzer' => 'lehre/gruppenmanager:rw',
'removeBenutzer' => 'lehre/gruppenmanager:rw'
)
);
// Loads models
$this->load->model('person/benutzer_model', 'BenutzerModel');
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
$this->load->model('person/benutzergruppe_model', 'BenutzergruppeModel');
$this->load->model('system/Log_model', 'LogModel');
$this->load->library('WidgetLib');
$this->loadPhrases(
array(
'global',
'person',
'lehre',
'ui',
'filter',
'gruppenmanagement'
)
);
$this->setControllerId(); // sets the controller id
$this->_setAuthUID(); // sets property uid
}
// -----------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Main page
*/
public function index()
{
$this->load->view(
'person/gruppenmanagement/gruppenmanagement.php',
array('uid' => $this->_uid)
);
}
/**
* Shows Benutzergruppe overview page.
*/
public function showBenutzergruppe()
{
$this->_setNavigationMenuShowDetails();
$gruppe_kurzbz = $this->input->get('gruppe_kurzbz');
$data[self::FHC_CONTROLLER_ID] = $this->getControllerId();
$this->load->view(
'person/gruppenmanagement/benutzergruppe.php',
array('gruppe_kurzbz' => $gruppe_kurzbz)
);
}
/**
* Gets Benutzer assigned to a Gruppe
*/
public function getBenutzer()
{
$gruppe_kurzbz = $this->input->get('gruppe_kurzbz');
$this->BenutzergruppeModel->addSelect('uid, vorname, nachname, ben.aktiv');
$this->BenutzergruppeModel->addJoin('public.tbl_benutzer ben', 'uid');
$this->BenutzergruppeModel->addJoin('public.tbl_person', 'person_id');
$benutzerRes = $this->BenutzergruppeModel->loadWhere(array('gruppe_kurzbz' => $gruppe_kurzbz));
$this->outputJson($benutzerRes);
}
/**
* Gets all Benutzer for assignment to Gruppe
*/
public function getAllBenutzer()
{
$this->BenutzerModel->addSelect('uid, vorname, nachname');
$this->BenutzerModel->addJoin('public.tbl_person', 'person_id');
$benutzerRes = $this->BenutzerModel->loadWhere(
array('tbl_benutzer.aktiv' => true)
);
$this->outputJson($benutzerRes);
}
/**
* Adds a Benutzer to Gruppe
*/
public function addBenutzer()
{
$uid = $this->input->post('uid');
$gruppe_kurzbz = $this->input->post('gruppe_kurzbz');
if (isEmptyString($uid))
$result = error('Uid missing');
else
{
$benutzerExistsRes = $this->BenutzergruppeModel->loadWhere(
array(
'uid' => $uid,
'gruppe_kurzbz' => $gruppe_kurzbz
)
);
if (isError($benutzerExistsRes))
{
$this->outputJsonError(getError($benutzerExistsRes));
return;
}
if (hasData($benutzerExistsRes))
{
$this->outputJsonError($this->p->t('gruppenmanagement', 'benutzerSchonZugewiesen'));
return;
}
$result = $this->BenutzergruppeModel->insert(
array(
'uid' => $uid,
'gruppe_kurzbz' => $gruppe_kurzbz,
'insertamum' => date('Y-m-d H:i:s'),
'insertvon' => $this->_uid
)
);
// log the group add
$lastQry = $this->db->last_query();
if (isSuccess($result))
{
$beschreibung = 'Gruppenmanagement: Nutzer zu Gruppe hinzugefügt';
$this->_writeLog($this->_uid, $beschreibung, $lastQry);
}
}
$this->outputJson($result);
}
/**
* Removes Benutzer from Gruppe
*/
public function removeBenutzer()
{
$uid = $this->input->post('uid');
$gruppe_kurzbz = $this->input->post('gruppe_kurzbz');
if (isEmptyString($uid))
$result = error('Uid missing');
else
{
$result = $this->BenutzergruppeModel->delete(
array(
'uid' => $uid,
'gruppe_kurzbz' => $gruppe_kurzbz
)
);
}
// log the group remove
$lastQry = $this->db->last_query();
if (isSuccess($result))
{
$beschreibung = 'Gruppenmanagement: Nutzer aus Gruppe entfernt';
$this->_writeLog($this->_uid, $beschreibung, $lastQry);
}
$this->outputJson($result);
}
// -----------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Define the navigation menu for the showDetails page
*/
private function _setNavigationMenuShowDetails()
{
$this->load->library('NavigationLib', array('navigation_page' => 'person/Gruppenmanagement/showBenutzergruppe'));
$link = site_url('person/Gruppenmanagement');
$this->navigationlib->setSessionMenu(
array(
'back' => $this->navigationlib->oneLevel(
'Zurück', // description
$link, // link
array(), // children
'angle-left', // icon
true, // expand
null, // subscriptDescription
null, // subscriptLinkClass
null, // subscriptLinkValue
'', // target
1 // sort
)
)
);
}
/**
* Set uid of authentificated user
*/
private function _setAuthUID()
{
$this->_uid = getAuthUID();
if (!$this->_uid) show_error('User authentification failed');
}
/**
* Writes an entry in the log table
*/
private function _writeLog($uid, $beschreibung, $lastQry)
{
$mitarbeiterResult = $this->MitarbeiterModel->load(array('mitarbeiter_uid'=>$this->_uid));
if(!isSuccess($mitarbeiterResult) || !hasData($mitarbeiterResult))
{
$uid = DUMMY_LEKTOR_UID;
$beschreibung .= ': '.$this->_uid;
$beschreibung = mb_substr($beschreibung, 0, 64);
}
$this->LogModel->insert(array(
'mitarbeiter_uid' => $uid,
'beschreibung' => $beschreibung,
'sql' => $lastQry
));
}
}
@@ -1,4 +1,20 @@
<?php <?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'); 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( parent::__construct(
array( array(
'setVar' => 'basis/variable:rw', 'setVar' => array('basis/variable:rw','basis/variable_persoenlich:rw'),
'getVar' => 'basis/variable:rw', 'getVar' => array('basis/variable:rw','basis/variable_persoenlich:rw'),
'changeStudiensemesterVar' => 'basis/variable:rw', 'changeStudiensemesterVar' => array('basis/variable:rw','basis/variable_persoenlich:rw'),
'changeStudengangsTypVar' => 'basis/variable:rw' 'changeStudengangsTypVar' => array('basis/variable:rw','basis/variable_persoenlich:rw')
) )
); );
@@ -20,6 +20,7 @@ class InfoCenter extends Auth_Controller
const INDEX_PAGE = 'index'; const INDEX_PAGE = 'index';
const FREIGEGEBEN_PAGE = 'freigegeben'; const FREIGEGEBEN_PAGE = 'freigegeben';
const REIHUNGSTESTABSOLVIERT_PAGE = 'reihungstestAbsolviert'; const REIHUNGSTESTABSOLVIERT_PAGE = 'reihungstestAbsolviert';
const ABGEWIESEN_PAGE = 'abgewiesen';
const SHOW_DETAILS_PAGE = 'showDetails'; const SHOW_DETAILS_PAGE = 'showDetails';
const SHOW_ZGV_DETAILS_PAGE = 'showZGVDetails'; const SHOW_ZGV_DETAILS_PAGE = 'showZGVDetails';
const ZGV_UBERPRUEFUNG_PAGE = 'ZGVUeberpruefung'; const ZGV_UBERPRUEFUNG_PAGE = 'ZGVUeberpruefung';
@@ -87,6 +88,12 @@ class InfoCenter extends Auth_Controller
'message' => 'Type of Document %s was updated, set to %s', 'message' => 'Type of Document %s was updated, set to %s',
'success' => null 'success' => null
), ),
'deletedoc' => array(
'logtype' => 'Action',
'name' => 'Document deleted',
'message' => 'Document %s deleted',
'success' => null
),
); );
// Name of Interessentenstatus // Name of Interessentenstatus
@@ -107,6 +114,7 @@ class InfoCenter extends Auth_Controller
array( array(
'index' => 'infocenter:r', 'index' => 'infocenter:r',
'freigegeben' => 'infocenter:r', 'freigegeben' => 'infocenter:r',
'abgewiesen' => 'infocenter:r',
'reihungstestAbsolviert' => 'infocenter:r', 'reihungstestAbsolviert' => 'infocenter:r',
'showDetails' => 'infocenter:r', 'showDetails' => 'infocenter:r',
'showZGVDetails' => 'lehre/zgvpruefung:r', 'showZGVDetails' => 'lehre/zgvpruefung:r',
@@ -123,12 +131,13 @@ class InfoCenter extends Auth_Controller
'zgvStatusUpdate' => 'lehre/zgvpruefung:rw', 'zgvStatusUpdate' => 'lehre/zgvpruefung:rw',
'saveAbsage' => 'infocenter:rw', 'saveAbsage' => 'infocenter:rw',
'saveFreigabe' => 'infocenter:rw', 'saveFreigabe' => 'infocenter:rw',
'getNotiz' => 'infocenter:r', 'getNotiz' => array('infocenter:r', 'lehre/zgvpruefung:r'),
'saveNotiz' => array('infocenter:rw', 'lehre/zgvpruefung:rw'), 'saveNotiz' => array('infocenter:rw', 'lehre/zgvpruefung:rw'),
'updateNotiz' => 'infocenter:rw', 'updateNotiz' => array('infocenter:rw', 'lehre/zgvpruefung:rw'),
'reloadZgvPruefungen' => 'infocenter:r', 'reloadZgvPruefungen' => 'infocenter:r',
'reloadMessages' => 'infocenter:r', 'reloadMessages' => 'infocenter:r',
'reloadDoks' => 'infocenter:r', 'reloadDoks' => 'infocenter:r',
'reloadUebersichtDoks' => 'infocenter:r',
'reloadNotizen' => array('infocenter:r', 'lehre/zgvpruefung:r'), 'reloadNotizen' => array('infocenter:r', 'lehre/zgvpruefung:r'),
'reloadLogs' => 'infocenter:r', 'reloadLogs' => 'infocenter:r',
'outputAkteContent' => array('infocenter:r', 'lehre/zgvpruefung:r'), 'outputAkteContent' => array('infocenter:r', 'lehre/zgvpruefung:r'),
@@ -140,7 +149,9 @@ class InfoCenter extends Auth_Controller
'getStudienjahrEnd' => array('infocenter:r', 'lehre/zgvpruefung:r'), 'getStudienjahrEnd' => array('infocenter:r', 'lehre/zgvpruefung:r'),
'setNavigationMenuArrayJson' => 'infocenter:r', 'setNavigationMenuArrayJson' => 'infocenter:r',
'getAbsageData' => 'infocenter:r', 'getAbsageData' => 'infocenter:r',
'saveAbsageForAll' => 'infocenter:rw' 'saveAbsageForAll' => 'infocenter:rw',
'deleteDoc' => 'infocenter:rw',
'getStudienartData' => 'infocenter:rw'
) )
); );
@@ -157,6 +168,10 @@ class InfoCenter extends Auth_Controller
$this->load->model('system/Message_model', 'MessageModel'); $this->load->model('system/Message_model', 'MessageModel');
$this->load->model('system/Filters_model', 'FiltersModel'); $this->load->model('system/Filters_model', 'FiltersModel');
$this->load->model('system/PersonLock_model', 'PersonLockModel'); $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');
// Loads libraries // Loads libraries
$this->load->library('PersonLogLib'); $this->load->library('PersonLogLib');
@@ -203,6 +218,16 @@ class InfoCenter extends Auth_Controller
$this->load->view('system/infocenter/infocenterFreigegeben.php'); $this->load->view('system/infocenter/infocenterFreigegeben.php');
} }
/**
* Abgewiesen page of the InfoCenter tool
*/
public function abgewiesen()
{
$this->_setNavigationMenu(self::ABGEWIESEN_PAGE); // define the navigation menu for this page
$this->load->view('system/infocenter/infocenterAbgewiesen.php');
}
/** /**
* *
*/ */
@@ -297,6 +322,13 @@ class InfoCenter extends Auth_Controller
} }
$persondata = $this->_loadPersonData($person_id); $persondata = $this->_loadPersonData($person_id);
$checkPerson = $this->PersonModel->checkDuplicate($person_id);
if (isError($checkPerson)) show_error(getError($checkPerson));
$duplicate = array('duplicated' => getData($checkPerson));
$prestudentdata = $this->_loadPrestudentData($person_id); $prestudentdata = $this->_loadPrestudentData($person_id);
$this->DokumentModel->addOrder('bezeichnung'); $this->DokumentModel->addOrder('bezeichnung');
@@ -305,7 +337,8 @@ class InfoCenter extends Auth_Controller
$data = array_merge( $data = array_merge(
$persondata, $persondata,
$prestudentdata, $prestudentdata,
$dokumentdata $dokumentdata,
$duplicate
); );
$data[self::FHC_CONTROLLER_ID] = $this->getControllerId(); $data[self::FHC_CONTROLLER_ID] = $this->getControllerId();
@@ -378,6 +411,35 @@ class InfoCenter extends Auth_Controller
$this->outputJsonSuccess(array($json)); $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 * Gets prestudent data for a person in json format
* @param $person_id * @param $person_id
@@ -540,8 +602,10 @@ class InfoCenter extends Auth_Controller
/** /**
* Sendet bei einer neuen ZGV Prüfung die Mail raus an den Studiengang * Sendet bei einer neuen ZGV Prüfung die Mail raus an den Studiengang
*/ */
private function sendZgvMail($mail, $typ){ private function sendZgvMail($mail, $typ, $person){
$data = array( $data = array(
'vorname' => $person->vorname,
'nachname' => $person->nachname,
'link' => site_url('system/infocenter/ZGVUeberpruefung') 'link' => site_url('system/infocenter/ZGVUeberpruefung')
); );
@@ -637,6 +701,16 @@ class InfoCenter extends Auth_Controller
if (isEmptyString($prestudent_id) || isEmptyString($person_id)) if (isEmptyString($prestudent_id) || isEmptyString($person_id))
$this->terminateWithJsonError('Prestudentid OR/AND Personid missing'); $this->terminateWithJsonError('Prestudentid OR/AND Personid missing');
$person = $this->PersonModel->load($person_id);
if (isError($person))
$this->terminateWithJsonError(getError($person));
if (!hasData($person))
$this->terminateWithJsonError('Person existiert nicht.');
$person = getData($person)[0];
$zgv = $this->ZGVPruefungStatusModel->getZgvStatusByPrestudent($prestudent_id); $zgv = $this->ZGVPruefungStatusModel->getZgvStatusByPrestudent($prestudent_id);
$data = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id); $data = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
@@ -668,7 +742,7 @@ class InfoCenter extends Auth_Controller
$this->_log($person_id, 'updatezgv', array($zgv[0]->zgvpruefung_id, 'pruefung_stg')); $this->_log($person_id, 'updatezgv', array($zgv[0]->zgvpruefung_id, 'pruefung_stg'));
if (isSuccess($insert)) if (isSuccess($insert))
$this->sendZgvMail($mail, $typ); $this->sendZgvMail($mail, $typ, $person);
elseif (isError($insert)) elseif (isError($insert))
$this->terminateWithJsonError('Fehler beim Speichern'); $this->terminateWithJsonError('Fehler beim Speichern');
}else }else
@@ -694,7 +768,7 @@ class InfoCenter extends Auth_Controller
$this->_log($person_id, 'newzgv', array($zgvpruefung_id)); $this->_log($person_id, 'newzgv', array($zgvpruefung_id));
if (isSuccess($result)) if (isSuccess($result))
$this->sendZgvMail($mail, $typ); $this->sendZgvMail($mail, $typ, $person);
elseif (isError($result)) elseif (isError($result))
$this->terminateWithJsonError('Fehler beim Speichern'); $this->terminateWithJsonError('Fehler beim Speichern');
} }
@@ -734,7 +808,7 @@ class InfoCenter extends Auth_Controller
if (hasData($lastStatus) && hasData($statusgrresult)) if (hasData($lastStatus) && hasData($statusgrresult))
{ {
//check if still Interessent //check if still Interessent, Bewerber or Wartender
if ($lastStatus->retval[0]->status_kurzbz === self::INTERESSENTSTATUS if ($lastStatus->retval[0]->status_kurzbz === self::INTERESSENTSTATUS
|| $lastStatus->retval[0]->status_kurzbz === self::BEWERBERSTATUS || $lastStatus->retval[0]->status_kurzbz === self::BEWERBERSTATUS
|| $lastStatus->retval[0]->status_kurzbz === self::WARTENDER) || $lastStatus->retval[0]->status_kurzbz === self::WARTENDER)
@@ -913,7 +987,8 @@ class InfoCenter extends Auth_Controller
$this->_log($person_id, 'freigegeben', $logparams); $this->_log($person_id, 'freigegeben', $logparams);
$this->_sendFreigabeMail($prestudent_id); if (is_numeric($statusgrund_id) || $logdata['studiengang_typ'] === 'm')
$this->_sendFreigabeMail($prestudent_id);
} }
} }
} }
@@ -1041,6 +1116,17 @@ class InfoCenter extends Auth_Controller
$this->load->view('system/infocenter/dokNachzureichend.php', array('dokumente_nachgereicht' => $dokumente_nachgereicht->retval)); $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);
$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) * Outputs content of an Akte, sends appropriate headers (so the document can be downloaded)
* @param $akte_id * @param $akte_id
@@ -1191,6 +1277,10 @@ class InfoCenter extends Auth_Controller
{ {
$this->_setNavigationMenu(self::REIHUNGSTESTABSOLVIERT_PAGE); $this->_setNavigationMenu(self::REIHUNGSTESTABSOLVIERT_PAGE);
} }
elseif (strpos($navigation_page, self::ABGEWIESEN_PAGE) !== false)
{
$this->_setNavigationMenu(self::ABGEWIESEN_PAGE);
}
$this->outputJsonSuccess('success'); $this->outputJsonSuccess('success');
} }
@@ -1414,12 +1504,14 @@ class InfoCenter extends Auth_Controller
$freigegebenLink = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE); $freigegebenLink = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE);
$reihungstestAbsolviertLink = site_url(self::INFOCENTER_URI.'/'.self::REIHUNGSTESTABSOLVIERT_PAGE); $reihungstestAbsolviertLink = site_url(self::INFOCENTER_URI.'/'.self::REIHUNGSTESTABSOLVIERT_PAGE);
$abgewiesenLink = site_url(self::INFOCENTER_URI.'/'.self::ABGEWIESEN_PAGE);
$currentFilterId = $this->input->get(self::FILTER_ID); $currentFilterId = $this->input->get(self::FILTER_ID);
if (isset($currentFilterId)) if (isset($currentFilterId))
{ {
$freigegebenLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId; $freigegebenLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId;
$reihungstestAbsolviertLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId; $reihungstestAbsolviertLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId;
$abgewiesenLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId;
} }
$this->navigationlib->setSessionMenu( $this->navigationlib->setSessionMenu(
@@ -1458,6 +1550,18 @@ class InfoCenter extends Auth_Controller
null, // subscriptLinkValue null, // subscriptLinkValue
'', // target '', // target
20 // sort 20 // sort
),
'abgewiesen' => $this->navigationlib->oneLevel(
'Abgewiesene', // description
$abgewiesenLink, // link
null, // children
'close', // icon
null, // subscriptDescription
false, // expand
null, // subscriptLinkClass
null, // subscriptLinkValue
'', // target
30 // sort
) )
) )
); );
@@ -1483,6 +1587,8 @@ class InfoCenter extends Auth_Controller
} }
if ($origin_page === self::ZGV_UBERPRUEFUNG_PAGE) if ($origin_page === self::ZGV_UBERPRUEFUNG_PAGE)
$link = site_url(self::ZGV_UEBERPRUEFUNG_URI); $link = site_url(self::ZGV_UEBERPRUEFUNG_URI);
if ($origin_page === self::ABGEWIESEN_PAGE)
$link = site_url(self::INFOCENTER_URI.'/'.self::ABGEWIESEN_PAGE);
$prevFilterId = $this->input->get(self::PREV_FILTER_ID); $prevFilterId = $this->input->get(self::PREV_FILTER_ID);
if (isset($prevFilterId)) if (isset($prevFilterId))
@@ -1520,6 +1626,7 @@ class InfoCenter extends Auth_Controller
$homeLink = site_url(self::INFOCENTER_URI.'/'.self::INDEX_PAGE); $homeLink = site_url(self::INFOCENTER_URI.'/'.self::INDEX_PAGE);
$freigegebenLink = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE); $freigegebenLink = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE);
$absolviertLink = site_url(self::INFOCENTER_URI.'/'.self::REIHUNGSTESTABSOLVIERT_PAGE); $absolviertLink = site_url(self::INFOCENTER_URI.'/'.self::REIHUNGSTESTABSOLVIERT_PAGE);
$abgewiesenLink = site_url(self::INFOCENTER_URI.'/'.self::ABGEWIESEN_PAGE);
$prevFilterId = $this->input->get(self::PREV_FILTER_ID); $prevFilterId = $this->input->get(self::PREV_FILTER_ID);
if (isset($prevFilterId)) if (isset($prevFilterId))
{ {
@@ -1578,6 +1685,24 @@ class InfoCenter extends Auth_Controller
) )
); );
} }
if($page == self::ABGEWIESEN_PAGE)
{
$this->navigationlib->setSessionElementMenu(
'abgewiesen',
$this->navigationlib->oneLevel(
'Abgewiesene', // description
$abgewiesenLink, // link
null, // children
'close', // icon
null, // subscriptDescription
false, // expand
null, // subscriptLinkClass
null, // subscriptLinkValue
'', // target
40 // sort
)
);
}
} }
/** /**
@@ -1648,9 +1773,15 @@ class InfoCenter extends Auth_Controller
if (isset($locked->retval[0]->uid)) if (isset($locked->retval[0]->uid))
{ {
$lockedby = $locked->retval[0]->uid; if (!$lockedby = getData($this->PersonModel->getFullName($locked->retval[0]->uid)))
if ($lockedby !== $this->_uid) {
show_error('Failed retrieving person');
}
if ($locked->retval[0]->uid !== $this->_uid)
{
$lockedbyother = true; $lockedbyother = true;
}
} }
$stammdaten = $this->PersonModel->getPersonStammdaten($person_id, true); $stammdaten = $this->PersonModel->getPersonStammdaten($person_id, true);
@@ -1854,10 +1985,25 @@ class InfoCenter extends Auth_Controller
$abwstatusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval; $abwstatusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
$intstatusgruende = $this->StatusgrundModel->getStatus(self::INTERESSENTSTATUS)->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());
$data = array ( $data = array (
'zgvpruefungen' => $zgvpruefungen, 'zgvpruefungen' => $zgvpruefungen,
'abwstatusgruende' => $abwstatusgruende, 'abwstatusgruende' => $abwstatusgruende,
'intstatusgruende' => $intstatusgruende 'intstatusgruende' => $intstatusgruende,
'studienArtBerechtigung' => $studienArtBerechtigung,
'all_zgvs' => $allZGVs,
'all_zgvs_master' => $allZGVsMaster,
'all_nations' => $allNations,
); );
return $data; return $data;
@@ -2116,35 +2262,54 @@ class InfoCenter extends Auth_Controller
public function getAbsageData() public function getAbsageData()
{ {
$this->load->model('organisation/Studiengang_model', 'StudiengangModel'); $studiengang_kz_all = $this->permissionlib->getSTG_isEntitledFor('infocenter');
$stg_typ = $this->StudiengangModel->getStudiengangTyp($studiengang_kz_all, ['b', 'm']);
$statusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval; if (hasData($stg_typ))
$studienSemester = $this->variablelib->getVar('infocenter_studiensemester'); {
$studiengaenge = $this->StudiengangModel->getStudiengaengeWithOrgForm(['b', 'm'], $studienSemester); $stg_typ = getData($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 ( $data = array (
'statusgruende' => $statusgruende, 'statusgruende' => $statusgruende,
'studiengaenge' => $studiengaenge->retval 'studiengaenge' => $studiengaenge->retval
); );
$this->outputJsonSuccess($data); $this->outputJsonSuccess($data);
}
else
$this->outputJsonSuccess(null);
}
public function getStudienArtBerechtigung()
{
$studiengang_kz_all = $this->permissionlib->getSTG_isEntitledFor('infocenter');
$stg_typ = $this->StudiengangModel->getStudiengangTyp($studiengang_kz_all, ['b', 'm', 'l']);
return getData($stg_typ);
}
public function getStudienartData()
{
$this->outputJsonSuccess($this->getStudienArtBerechtigung());
} }
public function saveAbsageForAll() public function saveAbsageForAll()
{ {
$statusgrund = $this->input->post('statusgrund'); $statusgrund = $this->input->post('statusgrund');
$studiengang = $this->input->post('studiengang'); $studiengang = $this->input->post('studiengang');
$abgeschickt = $this->input->post('abgeschickt');
$personen = $this->input->post('personen'); $personen = $this->input->post('personen');
$studienSemester = $this->variablelib->getVar('infocenter_studiensemester'); $studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
if ($statusgrund === 'null' || $studiengang === 'null' || empty($personen)) if ($statusgrund === 'null' || $studiengang === 'null' || $abgeschickt === 'null' || empty($personen))
$this->terminateWithJsonError("Bitte Statusgrund, Studiengang und Personen auswählen."); $this->terminateWithJsonError("Bitte füllen Sie alle Felder aus");
foreach($personen as $person) foreach($personen as $person)
{ {
$prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester); $prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt);
if(!hasData($prestudent)) if (!hasData($prestudent))
continue; continue;
$prestudentData = getData($prestudent); $prestudentData = getData($prestudent);
@@ -4,6 +4,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
class ZGVUeberpruefung extends Auth_Controller class ZGVUeberpruefung extends Auth_Controller
{ {
const BERECHTIGUNG_KURZBZ = 'lehre/zgvpruefung';
/** /**
* Constructor * Constructor
*/ */
@@ -12,14 +14,15 @@ class ZGVUeberpruefung extends Auth_Controller
// Set required permissions // Set required permissions
parent::__construct( parent::__construct(
array( array(
'index' => 'lehre/zgvpruefung:r', 'index' => self::BERECHTIGUNG_KURZBZ.':r',
'getZgvStatusByPrestudent' => 'lehre/zgvpruefung:r' 'getZgvStatusByPrestudent' => self::BERECHTIGUNG_KURZBZ.':r'
) )
); );
$this->load->model('crm/ZGVPruefungStatus_model', 'ZGVPruefungStatusModel'); $this->load->model('crm/ZGVPruefungStatus_model', 'ZGVPruefungStatusModel');
$this->load->model('crm/ZGVPruefung_model', 'ZGVPruefungModel'); $this->load->model('crm/ZGVPruefung_model', 'ZGVPruefungModel');
$this->load->library('WidgetLib'); $this->load->library('WidgetLib');
$this->load->library('PermissionLib');
$this->setControllerId(); $this->setControllerId();
$this->loadPhrases( $this->loadPhrases(
@@ -31,7 +34,14 @@ class ZGVUeberpruefung extends Auth_Controller
public function index() 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() public function getZgvStatusByPrestudent()
@@ -6,7 +6,7 @@ class Issues extends Auth_Controller
{ {
private $_uid; 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 const BERECHTIGUNG_KURZBZ = 'system/issues_verwalten'; // user having this permission can see issues for oes assigned with this permission
public function __construct() public function __construct()
@@ -23,19 +23,23 @@ class Issues extends Auth_Controller
$this->load->library('PermissionLib'); $this->load->library('PermissionLib');
$this->load->library('WidgetLib'); $this->load->library('WidgetLib');
$this->loadPhrases(
array(
'global',
'ui',
'filter'
)
);
// Load models // Load models
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel'); $this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
$this->loadPhrases(
array(
'global',
'ui',
'filter',
'lehre',
'person',
'fehlermonitoring'
)
);
$this->_setAuthUID(); // sets property uid $this->_setAuthUID(); // sets property uid
$this->setControllerId(); // sets the controller id
} }
public function index() public function index()
@@ -55,21 +59,42 @@ class Issues extends Auth_Controller
{ {
$issue_ids = $this->input->post('issue_ids'); $issue_ids = $this->input->post('issue_ids');
$status_kurzbz = $this->input->post('status_kurzbz'); $status_kurzbz = $this->input->post('status_kurzbz');
$verarbeitetvon = $this->_uid; $user = $this->_uid;
$errors = array(); $errors = array();
foreach ($issue_ids as $issue_id) foreach ($issue_ids as $issue_id)
{ {
$issueRes = $this->issueslib->changeIssueStatus($issue_id, $status_kurzbz, $verarbeitetvon); switch ($status_kurzbz)
{
case IssuesLib::STATUS_NEU:
$changeIssueMethod = 'setNeu';
break;
case IssuesLib::STATUS_IN_BEARBEITUNG:
$changeIssueMethod = 'setInBearbeitung';
break;
case IssuesLib::STATUS_BEHOBEN:
$changeIssueMethod = 'setBehoben';
break;
default:
$changeIssueMethod = null;
break;
}
if (isError($issueRes)) if (isEmptyString($changeIssueMethod))
$errors[] = getError($issueRes); $errors[] = "Invalid issue status given";
else
{
$issueRes = $this->issueslib->{$changeIssueMethod}($issue_id, $user);
if (isError($issueRes))
$errors[] = getError($issueRes);
}
} }
if (!isEmptyArray($errors)) if (!isEmptyArray($errors))
$this->outputJsonError(implode(", ", $errors)); $this->outputJsonError(implode(", ", $errors));
else else
$this->outputJsonSuccess("Status erfolgreich aktualisiert"); $this->outputJsonSuccess("Status successfully refreshed");
} }
/** /**
@@ -103,7 +128,7 @@ class Issues extends Auth_Controller
{ {
$all_funktionen_oe_kurzbz[$benutzerfunktion->oe_kurzbz][] = $benutzerfunktion->funktion_kurzbz; $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) if ($benutzerfunktion->funktion_kurzbz == self::FUNKTION_KURZBZ)
{ {
$oe_kurzbz_for_funktion[] = $benutzerfunktion->oe_kurzbz; $oe_kurzbz_for_funktion[] = $benutzerfunktion->oe_kurzbz;
@@ -129,8 +154,10 @@ class Issues extends Auth_Controller
} }
// add oes for which there is the "manage issues" Berechtigung // 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);
show_error('Keine Berechtigung oder Fehler bei Berechtigungsprüfung');
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)); $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');
}
}
+47 -7
View File
@@ -22,11 +22,16 @@ class DB_Model extends CI_Model
const PGSQL_BOOLEAN_FALSE = 'f'; const PGSQL_BOOLEAN_FALSE = 'f';
const PGSQL_BOOLEAN_TYPE = 'bool'; const PGSQL_BOOLEAN_TYPE = 'bool';
const PGSQL_BOOLEAN_ARRAY_TYPE = '_bool'; const PGSQL_BOOLEAN_ARRAY_TYPE = '_bool';
const PGSQL_INT2_TYPE = 'int2';
const PGSQL_INT4_TYPE = 'int4';
const PGSQL_INT8_TYPE = 'int8';
const PGSQL_FLOAT4_TYPE = 'float4';
const PGSQL_FLOAT8_TYPE = 'float8';
protected $dbTable; // Name of the DB-Table for CI-Insert, -Update, ... protected $dbTable; // Name of the DB-Table for CI-Insert, -Update, ...
protected $pk; // Name of the PrimaryKey for DB-Update, Load, ... protected $pk; // Name of the PrimaryKey for DB-Update, Load, ...
protected $hasSequence; // False if this table has a composite primary key that is not using a sequence protected $hasSequence; // False if this table has a composite primary key that is not using a sequence
// True if this table has a primary key that uses a sequence // True if this table has a primary key that uses a sequence
private $executedQueryMetaData; private $executedQueryMetaData;
private $executedQueryListFields; private $executedQueryListFields;
@@ -271,11 +276,6 @@ class DB_Model extends CI_Model
/** /**
* Load data and convert a record into a list of data from the main table, * Load data and convert a record into a list of data from the main table,
* and linked to every element, the data from the side tables * and linked to every element, the data from the side tables
*
* TODO:
* - Adding support for composed primary key
* - Adding support for cascading side tables (useful?)
*
* NOTE: sub queries are not supported in the from clause * NOTE: sub queries are not supported in the from clause
* *
* @return array * @return array
@@ -598,6 +598,28 @@ class DB_Model extends CI_Model
return $val; return $val;
} }
/**
* Convert PG-Int* to PHP-Integer
*/
public function pgIntPhp($val)
{
// If it is null, let it be null
if ($val == null) return $val;
return intval($val);
}
/**
* Convert PG-Float* to PHP-Float
*/
public function pgFloatPhp($val)
{
// If it is null, let it be null
if ($val == null) return $val;
return floatval($val);
}
/** /**
* Converts from PostgreSQL array to php array * Converts from PostgreSQL array to php array
* It also takes care about array of booleans * It also takes care about array of booleans
@@ -892,6 +914,11 @@ class DB_Model extends CI_Model
// If array type, boolean type OR a UDF // If array type, boolean type OR a UDF
if (strpos($eqmd->type, DB_Model::PGSQL_ARRAY_TYPE) !== false if (strpos($eqmd->type, DB_Model::PGSQL_ARRAY_TYPE) !== false
|| $eqmd->type == DB_Model::PGSQL_BOOLEAN_TYPE || $eqmd->type == DB_Model::PGSQL_BOOLEAN_TYPE
|| $eqmd->type == DB_Model::PGSQL_INT2_TYPE
|| $eqmd->type == DB_Model::PGSQL_INT4_TYPE
|| $eqmd->type == DB_Model::PGSQL_INT8_TYPE
|| $eqmd->type == DB_Model::PGSQL_FLOAT4_TYPE
|| $eqmd->type == DB_Model::PGSQL_FLOAT8_TYPE
|| $this->udflib->isUDFColumn($eqmd->name, $eqmd->type)) || $this->udflib->isUDFColumn($eqmd->name, $eqmd->type))
{ {
// If UDFs are inside this result set // If UDFs are inside this result set
@@ -941,6 +968,19 @@ class DB_Model extends CI_Model
{ {
$resultElement->{$toBeConverted->name} = $this->pgBoolPhp($resultElement->{$toBeConverted->name}); $resultElement->{$toBeConverted->name} = $this->pgBoolPhp($resultElement->{$toBeConverted->name});
} }
// Integer type
elseif ($toBeConverted->type == DB_Model::PGSQL_INT2_TYPE
|| $toBeConverted->type == DB_Model::PGSQL_INT4_TYPE
|| $toBeConverted->type == DB_Model::PGSQL_INT8_TYPE)
{
$resultElement->{$toBeConverted->name} = $this->pgIntPhp($resultElement->{$toBeConverted->name});
}
// Float type
elseif ($toBeConverted->type == DB_Model::PGSQL_FLOAT4_TYPE
|| $toBeConverted->type == DB_Model::PGSQL_FLOAT8_TYPE)
{
$resultElement->{$toBeConverted->name} = $this->pgFloatPhp($resultElement->{$toBeConverted->name});
}
} }
} }
} }
+34 -14
View File
@@ -121,7 +121,7 @@ abstract class FHC_Controller extends CI_Controller
protected function terminateWithJsonError($message) protected function terminateWithJsonError($message)
{ {
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode(error($message)); echo json_encode(error($message)); // KEEP IT!!!
exit; exit;
} }
@@ -132,31 +132,50 @@ abstract class FHC_Controller extends CI_Controller
{ {
$this->output->set_content_type('application/json')->set_output(json_encode($mixed)); $this->output->set_content_type('application/json')->set_output(json_encode($mixed));
} }
/**
* To download the given file represented by the fileObj parameter.
* fileObj has the following structure:
* $fileObj->filename
* $fileObj->file
* $fileObj->name
* $fileObj->mimetype
* $fileObj->disposition
*/
protected function outputFile($fileObj) protected function outputFile($fileObj)
{ {
if (file_exists($fileObj->file)) // If the file exists
if (isset($fileObj->file) && !isEmptyString($fileObj->file) && file_exists($fileObj->file))
{ {
$finfo = new finfo(FILEINFO_MIME);
header('Content-Description: File Transfer'); header('Content-Description: File Transfer');
header('Content-Type: '. $finfo->file($fileObj->file)); header('Content-Type: '. $fileObj->mimetype);
header('Expires: 0'); header('Expires: 0');
header('Cache-Control: must-revalidate'); header('Cache-Control: must-revalidate');
header('Pragma: public'); header('Pragma: public');
header('Content-Length: ' . filesize($fileObj->file)); header('Content-Length: ' . filesize($fileObj->file));
if (isset($fileObj->disposition) && ($fileObj->disposition == 'inline' || $fileObj->disposition == 'attachment')) if (isset($fileObj->disposition)
&& ($fileObj->disposition == 'inline' || $fileObj->disposition == 'attachment'))
{ {
header('Content-Disposition: '. $fileObj->disposition. '; filename="'. $fileObj->name. '"'); header('Content-Disposition: '. $fileObj->disposition. '; filename="'. $fileObj->name. '"');
} }
readfile($fileObj->file); readfile($fileObj->file); // reads the file content to the output buffer
exit;
} }
else
return false; {
// Otherwise print an error
show_error('The provided file does not exist: '.(isset($fileObj->file) ? $fileObj->file : 'file not given'));
}
}
/**
* Return the JSON decoded HTTP POST request
* If the request is not in JSON format then a null value is returned
*/
protected function getPostJSON()
{
return json_decode($this->input->raw_input_stream);
} }
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
@@ -175,3 +194,4 @@ abstract class FHC_Controller extends CI_Controller
} }
} }
} }
+249 -60
View File
@@ -3,113 +3,238 @@
if (!defined('BASEPATH')) exit('No direct script access allowed'); if (!defined('BASEPATH')) exit('No direct script access allowed');
/** /**
* * Model to work with the filesystem, it represents a directory
* It could be extended or could be used directly to work on the given path
*/ */
abstract class FS_Model extends CI_Model class FS_Model extends CI_Model
{ {
protected $filepath; // Path of the file const READ_MODE = 'r';
const READ_WRITE_MODE = 'w+';
const READ_APPEND_MODE = 'a+';
const BLOCK_SIZE = 8192;
const META_URI = 'uri';
private $_path; // Directory where this model can operate
/** /**
* Loads FilesystemLib and set properties * Set properties
*/ */
public function __construct($filepath = null) public function __construct($path)
{ {
parent::__construct(); parent::__construct();
// Load the filesystem library $this->_path = $path;
$this->load->library('FilesystemLib'); }
$this->filepath = $filepath; // ------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Opens a file in read mode and returns its file handle
*/
public function openRead($filename)
{
return $this->_open($filename, self::READ_MODE);
} }
/** /**
* Read data from file system * Opens a file in read and write mode and returns its file handle
* * If the file does not exist then it is created
* @return array
*/ */
public function read($filename) public function openReadWrite($filename)
{ {
// Check Class-Attributes return $this->_open($filename, self::READ_WRITE_MODE);
if (is_null($this->filepath)) return error('The given filepath in not valid', EXIT_ERROR);
// Check method parameters
if (is_null($filename)) return error('The given filename is not valid', EXIT_ERROR);
if (!is_null($data = $this->filesystemlib->read($this->filepath, $filename)))
{
return success(base64_encode($data));
}
else
{
return error('An error occurred while reading a file', EXIT_ERROR);
}
} }
/** /**
* Writing data to file system * Opens a file in read and append mode and returns its file handle
* * If the file does not exist then it is created
* @param string $fileContent File content
* @return object
*/ */
public function write($filename, $content) public function openReadAppend($filename)
{ {
// Check Class-Attributes return $this->_open($filename, self::READ_APPEND_MODE);
if (is_null($this->filepath)) return error('The given filepath in not valid', EXIT_ERROR); }
// Check method parameters /**
if (is_null($content)) return error('The given file content is not valid', EXIT_ERROR); * Closes a file handle
if (is_null($filename)) return error('The given filename is not valid', EXIT_ERROR); */
public function close($fileHandle)
{
return fclose($fileHandle) === true ? success() : error('Error while closing the file handler');
}
if ($this->filesystemlib->write($this->filepath, $filename, base64_decode($content)) === true) /**
* Reads a block of bytes from the given file
* Returns a success that contains the block
* On failure returns an error
*/
public function readBlock($fileHandle)
{
// Reads a block of bytes from the file
$block = fread($fileHandle, self::BLOCK_SIZE);
// If an error occurred
if ($block === false)
{
// Prepare the error message
$errorMsg = 'An error occurred while reading a file';
// Tries to get the file name and to concatenate it to the error message
$fileMetaData = stream_get_meta_data($fileHandle);
if (isset($fileMetaData[self::META_URI])) $errorMsg .= ': '.$fileMetaData[self::META_URI];
return error($errorMsg); // returns the error
}
return success($block); // return success if everything was fine
}
/**
* Writes/appends (depending on how the file was opened) a content into a file
* Returns a success that contains the written number of bytes
* On failure returns an error
*/
public function write($fileHandle, $content)
{
// Writes the provided content to the file
$writeResult = fwrite($fileHandle, $content);
// If an error occurred
if ($writeResult === false)
{
$errorMsg = 'An error occurred while writing a file';
// Tries to get the file name and to concatenate it to the error message
$fileMetaData = stream_get_meta_data($fileHandle);
if (isset($fileMetaData[self::META_URI])) $errorMsg .= ': '.$fileMetaData[self::META_URI];
return error($errorMsg); // returns the error
}
return success($writeResult);
}
/**
* Removes a given file
*/
public function remove($filename)
{
// Check if the property _path represents a valid directory
$checkResult = $this->_checkPath();
if (isError($checkResult)) return $checkResult; // If not then return the error
// Check filename
if (isEmptyString($filename)) return error('The given filename is not valid');
// remove file
if (unlink($this->_path.DIRECTORY_SEPARATOR.$filename) === true)
{ {
return success(); return success();
} }
else else
{ {
return error('An error occurred while writing a file', EXIT_ERROR); return error('An error occurred while removing a file');
} }
} }
// ------------------------------------------------------------------------------------------------------------------
// Old public methods that work with the base64 encoding, not to be used!
/** /**
* Append data to a file * Read data from the given file and encode its content to base64
*
* @param array $data File content
* @return array
*/ */
public function append($filename, $content) public function readBase64($filename)
{ {
// Check Class-Attributes // Open the file in read mode
if (is_null($this->filepath)) return error('The given filepath in not valid', EXIT_ERROR); $openReadResult = $this->openRead($filename);
if (isError($openReadResult)) return $openReadResult; // if an error occurred then return it
// Check method parameters $fileContent = ''; // to store the file content
if (is_null($content)) return error('The given file content is not valid', EXIT_ERROR); $fileHandle = getData($openReadResult); // get the file handle
if (is_null($filename)) return error('The given filename is not valid', EXIT_ERROR);
if ($this->filesystemlib->append($this->filepath, $filename, base64_decode($content)) === true) // While the end of the file is not reached and the read does not fail
while (!feof($fileHandle) && isSuccess($readBlockResult = $this->readBlock($fileHandle)))
{ {
return success(); // Concatenate the content of the file
} $fileContent .= getData($readBlockResult);
else
{
return error('An error occurred while appending to a file', EXIT_ERROR);
} }
// If an error occurred while reading then return it
if (isError($readBlockResult)) return $readBlockResult;
// Close the file handler
$closeResult = $this->close($fileHandle);
if (isError($closeResult)) return $closeResult; // if it fails then return the error
// If everything was fine encode the file content into base64 and return it as a success
return success(base64_encode($fileContent));
}
/**
* Writes the given content into the given file. The content is base64 encoded
*/
public function writeBase64($filename, $content)
{
// Open the file in read and write mode
$openWriteResult = $this->openReadWrite($filename);
if (isError($openWriteResult)) return $openWriteResult; // if an error occurred then return it
$fileHandle = getData($openWriteResult); // get the file handle
// Writes the given base64 encoded content into to given file
$writeResult = $this->write($fileHandle, base64_decode($content));
// If an error occurred while writing then return it
if (isError($writeResult)) return $writeResult;
// Close the file handler
$closeResult = $this->close($fileHandle);
if (isError($closeResult)) return $closeResult; // if it fails then return the error
// If everything was fine
return success();
}
/**
* Appends the given content into the given file. The content is base64 encoded
*/
public function appendBase64($filename, $content)
{
// Open the file in read and append mode
$openWriteResult = $this->openReadAppend($filename);
if (isError($openWriteResult)) return $openWriteResult; // if an error occurred then return it
$fileHandle = getData($openWriteResult); // get the file handle
// Writes the given base64 encoded content into to given file
$writeResult = $this->write($fileHandle, base64_decode($content));
// If an error occurred while writing then return it
if (isError($writeResult)) return $writeResult;
// Close the file handler
$closeResult = $this->close($fileHandle);
if (isError($closeResult)) return $closeResult; // if it fails then return the error
// If everything was fine
return success();
} }
/** /**
* Delete data from file system * Delete data from file system
* NOTE: it does not work with the base64 encoding but it has been kept for retro compatibility
* *
* @param string $id Primary Key for DELETE * @param string $id Primary Key for DELETE
* @return array * @return array
*/ */
public function remove($filename) public function removeBase64($filename)
{ {
// Check Class-Attributes // Check Class-Attributes
if (is_null($this->filepath)) return error('The given filepath in not valid', EXIT_ERROR); if (is_null($this->_path)) return error('The given _path in not valid', EXIT_ERROR);
// Check method parameters // Check method parameters
if (is_null($filename)) return error('The given filename is not valid', EXIT_ERROR); if (is_null($filename)) return error('The given filename is not valid', EXIT_ERROR);
if ($this->filesystemlib->remove($this->filepath, $filename) === true) if (unlink($this->_path.DIRECTORY_SEPARATOR.$filename) === true)
{ {
return success(); return success();
} }
@@ -121,20 +246,21 @@ abstract class FS_Model extends CI_Model
/** /**
* Rename a file * Rename a file
* NOTE: it does not work with the base64 encoding but it has been kept for retro compatibility
* *
* @param string $id Primary Key for DELETE * @param string $id Primary Key for DELETE
* @return array * @return array
*/ */
public function rename($filename, $newFilename) public function renameBase64($filename, $newFilename)
{ {
// Check Class-Attributes // Check Class-Attributes
if (is_null($this->filepath)) return error('The given filepath in not valid', EXIT_ERROR); if (is_null($this->_path)) return error('The given _path in not valid', EXIT_ERROR);
// Check method parameters // Check method parameters
if (is_null($filename)) return error('The given filename is not valid', EXIT_ERROR); if (is_null($filename)) return error('The given filename is not valid', EXIT_ERROR);
if (is_null($newFilename)) return error('The given new filename is not valid', EXIT_ERROR); if (is_null($newFilename)) return error('The given new filename is not valid', EXIT_ERROR);
if ($this->filesystemlib->rename($this->filepath, $filename, $this->filepath, $newFilename) === true) if (rename($this->_path.DIRECTORY_SEPARATOR.$filename, $this->_path.DIRECTORY_SEPARATOR.$newFilename) === true)
{ {
return success(); return success();
} }
@@ -143,4 +269,67 @@ abstract class FS_Model extends CI_Model
return error('An error occurred while renaming a file', EXIT_ERROR); return error('An error occurred while renaming a file', EXIT_ERROR);
} }
} }
// ------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Checks if the given $this->_path is a valid directory
*/
private function _checkPath()
{
// If _path...
if (!isEmptyString($this->_path) // ...is a not empty string...
&& file_exists($this->_path) && is_dir($this->_path)) // ...exists on the file system and it is a directory...
{
return success(); // return a success
}
// If not a valid path return an error
return error('The given path is not valid: '.$this->_path);
}
/**
* Open a file using the provided mode
* It returns a file handle
* Or write and append if the file does not exist then creates it
*/
private function _open($filename, $mode)
{
// Check if the property _path represents a valid directory
$checkResult = $this->_checkPath();
if (isError($checkResult)) return $checkResult; // If not then return the error
// Full file path: path + filename
$fileFullPath = $this->_path.DIRECTORY_SEPARATOR.$filename;
// If needed then check if the file exists and really it is a file
if ($mode == self::READ_MODE && (!file_exists($fileFullPath) || !is_file($fileFullPath)))
{
return error('Trying to read a not existing file');
}
// If needed then check if it is possible to read from the path and the file
if ($mode == self::READ_MODE && (!is_readable($this->_path) || !is_readable($fileFullPath)))
{
return error('The given path or filename are not readable: '.$fileFullPath);
}
// If needed then check if the path and the filename are writable
if (($mode == self::READ_WRITE_MODE || $mode == self::READ_APPEND_MODE)
&& (!is_writable($this->_path) || (file_exists($fileFullPath) && !is_writable($fileFullPath))))
{
return error('The given path or filename are not writable: '.$fileFullPath);
}
// Open the file in read mode
$fileHandle = fopen($fileFullPath, $mode);
// If it was a failure the return the error
if ($fileHandle === false) return error('An error occurred while opening a file in '.$mode.' mode');
// Otherwise return the file handle
return success($fileHandle);
}
} }
@@ -0,0 +1,15 @@
<?php
/**
* Interface defining method to implement for issue resolution checker (from core and extensions)
*/
interface IIssueResolvedChecker
{
/**
* Checks if a issue of a certain type is resolved.
* Classes for resolving a certain issue type implement this method.
* @param array $params parameters needed for issue resolution
* @return object with success(true) if issue resolved, success(false) otherwise
*/
public function checkIfIssueIsResolved($params);
}
+119
View File
@@ -0,0 +1,119 @@
<?php
/**
* Controller for retrieving open issues and, if the issue condition is not met anymore, automatically set it to resolved
*/
abstract class IssueResolver_Controller extends JOB_Controller
{
const ISSUES_FOLDER = 'issues';
const CHECK_ISSUE_RESOLVED_METHOD_NAME = 'checkIfIssueIsResolved';
protected $_codeLibMappings;
public function __construct()
{
parent::__construct();
$this->load->model('system/Issue_model', 'IssueModel');
$this->load->library('IssuesLib');
}
/**
* Initializes issue resolution.
*/
public function run()
{
$this->logInfo("Issue resolve job started");
// load open issues with given errorcodes
$openIssuesRes = $this->IssueModel->getOpenIssues(array_keys($this->_codeLibMappings));
// log error if occured
if (isError($openIssuesRes))
{
$this->logError(getError($openIssuesRes));
}
else
{
// log info if no data found
if (!hasData($openIssuesRes))
{
$this->logInfo("No open issues found");
}
else
{
$openIssues = getData($openIssuesRes);
foreach ($openIssues as $issue)
{
if (isset($this->_codeLibMappings[$issue->fehlercode]))
{
$libName = $this->_codeLibMappings[$issue->fehlercode];
// 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()
);
// if called from extension (extension name set), path includes extension names, otherwise it is the core library folder
$libRootPath = isset($this->_extensionName) ? 'extensions/' . $this->_extensionName . '/' : '';
$issuesLibPath = $libRootPath . self::ISSUES_FOLDER . '/';
$issuesLibFilePath = DOC_ROOT . 'application/' . $libRootPath . 'libraries/' . self::ISSUES_FOLDER . '/' . $libName . '.php';
// check if library file exists
if (!file_exists($issuesLibFilePath))
{
// log error and continue with next issue if not
$this->logError("Issue library file " . $issuesLibFilePath . " does not exist");
continue;
}
// load library connected to fehlercode
$this->load->library(
$issuesLibPath . $libName
);
$lowercaseLibName = mb_strtolower($libName);
// check if method is defined in libary class
if (!is_callable(array($this->{$lowercaseLibName}, self::CHECK_ISSUE_RESOLVED_METHOD_NAME)))
{
// log error and continue with next issue if not
$this->logError("Method " . self::CHECK_ISSUE_RESOLVED_METHOD_NAME . " is not defined in library $lowercaseLibName");
continue;
}
// call the function for checking for issue resolution
$issueResolvedRes = $this->{$lowercaseLibName}->{self::CHECK_ISSUE_RESOLVED_METHOD_NAME}($params);
if (isError($issueResolvedRes))
{
$this->logError(getError($issueResolvedRes));
}
else
{
$issueResolvedData = getData($issueResolvedRes);
if ($issueResolvedData === true)
{
// set issue to resolved if needed
$behobenRes = $this->issueslib->setBehoben($issue->issue_id, null);
if (isError($behobenRes))
$this->logError(getError($behobenRes));
else
$this->logInfo("Issue " . $issue->issue_id . " successfully resolved");
}
}
}
}
}
}
$this->logInfo("Issue resolve job ended");
}
}
+114 -52
View File
@@ -1,20 +1,19 @@
<?php <?php
/** /**
* FH-Complete * Copyright (C) 2022 fhcomplete.org
* *
* @package FHC-Helper * This program is free software: you can redistribute it and/or modify
* @author FHC-Team * it under the terms of the GNU General Public License as published by
* @copyright Copyright (c) 2016 fhcomplete.org * the Free Software Foundation, either version 3 of the License, or
* @license GPLv3 * (at your option) any later version.
* @since Version 1.0.0
*/
/**
* FHC Helper
* *
* @subpackage Helpers * This program is distributed in the hope that it will be useful,
* @category Helpers * 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'); if (! defined('BASEPATH')) exit('No direct script access allowed');
@@ -42,15 +41,19 @@ function generateToken($length = 64)
{ {
$firstGeneratedToken = random_bytes($length); // try to generates cryptographically secure pseudo-random bytes... $firstGeneratedToken = random_bytes($length); // try to generates cryptographically secure pseudo-random bytes...
} }
catch (Exception $e) { $firstGeneratedToken = null; } // if fails $firstGeneratedToken is set to null catch (Exception $e)
{
// If fails $firstGeneratedToken is set to null
$firstGeneratedToken = null;
}
} }
// For PHP >= 5.3 and < 7 and openssl is available // For PHP >= 5.3 and < 7 and openssl is available
elseif (function_exists('openssl_random_pseudo_bytes')) elseif (function_exists('openssl_random_pseudo_bytes'))
{ {
$firstGeneratedToken = openssl_random_pseudo_bytes($length, $strong); $firstGeneratedToken = openssl_random_pseudo_bytes($length, $strong);
// If the token generation ended with errors OR the generated token is NOT strong enough // If the token generation ended with errors OR the generated token is NOT strong enough
if ($firstGeneratedToken == false || $strong == false) $firstGeneratedToken = null; // $firstGeneratedToken is set to null if ($firstGeneratedToken == false || $strong == false) $firstGeneratedToken = null; // $firstGeneratedToken is set to null
} }
if ($firstGeneratedToken != null) // If everything was fine if ($firstGeneratedToken != null) // If everything was fine
{ {
@@ -107,10 +110,7 @@ function var_dump_to_error_log($parameter)
function loadResource($path, $resources = null, $subdir = false) function loadResource($path, $resources = null, $subdir = false)
{ {
// Place a / character at the and of the string if not present // Place a / character at the and of the string if not present
if (strrpos($path, '/') < strlen($path) - 1) if (strrpos($path, '/') < strlen($path) - 1) $path .= '/';
{
$path .= '/';
}
// Loads in $tmpResources all the given resources // Loads in $tmpResources all the given resources
$tmpResources = $resources; $tmpResources = $resources;
@@ -125,28 +125,36 @@ function loadResource($path, $resources = null, $subdir = false)
// Loads in $tmpPaths path and eventually the subdirectories // Loads in $tmpPaths path and eventually the subdirectories
$tmpPaths = array($path); $tmpPaths = array($path);
// NOTE: Used @ to prevent ugly error messages
if (is_dir($path) && ($dirHandler = @opendir($path)) !== false) // If path is a directory
if (is_dir($path))
{ {
// Reads all file system entries present in path // NOTE: Used @ to prevent ugly error messages
while (($entry = readdir($dirHandler)) !== false) $dirHandler = @opendir($path);
// Successfully opened
if ($dirHandler !== false)
{ {
// If entry is a directory but not the current and subdirectories should be loaded // Reads all file system entries present in path
if ($subdir === true && $entry != '.' && $entry != '..' && is_dir($entry)) while (($entry = readdir($dirHandler)) !== false)
{ {
$tmpPaths[] = $entry; // If entry is a directory but not the current and subdirectories should be loaded
} if ($subdir === true && $entry != '.' && $entry != '..' && is_dir($path.$entry))
// If no resources are specified and the current file system entry is a file
if ($resources == null && is_file($path.$entry))
{
// If the current entry is a php file store the name without extension
if ($entry != ($tmpName = str_replace('.php', '', $entry)))
{ {
$tmpResources[] = $tmpName; $tmpPaths[] = $path.$entry.'/';
}
// If no resources are specified and the current file system entry is a file
if ($resources == null && is_file($path.$entry))
{
// Name without php extension
$tmpName = str_replace('.php', '', $entry);
// If the current entry is a php file store the name without extension
if ($entry != $tmpName) $tmpResources[] = $tmpName;
} }
} }
closedir($dirHandler);
} }
closedir($dirHandler);
} }
// Loops through the resources // Loops through the resources
@@ -156,10 +164,7 @@ function loadResource($path, $resources = null, $subdir = false)
foreach ($tmpPaths as $tmpPath) foreach ($tmpPaths as $tmpPath)
{ {
$fileName = $tmpPath.$tmpResource.'.php'; // Php extension $fileName = $tmpPath.$tmpResource.'.php'; // Php extension
if (file_exists($fileName)) if (file_exists($fileName)) include_once($fileName);
{
include_once($fileName);
}
} }
} }
} }
@@ -314,32 +319,89 @@ function sanitizeProblemChars($str)
$enc = 'UTF-8'; $enc = 'UTF-8';
$acentos = array( $acentos = array(
'A' => '/&Agrave;|&Aacute;|&Acirc;|&Atilde;|&Aring;/', 'A' => '/&Agrave;|&Aacute;|&Acirc;|&Atilde;|&Aring;|&Abreve;|Ǎ/',
'Ae' => '/&Auml;/', 'Ae' => '/&Auml;/',
'a' => '/&agrave;|&aacute;|&acirc;|&atilde;|&aring;/', 'a' => '/&agrave;|&aacute;|&acirc;|&atilde;|&aring;|&abreve;|ǎ/',
'ae'=> '/&auml;/', 'ae' => '/&auml;/',
'C' => '/&Ccedil;/', 'C' => '/&Ccedil;|&Ccaron;/',
'c' => '/&ccedil;/', 'c' => '/&ccedil;|&ccaron;/',
'E' => '/&Egrave;|&Eacute;|&Ecirc;|&Euml;/', 'E' => '/&Egrave;|&Eacute;|&Ecirc;|&Euml;/',
'e' => '/&egrave;|&eacute;|&ecirc;|&euml;/', 'e' => '/&egrave;|&eacute;|&ecirc;|&euml;/',
'I' => '/&Igrave;|&Iacute;|&Icirc;|&Iuml;/', 'I' => '/&Igrave;|&Iacute;|&Icirc;|&Iuml;/',
'i' => '/&igrave;|&iacute;|&icirc;|&iuml;/', 'i' => '/&igrave;|&iacute;|&icirc;|&iuml;/',
'N' => '/&Ntilde;/', 'N' => '/&Ntilde;|&Ncaron;|&ncaron;/',
'n' => '/&ntilde;/', 'n' => '/&ntilde;/',
'O' => '/&Ograve;|&Oacute;|&Ocirc;|&Otilde;/', 'O' => '/&Ograve;|&Oacute;|&Ocirc;|&Otilde;/',
'Oe' => '/&Ouml;/', 'Oe' => '/&Ouml;/',
'o' => '/&ograve;|&oacute;|&ocirc;|&otilde;/', 'o' => '/&ograve;|&oacute;|&ocirc;|&otilde;/',
'oe' => '/&ouml;/', 'oe' => '/&ouml;/',
'U' => '/&Ugrave;|&Uacute;|&Ucirc;/', 'R' => '/&Rcaron;/',
'r' => '/&rcaron;/',
'S' => '/&Scaron;/',
's' => '/&scaron;/',
'T' => '/&Tcaron;/',
't' => '/&tcaron;/',
'U' => '/&Ugrave;|&Uacute;|&Ucirc;|&Ubreve;|Ǔ/',
'Ue' => '/&Uuml;/', 'Ue' => '/&Uuml;/',
'u' => '/&ugrave;|&uacute;|&ucirc;/', 'u' => '/&ugrave;|&uacute;|&ucirc;|&ubreve;|ǔ/',
'ue' => '/&uuml;/', 'ue' => '/&uuml;/',
'Y' => '/&Yacute;/', 'Y' => '/&Yacute;/',
'y' => '/&yacute;|&yuml;/', 'y' => '/&yacute;|&yuml;/',
'Z' => '/&Zcaron;/',
'z' => '/&zcaron;/',
'a.' => '/&ordf;/', 'a.' => '/&ordf;/',
'o.' => '/&ordm;/', 'o.' => '/&ordm;/',
'ss' => '/&szlig;/' 'ss' => '/&szlig;/'
); );
return preg_replace($acentos, array_keys($acentos), htmlentities($str,ENT_NOQUOTES, $enc)); return preg_replace($acentos, array_keys($acentos), htmlentities($str, ENT_NOQUOTES | ENT_HTML5, $enc));
} }
/**
*
*/
function findResource($path, $resource, $subdir = false, $extraDir = null)
{
// Place a / character at the and of the string if not present
if (strrpos($path, '/') < strlen($path) - 1) $path .= '/';
// Loads in $tmpPaths path and eventually the subdirectories
$tmpPaths = array($path);
if (is_dir($path))
{
// NOTE: Used @ to prevent ugly error messages
$dirHandler = @opendir($path);
// Successfully opened
if ($dirHandler !== false)
{
// Reads all file system entries present in path
while (($entry = readdir($dirHandler)) !== false)
{
// If entry is a directory but not the current and subdirectories should be loaded
if ($subdir === true && $entry != '.' && $entry != '..' && is_dir($path.$entry))
{
if ($extraDir == null)
{
$tmpPaths[] = $path.$entry.'/';
}
else
{
$tmpPaths[] = $path.$entry.'/'.$extraDir.'/';
}
}
}
closedir($dirHandler);
}
}
// Loops through the paths
foreach ($tmpPaths as $tmpPath)
{
$fileName = $tmpPath.$resource.'.php'; // Php extension
if (file_exists($fileName)) return $fileName;
}
return null;
}
+55 -1
View File
@@ -39,6 +39,24 @@ function printPageTitle($title)
} }
} }
/**
* Print the meta tag http-equiv refresh having as content the value of the given parameter
*/
function printRefreshMeta($refresh)
{
if ($refresh != null)
{
if (is_numeric($refresh) && $refresh > 0)
{
echo '<meta http-equiv="refresh" content="'.$refresh.'">';
}
else
{
show_error('The provided refresh parameter has to be a number greater then 0');
}
}
}
/** /**
* Generates tags for the style sheets you want to include, the parameter could by a string or an array of strings * Generates tags for the style sheets you want to include, the parameter could by a string or an array of strings
*/ */
@@ -131,6 +149,31 @@ function generateJSsInclude($JSs)
} }
} }
/**
* Generates tags for the javascript modules you want to include, the parameter could by a string or an array of strings
*/
function generateJSModulesInclude($JSModules)
{
$jsInclude = '<script type="module" src="%s"></script>';
$ci =& get_instance();
$cachetoken = '?'.$ci->config->item('fhcomplete_build_version');
if (isset($JSModules))
{
$tmpJSs = is_array($JSModules) ? $JSModules : array($JSModules);
for ($tmpJSsCounter = 0; $tmpJSsCounter < count($tmpJSs); $tmpJSsCounter++)
{
$toPrint = sprintf($jsInclude, base_url($tmpJSs[$tmpJSsCounter].$cachetoken)).PHP_EOL;
if ($tmpJSsCounter > 0) $toPrint = "\t\t".$toPrint;
echo $toPrint;
}
}
}
/** /**
* Generates all the includes needed by the Addons * Generates all the includes needed by the Addons
*/ */
@@ -138,16 +181,26 @@ function generateAddonsJSsInclude($calledFrom)
{ {
$aktive_addons = array_filter(explode(";", ACTIVE_ADDONS)); $aktive_addons = array_filter(explode(";", ACTIVE_ADDONS));
// For each active addon
foreach ($aktive_addons as $addon) foreach ($aktive_addons as $addon)
{ {
// Build the path to the hook file
$hookfile = DOC_ROOT.'addons/'.$addon.'/hooks.config.inc.php'; $hookfile = DOC_ROOT.'addons/'.$addon.'/hooks.config.inc.php';
// If the hook file exists
if (file_exists($hookfile)) if (file_exists($hookfile))
{ {
include($hookfile); $js_hooks = array(); // default value
include($hookfile); // include the hook file where the array js_hooks should be setup
// If it contains the provided key calledFrom
if (key_exists($calledFrom, $js_hooks)) if (key_exists($calledFrom, $js_hooks))
{ {
foreach ($js_hooks[$calledFrom] as $js_file) foreach ($js_hooks[$calledFrom] as $js_file)
{
generateJSsInclude('addons/'.$addon.'/'.$js_file); generateJSsInclude('addons/'.$addon.'/'.$js_file);
}
} }
} }
} }
@@ -162,3 +215,4 @@ function generateBackwardCompatibleJSMsIe($js)
echo ' <script type="text/javascript" src="'.$js.'"></script>'."\n"; echo ' <script type="text/javascript" src="'.$js.'"></script>'."\n";
echo "<![endif]-->\n"; echo "<![endif]-->\n";
} }
+1 -1
View File
@@ -74,7 +74,7 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm
$body = _parseMailContent('Sancho_Mail_Template', $layout); $body = _parseMailContent('Sancho_Mail_Template', $layout);
// Send mail // Send mail
$ci->maillib->send($from, $to, $subject, $body, $alias = '', $cc, $bcc, $altMessage = '', $bulk = true, $autogenerated = true); return $ci->maillib->send($from, $to, $subject, $body, $alias = '', $cc, $bcc, $altMessage = '', $bulk = true, $autogenerated = true);
} }
/** /**
+268
View File
@@ -0,0 +1,268 @@
<?php
/**
* FH-Complete
*
* @package FHC-Helper
* @author FHC-Team
* @copyright Copyright (c) 2022 fhcomplete.net
* @license GPLv3
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
class AkteLib
{
const AKTE_KATEGORIE_KURZBZ = 'Akte'; // kategorie_kurzbz of dms when inserting for akte
private $_ci; // Code igniter instance
private $_who; // who added this document
/**
* Object initialization
*/
public function __construct($params = null)
{
$this->_ci =& get_instance();
// Set the the _who property
$this->_who = 'Akte system'; // default
// It is possible to set it using the who parameter
if (!isEmptyArray($params) && isset($params['who']) && !isEmptyString($params['who'])) $this->_who = $params['who'];
$this->_ci->load->model('crm/Akte_model', 'AkteModel');
$this->_ci->load->model('content/DmsFS_model', 'DmsFSModel');
$this->_ci->load->library('DmsLib');
}
/**
* Writes a new file, adds a new dms entry with given akte data,
* adds a new dms version 0 for the written file, and adds Akte if dms add was successfull
* Returns success with inserted akte id or error
*/
public function add(
$person_id, $dokument_kurzbz, $titel, $mimetype, $fileHandle, // Required parameters
$bezeichnung = null, $archiv = false, $signiert = false, $stud_selfservice = false
)
{
// add new dms entry and new dms version for the Akte, using Akte data (title, mimetype, file content as handle)
$dmsAddResult = $this->_ci->dmslib->add($titel, $mimetype, $fileHandle, self::AKTE_KATEGORIE_KURZBZ, $dokument_kurzbz, $bezeichnung);
if (isError($dmsAddResult)) return $dmsAddResult;
if (!hasData($dmsAddResult)) return error("Dms document could not be added");
$dmsAddData = getData($dmsAddResult);
// insert the Akte
return $this->_ci->AkteModel->insert(
array(
'person_id' => $person_id,
'dokument_kurzbz' => $dokument_kurzbz,
'titel' => $titel,
'mimetype' => $mimetype,
'bezeichnung' => $bezeichnung,
'erstelltam' => date('Y-m-d'),
'dms_id' => $dmsAddData->dms_id,
'archiv' => $archiv,
'signiert' => $signiert,
'stud_selfservice' => $stud_selfservice,
'insertamum' => date('Y-m-d H:i:s'),
'insertvon' => $this->_who
)
);
}
/**
* Writes a new file, adds a new dms version 0 for the written file, and updates Akte if dms version add was successfull
* Returns success with updated akte id or error
*/
public function update($akte_id, $titel, $mimetype, $fileHandle, $bezeichnung = null, $archiv = false, $signiert = false, $stud_selfservice = false)
{
// check if Akte with dms exists
$this->_ci->AkteModel->addSelect('dms_id');
$akteResult = $this->_ci->AkteModel->load($akte_id);
if (isError($akteResult)) return $akteResult;
if (!hasData($akteResult)) return error("Akte not found");
$dms_id = getData($akteResult)[0]->dms_id;
if (isEmptyString($dms_id)) return error("Akte has no dms document");
// if Akte with dms found, update the last dms version
$dmsUpdateResult = $this->_ci->dmslib->updateLastVersion($dms_id, $fileHandle, $titel, $mimetype, $bezeichnung);
if (isError($dmsUpdateResult)) return $dmsUpdateResult;
if (!hasData($dmsUpdateResult)) return error("Dms document could not be updated");
// update the Akte
return $this->_ci->AkteModel->update(
$akte_id,
array(
'titel' => $titel,
'mimetype' => $mimetype,
'bezeichnung' => $bezeichnung,
'erstelltam' => date('Y-m-d'),
'dms_id' => $dms_id,
'archiv' => $archiv,
'signiert' => $signiert,
'stud_selfservice' => $stud_selfservice,
'updateamum' => date('Y-m-d H:i:s'),
'updatevon' => $this->_who
)
);
}
/**
* Gets akte data and associated dms data by akte Id
* Returns success with akte and dms data or error
*/
public function get($akte_id)
{
// get Akte data
$this->_ci->AkteModel->addSelect('person_id, dokument_kurzbz, mimetype, erstelltam, titel, bezeichnung,
gedruckt, uid, dms_id, nachgereicht, nachgereicht_am, anmerkung,
ausstellungsnation, formal_geprueft_amum, archiv, signiert,
stud_selfservice, akzeptiertamum, insertvon, insertamum, updatevon, updateamum');
$this->_ci->AkteModel->load($akte_id);
$akteResult = $this->_ci->AkteModel->load($akte_id);
if (isError($akteResult)) return $akteResult;
if (!hasData($akteResult)) return error("Akte not found");
$resultObject = getData($akteResult)[0];
// set properties with same name in Akte and Dms table
$resultObject->akte_mimetype = $resultObject->mimetype;
// get dms data
$dmsResult = $this->_ci->dmslib->getLastVersion($resultObject->dms_id);
if (isError($dmsResult)) return $dmsResult;
// properties to retrieve from dms
$dmsProperties = array('version', 'filename', 'mimetype', 'name', 'beschreibung', 'cis_suche', 'schlagworte', DmsLib::FILE_CONTENT_PROPERTY);
// set dms properties
if (hasData($dmsResult))
{
$dmsData = getData($dmsResult);
foreach ($dmsProperties as $dmsProperty)
{
$resultObject->{$dmsProperty} = $dmsData->{$dmsProperty};
}
}
else
{
// set null if no dms result found
foreach ($dmsProperties as $dmsProperty)
{
$resultObject->{$dmsProperty} = null;
}
}
// return the object containing akte and dms data
return success($resultObject);
}
/**
* Gets Akte data and associated dms data by person Id and dokument_kurzbz
* Returns success with result array with akte and dms data or error
*/
public function getByPersonIdAndDocumentType($person_id, $dokument_kurzbz)
{
// load all Akte entries for given person and dokument_kurzbz
$this->_ci->AkteModel->addSelect('akte_id');
$akteResult = $this->_ci->AkteModel->loadWhere(
array(
'person_id' => $person_id,
'dokument_kurzbz' => $dokument_kurzbz
)
);
if (!hasData($akteResult)) return error("Akte not found");
$akteData = getData($akteResult);
$resultArr = array();
// for each found akte entry
foreach ($akteData as $akte)
{
// get dms and akte data from akte Id
$getAkteDmsResult = $this->get($akte->akte_id);
if (isError($getAkteDmsResult)) return $getAkteDmsResult;
$resultArr[] = getData($getAkteDmsResult);
}
// return all found entries
return success($resultArr);
}
/**
* Removes Akte by akte Id, removes all associated dms entries and versions, and deletes all associated files
* Returns success with removed version numbers or error
*/
public function remove($akte_id)
{
// get dms_id for akte
$this->_ci->AkteModel->addSelect('dms_id');
$akteResult = $this->_ci->AkteModel->load($akte_id);
if (isError($akteResult)) return $akteResult;
if (!hasData($akteResult)) return error("Akte not found");
$dms_id = getData($akteResult)[0]->dms_id;
$error = null;
// Start DB transaction to avoid deleting only part of the data
$this->_ci->db->trans_begin();
// delete Akte
$deleteResult = $this->_ci->AkteModel->delete($akte_id);
if (isError($deleteResult))
{
$error = $deleteResult;
}
else
{
// remove all dms entry for dms of the akte
$removeAllResult = $this->_ci->dmslib->removeAll($dms_id);
if (isError($removeAllResult))
$error = $removeAllResult;
}
// Transaction complete!
$this->_ci->db->trans_complete();
// Check if everything went ok during the transaction
if ($this->_ci->db->trans_status() === false || isset($error))
{
$this->_ci->db->trans_rollback();
// return occured error
if (isset($error))
return $error;
else
return error("Error occured when deleting, rolled back");
}
else
{
$this->_ci->db->trans_commit();
// return removed dms entry data
return $removeAllResult;
}
}
}
+122 -1
View File
@@ -80,15 +80,26 @@ class AnrechnungLib
// Get latest ZGV // Get latest ZGV
$result = $this->ci->PrestudentModel->getLatestZGVBezeichnung($prestudent_id); $result = $this->ci->PrestudentModel->getLatestZGVBezeichnung($prestudent_id);
$latest_zgv_bezeichnung = hasData($result) ? getData($result)[0]->bezeichnung : ''; $latest_zgv_bezeichnung = hasData($result) ? getData($result)[0]->bezeichnung : '';
// Get Sum of berufliche and schulische ECTS
$result = $this->ci->LehrveranstaltungModel->getEctsSumSchulisch($uid, $prestudent_id, $lv->studiengang_kz);
$sumEctsSchulisch = getData($result)[0]->ectssumschulisch;
$result = $this->ci->LehrveranstaltungModel->getEctsSumBeruflich($uid);
$sumEctsBeruflich = getData($result)[0]->ectssumberuflich;
// Set the given studiensemester // Set the given studiensemester
$antrag_data->lv_id = $lv_id; $antrag_data->lv_id = $lv_id;
$antrag_data->lv_bezeichnung = $lv->bezeichnung; $antrag_data->lv_bezeichnung = $lv->bezeichnung;
$antrag_data->ects = $lv->ects; $antrag_data->ects = $lv->ects;
$antrag_data->sumEctsSchulisch = $sumEctsSchulisch;
$antrag_data->sumEctsBeruflich = $sumEctsBeruflich;
$antrag_data->studiensemester_kurzbz = $studiensemester_kurzbz; $antrag_data->studiensemester_kurzbz = $studiensemester_kurzbz;
$antrag_data->vorname = $person->vorname; $antrag_data->vorname = $person->vorname;
$antrag_data->nachname = $person->nachname; $antrag_data->nachname = $person->nachname;
$antrag_data->student_uid = $uid;
$antrag_data->matrikelnr = $student->matrikelnr; $antrag_data->matrikelnr = $student->matrikelnr;
$antrag_data->studiengang_kz = $studiengang->studiengang_kz;
$antrag_data->stg_bezeichnung = $studiengang->bezeichnung; $antrag_data->stg_bezeichnung = $studiengang->bezeichnung;
$antrag_data->lektoren = $lv_lektoren_arr; $antrag_data->lektoren = $lv_lektoren_arr;
$antrag_data->zgv = $latest_zgv_bezeichnung; $antrag_data->zgv = $latest_zgv_bezeichnung;
@@ -111,6 +122,7 @@ class AnrechnungLib
$anrechnung_data = new StdClass(); $anrechnung_data = new StdClass();
$this->ci->AnrechnungModel->addJoin('lehre.tbl_anrechnung_begruendung', 'begruendung_id');
$result = $this->ci->AnrechnungModel->load($anrechnung_id); $result = $this->ci->AnrechnungModel->load($anrechnung_id);
if (isError($result)) if (isError($result))
@@ -144,6 +156,7 @@ class AnrechnungLib
$anrechnung_data->prestudent_id = ''; $anrechnung_data->prestudent_id = '';
$anrechnung_data->lehrveranstaltung = ''; $anrechnung_data->lehrveranstaltung = '';
$anrechnung_data->begruendung_id = ''; $anrechnung_data->begruendung_id = '';
$anrechnung_data->begruendung = '';
$anrechnung_data->anmerkung = ''; $anrechnung_data->anmerkung = '';
$anrechnung_data->dms_id = ''; $anrechnung_data->dms_id = '';
$anrechnung_data->insertamum = ''; $anrechnung_data->insertamum = '';
@@ -154,6 +167,7 @@ class AnrechnungLib
$anrechnung_data->status = getUserLanguage() == 'German' ? 'neu' : 'new'; $anrechnung_data->status = getUserLanguage() == 'German' ? 'neu' : 'new';
$anrechnung_data->dokumentname = ''; $anrechnung_data->dokumentname = '';
$this->ci->AnrechnungModel->addJoin('lehre.tbl_anrechnung_begruendung', 'begruendung_id');
$result = $this->ci->AnrechnungModel->loadWhere( $result = $this->ci->AnrechnungModel->loadWhere(
array( array(
'lehrveranstaltung_id' => $lehrveranstaltung_id, 'lehrveranstaltung_id' => $lehrveranstaltung_id,
@@ -799,6 +813,7 @@ class AnrechnungLib
$anrechnung_data->prestudent_id = $anrechnung->prestudent_id; $anrechnung_data->prestudent_id = $anrechnung->prestudent_id;
$anrechnung_data->lehrveranstaltung_id = $anrechnung->lehrveranstaltung_id; $anrechnung_data->lehrveranstaltung_id = $anrechnung->lehrveranstaltung_id;
$anrechnung_data->begruendung_id = $anrechnung->begruendung_id; $anrechnung_data->begruendung_id = $anrechnung->begruendung_id;
$anrechnung_data->begruendung = $anrechnung->bezeichnung;
$anrechnung_data->anmerkung = $anrechnung->anmerkung_student; $anrechnung_data->anmerkung = $anrechnung->anmerkung_student;
$anrechnung_data->dms_id = $anrechnung->dms_id; $anrechnung_data->dms_id = $anrechnung->dms_id;
$anrechnung_data->insertamum = (new DateTime($anrechnung->insertamum))->format('d.m.Y'); $anrechnung_data->insertamum = (new DateTime($anrechnung->insertamum))->format('d.m.Y');
@@ -822,4 +837,110 @@ class AnrechnungLib
return $anrechnung_data; return $anrechnung_data;
} }
/**
* If Student is a Quereinsteiger, get ECTS Summe of all angerechnete Studiensemester.
*
* @param $prestudent_id
* @param $studiengang_kz Studiengang_kz der LV
* @return int|mixed
*/
public function getQuereinsteigerEctsSumme($prestudent_id, $studiengang_kz)
{
$sumEctsQuereinsteiger = 0;
// Check, if student is Quereinsteiger
$this->ci->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
$result = $this->ci->PrestudentstatusModel->getFirstStatus($prestudent_id, 'Student');
$prestudentFirstStudentStatus = getData($result)[0];
// If Prestudent is not a Quereinsteiger
if ($prestudentFirstStudentStatus->ausbildungssemester == 1)
{
return $sumEctsQuereinsteiger; // return 0
}
$anzahlAngerechneteStudiensemester = $prestudentFirstStudentStatus->ausbildungssemester - 1;
// If Prestudent is a Quereinsteiger
if ($prestudentFirstStudentStatus->ausbildungssemester > 1)
{
// Get the 'angerechnete Studiensemester'
$this->ci->load->model('organisations/Studiensemester_model', 'StudiensemesterModel');
$result = $this->ci->StudiensemesterModel->getPreviousFrom(
$prestudentFirstStudentStatus->studiensemester_kurzbz,
$anzahlAngerechneteStudiensemester
);
// Get ECTS Summe of each 'angerechnetes Studiensemester'
foreach (getData($result) as $studiensemester)
{
$result = $this->ci->LehrveranstaltungModel->getSumQuereinstiegsECTSProSemester(
$studiengang_kz,
$studiensemester->studiensemester_kurzbz,
$anzahlAngerechneteStudiensemester--,
$prestudentFirstStudentStatus->orgform_kurzbz
);
if (hasData($result))
{
$sumEctsQuereinsteiger = $sumEctsQuereinsteiger + getData($result)[0]->sum_ects;
}
}
}
return $sumEctsQuereinsteiger; // return sum of ects of all 'angerechnete Studiensemester'
}
/**
* Get ECTS Summe of all Anrechnungen based on schulische Kenntnisse.
*
* @param $student_uid
* @return int|mixed
*/
public function getSchulischeAnrechnungenEctsSumme($student_uid)
{
$sumEctsSchule = 0;
$result = $this->ci->LehrveranstaltungModel->getSumAngerechneteECTSByBegruendung($student_uid);
if (hasData($result))
{
foreach (getData($result) as $ects)
{
if ($ects->begruendung_id != 4)
{
$sumEctsSchule = $sumEctsSchule + $ects->sum;
}
}
}
return $sumEctsSchule;
}
/**
* Get ECTS Summe of all Anrechnungen based on berufliche Kenntnisse.
*
* @param $student_uid
* @return int
*/
public function getBeruflicheAnrechnungenEctsSumme($student_uid)
{
$sumEctsBeruflich = 0;
$result = $this->ci->LehrveranstaltungModel->getSumAngerechneteECTSByBegruendung($student_uid);
if (hasData($result))
{
foreach (getData($result) as $ects)
{
if ($ects->begruendung_id == 4)
{
$sumEctsBeruflich = $ects->sum;
}
}
}
return $sumEctsBeruflich;
}
} }
+588 -147
View File
@@ -1,26 +1,483 @@
<?php <?php
/**
* FH-Complete
*
* @package FHC-Helper
* @author FHC-Team
* @copyright Copyright (c) 2022 fhcomplete.net
* @license GPLv3
*/
if (! defined('BASEPATH')) exit('No direct script access allowed'); if (! defined('BASEPATH')) exit('No direct script access allowed');
class DmsLib extends FHC_Controller use \stdClass as stdClass;
class DmsLib
{ {
const FILE_CONTENT_PROPERTY = 'file_content'; const FILE_CONTENT_PROPERTY = 'file_content'; // property name for file content
private $UPLOAD_PATH = DMS_PATH; // temporary directory to store the upload file private $_ci; // code igniter instance
private $_who; // who added this document
/** /**
* Object initialization * Object initialization
*/ */
public function __construct() public function __construct($params = null)
{ {
$this->ci =& get_instance(); $this->_ci =& get_instance();
$this->ci->load->model('crm/Akte_model', 'AkteModel'); // Set the the _who property
$this->ci->load->model('content/Dms_model', 'DmsModel'); $this->_who = 'DMS system'; // default
$this->ci->load->model('content/DmsVersion_model', 'DmsVersionModel'); // It is possible to set it using the who parameter
$this->ci->load->model('content/DmsFS_model', 'DmsFSModel'); if (!isEmptyArray($params) && isset($params['who']) && !isEmptyString($params['who'])) $this->_who = $params['who'];
$this->_ci->load->model('crm/Akte_model', 'AkteModel'); // deprecated, should not be used here!
$this->_ci->load->model('content/Dms_model', 'DmsModel');
$this->_ci->load->model('content/DmsVersion_model', 'DmsVersionModel');
$this->_ci->load->model('content/DmsFS_model', 'DmsFSModel');
} }
// -----------------------------------------------------------------------------------------------------------
// Public methods
/**
* Writes a new file, adds a new dms entry and a new dms version 0 for the written file
* Returns success info of added dms entry (dms_id, version, filename) or error
*/
public function add(
$name, $mimetype, $fileHandle, // Required parameters
$kategorie_kurzbz = null, $dokument_kurzbz = null, $beschreibung = null, $cis_suche = false, $schlagworte = null
)
{
// create unique filename, using original document name to detect file extension
$filename = $this->_getUniqueFilename($name);
// copy file from fileHandle to dms folder
$copyFileResult = $this->_copyFile($fileHandle, $filename);
if (isError($copyFileResult)) return $copyFileResult;
// if file written successful, insert dms
$dmsResult = $this->_ci->DmsModel->insert(
array(
'kategorie_kurzbz' => $kategorie_kurzbz,
'dokument_kurzbz' => $dokument_kurzbz
)
);
if (isError($dmsResult)) return $dmsResult;
if (hasData($dmsResult))
{
$dms_id = getData($dmsResult);
$version = 0;
// insert dms version
$dmsVersion = array(
'dms_id' => $dms_id,
'version' => $version,
'filename' => $filename,
'mimetype' => $mimetype,
'name' => $name,
'beschreibung' => $beschreibung,
'cis_suche' => $cis_suche,
'schlagworte' => $schlagworte,
'insertvon' => $this->_who,
'insertamum' => date('Y-m-d H:i:s')
);
$dmsVersionResult = $this->_ci->DmsVersionModel->insert($dmsVersion);
if (isError($dmsVersionResult)) return $dmsVersionResult;
// return dms info
$resObj = new stdClass();
$resObj->dms_id = $dms_id;
$resObj->version = $version;
$resObj->filename = $filename;
return success($resObj);
}
else
return error("error when inserting DMS");
}
/**
* Writes a new file with content of fileHandle, adds a new dms version (max version number + 1) for the written file
* Returns success with info of added dms version (version, filename) or error
*/
public function addNewVersion($dms_id, $fileHandle, $name = null, $mimetype = null, $beschreibung = null, $cis_suche = false, $schlagworte = null)
{
// get the latest version
$lastVersionResult = $this->getLastVersion($dms_id);
if (isError($lastVersionResult)) return $lastVersionResult;
if (hasData($lastVersionResult))
{
$lastVersion = getData($lastVersionResult);
$originalName = isset($name) ? $name : $lastVersion->name;
// create unique filename, using original document name to detect file extension
$filename = $this->_getUniqueFilename($originalName);
// copy file from fileHandle to dms folder
$copyFileResult = $this->_copyFile($fileHandle, $filename);
if (isError($copyFileResult)) return $copyFileResult;
// insert new version
$newVersionNumber = $lastVersion->version + 1;
// if new parameters given, use them, otherwise use parameters from last version
$newVersion = array(
'dms_id' => $dms_id,
'name' => $originalName,
'filename' => $filename,
'version' => $newVersionNumber,
'mimetype' => isset($mimetype) ? $mimetype : $lastVersion->mimetype,
'beschreibung' => isset($beschreibung) ? $beschreibung : $lastVersion->beschreibung,
'cis_suche' => isset($cis_suche) ? $cis_suche : $lastVersion->cis_suche,
'schlagworte' => isset($schlagworte) ? $schlagworte : $lastVersion->schlagworte,
'insertvon' => $this->_who,
'insertamum' => date('Y-m-d H:i:s')
);
$addVersionResult = $this->_ci->DmsVersionModel->insert($newVersion);
if (isError($addVersionResult)) return $addVersionResult;
// return dms info
$resObj = new stdClass();
$resObj->version = $newVersionNumber;
$resObj->filename = $filename;
return success($resObj);
}
else
return error("last version not found");
}
/**
* Updates the last version (max version number) of a dms entry
* Overwrites the file associated with this version with content read from fileHandle
* Returns success with info of added dms version (version, filename) or error
*/
public function updateLastVersion($dms_id, $fileHandle, $name = null, $mimetype = null, $beschreibung = null, $cis_suche = false, $schlagworte = null)
{
// get the latest version
$lastVersionResult = $this->getLastVersion($dms_id);
if (isError($lastVersionResult)) return $lastVersionResult;
if (hasData($lastVersionResult))
{
$lastVersion = getData($lastVersionResult);
$filename = $lastVersion->filename;
// update file in filesystem
$copyFileResult = $this->_copyFile($fileHandle, $filename);
if (isError($copyFileResult)) return $copyFileResult;
// if new parameters given, use them, otherwise use parameters from last version
$newVersion = array(
'name' => isset($name) ? $name : $lastVersion->name,
'filename' => $filename,
'mimetype' => isset($mimetype) ? $mimetype : $lastVersion->mimetype,
'beschreibung' => isset($beschreibung) ? $beschreibung : $lastVersion->beschreibung,
'cis_suche' => isset($cis_suche) ? $cis_suche : $lastVersion->cis_suche,
'schlagworte' => isset($schlagworte) ? $schlagworte : $lastVersion->schlagworte,
);
// update last dms version
$addVersionResult = $this->_ci->DmsVersionModel->update(
array($dms_id, $lastVersion->version),
$newVersion
);
if (isError($addVersionResult)) return $addVersionResult;
// return dms info
$resObj = new stdClass();
$resObj->version = $lastVersion->version;
$resObj->filename = $filename;
return success($resObj);
}
else
return error("last version not found");
}
/**
* Gets dms version with highest number
* Returns success with dms data and fileHandle with file content or error
*/
public function getLastVersion($dms_id)
{
// get the latest version number
$this->_ci->DmsVersionModel->addSelect('version');
$this->_ci->DmsVersionModel->addOrder('version', 'DESC');
$this->_ci->DmsVersionModel->addOrder('insertamum', 'DESC');
$this->_ci->DmsVersionModel->addLimit(1);
$lastDmsVersionResult = $this->_ci->DmsVersionModel->loadWhere(
array('dms_id' => $dms_id)
);
if (isError($lastDmsVersionResult)) return $lastDmsVersionResult;
if (hasData($lastDmsVersionResult))
{
$lastDmsVersionData = getData($lastDmsVersionResult)[0];
$lastDmsVersion = $lastDmsVersionData->version;
// call get Version with last version number
return $this->getVersion($dms_id, $lastDmsVersion);
}
else
return error("Dms last version not found");
}
/**
* Gets specified dms version
* Returns success with dms data and fileHandle with file content or error
*/
public function getVersion($dms_id, $version)
{
$this->_ci->DmsVersionModel->addSelect('dms_id, version, filename, mimetype, name, beschreibung, cis_suche, schlagworte');
$dmsVersionResult = $this->_ci->DmsVersionModel->loadWhere(
array(
'dms_id' => $dms_id,
'version' => $version
)
);
if (isError($dmsVersionResult)) return $dmsVersionResult;
if (hasData($dmsVersionResult))
{
$dmsVersion = getData($dmsVersionResult)[0];
// get file content as file pointer
$fileHandleResult = $this->_ci->DmsFSModel->openRead($dmsVersion->filename);
if (isError($fileHandleResult)) return $fileHandleResult;
if (hasData($fileHandleResult))
{
$fileHandle = getData($fileHandleResult);
$dmsVersion->{self::FILE_CONTENT_PROPERTY} = $fileHandle;
// close file pointer
$closeResult = $this->_ci->DmsFSModel->close($fileHandle);
if (isError($closeResult)) return $closeResult;
return success($dmsVersion);
}
else
return error("File could not be opened");
}
else
return error("Dms version not found");
}
/**
* Removes dms entry and all its versions, deletes all associated files
* Returns success with removed version numbers or error
*/
public function removeAll($dms_id)
{
$versionsRemoved = array();
$this->_ci->DmsVersionModel->addSelect('version, filename');
$allVersionsResult = $this->_ci->DmsVersionModel->loadWhere(array('dms_id' => $dms_id));
if (hasData($allVersionsResult))
{
$allVersionsData = getData($allVersionsResult);
$error = null;
// Start DB transaction to avoid deleting only part of the data
$this->_ci->db->trans_begin();
// remove all versions of the dms Id
foreach ($allVersionsData as $version)
{
$removeVersionResult = $this->removeVersion($dms_id, $version->version);
if (isError($removeVersionResult))
{
$error = $removeVersionResult;
break;
}
else
$versionsRemoved[] = $version; // return removed versions
}
// Transaction complete!
$this->_ci->db->trans_complete();
// Check if everything went ok during the transaction
if ($this->_ci->db->trans_status() === false || isset($error))
{
$this->_ci->db->trans_rollback();
if (isset($error))
return $error;
else
return error("Error occured when deleting, rolled back");
}
else
{
$this->_ci->db->trans_commit();
}
}
return success($versionsRemoved);
}
/**
* Removes latest version and its associated file
* Returns success with removed dms version data (dms_id, version, filename) or error
*/
public function removeLastVersion($dms_id)
{
$lastVersionNumber = 0;
// get the latest version
$lastVersionResult = $this->getLastVersion($dms_id);
if (isError($lastVersionResult)) return $lastVersionResult;
if (hasData($lastVersionResult))
{
$lastVersion = getData($lastVersionResult);
$lastVersionNumber = $lastVersion->version;
}
// call remove method for latest version
return $this->removeVersion($dms_id, $lastVersionNumber);
}
/**
* Removes latest version and its associated file
* Returns success with removed dms version data (dms_id, version, filename) or error
*/
public function removeVersion($dms_id, $version)
{
$removeVersionResultObj = new stdClass();
$removeVersionResultObj->dms_id = null;
$removeVersionResultObj->version = null;
$removeVersionResultObj->filename = null;
// load dms version and check how many versions there are
$db = new DB_Model();
$checkDeleteResult = $db->execReadOnlyQuery(
"SELECT filename,
(SELECT count(version)
FROM campus.tbl_dms_version dv_anzahl
WHERE dv_anzahl.dms_id = dv.dms_id) AS anzahl_versionen
FROM campus.tbl_dms_version dv
WHERE dms_id=?
AND version=?",
array($dms_id, $version)
);
if (isError($checkDeleteResult)) return $checkDeleteResult;
if (hasData($checkDeleteResult))
{
$checkDeleteData = getData($checkDeleteResult)[0];
// delete version
$deleteVersionResult = $this->_ci->DmsVersionModel->delete(array($dms_id, $version));
if (isError($deleteVersionResult)) return $deleteVersionResult;
$removeVersionResultObj->version = $version;
$removeVersionResultObj->filename = $checkDeleteData->filename;
// delete dms too if no versions left
if ($checkDeleteData->anzahl_versionen <= 1)
{
$deleteDmsResult = $this->_ci->DmsModel->delete($dms_id);
if (isError($deleteDmsResult)) return $deleteDmsResult;
$removeVersionResultObj->dms_id = $dms_id;
}
// delete file from file system
$removeResult = $this->_ci->DmsFSModel->remove($checkDeleteData->filename);
if (isError($removeResult)) return $removeResult;
}
return success($removeVersionResultObj);
}
// -----------------------------------------------------------------------------------------------------------
// Private methods
/**
* Copies file from sourceFileHandle to destinationFilename in DMS folder
* Returns success or error on fail
*/
private function _copyFile($sourceFileHandle, $destinationFilename)
{
// get file location from file handle
$metaData = stream_get_meta_data($sourceFileHandle);
if (isset($metaData['uri']) && !isEmptyString($metaData['uri']))
{
// if file location determined, copy file
$source = $metaData['uri'];
if (copy($source, DMS_PATH.$destinationFilename))
{
return success();
}
else
{
// error if copy returned false
return error('error occured while copying file');
}
}
else
{
// error when source location could not be determined
return error('error occured while getting source file name');
}
return success($resObj);
}
/**
* Generates unique filename, appends file extension from document name
* Returns the filename string
*/
private function _getUniqueFilename($dokname)
{
// create unique id
$uniqueFilename = uniqid();
// getting extension of file from document name
$fileExtension = pathinfo($dokname, PATHINFO_EXTENSION);
// if file extension found, append it
if (!isEmptyString($fileExtension))
$uniqueFilename .= '.'.$fileExtension;
return $uniqueFilename;
}
// -----------------------------------------------------------------------------------------------------------
// Deprecated methods, not to be used
/** /**
* Load a DMS Document. * Load a DMS Document.
* If no version is particularly given, the latest version is loaded. * If no version is particularly given, the latest version is loaded.
@@ -33,19 +490,20 @@ class DmsLib extends FHC_Controller
{ {
if (is_numeric($dms_id)) if (is_numeric($dms_id))
{ {
$this->ci->DmsModel->addJoin('campus.tbl_dms_version', 'dms_id'); $this->_ci->DmsModel->addJoin('campus.tbl_dms_version', 'dms_id');
$this->ci->DmsModel->addOrder('version', 'DESC'); $this->_ci->DmsModel->addOrder('version', 'DESC');
$this->ci->DmsModel->addLimit(1); $this->_ci->DmsModel->addLimit(1);
if (!is_numeric($version)) if (!is_numeric($version))
{ {
return $this->ci->DmsModel->load($dms_id); return $this->_ci->DmsModel->load($dms_id);
} }
else else
{ {
return $this->ci->DmsModel->loadWhere(array('dms_id' => $dms_id, 'version' => $version)); return $this->_ci->DmsModel->loadWhere(array('dms_id' => $dms_id, 'version' => $version));
} }
} }
return error('The parameter DMS ID must be a number'); return error('The parameter DMS ID must be a number');
} }
@@ -57,34 +515,30 @@ class DmsLib extends FHC_Controller
*/ */
public function read($dms_id, $version = null) public function read($dms_id, $version = null)
{ {
$result = null; $result = error('Wrong dms_id parameter');
if (isset($dms_id)) if (isset($dms_id))
{ {
$this->ci->DmsModel->addJoin('campus.tbl_dms_version', 'dms_id'); $this->_ci->DmsModel->addJoin('campus.tbl_dms_version', 'dms_id');
$this->ci->DmsModel->addOrder('version', 'DESC'); $this->_ci->DmsModel->addOrder('version', 'DESC');
$this->ci->DmsModel->addLimit(1); $this->_ci->DmsModel->addLimit(1);
if (!isset($version)) if (!isset($version))
{ {
$result = $this->ci->DmsModel->load($dms_id); $result = $this->_ci->DmsModel->load($dms_id);
} }
else else
{ {
$result = $this->ci->DmsModel->loadWhere(array('dms_id' => $dms_id, 'version' => $version)); $result = $this->_ci->DmsModel->loadWhere(array('dms_id' => $dms_id, 'version' => $version));
} }
}
if (hasData($result)) // If a dms has been found
{ if (hasData($result))
$resultFS = $this->ci->DmsFSModel->read($result->retval[0]->filename);
if (isSuccess($resultFS))
{ {
$result->retval[0]->{DmsLib::FILE_CONTENT_PROPERTY} = $resultFS->retval; $resultFS = $this->_ci->DmsFSModel->readBase64(getData($result)[0]->filename);
} if (isError($resultFS)) return $resultFS; // if an error occurred return it
else
{ $result->retval[0]->{self::FILE_CONTENT_PROPERTY} = getData($resultFS);
$result = $resultFS;
} }
} }
@@ -101,28 +555,22 @@ class DmsLib extends FHC_Controller
*/ */
public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null, $no_file = null) public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null, $no_file = null)
{ {
$result = $this->ci->AkteModel->getAktenAcceptedDms($person_id, $dokument_kurzbz); $result = $this->_ci->AkteModel->getAktenAcceptedDms($person_id, $dokument_kurzbz);
if (hasData($result) && $no_file == null) if (hasData($result) && $no_file == null)
{ {
$cnt = count($result->retval); for ($i = 0; $i < count(getData($result)); $i++)
for ($i = 0; $i < $cnt; $i++)
{ {
$resultFS = $this->ci->DmsFSModel->read($result->retval[$i]->filename); $resultFS = $this->_ci->DmsFSModel->readBase64(getData($result)[$i]->filename);
if (isSuccess($resultFS)) if (isError($resultFS)) return $resultFS; // if an error occurred return it
{
$result->retval[$i]->{DmsLib::FILE_CONTENT_PROPERTY} = $resultFS->retval; $result->retval[$i]->{self::FILE_CONTENT_PROPERTY} = getData($resultFS);
}
else
{
$result = $resultFS;
}
} }
} }
return $result; return $result;
} }
/** /**
* Uploads a document and saves it to DMS * Uploads a document and saves it to DMS
* @param $dms DMS assoc array * @param $dms DMS assoc array
@@ -135,32 +583,33 @@ class DmsLib extends FHC_Controller
// Init upload configs // Init upload configs
$this->_loadUploadLibrary($allowed_types); $this->_loadUploadLibrary($allowed_types);
if (!$this->ci->upload->do_upload($field_name)) if (!$this->_ci->upload->do_upload($field_name))
{ {
return error($this->ci->upload->display_errors()); return error($this->_ci->upload->display_errors());
} }
$upload_data = $this->ci->upload->data(); // data about the uploaded file $upload_data = $this->_ci->upload->data(); // data about the uploaded file
$filename = $upload_data['file_name'];
// Insert to DMS table // Insert to DMS table
if (!$result = $this->ci->DmsModel->insert($this->ci->DmsModel->filterFields($dms))) $insDmsResult = $this->_ci->DmsModel->insert($this->_ci->DmsModel->filterFields($dms));
{ if (isError($insDmsResult)) return $insDmsResult;
return error('Failed inserting to DMS');
} $upload_data['dms_id'] = getData($insDmsResult);
$upload_data['dms_id'] = $result->retval;
// Insert DMS version // Insert DMS version
if (!$result = $this->ci->DmsVersionModel->insert( $insVersionResult = $this->_ci->DmsVersionModel->insert(
$this->ci->DmsVersionModel->filterFields($dms, $result->retval, $filename))) $this->_ci->DmsVersionModel->filterFields(
{ $dms,
return error('Failed inserting DMS version'); $upload_data['dms_id'],
} $upload_data['file_name']
)
);
if (isError($insVersionResult)) return $insVersionResult;
// return result of uploaded data // Return result of uploaded data
return success($upload_data); // data about the uploaded file return success($upload_data);
} }
/** /**
* Download a document. * Download a document.
* *
@@ -171,38 +620,31 @@ class DmsLib extends FHC_Controller
*/ */
public function download($dms_id, $filename = null, $disposition = 'inline') public function download($dms_id, $filename = null, $disposition = 'inline')
{ {
$result = $this->getFileInfo($dms_id); // Retrieves info about the given dms
$fileInfoResult = $this->getFileInfo($dms_id);
if (isError($result)) if (isError($fileInfoResult)) return error(getError($fileInfoResult));
// If data have been found
if (hasData($fileInfoResult))
{ {
return error(getError($result)); $fileObj = getData($fileInfoResult);
// Change filename, if filename is provided
if (!isEmptyString($filename)) $fileObj->name = $filename;
// Add file disposition if disposition has a valid value
if ($disposition == 'attachment' || $disposition == 'inline')
{
$fileObj->disposition = $disposition;
}
return success($fileObj);
} }
$fileObj = getData($result); // If no data have been found then return an empty success
return success();
// Change filename, if filename is provided
if (is_string($filename))
{
$fileObj->name = $filename;
}
// Add file disposition
if ($disposition == 'attachment')
{
$fileObj->disposition = 'attachment';
}
else
{
$fileObj->disposition = 'inline';
}
// Output file
if(!$this->outputFile($fileObj))
{
return error('Error on file output');
}
} }
/** /**
* Get file information. * Get file information.
* *
@@ -212,28 +654,28 @@ class DmsLib extends FHC_Controller
*/ */
public function getFileInfo($dms_id, $version = null) public function getFileInfo($dms_id, $version = null)
{ {
if (!is_numeric($dms_id)) // Checks the dms_id parameter
{ if (!is_numeric($dms_id)) return error('Wrong parameter');
return error('Wrong parameter');
} // Load DMS from database
// Load file
$result = $this->load($dms_id, $version); $result = $this->load($dms_id, $version);
if (isError($result)) return error(getError($result));
if (isError($result)) // If data have been found
if (hasData($result))
{ {
return error(getError($result)); // Store file information in fileObj
$fileObj = new stdClass();
$fileObj->filename = getData($result)[0]->filename;
$fileObj->file = DMS_PATH.getData($result)[0]->filename;
$fileObj->name = DMS_PATH.getData($result)[0]->name; // original user filename
$fileObj->mimetype = getData($result)[0]->mimetype;
return success($fileObj);
} }
// Store file information in fileObj // If no data have been found return an empty success
$fileObj = new StdClass(); return success();
$fileObj->filename = getData($result)[0]->filename;
$fileObj->file = DMS_PATH. getData($result)[0]->filename;
$fileObj->name = DMS_PATH. getData($result)[0]->name; // original users filename
$fileObj->mimetype = DMS_PATH. getData($result)[0]->mimetype;
return success($fileObj);
} }
/** /**
@@ -253,20 +695,20 @@ class DmsLib extends FHC_Controller
$result = $this->_saveFileOnInsert($dms); $result = $this->_saveFileOnInsert($dms);
if (isSuccess($result)) if (isSuccess($result))
{ {
$filename = $result->retval; $filename = getData($result);
if (isset($dms['dms_id']) && $dms['dms_id'] != '') if (isset($dms['dms_id']) && $dms['dms_id'] != '')
{ {
$result = $this->ci->DmsVersionModel->insert( $result = $this->_ci->DmsVersionModel->insert(
$this->ci->DmsVersionModel->filterFields($dms, $dms['dms_id'], $filename) $this->_ci->DmsVersionModel->filterFields($dms, $dms['dms_id'], $filename)
); );
} }
else else
{ {
$result = $this->ci->DmsModel->insert($this->ci->DmsModel->filterFields($dms)); $result = $this->_ci->DmsModel->insert($this->_ci->DmsModel->filterFields($dms));
if (isSuccess($result)) if (isSuccess($result))
{ {
$result = $this->ci->DmsVersionModel->insert( $result = $this->_ci->DmsVersionModel->insert(
$this->ci->DmsVersionModel->filterFields($dms, $result->retval, $filename) $this->_ci->DmsVersionModel->filterFields($dms, getData($result), $filename)
); );
} }
} }
@@ -277,15 +719,15 @@ class DmsLib extends FHC_Controller
$result = $this->_saveFileOnUpdate($dms); $result = $this->_saveFileOnUpdate($dms);
if (isSuccess($result)) if (isSuccess($result))
{ {
$result = $this->ci->DmsModel->update($dms['dms_id'], $this->ci->DmsModel->filterFields($dms)); $result = $this->_ci->DmsModel->update($dms['dms_id'], $this->_ci->DmsModel->filterFields($dms));
if (isSuccess($result)) if (isSuccess($result))
{ {
$result = $this->ci->DmsVersionModel->update( $result = $this->_ci->DmsVersionModel->update(
array( array(
$dms['dms_id'], $dms['dms_id'],
$dms['version'] $dms['version']
), ),
$this->ci->DmsVersionModel->filterFields($dms) $this->_ci->DmsVersionModel->filterFields($dms)
); );
} }
} }
@@ -308,56 +750,54 @@ class DmsLib extends FHC_Controller
if (is_numeric($person_id) && is_numeric($dms_id)) if (is_numeric($person_id) && is_numeric($dms_id))
{ {
// Start DB transaction // Start DB transaction
$this->ci->db->trans_start(false); $this->_ci->db->trans_start(false);
// Get akte_id from table tbl_akte // Get akte_id from table tbl_akte
$result = $this->ci->AkteModel->loadWhere(array('person_id' => $person_id, 'dms_id' => $dms_id)); $result = $this->_ci->AkteModel->loadWhere(array('person_id' => $person_id, 'dms_id' => $dms_id));
if (isSuccess($result)) if (isSuccess($result))
{ {
// Delete all entries in tbl_akte // Delete all entries in tbl_akte
$cnt = count($result->retval); for ($i = 0; $i < count(getData($result)); $i++)
for ($i = 0; $i < $cnt; $i++)
{ {
$this->ci->AkteModel->delete($result->retval[$i]->akte_id); $this->_ci->AkteModel->delete(getData($result)[$i]->akte_id);
} }
// Get all filenames related to this dms // Get all filenames related to this dms
$resultFileNames = $this->ci->DmsVersionModel->loadWhere(array('dms_id' => $dms_id)); $resultFileNames = $this->_ci->DmsVersionModel->loadWhere(array('dms_id' => $dms_id));
if (isSuccess($resultFileNames)) if (isSuccess($resultFileNames))
{ {
// Delete from tbl_dms_version // Delete from tbl_dms_version
$result = $this->ci->DmsVersionModel->delete(array('dms_id' => $dms_id)); $result = $this->_ci->DmsVersionModel->delete(array('dms_id' => $dms_id));
if (isSuccess($result)) if (isSuccess($result))
{ {
// Delete from tbl_dms // Delete from tbl_dms
$result = $this->ci->DmsModel->delete($dms_id); $result = $this->_ci->DmsModel->delete($dms_id);
} }
} }
} }
// Transaction complete! // Transaction complete!
$this->ci->db->trans_complete(); $this->_ci->db->trans_complete();
// Check if everything went ok during the transaction // Check if everything went ok during the transaction
if ($this->ci->db->trans_status() === false || isError($result)) if ($this->_ci->db->trans_status() === false || isError($result))
{ {
$this->ci->db->trans_rollback(); $this->_ci->db->trans_rollback();
$result = error('An error occurred while performing a delete operation', EXIT_ERROR); $result = error('An error occurred while performing a delete operation', EXIT_ERROR);
} }
else else
{ {
$this->ci->db->trans_commit(); $this->_ci->db->trans_commit();
$result = success('Dms successfully removed from DB'); $result = success('Dms successfully removed from DB');
} }
// If everything is ok // If everything is ok
if (isSuccess($result)) if (isSuccess($result))
{ {
$cnt = count($resultFileNames->retval);
// Remove all files related to this person and dms // Remove all files related to this person and dms
for ($i = 0; $i < $cnt; $i++) for ($i = 0; $i < count(getData($resultFileNames)); $i++)
{ {
$this->ci->DmsFSModel->remove($resultFileNames->retval[$i]->filename); $this->_ci->DmsFSModel->removeBase64(getData($resultFileNames)[$i]->filename);
} }
} }
} }
@@ -376,19 +816,19 @@ class DmsLib extends FHC_Controller
*/ */
public function getAkteContent($akte_id) public function getAkteContent($akte_id)
{ {
$akte = $this->ci->AkteModel->load($akte_id); $akte = $this->_ci->AkteModel->load($akte_id);
if (hasData($akte)) if (hasData($akte))
{ {
if ($akte->retval[0]->inhalt != '') if (getData($akte)[0]->inhalt != '')
{ {
return success(base64_decode($akte->retval[0]->inhalt)); return success(base64_decode(getData($akte)[0]->inhalt));
} }
elseif ($akte->retval[0]->dms_id != '') elseif (getData($akte)[0]->dms_id != '')
{ {
$dmscontent = $this->read($akte->retval[0]->dms_id); $dmscontent = $this->read(getData($akte)[0]->dms_id);
if (isSuccess($dmscontent)) if (isSuccess($dmscontent))
{ {
return success(base64_decode($dmscontent->retval[0]->file_content)); return success(base64_decode(getData($dmscontent)[0]->file_content));
} }
else else
{ {
@@ -415,10 +855,10 @@ class DmsLib extends FHC_Controller
{ {
$filename = uniqid().'.'.pathinfo($dms['name'], PATHINFO_EXTENSION); $filename = uniqid().'.'.pathinfo($dms['name'], PATHINFO_EXTENSION);
$result = $this->ci->DmsFSModel->write($filename, $dms['file_content']); $result = $this->_ci->DmsFSModel->writeBase64($filename, $dms['file_content']);
if (isSuccess($result)) if (isSuccess($result))
{ {
$result->retval = $filename; $result = success($filename);
} }
return $result; return $result;
@@ -439,7 +879,7 @@ class DmsLib extends FHC_Controller
if (hasData($result)) if (hasData($result))
{ {
$result = $this->ci->DmsFSModel->write($result->retval[0]->filename, $dms['file_content']); $result = $this->_ci->DmsFSModel->writeBase64(getData($result)[0]->filename, $dms['file_content']);
} }
} }
@@ -451,12 +891,13 @@ class DmsLib extends FHC_Controller
*/ */
private function _loadUploadLibrary($allowed_types) private function _loadUploadLibrary($allowed_types)
{ {
$config['upload_path'] = $this->UPLOAD_PATH; $config = array();
$config['allowed_types'] = implode('|', $allowed_types); $config['upload_path'] = DMS_PATH;
$config['overwrite'] = true; $config['allowed_types'] = implode('|', $allowed_types);
$config['file_name'] = uniqid().'.pdf'; $config['overwrite'] = true;
$config['file_name'] = uniqid().'.pdf';
$this->ci->load->library('upload', $config); $this->_ci->load->library('upload', $config);
$this->ci->upload->initialize($config); $this->_ci->upload->initialize($config);
} }
} }
+44 -20
View File
@@ -1,7 +1,25 @@
<?php <?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'); if (! defined('BASEPATH')) exit('No direct script access allowed');
use \stdClass as stdClass;
/** /**
* Library to manage core extensions * Library to manage core extensions
*/ */
@@ -23,7 +41,7 @@ class ExtensionsLib
// Directories that are part of the extension archive // Directories that are part of the extension archive
private $SOFTLINK_TARGET_DIRECTORIES = array( private $SOFTLINK_TARGET_DIRECTORIES = array(
APPPATH => array('config', 'controllers', 'helpers', 'hooks', 'libraries', 'models', 'views', 'widgets'), APPPATH => array('config', 'components', 'controllers', 'helpers', 'hooks', 'libraries', 'models', 'views', 'widgets'),
DOC_ROOT => array('public') DOC_ROOT => array('public')
); );
@@ -181,17 +199,15 @@ class ExtensionsLib
// Select all the version of this extension // Select all the version of this extension
$this->_ci->ExtensionsModel->addSelect('extension_id'); $this->_ci->ExtensionsModel->addSelect('extension_id');
$result = $this->_ci->ExtensionsModel->loadWhere(array('name' => $extensionName)); $result = $this->_ci->ExtensionsModel->loadWhere(array('name' => $extensionName));
if (hasData($result)) // if something was found // If something was found
if (hasData($result))
{ {
$extsArray = array(); // Loops on them
foreach ($result->retval as $key => $extension) // loops on them foreach ($result->retval as $extension)
{ {
// Remove them all // Remove them all
$result = $this->_ci->ExtensionsModel->delete($extension->extension_id); $result = $this->_ci->ExtensionsModel->delete($extension->extension_id);
if (isSuccess($result)) if (isSuccess($result)) $delExtension = true;
{
$delExtension = true;
}
} }
} }
} }
@@ -432,9 +448,13 @@ class ExtensionsLib
// If no errors occurred // If no errors occurred
if ($extensionJson != null) if ($extensionJson != null)
{ {
// Default value
$fhcomplete_version = 0;
require_once('version.php'); // get the core version require_once('version.php'); // get the core version
// Checks if the required core version of the extension is the same of this system // Checks if the required core version of the extension is the same of this system
if (isset($extensionJson->core_version) && $extensionJson->core_version == $fhcomplete_version) if (isset($extensionJson->core_version) && version_compare($extensionJson->core_version, $fhcomplete_version,'<='))
{ {
$this->_printMessage('Required core version: '.$extensionJson->core_version); $this->_printMessage('Required core version: '.$extensionJson->core_version);
$this->_printMessage('Current core version: '.$fhcomplete_version); $this->_printMessage('Current core version: '.$fhcomplete_version);
@@ -587,18 +607,22 @@ class ExtensionsLib
for ($sqlDir = $startVersion; $sqlDir <= $extensionJson->version; $sqlDir++) for ($sqlDir = $startVersion; $sqlDir <= $extensionJson->version; $sqlDir++)
{ {
// If a directory with the same value of the version is present in the sql scripts directory // If a directory with the same value of the version is present in the sql scripts directory
if (($files = glob($pkgSQLsPath.'/'.$sqlDir.'/*'.ExtensionsLib::SQL_FILE_EXTENSION)) != false) $files = glob($pkgSQLsPath.'/'.$sqlDir.'/*'.ExtensionsLib::SQL_FILE_EXTENSION);
{ if ($files != false)
{
// Loads every sql files // Loads every sql files
foreach ($files as $file) foreach ($files as $file)
{ {
$sql = file_get_contents($file); // gets the entire content of the file $sql = file_get_contents($file); // gets the entire content of the file
$this->_printMessage('Executing query:'); $this->_printMessage('Executing query:');
$this->_printMessage($sql); $this->_printMessage($sql);
// Try to execute that // Try to execute that
if (!isSuccess($result = @$this->_ci->ExtensionsModel->executeQuery($sql))) $resultQuery = @$this->_ci->ExtensionsModel->executeQuery($sql);
// If _not_ a success
if (!isSuccess($resultQuery))
{ {
$this->_errorOccurred = true; $this->_errorOccurred = true;
$this->_printFailure(' error occurred while executing the query'); $this->_printFailure(' error occurred while executing the query');
@@ -608,11 +632,11 @@ class ExtensionsLib
else else
{ {
$this->_printMessage('Query result:'); $this->_printMessage('Query result:');
var_dump($result->retval); // KEEP IT!!! var_dump(getData($resultQuery)); // KEEP IT!!!
$this->_ci->eprintflib->printEOL(); $this->_ci->eprintflib->printEOL();
} }
} }
} }
} }
$this->_printSuccess(!$this->_errorOccurred); $this->_printSuccess(!$this->_errorOccurred);
@@ -673,7 +697,7 @@ class ExtensionsLib
foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $rootPath => $targetDirectories) foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $rootPath => $targetDirectories)
{ {
foreach ($targetDirectories as $key => $targetDirectory) foreach ($targetDirectories as $targetDirectory)
{ {
if (file_exists($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName)) if (file_exists($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName))
{ {
@@ -727,7 +751,7 @@ class ExtensionsLib
// For every target directory // For every target directory
foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $rootPath => $targetDirectories) foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $rootPath => $targetDirectories)
{ {
foreach ($targetDirectories as $key => $targetDirectory) foreach ($targetDirectories as $targetDirectory)
{ {
// If destination of the symlink does not exist // If destination of the symlink does not exist
if (!file_exists($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName)) if (!file_exists($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName))
-142
View File
@@ -1,142 +0,0 @@
<?php
/***
* FH-Complete
*
* @package FHC-API
* @author FHC-Team
* @copyright Copyright (c) 2016, fhcomplete.org
* @license GPLv3
* @link http://fhcomplete.org
* @since Version 1.0
* @filesource
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
class FilesystemLib
{
/**
* checkParameters
*/
private function checkParameters($filepath, $filename)
{
if (isset($filepath) && isset($filename) &&
$filepath != '' && $filename != '')
{
return true;
}
else
{
return false;
}
}
/**
* read
*/
public function read($filepath, $filename)
{
$result = null;
if ($this->checkParameters($filepath, $filename))
{
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (file_exists($resource) && $fileHandle = fopen($resource, 'r'))
{
$result = '';
while (!feof($fileHandle))
{
$result .= fread($fileHandle, 8192);
}
fclose($fileHandle);
}
}
return $result;
}
/**
* write
*/
public function write($filepath, $filename, $content)
{
$result = null;
if ($this->checkParameters($filepath, $filename) && isset($content))
{
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (is_writable($filepath) && $fileHandle = fopen($resource, 'w'))
{
if (fwrite($fileHandle, $content) !== false)
{
$result = true;
}
fclose($fileHandle);
}
}
return $result;
}
/**
* append
*/
public function append($filepath, $filename, $content)
{
$result = null;
if ($this->checkParameters($filepath, $filename) && isset($content))
{
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (is_writable($resource) && $fileHandle = fopen($resource, 'a'))
{
if (fwrite($fileHandle, $content) !== false)
{
$result = true;
}
fclose($fileHandle);
}
}
return $result;
}
/**
* remove
*/
public function remove($filepath, $filename)
{
$result = null;
if ($this->checkParameters($filepath, $filename))
{
if (is_writable($filepath))
{
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
$result = unlink($resource);
}
}
return $result;
}
/**
* rename
*/
public function rename($filepath, $filename, $newFilepath, $newFilename)
{
$result = null;
if ($this->checkParameters($filepath, $filename) && $this->checkParameters($newFilepath, $newFilename))
{
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (is_writable($filepath) && is_writable($newFilepath) && file_exists($resource))
{
$destination = $newFilepath.DIRECTORY_SEPARATOR.$newFilename;
$result = rename($resource, $destination);
}
}
return $result;
}
}
File diff suppressed because it is too large Load Diff
+61 -17
View File
@@ -203,7 +203,7 @@ class FilterWidgetLib
// Loops in the session for all the filter widgets // Loops in the session for all the filter widgets
foreach ($filterWidgetsSession as $filterWidget => $filterWidgetData) foreach ($filterWidgetsSession as $filterWidget => $filterWidgetData)
{ {
// If this filter widget is not the currrent used filter widget and the it is expired... // If this filter widget is not the current used filter widget and the it is expired...
if ($this->_filterUniqueId != $filterWidget && $filterWidgetData[self::SESSION_TIMEOUT] <= time()) if ($this->_filterUniqueId != $filterWidget && $filterWidgetData[self::SESSION_TIMEOUT] <= time())
{ {
cleanSessionElement(self::SESSION_NAME, $filterWidget); // ...remove it cleanSessionElement(self::SESSION_NAME, $filterWidget); // ...remove it
@@ -232,7 +232,7 @@ class FilterWidgetLib
if ($filterId != null && is_numeric($filterId) && $filterId > 0) if ($filterId != null && is_numeric($filterId) && $filterId > 0)
{ {
$whereParameters = array( $whereParameters = array(
'filter_id' => $filterId self::FILTER_ID => $filterId
); );
} }
else else
@@ -279,6 +279,18 @@ class FilterWidgetLib
if ($definition == null && $whereParameters != null) if ($definition == null && $whereParameters != null)
{ {
$definition = $this->_ci->FiltersModel->loadWhere($whereParameters); $definition = $this->_ci->FiltersModel->loadWhere($whereParameters);
// Last chance!!!
if (!hasData($definition)) // If no data have been found until now the tries the most desperate query
{
$this->_ci->FiltersModel->addOrder('filter_id', 'ASC'); // sort on column filter_id to get the oldest
$whereParameters = array(
'app' => $app,
'dataset_name' => $datasetName
);
$definition = $this->_ci->FiltersModel->loadWhere($whereParameters);
}
} }
return $definition; return $definition;
@@ -328,20 +340,25 @@ class FilterWidgetLib
{ {
$filterDefinition = $filters[$filtersCounter]; // definition of one filter $filterDefinition = $filters[$filtersCounter]; // definition of one filter
if ($filtersCounter > 0) // If the name of the applied filter is valid
$where .= ' AND '; // if it's NOT the last one if (!isEmptyString($filterDefinition->name))
if (!isEmptyString($filterDefinition->name)) // if the name of the applied filter is valid
{ {
// ...build the condition // Build the query conditions
$where .= '"'.$filterDefinition->name.'"'.$this->_getDatasetQueryCondition($filterDefinition); $datasetQueryCondition = $this->_getDatasetQueryCondition($filterDefinition);
// If the built condition is valid then add it to the query clause
if (!isEmptyString($datasetQueryCondition))
{
// // If this is NOT the first one
if ($filtersCounter > 0) $where .= ' AND ';
$where .= '"'.$filterDefinition->name.'"'.$datasetQueryCondition;
}
} }
} }
if ($where != '') // if the SQL where clause was built // If the SQL where clause was built
{ if ($where != '') $datasetQuery .= ' WHERE '.$where;
$datasetQuery .= ' WHERE '.$where;
}
} }
return $datasetQuery; return $datasetQuery;
@@ -712,8 +729,11 @@ class FilterWidgetLib
{ {
$this->_ci->load->model('system/Filters_model', 'FiltersModel'); // to remove the filter definitions from DB $this->_ci->load->model('system/Filters_model', 'FiltersModel'); // to remove the filter definitions from DB
// delete it! // Delete it from database
$this->_ci->FiltersModel->delete(array('filter_id' => $filterId)); $this->_ci->FiltersModel->delete(array(self::FILTER_ID => $filterId));
// Delete it from session
$this->_dropFromSessionFilterWidgetById($filterId);
$removeCustomFilter = true; $removeCustomFilter = true;
} }
@@ -735,7 +755,7 @@ class FilterWidgetLib
$session = $this->getSession(); // The filter currently stored in session (the one that is currently used) $session = $this->getSession(); // The filter currently stored in session (the one that is currently used)
if ($session != null) if ($session != null)
{ {
// Loads the Fitlers model // Loads the Filters model
$this->_ci->load->model('system/Filters_model', 'FiltersModel'); $this->_ci->load->model('system/Filters_model', 'FiltersModel');
// Loads all the filters related to this page (same dataset_name and same app name) // Loads all the filters related to this page (same dataset_name and same app name)
@@ -761,7 +781,7 @@ class FilterWidgetLib
'%s?%s=%s', '%s?%s=%s',
site_url($navigationPage), site_url($navigationPage),
self::FILTER_ID, self::FILTER_ID,
$filter->filter_id $filter->{self::FILTER_ID}
) // link ) // link
); );
@@ -774,7 +794,7 @@ class FilterWidgetLib
{ {
$menuEntry['subscriptDescription'] = 'Remove'; $menuEntry['subscriptDescription'] = 'Remove';
$menuEntry['subscriptLinkClass'] = 'remove-custom-filter'; $menuEntry['subscriptLinkClass'] = 'remove-custom-filter';
$menuEntry['subscriptLinkValue'] = $filter->filter_id; $menuEntry['subscriptLinkValue'] = $filter->{self::FILTER_ID};
$childrenPersonalArray[] = $menuEntry; // adds to personal filters menu array $childrenPersonalArray[] = $menuEntry; // adds to personal filters menu array
} }
} }
@@ -974,5 +994,29 @@ class FilterWidgetLib
return $pos; return $pos;
} }
/**
* Remove from the session the given filter widget
*/
private function _dropFromSessionFilterWidgetById($filterId)
{
// Loads the session for all the filter widgets
$filterWidgetsSession = getSession(self::SESSION_NAME);
// If something is present in session
if ($filterWidgetsSession != null)
{
// Loops in the session for all the filter widgets
foreach ($filterWidgetsSession as $filterWidget => $filterWidgetData)
{
// If this filter widget is not the one that we are looking for
if ($filterWidgetData[self::FILTER_ID] == $filterId)
{
cleanSessionElement(self::SESSION_NAME, $filterWidget); // ...remove it
break; // stop to search
}
}
}
}
} }
+87 -52
View File
@@ -62,17 +62,17 @@ class IssuesLib
* @param array $fehlertext_params params for sprint replace of error text in system.tbl_fehler * @param array $fehlertext_params params for sprint replace of error text in system.tbl_fehler
* @return object success or error * @return object success or error
*/ */
public function addFhcIssue($fehler_kurzbz, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null) public function addFhcIssue($fehler_kurzbz, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $resolution_params = null)
{ {
$fehlerRes = $this->_ci->FehlerModel->loadWhere(array('fehler_kurzbz' => $fehler_kurzbz)); $fehlerRes = $this->_ci->FehlerModel->loadWhere(array('fehler_kurzbz' => $fehler_kurzbz));
if (hasData($fehlerRes)) if (hasData($fehlerRes))
{ {
$fehlercode = getData($fehlerRes)[0]->fehlercode; $fehlercode = getData($fehlerRes)[0]->fehlercode;
return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params); return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, $resolution_params);
} }
else else
return error("Fehler $fehler_kurzbz nicht gefunden"); return error("Error $fehler_kurzbz not found");
} }
/** /**
@@ -82,13 +82,13 @@ class IssuesLib
* @param int $person_id * @param int $person_id
* @param int $oe_kurzbz * @param int $oe_kurzbz
* @param array $fehlertext_params params for replacement of parts of error text * @param array $fehlertext_params params for replacement of parts of error text
* @param bool $force_predefined if true, only predefined external issues are added * @param bool $force_predefined if true, only predefined (with entry in fehler table) external issues are added
* @return object success or error * @return object success or error
*/ */
public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $force_predefined = false) public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null)
{ {
if (isEmptyString($fehlercode_extern)) if (isEmptyString($fehlercode_extern))
return error("fehlercode_extern fehlt"); return error("fehlercode_extern missing");
// get external fehlercode (unique for each app) // get external fehlercode (unique for each app)
$this->_ci->FehlerModel->addSelect('fehlercode'); $this->_ci->FehlerModel->addSelect('fehlercode');
@@ -102,19 +102,13 @@ class IssuesLib
if (isError($fehlerRes)) if (isError($fehlerRes))
return $fehlerRes; return $fehlerRes;
$fehlerData = getData($fehlerRes)[0];
// check if there is a predefined custom error for the external issue // check if there is a predefined custom error for the external issue
if (hasData($fehlerRes)) if (hasData($fehlerRes))
{ {
$fehlerData = getData($fehlerRes)[0];
// if found, use the code // if found, use the code
$fehlercode = $fehlerData->fehlercode; $fehlercode = $fehlerData->fehlercode;
} }
elseif ($force_predefined === true)
{
// only added if predefined
return success("No definition found - not added");
}
else else
{ {
// if predefined error is not found, insert with fallback code // if predefined error is not found, insert with fallback code
@@ -122,20 +116,70 @@ class IssuesLib
} }
// add external issue // add external issue
return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, $fehlercode_extern, $inhalt_extern); return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, null, $fehlercode_extern, $inhalt_extern);
}
/**
* Set issue to resolved.
* @param int $issue_id
* @param string $user uid of issue resolver
* @return object success or error
*/
public function setBehoben($issue_id, $user)
{
$data = array(
'status_kurzbz' => self::STATUS_BEHOBEN,
'verarbeitetvon' => $user,
'verarbeitetamum' => date('Y-m-d H:i:s')
);
return $this->_changeIssueStatus($issue_id, $data, $user);
}
/**
* Set issue to in progress.
* @param int $issue_id
* @param string $user uid of issue resovler
* @return object success or error
*/
public function setInBearbeitung($issue_id, $user)
{
$data = array(
'status_kurzbz' => self::STATUS_IN_BEARBEITUNG,
'verarbeitetvon' => $user
);
return $this->_changeIssueStatus($issue_id, $data, $user);
}
/**
* Set issue to new.
* @param int $issue_id
* @param string $user uid of issue resolver
* @return object success or error
*/
public function setNeu($issue_id, $user)
{
$data = array(
'status_kurzbz' => self::STATUS_NEU,
'verarbeitetvon' => null,
'verarbeitetamum' => null
);
return $this->_changeIssueStatus($issue_id, $data, $user);
} }
/** /**
* Changes status of an issue. * Changes status of an issue.
* @param int $issue_id * @param int $issue_id
* @param string $status_kurzbz the new status * @param array $sdata the data to save, including status
* @param string $verarbeitetvon uid of person changing the status (needed for in Bearbeitung and behoben) * @param string $user uid of person changing the status (needed for in Bearbeitung and behoben)
* @return success or error * @return success or error
*/ */
public function changeIssueStatus($issue_id, $status_kurzbz, $verarbeitetvon = null) private function _changeIssueStatus($issue_id, $data, $user)
{ {
if (!isset($issue_id) || !is_numeric($issue_id)) if (!isset($issue_id) || !is_numeric($issue_id))
return error("Issue Id muss korrekt gesetzt sein."); return error("Issue Id must be set correctly.");
// check if given status is same as existing // check if given status is same as existing
$this->_ci->IssueModel->addSelect('status_kurzbz'); $this->_ci->IssueModel->addSelect('status_kurzbz');
@@ -143,39 +187,14 @@ class IssuesLib
if (hasData($currStatus)) if (hasData($currStatus))
{ {
if (getData($currStatus)[0]->status_kurzbz == $status_kurzbz) if (getData($currStatus)[0]->status_kurzbz == $data['status_kurzbz'])
return success("Gleicher Status bereits gesetzt"); return success("Same status already set");
} }
else else
return error("Fehler beim Holen des Status"); return error("Error when getting status");
$data = array( $data['updatevon'] = $user;
'status_kurzbz' => $status_kurzbz, $data['updateamum'] = date('Y-m-d H:i:s');
'updatevon' => $verarbeitetvon,
'updateamum' => date('Y-m-d H:i:s')
);
if ($status_kurzbz == self::STATUS_NEU)
{
$data['verarbeitetvon'] = null;
}
if ($status_kurzbz == self::STATUS_NEU || $status_kurzbz == self::STATUS_IN_BEARBEITUNG)
{
$data['verarbeitetamum'] = null;
}
if ($status_kurzbz == self::STATUS_IN_BEARBEITUNG || $status_kurzbz == self::STATUS_BEHOBEN)
{
if (isset($verarbeitetvon))
$data['verarbeitetvon'] = $verarbeitetvon;
else
return error("Verarbeitetvon nicht gesetzt");
}
if ($status_kurzbz == self::STATUS_BEHOBEN)
$data['verarbeitetamum'] = date('Y-m-d H:i:s');
return $this->_ci->IssueModel->update( return $this->_ci->IssueModel->update(
array( array(
@@ -191,14 +210,15 @@ class IssuesLib
* @param int $person_id * @param int $person_id
* @param string $oe_kurzbz * @param string $oe_kurzbz
* @param array $fehlertext_params * @param array $fehlertext_params
* @param string $resolution_params
* @param string $fehlercode_extern * @param string $fehlercode_extern
* @param string $inhalt_extern * @param string $inhalt_extern
* @return object success or error * @return object success or error
*/ */
private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $fehlercode_extern = null, $inhalt_extern = null) private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $resolution_params = null, $fehlercode_extern = null, $inhalt_extern = null)
{ {
if (isEmptyString($person_id) && isEmptyString($oe_kurzbz)) if (isEmptyString($person_id) && isEmptyString($oe_kurzbz))
return error("Person_id oder oe_kurzbz muss gesetzt sein."); return error("Person_id or oe_kurzbz must be set.");
// get fehlertextVorlage and replace it with params // get fehlertextVorlage and replace it with params
$fehlerRes = $this->_ci->FehlerModel->load($fehlercode); $fehlerRes = $this->_ci->FehlerModel->load($fehlercode);
@@ -218,6 +238,20 @@ class IssuesLib
if ($openIssueCount == 0) 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");
}
return $this->_ci->IssueModel->insert( return $this->_ci->IssueModel->insert(
array( array(
'fehlercode' => $fehlercode, 'fehlercode' => $fehlercode,
@@ -228,6 +262,7 @@ class IssuesLib
'oe_kurzbz' => $oe_kurzbz, 'oe_kurzbz' => $oe_kurzbz,
'datum' => date('Y-m-d H:i:s'), 'datum' => date('Y-m-d H:i:s'),
'status_kurzbz' => self::STATUS_NEU, 'status_kurzbz' => self::STATUS_NEU,
'behebung_parameter' => isset($resolution_params) ? json_encode($resolution_params) : null,
'insertvon' => $this->_insertvon 'insertvon' => $this->_insertvon
) )
); );
@@ -236,9 +271,9 @@ class IssuesLib
return success($openIssueCount); return success($openIssueCount);
} }
else else
return error("Anzahl offener Issues konnte nicht ermittelt werden."); return error("Number of open issues could not be determined");
} }
else else
return error("Fehler $fehlercode nicht gefunden"); return error("Error $fehlercode could not be found");
} }
} }
+34 -7
View File
@@ -1,4 +1,20 @@
<?php <?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'); if (! defined('BASEPATH')) exit('No direct script access allowed');
@@ -37,7 +53,7 @@ class NavigationLib
// Loads library ExtensionsLib // Loads library ExtensionsLib
$this->_ci->load->library('ExtensionsLib'); $this->_ci->load->library('ExtensionsLib');
$this->_navigationPage = $this->_getNavigationtPage($params); // sets the id for the related navigation widget $this->_navigationPage = $this->_getNavigationPage($params); // sets the id for the related navigation widget
} }
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
@@ -67,9 +83,19 @@ class NavigationLib
* Returns the structure for one level of the menu * Returns the structure for one level of the menu
*/ */
public function oneLevel( public function oneLevel(
$description, $link = '#', $children = null, $icon = '', $expand = false, $description,
$subscriptDescription = null, $subscriptLinkClass = null, $subscriptLinkValue = null, $target = '', $link = '#',
$sort = null, $requiredPermissions = null, $subscriptLinkHref = '#') $children = null,
$icon = '',
$expand = false,
$subscriptDescription = null,
$subscriptLinkClass = null,
$subscriptLinkValue = null,
$target = '',
$sort = null,
$requiredPermissions = null,
$subscriptLinkHref = '#'
)
{ {
return array( return array(
'description' => $description, 'description' => $description,
@@ -223,7 +249,8 @@ class NavigationLib
$filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/'.self::CONFIG_NAVIGATION_FILENAME; $filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/'.self::CONFIG_NAVIGATION_FILENAME;
if (file_exists($filename)) if (file_exists($filename))
{ {
unset($config); $config = array(); // default value
include($filename); include($filename);
if (isset($config[$configName]) && is_array($config[$configName])) if (isset($config[$configName]) && is_array($config[$configName]))
@@ -278,7 +305,7 @@ class NavigationLib
} }
else else
{ {
foreach ($navigationArray as $key=>$row) foreach ($navigationArray as $key => $row)
{ {
// Search for * Entries // Search for * Entries
if (mb_strpos($key, '*') === 0 || mb_strpos($key, '*') === mb_strlen($key) - 1) if (mb_strpos($key, '*') === 0 || mb_strpos($key, '*') === mb_strlen($key) - 1)
@@ -300,7 +327,7 @@ class NavigationLib
* Return an unique string that identify this navigation widget * Return an unique string that identify this navigation widget
* NOTE: The default value is the URI where the NavigationWidget is called * NOTE: The default value is the URI where the NavigationWidget is called
*/ */
private function _getNavigationtPage($params) private function _getNavigationPage($params)
{ {
if ($params != null if ($params != null
&& is_array($params) && is_array($params)
+298
View File
@@ -0,0 +1,298 @@
<?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');
use \stdClass as stdClass;
/**
*
*/
class SearchBarLib
{
// Error constats
const ERROR_WRONG_JSON = 'ERR001';
const ERROR_WRONG_SEARCHSTR = 'ERR002';
const ERROR_NO_TYPES = 'ERR003';
const ERROR_WRONG_TYPES = 'ERR004';
// List of allowed types of search
const ALLOWED_TYPES = ['mitarbeiter', 'organisationunit', 'raum', 'person', 'student', 'prestudent', 'document', 'cms'];
const PHOTO_IMG_URL = '/cis/public/bild.php?src=person&person_id=';
private $_ci; // Code igniter instance
/**
* Gets the CI instance and loads model
*/
public function __construct()
{
$this->_ci =& get_instance(); // get code igniter instance
// It is loaded only to have the DB_Model available
$this->_ci->load->model('person/Benutzer_model', 'BenutzerModel');
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* It performes the search of the given search string using the specified search types
*/
public function search($searchstr, $types)
{
// Checks if the given parameters are fine
$search = $this->_checkParameters($searchstr, $types);
// If the check was successful then perform the search
if (isSuccess($search)) $search = $this->_search($searchstr, $types);
return $search; // return the result
}
//------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Checks:
* - The given searchstr is a not empty string
* - The given types is a not empty array and contains allowed search types
*/
private function _checkParameters($searchstr, $types)
{
// If searchstr is empty
if (isEmptyString($searchstr)) return error(self::ERROR_WRONG_SEARCHSTR);
// If types is not an array or it is empty
if (isEmptyArray($types)) return error(self::ERROR_NO_TYPES);
// If all the elements in types are allowed search types
if (!isEmptyArray(array_diff($types, self::ALLOWED_TYPES))) return error(self::ERROR_WRONG_TYPES);
return success(); // The check is fine!
}
/**
* Loops on types and perform the search of that type using searchstr
* Then it collects all the returned data into an array as property of an object
*/
private function _search($searchstr, $types)
{
// Object to be returned
$result = new stdClass();
$result->data = array();
// For each search type
foreach ($types as $type)
{
// Perform the search and then add the result to data
$result->data = array_merge($result->data, $this->{'_'.$type}($searchstr, $type));
}
return $result;
}
/**
* Search for employees
*/
private function _mitarbeiter($searchstr, $type)
{
$dbModel = new DB_Model();
$employees = $dbModel->execReadOnlyQuery('
SELECT
\''.$type.'\' AS type,
b.uid AS uid,
p.person_id AS person_id,
p.vorname || \' \' || p.nachname AS name,
ARRAY_AGG(DISTINCT(org.bezeichnung)) AS organisationunit_name,
COALESCE(b.alias, b.uid) || \''.'@'.DOMAIN.'\' AS email,
TRIM(COALESCE(k.kontakt, \'\') || \' \' || COALESCE(m.telefonklappe, \'\')) AS phone,
\''.base_url(self::PHOTO_IMG_URL).'\' || p.person_id AS photo_url,
ARRAY_AGG(DISTINCT(stdkst.bezeichnung)) AS standardkostenstelle
FROM public.tbl_mitarbeiter m
JOIN public.tbl_benutzer b ON(b.uid = m.mitarbeiter_uid)
JOIN (
SELECT o.bezeichnung, bf.uid
FROM public.tbl_benutzerfunktion bf
JOIN public.tbl_organisationseinheit o USING(oe_kurzbz)
WHERE bf.funktion_kurzbz = \'kstzuordnung\'
AND (bf.datum_von IS NULL OR bf.datum_von <= NOW())
AND (bf.datum_bis IS NULL OR bf.datum_bis >= NOW())
GROUP BY o.bezeichnung, bf.uid
) stdkst ON stdkst.uid = b.uid
JOIN public.tbl_person p USING(person_id)
JOIN (
SELECT o.bezeichnung, bf.uid
FROM public.tbl_benutzerfunktion bf
JOIN public.tbl_organisationseinheit o USING(oe_kurzbz)
WHERE bf.funktion_kurzbz = \'oezuordnung\'
AND (bf.datum_von IS NULL OR bf.datum_von <= NOW())
AND (bf.datum_bis IS NULL OR bf.datum_bis >= NOW())
GROUP BY o.bezeichnung, bf.uid
) org ON org.uid = b.uid
LEFT JOIN (
SELECT kontakt, standort_id
FROM public.tbl_kontakt
WHERE kontakttyp = \'telefon\'
) k ON(k.standort_id = m.standort_id)
WHERE b.uid ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR p.vorname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR p.nachname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR org.bezeichnung ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR stdkst.bezeichnung ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
GROUP BY type, b.uid, p.person_id, name, email, m.telefonklappe, phone
');
// If something has been found then return it
if (hasData($employees)) return getData($employees);
// Otherwise return an empty array
return array();
}
/**
* Seach for organisation units
*/
private function _organisationunit($searchstr, $type)
{
$dbModel = new DB_Model();
$ous = $dbModel->execReadOnlyQuery('
SELECT
\''.$type.'\' AS type,
o.oe_kurzbz AS oe_kurzbz,
o.bezeichnung AS name,
oParent.oe_kurzbz AS parentoe_kurzbz,
oParent.bezeichnung AS parentoe_name,
ARRAY_AGG(DISTINCT(bfLeader.uid)) AS leader_uid,
ARRAY_AGG(DISTINCT(bfLeader.vorname || \' \' || bfLeader.nachname)) AS leader_name,
COUNT(bfCount.benutzerfunktion_id) AS number_of_people,
(CASE WHEN o.mailverteiler = TRUE THEN o.oe_kurzbz || \''.'@'.DOMAIN.'\' END) AS mailgroup
FROM public.tbl_organisationseinheit o
LEFT JOIN public.tbl_organisationseinheit oParent ON(oParent.oe_kurzbz = o.oe_parent_kurzbz)
LEFT JOIN (
SELECT benutzerfunktion_id, oe_kurzbz
FROM public.tbl_benutzerfunktion
WHERE funktion_kurzbz = \'oezuordnung\'
AND (datum_von IS NULL OR datum_von <= NOW())
AND (datum_bis IS NULL OR datum_bis >= NOW())
) bfCount ON(bfCount.oe_kurzbz = o.oe_kurzbz)
LEFT JOIN (
SELECT bf.oe_kurzbz, bf.uid, p.vorname, p.nachname
FROM public.tbl_benutzerfunktion bf
JOIN public.tbl_benutzer b USING(uid)
JOIN public.tbl_person p USING(person_id)
WHERE funktion_kurzbz = \'Leitung\'
AND (datum_von IS NULL OR datum_von <= NOW())
AND (datum_bis IS NULL OR datum_bis >= NOW())
AND b.aktiv = TRUE
) bfLeader ON(bfLeader.oe_kurzbz = o.oe_kurzbz)
WHERE o.oe_kurzbz ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR o.bezeichnung ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
GROUP BY type, o.oe_kurzbz, o.bezeichnung, oParent.oe_kurzbz, oParent.bezeichnung
');
// If something has been found
if (hasData($ous))
{
// Loop through the returned dataset
foreach (getData($ous) as $ou)
{
// Create the new property leaders as an empty array
$ou->leaders = array();
// Loop through the found leaders for this organisation unit
for ($i = 0; $i < count($ou->leader_uid); $i++)
{
// If a leader exists for this organisationunit and has a name :D
if (!isEmptyString($ou->leader_uid[$i]) && !isEmptyString($ou->leader_name[$i]))
{
// Empty object that will contains the leader uid and name
$leader = new stdClass();
// Set the properties name and uid
$leader->uid = $ou->leader_uid[$i];
$leader->name = $ou->leader_name[$i];
// Add the leader object to the leaders array
$ou->leaders[] = $leader;
}
}
// Remove the not needed properties leader_uid and leader_name
unset($ou->leader_uid);
unset($ou->leader_name);
}
// Returns the changed dataset
return getData($ous);
}
// Otherwise return an empty array
return array();
}
/**
* Search for persons
*/
private function _person($searchstr, $type)
{
return array();
}
/**
* Search for students
*/
private function _student($searchstr, $type)
{
return array();
}
/**
* Search for prestudents
*/
private function _prestudent($searchstr, $type)
{
return array();
}
/**
* Search for documents
*/
private function _document($searchstr, $type)
{
return array();
}
/**
* Search for CMSs
*/
private function _cms($searchstr, $type)
{
return array();
}
/**
* Search for rooms
*/
private function _raum($searchstr, $type)
{
return array();
}
}
+3 -3
View File
@@ -312,10 +312,10 @@ class UDFLib
{ {
$resultElement->{$columnName} = $columnValue; $resultElement->{$columnName} = $columnValue;
} }
}
// And finally remove the UDFs column // And finally remove the UDFs column
unset($resultElement->{self::COLUMN_NAME}); unset($resultElement->{self::COLUMN_NAME});
}
} }
/** /**
+2 -11
View File
@@ -114,7 +114,7 @@ class VorlageLib
if (!hasData($vorlage)) if (!hasData($vorlage))
{ {
// Builds where clause // Builds where clause
$where = $this->_where($vorlage_kurzbz, $orgform_kurzbz, $sprache); $where = $this->_where($vorlage_kurzbz);
$vorlage = $this->ci->organisationseinheitlib->treeSearch( $vorlage = $this->ci->organisationseinheitlib->treeSearch(
'public', 'public',
@@ -134,20 +134,11 @@ class VorlageLib
/** /**
* _where * _where
*/ */
private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache) private function _where($vorlage_kurzbz)
{ {
// Builds where clause // Builds where clause
$where = "vorlage_kurzbz = ".$this->ci->VorlageModel->escape($vorlage_kurzbz); $where = "vorlage_kurzbz = ".$this->ci->VorlageModel->escape($vorlage_kurzbz);
if (is_null($sprache))
{
$where .= " AND sprache IS NULL";
}
else
{
$where .= " AND sprache = ".$this->ci->VorlageModel->escape($sprache);
}
$where .= " AND aktiv = true"; $where .= " AND aktiv = true";
return $where; return $where;
@@ -0,0 +1,31 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Bisio Zweck does not exist
*/
class CORE_INOUT_0001 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
// get all bisio Zwecke
$this->_ci->BisiozweckModel->addSelect('1');
$bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id']));
if (isError($bisiozweckRes))
return $bisiozweckRes;
if (hasData($bisiozweckRes))
return success(true); // resolved if bisio Zweck exists
else
return success(false); // not resolved if no bisio zweck
}
}
@@ -0,0 +1,34 @@
<?php
/**
* More than one Zweck for incoming
*/
class CORE_INOUT_0002 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
// get all bisio Zwecke
$this->_ci->BisiozweckModel->addSelect('1');
$bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id']));
if (isError($bisiozweckRes))
return $bisiozweckRes;
if (hasData($bisiozweckRes))
{
if (count(getData($bisiozweckRes)) <= 1) // resolved if one bisio Zweck
return success(true);
else
return success(false); // otherwise not resolved
}
else
return success(true); // resolved if no bisio zweck
}
}
@@ -0,0 +1,39 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Invalid Zweck for incoming
*/
class CORE_INOUT_0003 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
// get all Zwecke
$this->_ci->BisiozweckModel->addSelect('zweck_code');
$bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id']));
if (isError($bisiozweckRes))
return $bisiozweckRes;
if (hasData($bisiozweckRes))
{
$bisiozweckData = getData($bisiozweckRes);
// resolved if Zweck is 1, 2 or 3
if (count($bisiozweckData) == 1 && !in_array($bisiozweckData[0]->zweck_code, array(1, 2, 3)))
return success(false);
else
return success(true);
}
else
return success(true);
}
}
@@ -0,0 +1,57 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Aufenthaltsförderung must exist if certain length of outgoing stay is exceeded
*/
class CORE_INOUT_0004 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel');
// get all Zwecke
$this->_ci->AufenthaltfoerderungModel->addSelect('tbl_aufenthaltfoerderung.aufenthaltfoerderung_code');
$this->_ci->AufenthaltfoerderungModel->addJoin('bis.tbl_bisio_aufenthaltfoerderung', 'aufenthaltfoerderung_code');
$this->_ci->AufenthaltfoerderungModel->addOrder('tbl_aufenthaltfoerderung.aufenthaltfoerderung_code');
$bisioFoerderungRes = $this->_ci->AufenthaltfoerderungModel->loadWhere(array('bisio_id' => $params['bisio_id']));
if (isError($bisioFoerderungRes))
return $bisioFoerderungRes;
if (hasData($bisioFoerderungRes))
{
// resolved if Aufenthaltsfoerderung exists
return success(true);
}
else
{
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
// get Bisio Aufenthaltsdauer
$aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']);
if (isError($aufenthaltsdauerRes))
return $aufenthaltsdauerRes;
if (hasData($aufenthaltsdauerRes))
{
$aufenthaltsdauer = getData($aufenthaltsdauerRes);
// check if stay >= 29 days. If yes and no Aufenthaltsfoerderung - not resolved
if ($aufenthaltsdauer >= 29)
return success(false);
else
return success(true);
}
else // no Aufenthaltsdauer - not resolved
return success(false);
}
}
}
@@ -0,0 +1,53 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ECTS angerechnet must exist for outgoing if longer stay
*/
class CORE_INOUT_0005 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
// get all Zwecke
$this->_ci->BisioModel->addSelect('ects_angerechnet');
$bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id']));
if (isError($bisioRes))
return $bisioRes;
if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_angerechnet))
{
// resolved if ects exists
return success(true);
}
else
{
// get Bisio Aufenthaltsdauer
$aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']);
if (isError($aufenthaltsdauerRes))
return $aufenthaltsdauerRes;
if (hasData($aufenthaltsdauerRes))
{
$aufenthaltsdauer = getData($aufenthaltsdauerRes);
// check if stay >= 29 days. If yes and no ects - not resolved
if ($aufenthaltsdauer >= 29)
return success(false);
else
return success(true);
}
else // no Aufenthaltsdauer - not resolved
return success(false);
}
}
}
@@ -0,0 +1,54 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ECTS erworben must exist for outgoing if longer stay
*/
class CORE_INOUT_0006 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
//$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel');
// get all Zwecke
$this->_ci->BisioModel->addSelect('ects_erworben');
$bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id']));
if (isError($bisioRes))
return $bisioRes;
if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_erworben))
{
// resolved if ects exists
return success(true);
}
else
{
// get Bisio Aufenthaltsdauer
$aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']);
if (isError($aufenthaltsdauerRes))
return $aufenthaltsdauerRes;
if (hasData($aufenthaltsdauerRes))
{
$aufenthaltsdauer = getData($aufenthaltsdauerRes);
// check if stay >= 29 days. If yes and no ects - not resolved
if ($aufenthaltsdauer >= 29)
return success(false);
else
return success(true);
}
else // no Aufenthaltsdauer - not resolved
return success(false);
}
}
}
@@ -0,0 +1,42 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ZGV Datum in future
*/
class CORE_ZGV_0001 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
// get zgvdatum of prestudent
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->_ci->PrestudentModel->addSelect('zgvdatum');
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
if (isError($prestudentRes))
return $prestudentRes;
if (hasData($prestudentRes))
{
$zgvdatum = getData($prestudentRes)[0]->zgvdatum;
if (isEmptyString($zgvdatum))
return success(false);
// check if zgvdatum comes after today
if ($zgvdatum > date('Y-m-d'))
return success(false);
else
return success(true);
}
else
return success(false);
}
}
@@ -0,0 +1,50 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ZGV Datum must be after Geburtsdatum
*/
class CORE_ZGV_0002 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
// get zgvdatum of prestudent
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->_ci->PrestudentModel->addSelect('zgvdatum, gebdatum');
$this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id');
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
if (isError($prestudentRes))
return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudentData = getData($prestudentRes)[0];
$zgvdatum = $prestudentData->zgvdatum;
if (isEmptyString($zgvdatum))
return success(false);
$gebdatum = $prestudentData->gebdatum;
if (isEmptyString($gebdatum))
return success(false);
// check if zgvdatum comes before geburtsdatum
if ($zgvdatum < $gebdatum)
return success(false);
else
return success(true);
}
else
return success(false);
}
}
@@ -0,0 +1,42 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ZGV master Datum in future
*/
class CORE_ZGV_0003 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
// get zgvdatum of prestudent
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->_ci->PrestudentModel->addSelect('zgvmadatum');
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
if (isError($prestudentRes))
return $prestudentRes;
if (hasData($prestudentRes))
{
$zgvdatum = getData($prestudentRes)[0]->zgvmadatum;
if (isEmptyString($zgvdatum))
return success(false);
// check if zgvdatum comes after today
if ($zgvdatum > date('Y-m-d'))
return success(false);
else
return success(true);
}
else
return success(false);
}
}
@@ -0,0 +1,50 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ZGV Datum should not be after ZGV master Datum
*/
class CORE_ZGV_0004 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
// get zgvdatum of prestudent
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->_ci->PrestudentModel->addSelect('zgvdatum, zgvmadatum');
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
if (isError($prestudentRes))
return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudentData = getData($prestudentRes)[0];
// get and compare zgvdatum and zgvmadatum
$zgvdatum = $prestudentData->zgvdatum;
if (isEmptyString($zgvdatum))
return success(false);
$zgvmadatum = $prestudentData->zgvmadatum;
if (isEmptyString($zgvmadatum))
return success(false);
// check if zgvmadatum comes after zgvdatum
if ($zgvmadatum < $zgvdatum)
return success(false);
else
return success(true);
}
else
return success(false);
}
}
@@ -0,0 +1,50 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ZGV master Datum before Geburtsdatum
*/
class CORE_ZGV_0005 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
// get zgvdatum and geburtsdatum of prestudent
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->_ci->PrestudentModel->addSelect('zgvmadatum, gebdatum');
$this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id');
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
if (isError($prestudentRes))
return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudentData = getData($prestudentRes)[0];
$zgvdatum = $prestudentData->zgvmadatum;
if (isEmptyString($zgvdatum))
return success(false);
$gebdatum = $prestudentData->gebdatum;
if (isEmptyString($gebdatum))
return success(false);
// check if zgvdatum comes before geburtsdatum
if ($zgvdatum < $gebdatum)
return success(false);
else
return success(true);
}
else
return success(false);
}
}
+7
View File
@@ -528,6 +528,13 @@ class Messages_model extends CI_Model
*/ */
public function sendReply($receiver_id, $subject, $body, $relationmessage_id, $token) public function sendReply($receiver_id, $subject, $body, $relationmessage_id, $token)
{ {
// Checks that the receiver_id, relationmessage_id and token belongs to the same message
$crossedDataResult = $this->MessageTokenModel->crossClientData($token, $relationmessage_id, $receiver_id);
if (isError($crossedDataResult)) show_error(getError($crossedDataResult));
if (!hasData($crossedDataResult)) show_error(
'The parameters token, relationmessage_id and receiver_id do not belong to the same message'
);
// Retrieves message sender information // Retrieves message sender information
$senderResult = $this->MessageTokenModel->getSenderData($receiver_id); $senderResult = $this->MessageTokenModel->getSenderData($receiver_id);
if (isError($senderResult)) show_error(getError($senderResult)); if (isError($senderResult)) show_error(getError($senderResult));
@@ -135,7 +135,7 @@ class Vertragvertragsstatus_model extends DB_Model
/** /**
* Get all contracts, where the status had been set to 'bestellt' on given date * Get all contracts, where the status had been set to 'bestellt' on given date
* @param string $string_date e.g. '01.11.2019' or special Date/Time inputs like 'YESTERDAY', 'TODAY', 'NOW' * @param string $string_date e.g. 'YYYY-MM-DD' or special Date/Time inputs like 'YESTERDAY', 'TODAY', 'NOW'
* @param bool $further_processed If true, ALL ordered contracts of that day are retrieved, even if they were * @param bool $further_processed If true, ALL ordered contracts of that day are retrieved, even if they were
* were ALSO approved/accepted/cancelled (further processed) on that same day. * were ALSO approved/accepted/cancelled (further processed) on that same day.
* @return array * @return array
+33
View File
@@ -11,4 +11,37 @@ class Bisio_model extends DB_Model
$this->dbTable = 'bis.tbl_bisio'; $this->dbTable = 'bis.tbl_bisio';
$this->pk = 'bisio_id'; $this->pk = 'bisio_id';
} }
/**
* Gets duration of stay in days by bisio_id.
* @param int $bisio_id
* @return object success with number of days or error
*/
public function getAufenthaltsdauer($bisio_id)
{
// get from and to date
$this->addSelect('von, bis');
$bisioRes = $this->load($bisio_id);
if (isError($bisioRes))
return $bisioRes;
if (hasData($bisioRes))
{
$bisioData = getData($bisioRes)[0];
$avon = $bisioData->von;
$abis = $bisioData->bis;
if (is_null($avon) || is_null($abis))
return success("Von or bis date not set");
$vonDate = new DateTime($avon);
$bisDate = new DateTime($abis);
$interval = $vonDate->diff($bisDate);
return success($interval->days);
}
else
return success("Bisio not found");
}
} }
@@ -0,0 +1,15 @@
<?php
class Gsprogramm_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'bis.tbl_gsprogramm';
$this->pk = 'gsprogramm_id';
}
}
@@ -0,0 +1,14 @@
<?php
class Mobilitaet_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'bis.tbl_mobilitaet';
$this->pk = 'mobilitaet_id';
}
}
+2 -2
View File
@@ -3,7 +3,7 @@
class Nation_model extends DB_Model class Nation_model extends DB_Model
{ {
/** /**
* *
*/ */
public function __construct() public function __construct()
{ {
@@ -11,4 +11,4 @@ class Nation_model extends DB_Model
$this->dbTable = 'bis.tbl_nation'; $this->dbTable = 'bis.tbl_nation';
$this->pk = 'nation_code'; $this->pk = 'nation_code';
} }
} }
+3 -3
View File
@@ -7,7 +7,7 @@ class DmsFS_model extends FS_Model
*/ */
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct(DMS_PATH);
$this->filepath = DMS_PATH;
} }
} }
@@ -0,0 +1,16 @@
<?php
/**
* Model for writing temporary files
*/
class TempFS_model extends FS_Model
{
/**
* Constructor
*/
public function __construct()
{
// default temp directory of server is used
parent::__construct(sys_get_temp_dir());
}
}
@@ -10,6 +10,7 @@ class Dokumentprestudent_model extends DB_Model
parent::__construct(); parent::__construct();
$this->dbTable = 'public.tbl_dokumentprestudent'; $this->dbTable = 'public.tbl_dokumentprestudent';
$this->pk = array('prestudent_id', 'dokument_kurzbz'); $this->pk = array('prestudent_id', 'dokument_kurzbz');
$this->hasSequence = false;
} }
/** /**
+82 -27
View File
@@ -18,45 +18,50 @@ class Konto_model extends DB_Model
public function setPaid($buchungsnr) public function setPaid($buchungsnr)
{ {
// get payment // get payment
$buchungResult = $this->loadWhere(array('buchungsnr' => $buchungsnr)); $buchungResult = $this->loadWhere(array('buchungsnr' => $buchungsnr));
if(isSuccess($buchungResult) && hasData($buchungResult)) if (isSuccess($buchungResult) && hasData($buchungResult))
{ {
$buchung = getData($buchungResult)[0];
// get already paid amount // get already paid amount
$this->addSelect('sum(betrag) as bezahlt'); $this->addSelect('sum(betrag) as bezahlt');
$this->addGroupBy('buchungsnr_verweis'); $this->addGroupBy('buchungsnr_verweis');
$buchungVerweisResult = $this->loadWhere(array('buchungsnr_verweis' => $buchungsnr)); $buchungVerweisResult = $this->loadWhere(array('buchungsnr_verweis' => $buchungsnr));
if(isSuccess($buchungVerweisResult)) if (isSuccess($buchungVerweisResult))
{ {
if(hasData($buchungVerweisResult)) $betragBezahlt = 0;
{
$betragBezahltResult = getData($buchungVerweisResult);
$betragBezahlt = $betragBezahltResult->bezahlt;
}
else
$betragBezahlt = 0;
$buchung = getData($buchungResult); if (hasData($buchungVerweisResult))
$buchung = $buchung[0]; {
$betragBezahlt = getData($buchungVerweisResult)[0]->bezahlt;
}
// calculate open amount // calculate open amount
$betragOffen = $betragBezahlt - $buchung->betrag*(-1); $betragOffen = $betragBezahlt - $buchung->betrag * (-1);
$data = array( if ($betragOffen != 0)
'person_id' => $buchung->person_id, {
'studiengang_kz' => $buchung->studiengang_kz, $data = array(
'studiensemester_kurzbz' => $buchung->studiensemester_kurzbz, 'person_id' => $buchung->person_id,
'buchungsnr_verweis' => $buchungsnr, 'studiengang_kz' => $buchung->studiengang_kz,
'betrag' => str_replace(',','.',$betragOffen*(-1)), 'studiensemester_kurzbz' => $buchung->studiensemester_kurzbz,
'buchungsdatum' => date('Y-m-d'), 'buchungsnr_verweis' => $buchungsnr,
'buchungstext' => $buchung->buchungstext, 'betrag' => str_replace(',', '.', $betragOffen * (-1)),
'insertamum' => date('Y-m-d H:i:s'), 'buchungsdatum' => date('Y-m-d'),
'insertvon' => '', 'buchungstext' => $buchung->buchungstext,
'buchungstyp_kurzbz' => $buchung->buchungstyp_kurzbz, 'insertamum' => date('Y-m-d H:i:s'),
); 'insertvon' => '',
'buchungstyp_kurzbz' => $buchung->buchungstyp_kurzbz,
);
return $this->insert($data); return $this->insert($data);
}
else
{
return success();
}
} }
else else
{ {
@@ -68,4 +73,54 @@ class Konto_model extends DB_Model
return error('Failed to load Payment'); return error('Failed to load Payment');
} }
} }
public function getStudienbeitraege($uid, $buchungstypen)
{
$query = 'SELECT konto.studiensemester_kurzbz
FROM public.tbl_konto konto
JOIN public.tbl_studiensemester studiensemester ON konto.studiensemester_kurzbz = studiensemester.studiensemester_kurzbz,
public.tbl_benutzer,
public.tbl_student
WHERE tbl_benutzer.uid = \'' . $uid . '\'
AND tbl_benutzer.uid = tbl_student.student_uid
AND tbl_benutzer.person_id = konto.person_id
AND konto.studiengang_kz = tbl_student.studiengang_kz
AND konto.buchungstyp_kurzbz IN (\'' . $buchungstypen . '\')
AND 0 = (
SELECT sum(betrag)
FROM public.tbl_konto skonto
WHERE skonto.buchungsnr = konto.buchungsnr_verweis
OR skonto.buchungsnr_verweis = konto.buchungsnr_verweis
)
ORDER BY studiensemester.start DESC;
';
return $this->execQuery($query);
}
public function checkStudienbeitrag($uid, $stsem, $buchungstypen)
{
$query = 'SELECT tbl_konto.buchungsnr,
tbl_konto.buchungsdatum
FROM public.tbl_konto,
public.tbl_benutzer,
public.tbl_student
WHERE
tbl_konto.studiensemester_kurzbz = \'' . $stsem . '\'
AND tbl_benutzer.uid = \'' . $uid . '\'
AND tbl_benutzer.uid = tbl_student.student_uid
AND tbl_benutzer.person_id = tbl_konto.person_id
AND tbl_konto.studiengang_kz=tbl_student.studiengang_kz
AND tbl_konto.buchungstyp_kurzbz IN (\'' . $buchungstypen . '\')
AND 0 >= (
SELECT sum(betrag)
FROM public.tbl_konto skonto
WHERE skonto.buchungsnr = tbl_konto.buchungsnr_verweis
OR skonto.buchungsnr_verweis = tbl_konto.buchungsnr_verweis
)
ORDER BY buchungsnr DESC LIMIT 1
';
return $this->execQuery($query);
}
} }
+22 -10
View File
@@ -556,11 +556,11 @@ class Prestudent_model extends DB_Model
*/ */
public function getOrganisationunitsByPersonId($person_id) public function getOrganisationunitsByPersonId($person_id)
{ {
$query = 'SELECT o.oe_kurzbz, $query = 'SELECT DISTINCT o.oe_kurzbz,
o.bezeichnung, o.bezeichnung,
(CASE (CASE
WHEN sg.typ = \'b\' THEN ps.prestudent_id WHEN sg.typ = \'b\' THEN ps.prestudent_id
WHEN sg.typ = \'m\' THEN p.prestudent_id WHEN sg.typ = \'m\' THEN ps.prestudent_id
ELSE NULL ELSE NULL
END) AS prestudent_id END) AS prestudent_id
FROM public.tbl_prestudent p FROM public.tbl_prestudent p
@@ -581,7 +581,7 @@ class Prestudent_model extends DB_Model
return $this->execQuery($query, array($person_id)); return $this->execQuery($query, array($person_id));
} }
/** /**
* Get latest ZGV Bezeichnung of Prestudent. * Get latest ZGV Bezeichnung of Prestudent.
* *
@@ -593,35 +593,46 @@ class Prestudent_model extends DB_Model
{ {
show_error('Prestudent_id is not numeric.'); show_error('Prestudent_id is not numeric.');
} }
$language_index = getUserLanguage() == 'German' ? 0 : 1; $language_index = getUserLanguage() == 'German' ? 0 : 1;
$this->addSelect(' $this->addSelect('
COALESCE( COALESCE(
array_to_json(zgvmaster.bezeichnung::varchar[])->>' . $language_index . ', array_to_json(zgvmaster.bezeichnung::varchar[])->>' . $language_index . ',
array_to_json(zgv.bezeichnung::varchar[])->>' . $language_index . ' array_to_json(zgv.bezeichnung::varchar[])->>' . $language_index . '
) AS bezeichnung' ) AS bezeichnung'
); );
$this->addJoin('bis.tbl_zgv zgv', 'zgv_code', 'LEFT'); $this->addJoin('bis.tbl_zgv zgv', 'zgv_code', 'LEFT');
$this->addJoin('bis.tbl_zgvmaster zgvmaster', 'zgvmas_code', 'LEFT'); $this->addJoin('bis.tbl_zgvmaster zgvmaster', 'zgvmas_code', 'LEFT');
return $this->loadWhere(array( return $this->loadWhere(array(
'prestudent_id' => $prestudent_id 'prestudent_id' => $prestudent_id
)); ));
} }
public function getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester) public function getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt)
{ {
$query = "SELECT ps.prestudent_id $query = "SELECT ps.prestudent_id
FROM public.tbl_prestudentstatus pss FROM public.tbl_prestudentstatus pss
JOIN public.tbl_prestudent ps USING(prestudent_id) JOIN public.tbl_prestudent ps USING(prestudent_id)
JOIN public.tbl_studiengang sg USING(studiengang_kz) JOIN public.tbl_studiengang sg USING(studiengang_kz)
JOIN lehre.tbl_studienplan sp USING(studienplan_id) JOIN lehre.tbl_studienplan sp USING(studienplan_id)
JOIN lehre.tbl_studienordnung so USING(studienordnung_id)
WHERE ps.person_id = ? WHERE ps.person_id = ?
AND UPPER((sg.typ || sg.kurzbz) || ':' || sp.orgform_kurzbz) = ? AND UPPER(so.studiengangkurzbzlang || ':' || sp.orgform_kurzbz) = ?
AND pss.studiensemester_kurzbz = ? AND pss.studiensemester_kurzbz = ?
"; AND";
if ($abgeschickt === 'true')
$query .= " EXISTS";
else
$query .= " NOT EXISTS";
$query .= " (SELECT 1 FROM public.tbl_prestudentstatus spss
JOIN public.tbl_prestudent sps USING(prestudent_id)
WHERE sps.prestudent_id = ps.prestudent_id
AND spss.bewerbung_abgeschicktamum IS NOT NULL)";
return $this->execQuery($query, array($person, $studiengang, $studienSemester)); return $this->execQuery($query, array($person, $studiengang, $studienSemester));
} }
@@ -655,4 +666,5 @@ class Prestudent_model extends DB_Model
return $this->execQuery($query, array($prestudent_id)); return $this->execQuery($query, array($prestudent_id));
} }
} }
@@ -52,6 +52,24 @@ class Prestudentstatus_model extends DB_Model
return $this->execQuery($query, $parametersArray); return $this->execQuery($query, $parametersArray);
} }
/**
* Liefert den Ersten Status eines Prestudenten mit der übergebenen Statuskurzbezeichnung.
*
* @param $prestudent_id
* @param $status_kurzbz
* @return array
*/
public function getFirstStatus($prestudent_id, $status_kurzbz)
{
$this->addOrder('datum, insertamum, ext_id');
$this->addLimit(1);
return $this->loadWhere(array(
'prestudent_id' => $prestudent_id,
'status_kurzbz' => $status_kurzbz
));
}
/** /**
* updateStufe * updateStufe
*/ */
+16
View File
@@ -66,4 +66,20 @@ class Student_model extends DB_Model
return $result->retval[0]->student_uid; return $result->retval[0]->student_uid;
} }
public function searchStudent($filter)
{
$this->addSelect('vorname, nachname, gebdatum, person.person_id, student_uid');
$this->addJoin('public.tbl_prestudent ps', 'prestudent_id');
$this->addJoin('public.tbl_person person', 'person_id');
$result = $this->loadWhere(
"lower(student_uid) like ".$this->db->escape('%'.$filter.'%')."
OR lower(person.nachname) like ".$this->db->escape('%'.$filter.'%')."
OR lower(person.vorname) like ".$this->db->escape('%'.$filter.'%')."
OR lower(person.nachname || ' ' || person.vorname) like ".$this->db->escape('%'.$filter.'%')."
OR lower(person.vorname || ' ' || person.nachname) like ".$this->db->escape('%'.$filter.'%'));
return $result;
}
} }
@@ -309,4 +309,166 @@ class Lehrveranstaltung_model extends DB_Model
return $this->execQuery($query, array($uid, $studiensemester_kurzbz, $lehrveranstaltung_id)); return $this->execQuery($query, array($uid, $studiensemester_kurzbz, $lehrveranstaltung_id));
} }
/**
* Sucht nach LV Templates und gibt Id und Label ("bezeichnung [kurzbz]") aus
* Diese funktion ist für autocomplete gedacht
*
* @param string $filter Suchfilter
* @return \stdClass A return object
*/
public function loadTemplates($filter)
{
$filter = strtolower($filter);
$qry = "SELECT
tbl_lehrveranstaltung.lehrveranstaltung_id, tbl_lehrveranstaltung.bezeichnung, tbl_lehrveranstaltung.kurzbz
FROM
lehre.tbl_lehrveranstaltung
WHERE
tbl_lehrveranstaltung.lehrtyp_kurzbz = 'tpl' AND (
CAST(tbl_lehrveranstaltung.lehrveranstaltung_id AS TEXT) LIKE '%".$this->db_escape($filter)."%' OR
LOWER(tbl_lehrveranstaltung.bezeichnung) LIKE '%".$this->db_escape($filter). "%' OR
LOWER(tbl_lehrveranstaltung.kurzbz) LIKE '%".$this->db_escape($filter). "%'
)
";
return $this->execQuery($qry);
}
/**
* Lädt Template und gibt Id und Label ("bezeichnung [kurzbz]") zurück
* Diese funktion ist für autocomplete gedacht
*
* @param string $name
* @return \stdClass A return object
*/
public function loadTemplateByName($name)
{
$qry = "SELECT
tbl_lehrveranstaltung.lehrveranstaltung_id as id, CONCAT(tbl_lehrveranstaltung.bezeichnung, ' [', tbl_lehrveranstaltung.kurzbz, ']') as label
FROM
lehre.tbl_lehrveranstaltung
WHERE
tbl_lehrveranstaltung.lehrtyp_kurzbz = 'tpl' AND (
CAST(tbl_lehrveranstaltung.lehrveranstaltung_id AS TEXT) = '".($name ? $this->db_escape($name) : 0)."' OR tbl_lehrveranstaltung.bezeichnung = '".$this->db_escape($name). "' OR tbl_lehrveranstaltung.kurzbz = '".$this->db_escape($name). "'
)
";
return $this->execQuery($qry);
}
/**
* Get ECTS Summe pro angerechnetes Quereinstiegssemester.
*
* @param $studiengang_kz
* @param $studiensemester_kurzbz
* @param $ausbildungssemester
* @param $orgform_kurzbz
* @return array|stdClass|null
*/
public function getSumQuereinstiegsECTSProSemester($studiengang_kz, $studiensemester_kurzbz, $ausbildungssemester, $orgform_kurzbz)
{
$qry = '
SELECT
sum(tbl_lehrveranstaltung.ects) as "sum_ects"
FROM
lehre.tbl_studienplan
JOIN lehre.tbl_studienplan_lehrveranstaltung USING (studienplan_id)
JOIN lehre.tbl_lehrveranstaltung USING (lehrveranstaltung_id)
WHERE
tbl_studienplan.studienplan_id = (
SELECT
studienplan_id
FROM
lehre.tbl_studienordnung
JOIN lehre.tbl_studienplan USING (studienordnung_id)
JOIN lehre.tbl_studienplan_semester USING (studienplan_id)
WHERE tbl_studienordnung.studiengang_kz = ?
AND tbl_studienplan_semester.semester = ?
AND tbl_studienplan_semester.studiensemester_kurzbz = ?
AND tbl_studienplan.orgform_kurzbz = ?
LIMIT 1
)
AND tbl_studienplan_lehrveranstaltung.semester = ?
AND studienplan_lehrveranstaltung_id_parent IS NULL -- auf Modulebene
AND tbl_studienplan_lehrveranstaltung.export = TRUE
';
return $this->execQuery($qry, array(
$studiengang_kz, $ausbildungssemester, $studiensemester_kurzbz, $orgform_kurzbz, $ausbildungssemester)
);
}
/**
* Get ECTS Summe aller bisher angerechneten LVs.
* Wenn keine explizite Begruendung angegeben ist, wird eine schulische Begruendung angenommen.
*
* @param $student_uid
* @return array|stdClass|null
*/
public function getSumAngerechneteECTSByBegruendung($student_uid)
{
$qry = '
SELECT sum(ects), begruendung_id FROM (
SELECT
lehrveranstaltung_id, studiensemester_kurzbz, ects, COALESCE(begruendung_id, 1) as begruendung_id -- fallback auf externes Zeugnis
FROM
lehre.tbl_zeugnisnote
LEFT JOIN lehre.tbl_anrechnung USING(lehrveranstaltung_id, studiensemester_kurzbz)
JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id)
JOIN public.tbl_student USING(student_uid)
WHERE
tbl_zeugnisnote.note = 6
AND student_uid = ?
AND (lehre.tbl_anrechnung.prestudent_id = tbl_student.prestudent_id
OR lehre.tbl_anrechnung.prestudent_id is null)
UNION
SELECT
lehrveranstaltung_id, studiensemester_kurzbz, ects, begruendung_id -- fallback auf externes Zeugnis
FROM
lehre.tbl_anrechnung
JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id)
JOIN public.tbl_student USING(prestudent_id)
WHERE
genehmigt_von is not null
AND student_uid = ?
) lvsangerechnet
GROUP BY begruendung_id
';
return $this->execQuery($qry, array($student_uid, $student_uid));
}
/**
* Get ECTS Summe aller bisher schulisch begruendeten angerechneten LVs.
* Derzeit wird auch jede Anrechnung, die nicht beruflich ist, als schulisch angenommen.
*
* @param $student_uid
* @return array|stdClass|null
*/
public function getEctsSumSchulisch($student_uid, $prestudent_id, $studiengang_kz)
{
$qry = '
SELECT get_ects_summe_schulisch(?, ?, ?) AS ectsSumSchulisch
';
return $this->execQuery($qry, array($student_uid, $prestudent_id, $studiengang_kz));
}
/**
* Get ECTS Summe aller bisher beruflich angerechneten LVs.
*
* @param $student_uid
* @return array|stdClass|null
*/
public function getEctsSumBeruflich($student_uid)
{
$qry = '
SELECT get_ects_summe_beruflich(?) AS ectsSumBeruflich
';
return $this->execQuery($qry, array($student_uid));
}
} }
@@ -42,6 +42,34 @@ class Projektbetreuer_model extends DB_Model
} }
} }
/**
* Gets Betreuer of a certain Type of a Projektarbeit.
* Returns one row for each person.
* @param int $projektarbeit_id
* @param string $betreuerart_kurzbz
* @return array success with number of Betreuer or error
*/
public function getBetreuerOfProjektarbeit($projektarbeit_id, $betreuerart_kurzbz)
{
$qry = "SELECT DISTINCT ON (pers.person_id) pers.person_id, betreuerart_kurzbz, vorname, nachname,
trim(COALESCE(titelpre,'')||' '||COALESCE(vorname,'')||' '||COALESCE(nachname,'')||' '||COALESCE(titelpost,'')) as voller_name,
anrede, titelpre, titelpost, gebdatum, geschlecht, pa.projekttyp_kurzbz,
ben.uid, ben.alias, ma.personalnummer, mitarbeiter_uid, student_uid
FROM lehre.tbl_projektarbeit pa
JOIN lehre.tbl_projektbetreuer USING (projektarbeit_id)
JOIN public.tbl_person pers USING (person_id)
LEFT JOIN public.tbl_benutzer ben USING (person_id)
LEFT JOIN public.tbl_mitarbeiter ma ON ben.uid = ma.mitarbeiter_uid
WHERE ben.aktiv
AND projektarbeit_id = ?
AND betreuerart_kurzbz = ?
ORDER BY pers.person_id, CASE WHEN ma.mitarbeiter_uid IS NULL THEN 1 ELSE 0 END, /*Mitarbeiter account first*/
CASE WHEN ben.uid IS NULL THEN 1 ELSE 0 END, /*user with account first*/
ben.insertamum";
return $this->execQuery($qry, array($projektarbeit_id, $betreuerart_kurzbz));
}
/** /**
* Get Projektbetreuer data by authentification token * Get Projektbetreuer data by authentification token
* @param $zugangstoken * @param $zugangstoken
@@ -60,4 +88,83 @@ class Projektbetreuer_model extends DB_Model
return $this->execQuery($qry, array($zugangstoken)); return $this->execQuery($qry, array($zugangstoken));
} }
/**
* Holt Zweitbegutachter einer Projektarbeit mit Mail.
* @param $erstbegutachter_person_id int person_id des Erstbegutachters
* @param $projektarbeit_id int
* @param $student_uid string uid des Studenten der Arbeit abgibt
* @return object | bool
*/
public function getZweitbegutachterWithToken($erstbegutachter_person_id, $projektarbeit_id, $student_uid)
{
$qry_betr = "SELECT betr.person_id, betr.projektarbeit_id, pers.anrede, betr.zugangstoken, betr.zugangstoken_gueltigbis, tbl_benutzer.uid, kontakt,
trim(COALESCE(titelpre,'')||' '||COALESCE(vorname,'')||' '||COALESCE(nachname,'')||' '||COALESCE(titelpost,'')) as voller_name,
CASE WHEN tbl_benutzer.uid IS NULL THEN kontakt ELSE tbl_benutzer.uid || '@".DOMAIN."' END AS email, abg.abgabedatum
FROM lehre.tbl_projektbetreuer betr
JOIN lehre.tbl_projektarbeit parb ON betr.projektarbeit_id = parb.projektarbeit_id
JOIN public.tbl_person pers ON betr.person_id = pers.person_id
LEFT JOIN public.tbl_kontakt ON pers.person_id = tbl_kontakt.person_id AND kontakttyp = 'email' AND zustellung = true
LEFT JOIN public.tbl_benutzer ON pers.person_id = tbl_benutzer.person_id
LEFT JOIN campus.tbl_paabgabe abg ON betr.projektarbeit_id = abg.projektarbeit_id AND abg.paabgabetyp_kurzbz = 'end'
WHERE betr.betreuerart_kurzbz = 'Zweitbegutachter'
AND betr.projektarbeit_id = ?
AND parb.student_uid = ?
AND EXISTS (
SELECT 1 FROM lehre.tbl_projektbetreuer
WHERE person_id = ?
AND betreuerart_kurzbz = 'Erstbegutachter'
AND projektarbeit_id = betr.projektarbeit_id
)
AND (tbl_benutzer.aktiv OR tbl_benutzer.aktiv IS NULL)
ORDER BY betr.insertamum DESC
LIMIT 1";
return $this->execQuery($qry_betr, array($projektarbeit_id, $student_uid, $erstbegutachter_person_id));
}
/**
* Generiert neuen Token für externen Zweitbetreuer.
* @param int $zweitbegutachter_person_id
* @param int $projektarbeit_id
* @return array
*/
public function generateZweitbegutachterToken($zweitbegutachter_person_id, $projektarbeit_id)
{
$betreuerUidQry = "SELECT uid, zugangstoken, zugangstoken_gueltigbis, tbl_projektbetreuer.person_id
FROM lehre.tbl_projektbetreuer
JOIN public.tbl_person USING(person_id)
LEFT JOIN public.tbl_benutzer USING(person_id)
WHERE projektarbeit_id = ?
AND tbl_projektbetreuer.person_id = ?
AND betreuerart_kurzbz = 'Zweitbegutachter'
LIMIT 1";
$betreueruidres = $this->execQuery($betreuerUidQry, array($projektarbeit_id, $zweitbegutachter_person_id));
if (!hasData($betreueruidres))
return error('Zweitbegutachter nicht gefunden');
$row_betr = getData($betreueruidres)[0];
if (!isset($row_betr->uid))
{
do {
$token = generateToken(16);
$qry_tokencheck = $this->load(array('zugangstoken' => $token));
} while(hasData($qry_tokencheck));
$result = $this->update(
array('projektarbeit_id' => $projektarbeit_id,
'person_id' => $row_betr->person_id,
'betreuerart_kurzbz' => 'Zweitbegutachter'),
array('zugangstoken' => $token,
'zugangstoken_gueltigbis' => date('Y-m-d', strtotime('+1 year')))
);
return $result;
}
else
return success("Account vorhanden, kein Token benötigt");
}
} }
@@ -86,9 +86,10 @@ class Zeugnisnote_model extends DB_Model
* @param bool $lehre * @param bool $lehre
* @param bool $offiziell * @param bool $offiziell
* @param bool $positiv * @param bool $positiv
* @param bool $zeugnis
* @return object * @return object
*/ */
public function getByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null) public function getByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null, $zeugnis = null)
{ {
$params = array($person_id, $studiensemester_kurzbz); $params = array($person_id, $studiensemester_kurzbz);
@@ -129,6 +130,12 @@ class Zeugnisnote_model extends DB_Model
$params[] = $positiv; $params[] = $positiv;
} }
if (isset($zeugnis))
{
$qry .= ' AND lv.zeugnis = ?';
$params[] = $zeugnis;
}
$qry .= ' ORDER BY zgnisnote.benotungsdatum'; $qry .= ' ORDER BY zgnisnote.benotungsdatum';
return $this->execQuery($qry, $params); return $this->execQuery($qry, $params);
@@ -448,10 +448,11 @@ class Studiengang_model extends DB_Model
return $this->execQuery($query, array($typ)); return $this->execQuery($query, array($typ));
} }
/** /**
* Get Studiengangsleitung * Get Studiengangsleitung/en of Studiengang/Studiengaenge.
* @param null $studiengang_kz *
* @param null $studiengang_kz Numeric or Array
* @return array * @return array
*/ */
public function getLeitung($studiengang_kz = null) public function getLeitung($studiengang_kz = null)
@@ -460,7 +461,12 @@ class Studiengang_model extends DB_Model
$this->addJoin('public.tbl_benutzerfunktion', 'oe_kurzbz'); $this->addJoin('public.tbl_benutzerfunktion', 'oe_kurzbz');
$this->addJoin('public.tbl_benutzer', 'uid'); $this->addJoin('public.tbl_benutzer', 'uid');
$this->addJoin('public.tbl_person', 'person_id'); $this->addJoin('public.tbl_person', 'person_id');
if (!is_numeric($studiengang_kz) && !is_array($studiengang_kz))
{
return error('Studiengangskennzahl ungültig');
}
if (is_null($studiengang_kz)) if (is_null($studiengang_kz))
{ {
$condition = ' $condition = '
@@ -469,30 +475,46 @@ class Studiengang_model extends DB_Model
AND ( datum_bis >= NOW() OR datum_bis IS NULL ) AND ( datum_bis >= NOW() OR datum_bis IS NULL )
'; ';
} }
elseif (is_numeric($studiengang_kz)) elseif (is_numeric($studiengang_kz) || is_array($studiengang_kz))
{ {
if (is_array($studiengang_kz))
{
$studiengang_kz = array_map(array($this,'escape'), $studiengang_kz);
$studiengang_kz = implode(', ', $studiengang_kz);
}
$condition = ' $condition = '
funktion_kurzbz = \'Leitung\' funktion_kurzbz = \'Leitung\'
AND ( datum_von <= NOW() OR datum_von IS NULL ) AND ( datum_von <= NOW() OR datum_von IS NULL )
AND ( datum_bis >= NOW() OR datum_bis IS NULL ) AND ( datum_bis >= NOW() OR datum_bis IS NULL )
AND studiengang_kz = ' . $this->db->escape($studiengang_kz) AND studiengang_kz IN (' . $studiengang_kz. ')';
; ;
} }
return $this->loadWhere($condition); return $this->loadWhere($condition);
} }
public function getStudiengaengeWithOrgForm($typ, $semester) public function getStudiengaengeWithOrgForm($typ, $semester)
{ {
$query = "SELECT DISTINCT (UPPER(sg.typ || sg.kurzbz || ':' || sp.orgform_kurzbz)) AS Studiengang $query = "SELECT DISTINCT (UPPER(so.studiengangkurzbzlang || ':' || sp.orgform_kurzbz)) AS Studiengang
FROM public.tbl_studiengang sg FROM public.tbl_studiengang sg
JOIN lehre.tbl_studienordnung USING (studiengang_kz) JOIN lehre.tbl_studienordnung USING (studiengang_kz)
JOIN lehre.tbl_studienplan sp USING (studienordnung_id) JOIN lehre.tbl_studienplan sp USING (studienordnung_id)
JOIN lehre.tbl_studienplan_semester spsem USING (studienplan_id) JOIN lehre.tbl_studienplan_semester spsem USING (studienplan_id)
JOIN lehre.tbl_studienordnung so USING(studienordnung_id)
WHERE sp.aktiv = TRUE AND sg.aktiv = TRUE AND sg.typ IN ? WHERE sp.aktiv = TRUE AND sg.aktiv = TRUE AND sg.typ IN ?
AND spsem.studiensemester_kurzbz = ? AND spsem.studiensemester_kurzbz = ?
ORDER BY Studiengang"; ORDER BY Studiengang";
return $this->execQuery($query, array($typ, $semester)); return $this->execQuery($query, array($typ, $semester));
} }
public function getStudiengangTyp($studiengang_kz, $typ)
{
$query = "SELECT DISTINCT(sgt.*)
FROM tbl_studiengangstyp sgt JOIN tbl_studiengang sg on sgt.typ = sg.typ
WHERE studiengang_kz IN ? and sgt.typ IN ?";
return $this->execQuery($query, array($studiengang_kz, $typ));
}
} }
@@ -13,6 +13,20 @@ class Studiensemester_model extends DB_Model
$this->hasSequence = false; $this->hasSequence = false;
} }
/**
* Get actual Studiensemester.
*
* @return array
*/
public function getAkt()
{
return $this->loadWhere(array(
'start <= ' => 'NOW()',
'ende >= ' => 'NOW()'
)
);
}
// Get next study semester // Get next study semester
public function getNext() public function getNext()
{ {
@@ -91,7 +105,7 @@ class Studiensemester_model extends DB_Model
/** /**
* getPreviousFrom * getPreviousFrom
*/ */
public function getPreviousFrom($studiensemester_kurzbz) public function getPreviousFrom($studiensemester_kurzbz, $limit = 1)
{ {
$query = 'SELECT studiensemester_kurzbz, $query = 'SELECT studiensemester_kurzbz,
start, start,
@@ -103,9 +117,9 @@ class Studiensemester_model extends DB_Model
WHERE studiensemester_kurzbz = ? WHERE studiensemester_kurzbz = ?
) )
ORDER BY start DESC ORDER BY start DESC
LIMIT 1'; LIMIT ?';
return $this->execQuery($query, array($studiensemester_kurzbz)); return $this->execQuery($query, array($studiensemester_kurzbz, $limit));
} }
/** /**
@@ -167,15 +181,13 @@ class Studiensemester_model extends DB_Model
if (date_format(date_create($from), 'Y-m-d') > (date_format(date_create($to), 'Y-m-d'))) if (date_format(date_create($from), 'Y-m-d') > (date_format(date_create($to), 'Y-m-d')))
return success(array()); return success(array());
$query = "SELECT * $query = "
FROM public.tbl_studiensemester SELECT *
WHERE FROM public.tbl_studiensemester
(ende > ?::date AND start < ?::date) WHERE ( ?::date < ende AND ?::date > start )
OR start = ?::date ORDER BY start DESC";
OR ende = ?::date
ORDER BY start DESC";
return $this->execQuery($query, array($from, $to, $from, $to)); return $this->execQuery($query, array($from, $to));
} }
/** /**
@@ -0,0 +1,14 @@
<?php
class Adressentyp_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_adressentyp';
$this->pk = 'adressentyp_kurzbz';
}
}
@@ -0,0 +1,22 @@
<?php
class Fotostatusperson_model extends DB_Model
{
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_person_fotostatus';
$this->pk = 'person_fotostatus_id';
}
public function getLastFotoStatus($person_id)
{
$this->addOrder('datum', 'DESC');
$this->addOrder('person_fotostatus_id', 'DESC');
$this->addLimit(1);
return $this->loadWhere(array('person_id' => $person_id));
}
}
+73 -3
View File
@@ -82,7 +82,7 @@ class Person_model extends DB_Model
} }
else else
{ {
$person['svnr'] = $person['svnr'] . 'v' . ($result->retval[0]->svnr{11} + 1); $person['svnr'] = $person['svnr'] . 'v' . ($result->retval[0]->svnr[11] + 1);
} }
} }
} }
@@ -165,7 +165,7 @@ class Person_model extends DB_Model
if (!hasData($person)) if (!hasData($person))
return success(null); return success(null);
$this->KontaktModel->addSelect('kontakttyp, anmerkung, kontakt, zustellung'); $this->KontaktModel->addSelect('kontakt_id, kontakttyp, anmerkung, kontakt, zustellung');
$this->KontaktModel->addOrder('kontakttyp'); $this->KontaktModel->addOrder('kontakttyp');
$this->KontaktModel->addOrder('insertamum', 'DESC'); $this->KontaktModel->addOrder('insertamum', 'DESC');
$where = $zustellung_only === true ? array('person_id' => $person_id, 'zustellung' => true) : array('person_id' => $person_id); $where = $zustellung_only === true ? array('person_id' => $person_id, 'zustellung' => true) : array('person_id' => $person_id);
@@ -193,7 +193,7 @@ class Person_model extends DB_Model
*/ */
public function getByUid($uid) public function getByUid($uid)
{ {
$this->addSelect('vorname, nachname, gebdatum, person_id, bpk, matr_nr'); $this->addSelect('vorname, nachname, gebdatum, person_id, bpk, matr_nr, foto');
$this->addJoin('tbl_benutzer', 'person_id'); $this->addJoin('tbl_benutzer', 'person_id');
return $this->loadWhere(array('uid' => $uid)); return $this->loadWhere(array('uid' => $uid));
@@ -265,4 +265,74 @@ class Person_model extends DB_Model
return success($result->vorname. ' '. $result->nachname); return success($result->vorname. ' '. $result->nachname);
} }
public function checkDuplicate($person_id)
{
$qry = "SELECT person_id
FROM public.tbl_prestudent p
JOIN
(
SELECT DISTINCT ON(prestudent_id) *
FROM public.tbl_prestudentstatus
WHERE prestudent_id IN
(
SELECT prestudent_id
FROM public.tbl_prestudent
WHERE person_id IN
(
SELECT p2.person_id
FROM public.tbl_person p
JOIN public.tbl_person p2
ON lower(p.vorname) = lower(p2.vorname)
AND lower(p.nachname) = lower(p2.nachname)
AND p.gebdatum = p2.gebdatum
AND p.person_id = ?
)
)
ORDER BY prestudent_id, datum DESC, insertamum DESC
) ps USING(prestudent_id)
JOIN public.tbl_status USING(status_kurzbz)
WHERE status_kurzbz = 'Interessent'
AND studiengang_kz IN
(
SELECT studiengang_kz
FROM public.tbl_prestudent p
JOIN
(
SELECT DISTINCT ON(prestudent_id) *
FROM public.tbl_prestudentstatus
WHERE prestudent_id IN
(
SELECT prestudent_id
FROM public.tbl_prestudent
WHERE person_id IN
(
SELECT p2.person_id
FROM public.tbl_person p
JOIN public.tbl_person p2
ON lower(p.vorname) = lower(p2.vorname)
AND lower(p.nachname) = lower(p2.nachname)
AND p.gebdatum = p2.gebdatum
AND p.person_id = ?
)
)
ORDER BY prestudent_id, datum DESC, insertamum DESC
) ps USING(prestudent_id)
JOIN public.tbl_status USING(status_kurzbz)
WHERE status_kurzbz = 'Abbrecher'
)
UNION
SELECT p2.person_id
FROM tbl_person p1
INNER JOIN (
SELECT vorname, nachname, gebdatum, person_id
FROM tbl_person
) p2
ON (lower(p1.vorname) = lower(p2.vorname) AND lower(p1.nachname) = lower(p2.nachname) AND p1.gebdatum = p2.gebdatum)
WHERE p1.person_id != p2.person_id AND (p1.person_id = ?)";
return $this->execQuery($qry, array($person_id, $person_id, $person_id));
}
} }
@@ -18,7 +18,7 @@ class Betriebsmittelperson_model extends DB_Model
* @param bool $isRetourniert False to retrieve only active Betriebsmittel. * @param bool $isRetourniert False to retrieve only active Betriebsmittel.
* @return array|bool * @return array|bool
*/ */
public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null) public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null, $onlyAktiveBenutzer=false)
{ {
if (!is_numeric($person_id)) if (!is_numeric($person_id))
{ {
@@ -28,8 +28,12 @@ class Betriebsmittelperson_model extends DB_Model
$this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id'); $this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id');
if( $onlyAktiveBenutzer ) {
$this->addJoin('public.tbl_benutzer b', 'b.uid = wawi.tbl_betriebsmittelperson.uid AND b.aktiv = \'t\'');
}
$condition = ' $condition = '
person_id = '. $this->escape($person_id). ' wawi.tbl_betriebsmittelperson.person_id = '. $this->escape($person_id). '
'; ';
if (is_string($betriebsmitteltyp)) { if (is_string($betriebsmitteltyp)) {
@@ -51,4 +55,45 @@ class Betriebsmittelperson_model extends DB_Model
return $this->loadWhere($condition); return $this->loadWhere($condition);
} }
public function getBetriebsmittelZuordnung($cardIdentifier, $typ = 'Zutrittskarte', $ausgegeben = true)
{
$this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id');
$where = 'wawi.tbl_betriebsmittel.nummer2 = \'' . $cardIdentifier . '\'
AND wawi.tbl_betriebsmittel.betriebsmitteltyp = \''. $typ .'\'
AND (retouram >= now() OR retouram IS NULL)
';
if ($ausgegeben)
$where .= 'AND ausgegebenam <= now()';
else
$where .= 'AND (ausgegebenam <= now() OR ausgegebenam IS NULL)';
return $this->loadWhere($where);
}
public function getBetriebsmittelByUid($uid, $betriebsmitteltyp = null, $isRetourniert = false)
{
$this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id');
$condition = ' wawi.tbl_betriebsmittelperson.uid = '. $this->escape($uid);
if (is_string($betriebsmitteltyp))
{
$condition .= ' AND betriebsmitteltyp = ' . $this->escape($betriebsmitteltyp);
}
if ($isRetourniert === true) {
$condition .= ' AND retouram IS NOT NULL';
}
elseif ($isRetourniert === false)
{
$condition .= ' AND retouram IS NULL';
}
$this->addOrder('ausgegebenam', 'DESC');
return $this->loadWhere($condition);
}
} }
@@ -61,4 +61,98 @@ class Stundenplandev_model extends DB_Model
return $this->execQuery($qry, $parametersArray); return $this->execQuery($qry, $parametersArray);
} }
/**
* Get Stundenplan data.
*
* @param null $lehrveranstaltung_id
* @param null $studiensemester_kurzbz
* @param null $lehreinheit_id
* @param null $mitarbeiter_uid
* @param null $student_uid
* @param false $nurBevorstehende If true, only future data is retrieved.
* @return array|false|stdClass|null
*/
public function getStundenplanData($lehrveranstaltung_id=null, $studiensemester_kurzbz=null, $lehreinheit_id=null, $mitarbeiter_uid=null, $student_uid=null, $nurBevorstehende = false)
{
$params = array();
$qry = "SELECT
stpl.datum, min(stpl.stunde) as stundevon, max(stpl.stunde) as stundebis,
stpl.lehreinheit_id, lehrfach.bezeichnung as lehrfach_bezeichnung,
array_agg(
CASE WHEN gruppe_kurzbz is not null THEN gruppe_kurzbz
ELSE (SELECT UPPER(typ || kurzbz) FROM public.tbl_studiengang WHERE studiengang_kz=stpl.studiengang_kz) || COALESCE(stpl.semester,'0') || COALESCE(stpl.verband,'') || COALESCE(stpl.gruppe,'')
END) as gruppen, array_agg(mitarbeiter_uid) as lektoren,
array_agg(ort_kurzbz) as orte,
array_agg(titel) as titel
FROM
lehre.tbl_stundenplandev as stpl
JOIN lehre.tbl_lehreinheit USING(lehreinheit_id)
JOIN lehre.tbl_lehrveranstaltung as lehrfach ON(tbl_lehreinheit.lehrfach_id=lehrfach.lehrveranstaltung_id)
WHERE ";
if ($lehrveranstaltung_id != '')
{
$qry.="
lehreinheit_id IN (
SELECT lehreinheit_id FROM lehre.tbl_lehreinheit
WHERE lehrveranstaltung_id = ?
AND studiensemester_kurzbz = ?
)";
$params[]= $lehrveranstaltung_id;
$params[]= $studiensemester_kurzbz;
}
elseif ($lehreinheit_id!='')
{
$qry.=" lehreinheit_id = ?";
$params[]= $lehreinheit_id;
}
elseif ($mitarbeiter_uid != '')
{
$qry.= "
mitarbeiter_uid = ?
AND lehreinheit_id IN (
SELECT lehreinheit_id
FROM lehre.tbl_lehreinheitmitarbeiter
JOIN lehre.tbl_lehreinheit USING (lehreinheit_id)
WHERE mitarbeiter_uid = ?
AND studiensemester_kurzbz IN ( ? )
)";
$params[] = $mitarbeiter_uid;
$params[] = $mitarbeiter_uid;
$params[] = $studiensemester_kurzbz;
}
elseif ($student_uid != '')
{
$qry.="
lehreinheit_id IN (
SELECT lehreinheit_id
FROM campus.vw_student_lehrveranstaltung
WHERE uid = ?
AND studiensemester_kurzbz = ?
)";
$params[] = $student_uid;
$params[] = $studiensemester_kurzbz;
}
else
return false;
if($nurBevorstehende)
{
$qry.= " AND stpl.datum >= NOW()::date ";
}
$qry.= "
GROUP BY stpl.datum, stpl.unr, stpl.lehreinheit_id, lehrfach.bezeichnung
ORDER BY stpl.datum, min(stpl.stunde), stpl.unr, stpl.lehreinheit_id
";
return $this->execQuery($qry, $params);
}
} }
@@ -12,6 +12,47 @@ class Zeitsperre_model extends DB_Model
$this->pk = 'zeitsperre_id'; $this->pk = 'zeitsperre_id';
} }
/**
* Save or update Zeitsperre.
*
* @param $zeitsperretyp_kurzbz
* @param $mitarbeiter_uid
* @param $vonDatum
* @param $bisDatum
* @param null $vonStunde
* @param null $bisStunde
* @param null $bezeichnung
* @param null $vertretung_uid
* @param null $erreichbarkeit_kurzbz
* @param null $freigabeamum
* @param null $freigabevon
* @return array
*/
public function save($zeitsperretyp_kurzbz, $mitarbeiter_uid, $vonDatum, $bisDatum,
$vonStunde = null, $bisStunde = null, $bezeichnung = null, $vertretung_uid = null,
$erreichbarkeit_kurzbz = null, $freigabeamum = null, $freigabevon = null)
{
return $this->insert(array(
'zeitsperretyp_kurzbz' => $zeitsperretyp_kurzbz,
'mitarbeiter_uid' => $mitarbeiter_uid,
'vondatum' => $vonDatum,
'bisdatum' => $bisDatum,
'vonstunde' => $vonStunde,
'bisstunde' => $bisStunde,
'bezeichnung' => $bezeichnung,
'vertretung_uid' => $vertretung_uid,
'insertvon' => getAuthUID(),
'insertamum' => (new DateTime())->format('Y-m-d H:i:s'),
'erreichbarkeit_kurzbz' => $erreichbarkeit_kurzbz,
'freigabeamum' => $freigabeamum,
'freigabevon' => $freigabevon
));
}
/**
* Delete Zeitsperre.
* @return array|stdClass|null
*/
public function deleteEntriesForCurrentDay() public function deleteEntriesForCurrentDay()
{ {
$today = date('Y-m-d'); $today = date('Y-m-d');
@@ -0,0 +1,14 @@
<?php
class Zeitwunsch_gueltigkeit_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'campus.tbl_zeitwunsch_gueltigkeit';
$this->pk = 'zeitwunsch_gueltigkeit_id';
}
}
@@ -43,7 +43,7 @@ class Benutzerrolle_model extends DB_Model
* @param null $oe_kurzbz * @param null $oe_kurzbz
* @return array * @return array
*/ */
public function getBenutzerByBerechtigung($berechtigung_kurzbz, $oe_kurzbz = null) public function getBenutzerByBerechtigung($berechtigung_kurzbz, $oe_kurzbz = null, $art = null)
{ {
$params = array(); $params = array();
$query = ' $query = '
@@ -62,6 +62,12 @@ class Benutzerrolle_model extends DB_Model
$params[] = $oe_kurzbz; $params[] = $oe_kurzbz;
} }
if (!is_null($art))
{
$query .= ' AND art = ?';
$params[] = $art;
}
return $this->execQuery($query, $params); return $this->execQuery($query, $params);
} }
} }
@@ -0,0 +1,58 @@
<?php
class Fehlerzustaendigkeiten_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'system.tbl_fehler_zustaendigkeiten';
$this->pk = 'fehlerzustaendigkeiten_id';
}
/**
* Gets active Mitarbeiter not assigned to a Fehler.
* @param $fehlercode
* @return object
*/
public function getNonAssignedMitarbeiter($fehlercode)
{
$query = "SELECT person_id, ben.uid, vorname, nachname, titelpre, titelpost, personalnummer
FROM public.tbl_mitarbeiter
JOIN public.tbl_benutzer ben ON tbl_mitarbeiter.mitarbeiter_uid = ben.uid
JOIN public.tbl_person pers USING (person_id)
WHERE ben.aktiv
AND NOT EXISTS (
SELECT 1 FROM system.tbl_fehler_zustaendigkeiten
WHERE person_id = pers.person_id
AND fehlercode = ?
)
ORDER BY nachname, vorname, uid";
return $this->execReadOnlyQuery($query, array($fehlercode));
}
/**
* Gets Funktionen not assigned to a Fehler (over an organisational unit).
* @param $fehlercode
* @param $oe_kurzbz
* @return object
*/
public function getNonAssignedFunktionen($fehlercode, $oe_kurzbz)
{
$query = "SELECT funktion_kurzbz, beschreibung
FROM public.tbl_funktion funk
WHERE aktiv
AND NOT EXISTS (
SELECT 1 FROM system.tbl_fehler_zustaendigkeiten
WHERE funktion_kurzbz = funk.funktion_kurzbz
AND fehlercode = ?
AND oe_kurzbz = ?
)
ORDER BY beschreibung";
return $this->execReadOnlyQuery($query, array($fehlercode, $oe_kurzbz));
}
}
+39
View File
@@ -12,6 +12,45 @@ class Issue_model extends DB_Model
$this->pk = 'issue_id'; $this->pk = 'issue_id';
} }
/**
* Gets issues which are open, i.e. not resolved.
* @param array $fehlercodes only issues for given fehler are retrieved
* @param int $person_id
* @param string $oe_kurzbz
* @param string $fehlercode_extern
* @return object success with issues or error
*/
public function getOpenIssues($fehlercodes, $person_id = null, $oe_kurzbz = null, $fehlercode_extern = null)
{
$params = array($fehlercodes);
// issue exists for a fehlercode (or fehlercode_extern), person_id, oe_kurzbz, if not verarbeitet yet
$qry = 'SELECT issue_id, fehlercode, inhalt, fehlercode_extern, inhalt_extern, person_id, oe_kurzbz,
behebung_parameter, datum, verarbeitetvon, verarbeitetamum
FROM system.tbl_issue
WHERE fehlercode IN ?
AND verarbeitetamum IS NULL';
if (!isEmptyString($fehlercode_extern))
{
$qry .= ' AND fehlercode_extern = ?';
$params[] = $fehlercode_extern;
}
if (isset($person_id))
{
$qry .= ' AND person_id = ?';
$params[] = $person_id;
}
if (isset($oe_kurzbz))
{
$qry .= ' AND oe_kurzbz = ?';
$params[] = $oe_kurzbz;
}
return $this->execQuery($qry, $params);
}
/** /**
* Gets number of open (non-resolved) issues. * Gets number of open (non-resolved) issues.
* @param string $fehlercode unique error code * @param string $fehlercode unique error code
@@ -176,4 +176,20 @@ class MessageToken_model extends DB_Model
return $this->execQuery($sql, array($oe_kurzbz)); return $this->execQuery($sql, array($oe_kurzbz));
} }
/**
*
*/
public function crossClientData($token, $relationmessage_id, $receiver_id)
{
$sql = 'SELECT mm.message_id
FROM public.tbl_msg_message mm
JOIN public.tbl_msg_recipient mr USING(message_id)
WHERE mr.token = ?
AND mm.message_id = ?
AND mm.person_id = ?';
return $this->execQuery($sql, array($token, $relationmessage_id, $receiver_id));
}
} }
@@ -12,7 +12,14 @@ class Variablenname_model extends DB_Model
) sem ) sem
WHERE start > now() WHERE start > now()
LIMIT 1;', LIMIT 1;',
'infocenter_studiensgangtyp' => 'SELECT infocenter_studiensgangtyp FROM public.tbl_variablenname LIMIT 1' 'infocenter_studiensgangtyp' => 'SELECT infocenter_studiensgangtyp FROM public.tbl_variablenname LIMIT 1;',
'projektuebersicht_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;'
); );
/** /**
+21 -13
View File
@@ -3,15 +3,23 @@ $this->load->view(
'templates/FHC-Header', 'templates/FHC-Header',
array( array(
'title' => 'ÖH-Beitragsverwaltung', 'title' => 'ÖH-Beitragsverwaltung',
'jquery' => true, 'jquery3' => true,
'jqueryui' => true, 'jqueryui1' => true,
'bootstrap' => true, 'bootstrap3' => true,
'fontawesome' => true, 'fontawesome4' => true,
'sbadmintemplate' => true, 'sbadmintemplate3' => true,
'tablesorter' => true, 'tablesorter2' => true,
'dialoglib' => true, 'dialoglib' => true,
'ajaxlib' => true, 'ajaxlib' => true,
'navigationwidget' => true, 'navigationwidget' => true,
'phrases' => array(
'person' => array('vorname', 'nachname'),
'global' => array('unbeschraenkt'),
'ui' => array('bearbeiten', 'loeschen', 'speichern', 'entfernen'),
'oehbeitrag' => array('oehbeitraegeFestgelegt', 'fehlerHolenOehbeitraege', 'fehlerHolenSemester',
'fehlerHinzufuegenOehbeitrag', 'fehlerAktualisierenOehbeitrag',
'fehlerLoeschenOehbeitrag')
),
'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css', 'public/css/codex/oehbeitrag.css'), 'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css', 'public/css/codex/oehbeitrag.css'),
'customJSs' => array('public/js/tablesort/tablesort.js', 'public/js/codex/oehbeitrag.js') 'customJSs' => array('public/js/tablesort/tablesort.js', 'public/js/codex/oehbeitrag.js')
) )
@@ -28,23 +36,23 @@ $this->load->view(
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<h3 class="page-header"> <h3 class="page-header">
&Ouml;hbeitragsverwaltung <?php echo $this->p->t('oehbeitrag', 'oehbeitragsVerwaltung') ?>
</h3> </h3>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<button class="btn btn-default" id="addNewOeh">Neuen &Ouml;hbeitrag hinzuf&uuml;gen</button> <button class="btn btn-default" id="addNewOeh"><?php echo $this->p->t('oehbeitrag', 'oehbeitragHinzufuegen') ?></button>
<br /> <br />
<br /> <br />
<table class="table table-bordered table-condensed" id="oehbeitraegeTbl"> <table class="table table-bordered table-condensed" id="oehbeitraegeTbl">
<thead> <thead>
<tr> <tr>
<th>G&uuml;ltig von</th> <th><?php echo ucfirst($this->p->t('global', 'gueltigVon')) ?></th>
<th>G&uuml;ltig bis</th> <th><?php echo ucfirst($this->p->t('global', 'gueltigBis')) ?></th>
<th>Studierendenbetrag</th> <th><?php echo ucfirst($this->p->t('oehbeitrag', 'studierendenbetrag')) ?></th>
<th>Versicherungsbetrag</th> <th><?php echo ucfirst($this->p->t('oehbeitrag', 'versicherungsbetrag')) ?></th>
<th id="actionHeading">Aktion</th> <th id="actionHeading"><?php echo ucfirst($this->p->t('ui', 'aktion')) ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
+26 -32
View File
@@ -1,42 +1,36 @@
<?php <?php
$this->load->view('templates/FHC-Header', $includesArray = array(
array(
'title' => 'FH-Complete', 'title' => 'FH-Complete',
'jquery' => true, 'jquery3' => true,
'jqueryui' => true, 'jqueryui1' => true,
'bootstrap' => true, 'bootstrap3' => true,
'fontawesome' => true, 'fontawesome4' => true,
'sbadmintemplate' => true, 'sbadmintemplate3' => true,
'ajaxlib' => true, 'ajaxlib' => true,
'bootstrapper' => true, // to be used only if you know what you are doing!
'addons' => true, 'addons' => true,
'navigationwidget' => true 'navigationwidget' => true
) );
);
$this->load->view('templates/FHC-Header', $includesArray);
?> ?>
<body> <div id="wrapper">
<div id="wrapper">
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
<div id="page-wrapper">
<div id="page-wrapper"> <div class="container-fluid">
<div class="container-fluid"> <div class="row">
<div class="row"> <div class="col-lg-12">
<div class="col-lg-12"> <h3 class="page-header">FH-Complete</h3>
<h3 class="page-header">FH-Complete</h3> </div>
</div> </div>
<span>
<div id="dashboard"></div>
</span>
</div> </div>
<span>
<div id="dashboard"></div>
</span>
</div> </div>
</div> </div>
</div>
<script> <?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
//javascript hacks for bootstrap
$("select").addClass("form-control");
$("input[type=text]").addClass("form-control");
$("input[type=button]").addClass("btn btn-default");
$("#tableDataset").addClass('table-bordered');
</script>
</body>
<?php $this->load->view('templates/FHC-Footer'); ?>
@@ -3,10 +3,10 @@ $this->load->view(
'templates/FHC-Header', 'templates/FHC-Header',
array( array(
'title' => $this->p->t('anrechnung', 'anrechnungenGenehmigen'), 'title' => $this->p->t('anrechnung', 'anrechnungenGenehmigen'),
'jquery' => true, 'jquery3' => true,
'jqueryui' => true, 'jqueryui1' => true,
'bootstrap' => true, 'bootstrap3' => true,
'fontawesome' => true, 'fontawesome4' => true,
'ajaxlib' => true, 'ajaxlib' => true,
'dialoglib' => true, 'dialoglib' => true,
'phrases' => array( 'phrases' => array(
@@ -25,7 +25,8 @@ $this->load->view(
'bitteBegruendungAngeben', 'bitteBegruendungAngeben',
'empfehlungWurdeAngefordert', 'empfehlungWurdeAngefordert',
'anrechnungenWurdenGenehmigt', 'anrechnungenWurdenGenehmigt',
'anrechnungenWurdenAbgelehnt' 'anrechnungenWurdenAbgelehnt',
'nurLeseberechtigung'
), ),
'person' => array( 'person' => array(
'student', 'student',
@@ -43,7 +44,8 @@ $this->load->view(
'empfehlungsanforderungWirklichZuruecknehmen', 'empfehlungsanforderungWirklichZuruecknehmen',
'erfolgreichZurueckgenommen', 'erfolgreichZurueckgenommen',
'empfehlungPositivConfirmed', 'empfehlungPositivConfirmed',
'empfehlungNegativConfirmed' 'empfehlungNegativConfirmed',
'anrechnungEctsTooltipTextBeiUeberschreitung'
) )
), ),
'customCSSs' => array( 'customCSSs' => array(
@@ -58,7 +60,6 @@ $this->load->view(
); );
?> ?>
<body>
<div id="page-wrapper"> <div id="page-wrapper">
<div class="container-fluid"> <div class="container-fluid">
<!-- header --> <!-- header -->
@@ -72,7 +73,7 @@ $this->load->view(
</div> </div>
<!--end header --> <!--end header -->
<div class="row"> <div class="row" id="approveAnrechnungDetail-generell" data-readonly="<?php echo json_encode($hasReadOnlyAccess)?>">
<div class="col-xs-8"> <div class="col-xs-8">
<!-- Antragsdaten --> <!-- Antragsdaten -->
<div class="row"> <div class="row">
@@ -123,11 +124,27 @@ $this->load->view(
<tr> <tr>
<th class="col-xs-4"><?php echo $this->p->t('lehre', 'ects'); ?></th> <th class="col-xs-4"><?php echo $this->p->t('lehre', 'ects'); ?></th>
<td><?php echo $antragData->ects ?></td> <td colspan="3"><span id="ects"><?php echo $antragData->ects ?></span></td>
</tr> </tr>
<tr>
<th class="col-xs-4">
<?php echo $this->p->t('anrechnung', 'bisherAngerechneteEcts'); ?>
<span class="approveAnrechnungDetail-anrechnungEctsTooltip"
data-toggle="tooltip" data-placement="right"
title="<?php echo $this->p->t('anrechnung', 'anrechnungEctsTooltipText'); ?>">
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>
</span>
</th>
<td colspan="3">
Total: <span id="sumEctsTotal"><?php echo number_format($antragData->sumEctsSchulisch + $antragData->sumEctsBeruflich, 1) ?></span>
[Schulisch: <span id="sumEctsSchulisch" value="<?php echo $antragData->sumEctsSchulisch ?>"><?php echo $antragData->sumEctsSchulisch ?></span> /
Beruflich: <span id="sumEctsBeruflich" value="<?php echo $antragData->sumEctsBeruflich ?>"><?php echo $antragData->sumEctsBeruflich ?></span> ]
<span id="sumEctsMsg"></span>
</td>
</tr>
<tr> <tr>
<th class="col-xs-4"><?php echo $this->p->t('lehre', 'lektorInnen'); ?></th> <th class="col-xs-4"><?php echo $this->p->t('lehre', 'lektorInnen'); ?></th>
<td> <td colspan="3">
<?php $len = count($antragData->lektoren) - 1 ?> <?php $len = count($antragData->lektoren) - 1 ?>
<?php foreach ($antragData->lektoren as $key => $lektor): ?> <?php foreach ($antragData->lektoren as $key => $lektor): ?>
<?php echo $lektor->vorname . ' ' . $lektor->nachname; <?php echo $lektor->vorname . ' ' . $lektor->nachname;
@@ -137,19 +154,23 @@ $this->load->view(
</tr> </tr>
<tr> <tr>
<th class="col-xs-4"><?php echo ucfirst($this->p->t('global', 'zgv')); ?></th> <th class="col-xs-4"><?php echo ucfirst($this->p->t('global', 'zgv')); ?></th>
<td><?php echo $antragData->zgv ?></td> <td colspan="3"><?php echo $antragData->zgv ?></td>
</tr> </tr>
<tr> <tr>
<th class="col-xs-4"><?php echo $this->p->t('anrechnung', 'herkunftDerKenntnisse'); ?></th> <th class="col-xs-4"><?php echo $this->p->t('anrechnung', 'herkunftDerKenntnisse'); ?></th>
<td><?php echo $anrechnungData->anmerkung ?></td> <td colspan="3"><?php echo $anrechnungData->anmerkung ?></td>
</tr> </tr>
<tr> <tr>
<th class="col-xs-4"><?php echo $this->p->t('anrechnung', 'nachweisdokumente'); ?></th> <th class="col-xs-4"><?php echo $this->p->t('anrechnung', 'nachweisdokumente'); ?></th>
<td> <td colspan="3">
<a href="<?php echo current_url() . '/download?dms_id=' . $anrechnungData->dms_id; ?>" <a href="<?php echo current_url() . '/download?dms_id=' . $anrechnungData->dms_id; ?>"
target="_blank"><?php echo htmlentities($anrechnungData->dokumentname) ?></a> target="_blank"><?php echo htmlentities($anrechnungData->dokumentname) ?></a>
</td> </td>
</tr> </tr>
<tr>
<th class="col-xs-4"><?php echo $this->p->t('global', 'begruendung'); ?></th>
<td colspan="3"><span id="begruendung_id" data-begruendung_id="<?php echo $anrechnungData->begruendung_id ?>" ><?php echo $anrechnungData->begruendung ?></span></td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -177,8 +198,10 @@ $this->load->view(
<div class="row"> <div class="row">
<div class="col-lg-6"> <div class="col-lg-6">
<form id="form-empfehlung"> <form id="form-empfehlung">
<input type="hidden" name="anrechnung_id" <input type="hidden" name="anrechnung_id" value="<?php echo $anrechnungData->anrechnung_id ?>">
value="<?php echo $anrechnungData->anrechnung_id ?>"> <input type="hidden" name="ects" value="<?php echo $antragData->ects ?>">
<input type="hidden" name="sumEctsSchulisch" value="<?php echo $antragData->sumEctsSchulisch ?>">
<input type="hidden" name="sumEctsBeruflich" value="<?php echo $antragData->sumEctsBeruflich ?>">
<table class="table table-bordered table-condensed table-fixed"> <table class="table table-bordered table-condensed table-fixed">
<tbody> <tbody>
<tr> <tr>
@@ -290,38 +313,44 @@ $this->load->view(
<div style="display: none" id="approveAnrechnungDetail-begruendung-panel"> <div style="display: none" id="approveAnrechnungDetail-begruendung-panel">
<div> <div>
<h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'genehmigungNegativQuestion'); ?></h4> <h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'genehmigungNegativQuestion'); ?></h4>
<b>&nbsp;<?php echo $this->p->t('anrechnung', 'bitteBegruendungAngeben'); ?></b><br><br> <ul class="list-group">
<ul> <li class="list-group-item">
<li>
<span><?php echo $this->p->t('anrechnung', 'genehmigungNegativPruefungNichtMoeglich'); ?></span> <span><?php echo $this->p->t('anrechnung', 'genehmigungNegativPruefungNichtMoeglich'); ?></span>
<span class="btn-copyIntoTextarea" data-toggle="tooltip" <span class="btn-copyIntoTextarea pull-right" data-toggle="tooltip"
data-placement="right" data-placement="right"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>"> title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard" aria-hidden="true"></i> <i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span> </span>
</li> </li>
<li> <li class="list-group-item">
<span><?php echo $this->p->t('anrechnung', 'genehmigungNegativKenntnisseNichtGleichwertig'); ?></span> <span><?php echo $this->p->t('anrechnung', 'genehmigungNegativKenntnisseNichtGleichwertig'); ?></span>
<span class="btn-copyIntoTextarea" data-toggle="tooltip" <span class="btn-copyIntoTextarea pull-right" data-toggle="tooltip"
data-placement="right" data-placement="right"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>"> title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard" aria-hidden="true"></i> <i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span> </span>
</li> </li>
<li> <li class="list-group-item">
<span><?php echo $this->p->t('anrechnung', 'genehmigungNegativEctsHoechstgrenzeUeberschritten'); ?></span>
<span class="btn-copyIntoTextarea pull-right" data-toggle="tooltip"
data-placement="right"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span>
</li>
<li class="list-group-item">
<span><?php echo $this->p->t('anrechnung', 'genehmigungNegativEmpfehlungstextUebernehmen'); ?></span> <span><?php echo $this->p->t('anrechnung', 'genehmigungNegativEmpfehlungstextUebernehmen'); ?></span>
<span id="empfehlungstextUebernehmen" class="btn-copyIntoTextarea" data-toggle="tooltip" <span id="empfehlungstextUebernehmen" class="btn-copyIntoTextarea pull-right" data-toggle="tooltip"
data-placement="right" data-placement="right"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>"> title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard" aria-hidden="true"></i> <i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span> </span>
</li> </li>
<li><?php echo $this->p->t('anrechnung', 'andereBegruendung'); ?></li>
</ul> </ul>
<br>
<textarea class="form-control" name="begruendung" <textarea class="form-control" name="begruendung"
id="approveAnrechnungDetail-begruendung" id="approveAnrechnungDetail-begruendung"
rows="2" required></textarea> rows="2"
placeholder="<?php echo $this->p->t('anrechnung', 'textUebernehmenOderEigenenBegruendungstext'); ?>" required></textarea>
</div> </div>
<br> <br>
<!-- Action Button 'Abbrechen'--> <!-- Action Button 'Abbrechen'-->
@@ -398,6 +427,5 @@ $this->load->view(
</div><!--end container-fluid--> </div><!--end container-fluid-->
</div><!--end page-wrapper--> </div><!--end page-wrapper-->
</body>
<?php $this->load->view('templates/FHC-Footer'); ?> <?php $this->load->view('templates/FHC-Footer'); ?>
@@ -3,11 +3,11 @@ $this->load->view(
'templates/FHC-Header', 'templates/FHC-Header',
array( array(
'title' => $this->p->t('anrechnung', 'anrechnungenGenehmigen'), 'title' => $this->p->t('anrechnung', 'anrechnungenGenehmigen'),
'jquery' => true, 'jquery3' => true,
'jqueryui' => true, 'jqueryui1' => true,
'bootstrap' => true, 'bootstrap3' => true,
'fontawesome' => true, 'fontawesome4' => true,
'tabulator' => true, 'tabulator4' => true,
'ajaxlib' => true, 'ajaxlib' => true,
'dialoglib' => true, 'dialoglib' => true,
'tablewidget' => true, 'tablewidget' => true,
@@ -48,7 +48,8 @@ $this->load->view(
'empfehlungWurdeAngefordert', 'empfehlungWurdeAngefordert',
'empfehlungWurdeAngefordertAusnahmeWoKeineLektoren', 'empfehlungWurdeAngefordertAusnahmeWoKeineLektoren',
'anrechnungenWurdenGenehmigt', 'anrechnungenWurdenGenehmigt',
'anrechnungenWurdenAbgelehnt' 'anrechnungenWurdenAbgelehnt',
'nurLeseberechtigung'
), ),
'person' => array( 'person' => array(
'student', 'student',
@@ -86,7 +87,6 @@ $this->load->view(
); );
?> ?>
<body>
<div id="page-wrapper"> <div id="page-wrapper">
<div class="container-fluid"> <div class="container-fluid">
<!-- title --> <!-- title -->
@@ -101,7 +101,7 @@ $this->load->view(
<!-- dropdown studiensemester --> <!-- dropdown studiensemester -->
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<form id="formApproveAnrechnungUebersicht" class="form-inline" action="" method="get"> <form id="formApproveAnrechnungUebersicht" class="form-inline" action="" method="get" data-readonly="<?php echo json_encode($hasReadOnlyAccess)?>" data-createaccess="<?php echo json_encode($hasCreateAnrechnungAccess)?>">
<div class="form-group"> <div class="form-group">
<?php <?php
echo $this->widgetlib->widget( echo $this->widgetlib->widget(
@@ -133,28 +133,34 @@ $this->load->view(
id="approveAnrechnungUebersicht-begruendung-panel"> id="approveAnrechnungUebersicht-begruendung-panel">
<div> <div>
<h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'genehmigungenNegativQuestion'); ?></h4> <h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'genehmigungenNegativQuestion'); ?></h4>
&nbsp;<b><?php echo $this->p->t('anrechnung', 'bitteBegruendungAngeben'); ?></b><br><br> &nbsp;<b><?php echo $this->p->t('anrechnung', 'bitteBegruendungAngeben'); ?>
<ol>
<li><?php echo $this->p->t('anrechnung', 'genehmigungNegativPruefungNichtMoeglich'); ?>
<span class="btn-copyIntoTextarea" data-toggle="tooltip" data-placement="left"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard" aria-hidden="true"></i>
</span>
</li>
<li><?php echo $this->p->t('anrechnung', 'genehmigungNegativKenntnisseNichtGleichwertig'); ?>
<span class="btn-copyIntoTextarea" data-toggle="tooltip" data-placement="left"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard" aria-hidden="true"></i>
</span>
</li>
<li><?php echo $this->p->t('anrechnung', 'andereBegruendung'); ?></li>
</ol>
<br>
<span class="text-danger"> <span class="text-danger">
<?php echo $this->p->t('anrechnung', 'begruendungWirdFuerAlleUebernommen'); ?> <?php echo $this->p->t('anrechnung', 'begruendungWirdFuerAlleUebernommen'); ?>
</span><br><br> </span></b>
<br><br>
<ol class="list-group">
<li class="list-group-item"><?php echo $this->p->t('anrechnung', 'genehmigungNegativPruefungNichtMoeglich'); ?>
<span class="btn-copyIntoTextarea pull-right" data-toggle="tooltip" data-placement="left"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span>
</li>
<li class="list-group-item"><?php echo $this->p->t('anrechnung', 'genehmigungNegativKenntnisseNichtGleichwertig'); ?>
<span class="btn-copyIntoTextarea pull-right" data-toggle="tooltip" data-placement="left"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span>
</li>
<li class="list-group-item"><?php echo $this->p->t('anrechnung', 'genehmigungNegativEctsHoechstgrenzeUeberschritten'); ?>
<span class="btn-copyIntoTextarea pull-right" data-toggle="tooltip" data-placement="left"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span>
</li>
</ol>
<textarea class="form-control" name="begruendung" id="approveAnrechnungUebersicht-begruendung" <textarea class="form-control" name="begruendung" id="approveAnrechnungUebersicht-begruendung"
rows="2" required></textarea> rows="2"
placeholder="<?php echo $this->p->t('anrechnung', 'textUebernehmenOderEigenenBegruendungstext'); ?>" required></textarea>
</div> </div>
<br> <br>
<!-- Action Button 'Abbrechen'--> <!-- Action Button 'Abbrechen'-->
@@ -226,7 +232,7 @@ $this->load->view(
class='fa fa-times'></i> class='fa fa-times'></i>
</button> </button>
</div> </div>
<a type="button" class="btn btn-default" style="margin-left: 20px;" href='<?php echo site_url('lehre/anrechnung/createAnrechnung') ?>' target='_blank'> <a type="button" id="approveAnrechnungUebersicht-create-anrechnung" class="btn btn-default" style="margin-left: 20px;" href='<?php echo site_url('lehre/anrechnung/createAnrechnung') ?>' target='_blank'>
<i class='fa fa-plus' aria-hidden='true'></i> <?php echo $this->p->t('global', 'antragAnlegen'); ?> <i class='fa fa-plus' aria-hidden='true'></i> <?php echo $this->p->t('global', 'antragAnlegen'); ?>
</a> </a>
</div> </div>
@@ -248,6 +254,5 @@ $this->load->view(
</div> </div>
</div> </div>
</div> </div>
</body>
<?php $this->load->view('templates/FHC-Footer'); ?> <?php $this->load->view('templates/FHC-Footer'); ?>
@@ -16,15 +16,20 @@ $query = '
anrechnung.dms_id, anrechnung.dms_id,
anrechnung.studiensemester_kurzbz, anrechnung.studiensemester_kurzbz,
stg.studiengang_kz, stg.studiengang_kz,
stg.bezeichnung AS "stg_bezeichnung", stg.bezeichnung AS stg_bezeichnung,
lv.orgform_kurzbz, lv.orgform_kurzbz,
(SELECT ausbildungssemester (SELECT ausbildungssemester
FROM public.tbl_prestudentstatus press FROM public.tbl_prestudentstatus press
WHERE press.prestudent_id = anrechnung.prestudent_id WHERE press.prestudent_id = anrechnung.prestudent_id
AND press.studiensemester_kurzbz = anrechnung.studiensemester_kurzbz AND press.studiensemester_kurzbz = anrechnung.studiensemester_kurzbz
AND press.status_kurzbz = \'Student\'), AND press.status_kurzbz = \'Student\'
lv.bezeichnung AS "lv_bezeichnung", ORDER BY press.datum DESC
lv.ects, LIMIT 1
),
lv.bezeichnung AS lv_bezeichnung,
lv.ects::numeric(4,1),
get_ects_summe_schulisch(student.student_uid, anrechnung.prestudent_id, stg.studiengang_kz) AS ectsSumSchulisch,
get_ects_summe_beruflich(student.student_uid) AS ectsSumBeruflich,
(person.nachname || \' \' || person.vorname) AS "student", (person.nachname || \' \' || person.vorname) AS "student",
begruendung.bezeichnung AS "begruendung", begruendung.bezeichnung AS "begruendung",
dmsversion.name AS "dokument_bezeichnung", dmsversion.name AS "dokument_bezeichnung",
@@ -46,7 +51,9 @@ $query = '
WHERE anrechnung_id = anrechnung.anrechnung_id WHERE anrechnung_id = anrechnung.anrechnung_id
ORDER BY insertamum DESC ORDER BY insertamum DESC
LIMIT 1 LIMIT 1
) AS status_kurzbz ) AS status_kurzbz,
student.student_uid,
anrechnung.prestudent_id
FROM lehre.tbl_anrechnung AS anrechnung FROM lehre.tbl_anrechnung AS anrechnung
JOIN public.tbl_prestudent USING (prestudent_id) JOIN public.tbl_prestudent USING (prestudent_id)
JOIN public.tbl_person AS person USING (person_id) JOIN public.tbl_person AS person USING (person_id)
@@ -55,44 +62,69 @@ $query = '
LEFT JOIN campus.tbl_dms_version AS dmsversion USING (dms_id) LEFT JOIN campus.tbl_dms_version AS dmsversion USING (dms_id)
JOIN lehre.tbl_anrechnung_anrechnungstatus USING (anrechnung_id) JOIN lehre.tbl_anrechnung_anrechnungstatus USING (anrechnung_id)
JOIN lehre.tbl_anrechnung_begruendung AS begruendung USING (begruendung_id) JOIN lehre.tbl_anrechnung_begruendung AS begruendung USING (begruendung_id)
JOIN public.tbl_student student USING (prestudent_id)
WHERE anrechnung.studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
AND stg.studiengang_kz IN (' . $STUDIENGAENGE_ENTITLED . ')
) )
SELECT anrechnungen.*, SELECT anrechnungen.anrechnung_id,
array_to_json(anrechnungstatus.bezeichnung_mehrsprachig::varchar[])->>' . $LANGUAGE_INDEX . ' AS "status_bezeichnung", anrechnungen.lehrveranstaltung_id,
CASE anrechnungen.begruendung_id,
WHEN (anrechnungen.empfehlung_anrechnung IS NULL AND anrechnungen.status_kurzbz = \'' . ANRECHNUNGSTATUS_PROGRESSED_BY_STGL . '\') THEN NULL anrechnungen.dms_id,
ELSE anrechnungen.studiensemester_kurzbz,
(SELECT insertamum::date anrechnungen.studiengang_kz,
FROM lehre.tbl_anrechnungstatus anrechnungen.stg_bezeichnung,
JOIN lehre.tbl_anrechnung_anrechnungstatus USING (status_kurzbz) anrechnungen.orgform_kurzbz,
WHERE anrechnung_id = anrechnungen.anrechnung_id anrechnungen.ausbildungssemester,
AND status_kurzbz = \'' . ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR . '\' anrechnungen.lv_bezeichnung,
ORDER BY insertamum DESC anrechnungen.ects::float4 AS ects,
LIMIT 1) NULL AS "ectsSumBisherUndNeu",
END "empfehlungsanfrageAm", anrechnungen.ectsSumSchulisch::float4 AS "ectsSumSchulisch",
CASE anrechnungen.ectsSumBeruflich::float4 AS "ectsSumBeruflich",
WHEN (anrechnungen.empfehlung_anrechnung IS NULL AND anrechnungen.status_kurzbz = \'' . ANRECHNUNGSTATUS_PROGRESSED_BY_STGL . '\') THEN NULL anrechnungen.begruendung,
ELSE anrechnungen.student,
(SELECT COALESCE( anrechnungen.dokument_bezeichnung,
STRING_AGG(CONCAT_WS(\' \', vorname, nachname), \', \') FILTER (WHERE lvleiter = TRUE), anrechnungen.anmerkung_student,
STRING_AGG(CONCAT_WS(\' \', vorname, nachname), \', \') FILTER (WHERE lvleiter = FALSE) anrechnungen.zgv,
) empfehlungsanfrageAn anrechnungen.antragsdatum,
FROM ( anrechnungen.empfehlung_anrechnung,
SELECT DISTINCT ON (benutzer.uid) uid, vorname, nachname, anrechnungen.status_kurzbz,
CASE WHEN lehrfunktion_kurzbz = \'LV-Leitung\' THEN TRUE ELSE FALSE END AS lvleiter array_to_json(anrechnungstatus.bezeichnung_mehrsprachig::varchar[])->>' . $LANGUAGE_INDEX . ' AS "status_bezeichnung",
FROM lehre.tbl_lehreinheit anrechnungen.prestudent_id,
JOIN lehre.tbl_lehreinheitmitarbeiter lema USING (lehreinheit_id) CASE
JOIN public.tbl_benutzer benutzer ON lema.mitarbeiter_uid = benutzer.uid WHEN (anrechnungen.empfehlung_anrechnung IS NULL AND anrechnungen.status_kurzbz = \'' . ANRECHNUNGSTATUS_PROGRESSED_BY_STGL . '\') THEN NULL
JOIN public.tbl_person USING (person_id) ELSE
WHERE studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\' (SELECT insertamum::date
AND lehrveranstaltung_id = anrechnungen.lehrveranstaltung_id FROM lehre.tbl_anrechnungstatus
AND lema.mitarbeiter_uid NOT like \'_Dummy%\' JOIN lehre.tbl_anrechnung_anrechnungstatus USING (status_kurzbz)
AND benutzer.aktiv = TRUE WHERE anrechnung_id = anrechnungen.anrechnung_id
AND tbl_person.aktiv = TRUE AND status_kurzbz = \'' . ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR . '\'
ORDER BY benutzer.uid, lvleiter DESC, nachname, vorname ORDER BY insertamum DESC
) as tmp_lvlektoren LIMIT 1)
) END "empfehlungsanfrageAm",
END "empfehlungsanfrageAn" CASE
WHEN (anrechnungen.empfehlung_anrechnung IS NULL AND anrechnungen.status_kurzbz = \'' . ANRECHNUNGSTATUS_PROGRESSED_BY_STGL . '\') THEN NULL
ELSE
(SELECT COALESCE(
STRING_AGG(CONCAT_WS(\' \', vorname, nachname), \', \') FILTER (WHERE lvleiter = TRUE),
STRING_AGG(CONCAT_WS(\' \', vorname, nachname), \', \') FILTER (WHERE lvleiter = FALSE)
) empfehlungsanfrageAn
FROM (
SELECT DISTINCT ON (benutzer.uid) uid, vorname, nachname,
CASE WHEN lehrfunktion_kurzbz = \'LV-Leitung\' THEN TRUE ELSE FALSE END AS lvleiter
FROM lehre.tbl_lehreinheit
JOIN lehre.tbl_lehreinheitmitarbeiter lema USING (lehreinheit_id)
JOIN public.tbl_benutzer benutzer ON lema.mitarbeiter_uid = benutzer.uid
JOIN public.tbl_person USING (person_id)
WHERE studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
AND lehrveranstaltung_id = anrechnungen.lehrveranstaltung_id
AND lema.mitarbeiter_uid NOT like \'_Dummy%\'
AND benutzer.aktiv = TRUE
AND tbl_person.aktiv = TRUE
ORDER BY benutzer.uid, lvleiter DESC, nachname, vorname
) as tmp_lvlektoren
)
END "empfehlungsanfrageAn"
FROM anrechnungen FROM anrechnungen
JOIN lehre.tbl_anrechnungstatus as anrechnungstatus ON (anrechnungstatus.status_kurzbz = anrechnungen.status_kurzbz) JOIN lehre.tbl_anrechnungstatus as anrechnungstatus ON (anrechnungstatus.status_kurzbz = anrechnungen.status_kurzbz)
WHERE studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\' WHERE studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
@@ -115,9 +147,12 @@ $filterWidgetArray = array(
ucfirst($this->p->t('lehre', 'organisationsform')), ucfirst($this->p->t('lehre', 'organisationsform')),
'Semester', 'Semester',
ucfirst($this->p->t('lehre', 'lehrveranstaltung')), ucfirst($this->p->t('lehre', 'lehrveranstaltung')),
'ECTS', 'ECTS (LV)',
ucfirst($this->p->t('person', 'studentIn')), 'ECTS (LV + Bisher)',
'ECTS (Bisher schulisch)',
'ECTS (Bisher beruflich',
ucfirst($this->p->t('global', 'begruendung')), ucfirst($this->p->t('global', 'begruendung')),
ucfirst($this->p->t('person', 'studentIn')),
ucfirst($this->p->t('anrechnung', 'nachweisdokumente')), ucfirst($this->p->t('anrechnung', 'nachweisdokumente')),
ucfirst($this->p->t('anrechnung', 'herkunft')), ucfirst($this->p->t('anrechnung', 'herkunft')),
ucfirst($this->p->t('global', 'zgv')), ucfirst($this->p->t('global', 'zgv')),
@@ -125,6 +160,7 @@ $filterWidgetArray = array(
ucfirst($this->p->t('anrechnung', 'empfehlung')), ucfirst($this->p->t('anrechnung', 'empfehlung')),
'status_kurzbz', 'status_kurzbz',
'Status', 'Status',
'PrestudentID',
ucfirst($this->p->t('anrechnung', 'empfehlungsanfrageAm')), ucfirst($this->p->t('anrechnung', 'empfehlungsanfrageAm')),
ucfirst($this->p->t('anrechnung', 'empfehlungsanfrageAn')) ucfirst($this->p->t('anrechnung', 'empfehlungsanfrageAn'))
), ),
@@ -152,8 +188,8 @@ $filterWidgetArray = array(
rowFormatter:function(row){ rowFormatter:function(row){
func_rowFormatter(row); func_rowFormatter(row);
}, },
rowUpdated:function(row){ rowSelectionChanged:function(data, rows){
func_rowUpdated(row); func_rowSelectionChanged(data, rows);
}, },
tooltips: function(cell){ tooltips: function(cell){
return func_tooltips(cell); return func_tooltips(cell);
@@ -171,8 +207,11 @@ $filterWidgetArray = array(
ausbildungssemester: {headerFilter:"input"}, ausbildungssemester: {headerFilter:"input"},
lv_bezeichnung: {headerFilter:"input"}, lv_bezeichnung: {headerFilter:"input"},
ects: {headerFilter:"input", align:"center"}, ects: {headerFilter:"input", align:"center"},
ectsSumBisherUndNeu: {formatter: format_ectsSumBisherUndNeu},
ectsSumSchulisch: {visible: false, headerFilter:"input", align:"right"},
ectsSumBeruflich: {visible: false, headerFilter:"input", align:"right"},
begruendung: {headerFilter:"input", visible: true},
student: {headerFilter:"input"}, student: {headerFilter:"input"},
begruendung: {headerFilter:"input"},
zgv: {visible: false, headerFilter:"input"}, zgv: {visible: false, headerFilter:"input"},
dokument_bezeichnung: {headerFilter:"input", formatter:"link", formatterParams:{ dokument_bezeichnung: {headerFilter:"input", formatter:"link", formatterParams:{
labelField:"dokument_bezeichnung", labelField:"dokument_bezeichnung",
@@ -184,6 +223,7 @@ $filterWidgetArray = array(
empfehlung_anrechnung: {headerFilter:"input", align:"center", formatter: format_empfehlung_anrechnung, headerFilterFunc: hf_filterTrueFalse}, empfehlung_anrechnung: {headerFilter:"input", align:"center", formatter: format_empfehlung_anrechnung, headerFilterFunc: hf_filterTrueFalse},
status_kurzbz: {visible: false, headerFilter:"input"}, status_kurzbz: {visible: false, headerFilter:"input"},
status_bezeichnung: {headerFilter:"input"}, status_bezeichnung: {headerFilter:"input"},
prestudent_id: {visible: false, headerFilter:"input"},
empfehlungsanfrageAm: {visible: false, align:"center", headerFilter:"input", mutator: mut_formatStringDate}, empfehlungsanfrageAm: {visible: false, align:"center", headerFilter:"input", mutator: mut_formatStringDate},
empfehlungsanfrageAn: {visible: false, headerFilter:"input"} empfehlungsanfrageAn: {visible: false, headerFilter:"input"}
}', // col properties }', // col properties
@@ -191,4 +231,4 @@ $filterWidgetArray = array(
echo $this->widgetlib->widget('TableWidget', $filterWidgetArray); echo $this->widgetlib->widget('TableWidget', $filterWidgetArray);
?> ?>
@@ -3,13 +3,13 @@ $this->load->view(
'templates/FHC-Header', 'templates/FHC-Header',
array( array(
'title' => $this->p->t('anrechnung', 'neueAnrechnung'), 'title' => $this->p->t('anrechnung', 'neueAnrechnung'),
'jquery' => true, 'jquery3' => true,
'jqueryui' => true, 'jqueryui1' => true,
'bootstrap' => true, 'bootstrap3' => true,
'fontawesome' => true, 'fontawesome4' => true,
'ajaxlib' => true, 'ajaxlib' => true,
'dialoglib' => true, 'dialoglib' => true,
'tabulator' => true, 'tabulator4' => true,
'tablewidget' => true, 'tablewidget' => true,
'phrases' => array( 'phrases' => array(
'global' => array( 'global' => array(
@@ -38,7 +38,6 @@ $this->load->view(
); );
?> ?>
<body>
<div id="page-wrapper"> <div id="page-wrapper">
<div class="container-fluid"> <div class="container-fluid">
@@ -102,7 +101,7 @@ $this->load->view(
<th class="col-xs-5 col-lg-2"><?php echo $this->p->t('lehre', 'lehrveranstaltung'); ?> *</th> <th class="col-xs-5 col-lg-2"><?php echo $this->p->t('lehre', 'lehrveranstaltung'); ?> *</th>
<td> <td>
<select name="lehrveranstaltung_id" id="select-lehrveranstaltung" class="form-control select-w500"> <select name="lehrveranstaltung_id" id="select-lehrveranstaltung" class="form-control select-w500">
<option value="" <?php echo set_select('lehrveranstaltung', '', TRUE); ?> > <option value="" <?php echo set_select('lehrveranstaltung', '', true); ?> >
<?php echo $this->p->t('ui', 'bitteWaehlen'); ?> <?php echo $this->p->t('ui', 'bitteWaehlen'); ?>
</option> </option>
</select> </select>
@@ -113,7 +112,7 @@ $this->load->view(
<th class="col-xs-5 col-lg-2"><?php echo $this->p->t('global', 'begruendung'); ?> *</th> <th class="col-xs-5 col-lg-2"><?php echo $this->p->t('global', 'begruendung'); ?> *</th>
<td> <td>
<select name="begruendung_id" id="select-begruendung" class="form-control select-w500"> <select name="begruendung_id" id="select-begruendung" class="form-control select-w500">
<option value="" <?php echo set_select('begruendung', '', TRUE); ?> > <option value="" <?php echo set_select('begruendung', '', true); ?> >
<?php echo $this->p->t('ui', 'bitteWaehlen'); ?> <?php echo $this->p->t('ui', 'bitteWaehlen'); ?>
</option> </option>
<?php foreach ($begruendungen as $begruendung) : ?> <?php foreach ($begruendungen as $begruendung) : ?>
@@ -170,4 +169,5 @@ $this->load->view(
</div> </div>
</div> </div>
</body>
<?php $this->load->view('templates/FHC-Footer'); ?>
@@ -5,10 +5,10 @@ $this->load->view(
'templates/FHC-Header', 'templates/FHC-Header',
array( array(
'title' => $this->p->t('anrechnung', 'antragStellen'), 'title' => $this->p->t('anrechnung', 'antragStellen'),
'jquery' => true, 'jquery3' => true,
'jqueryui' => true, 'jqueryui1' => true,
'bootstrap' => true, 'bootstrap3' => true,
'fontawesome' => true, 'fontawesome4' => true,
'ajaxlib' => true, 'ajaxlib' => true,
'dialoglib' => true, 'dialoglib' => true,
'phrases' => array( 'phrases' => array(
@@ -26,11 +26,14 @@ $this->load->view(
'neu', 'neu',
'maxZeichen', 'maxZeichen',
'errorBestaetigungFehlt', 'errorBestaetigungFehlt',
'systemfehler' 'systemfehler',
'errorDokumentZuGross'
), ),
'anrechnung' => array( 'anrechnung' => array(
'deadlineUeberschritten', 'deadlineUeberschritten',
'benotungDerLV' 'benotungDerLV',
'anrechnungEctsTextBeiUeberschreitung',
'anrechnungEctsTooltipTextBeiUeberschreitung'
), ),
'person' => array( 'person' => array(
'student', 'student',
@@ -59,7 +62,6 @@ $this->load->view(
} }
</style> </style>
<body>
<div id="page-wrapper"> <div id="page-wrapper">
<div class="container-fluid"> <div class="container-fluid">
<!-- header --> <!-- header -->
@@ -79,9 +81,13 @@ $this->load->view(
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<form id="requestAnrechnung-form"> <form id="requestAnrechnung-form">
<input type="hidden" name="anrechnung_id" id="anrechnung_id" value="<?php echo $anrechnungData->anrechnung_id ?>">
<input type="hidden" name="lv_id" value="<?php echo $antragData->lv_id ?>"> <input type="hidden" name="lv_id" value="<?php echo $antragData->lv_id ?>">
<input type="hidden" name="studiensemester" value="<?php echo $antragData->studiensemester_kurzbz ?>"> <input type="hidden" name="studiensemester" value="<?php echo $antragData->studiensemester_kurzbz ?>">
<!-- Antragsdaten --> <input type="hidden" name="ects" value="<?php echo $antragData->ects ?>">
<input type="hidden" name="sumEctsSchulisch" value="<?php echo $antragData->sumEctsSchulisch ?>">
<input type="hidden" name="sumEctsBeruflich" value="<?php echo $antragData->sumEctsBeruflich ?>">
<!-- Antragsdaten -->
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="panel panel-default"> <div class="panel panel-default">
@@ -118,8 +124,23 @@ $this->load->view(
</tr> </tr>
<tr> <tr>
<th><?php echo $this->p->t('lehre', 'ects'); ?></th> <th><?php echo $this->p->t('lehre', 'ects'); ?></th>
<td><?php echo $antragData->ects ?></td> <td><span id="ects"><?php echo number_format($antragData->ects, 1) ?> ECTS</span></td>
</tr> </tr>
<tr>
<th>
<?php echo $this->p->t('anrechnung', 'bisherAngerechneteEcts'); ?>
<span data-toggle="tooltip" data-placement="right"
title="<?php echo $this->p->t('anrechnung', 'anrechnungEctsTooltipText'); ?>">
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>
</span>
</th>
<td colspan="3">
Total ECTS: <span id="sumEctsTotal"><?php echo number_format($antragData->sumEctsSchulisch + $antragData->sumEctsBeruflich, 1) ?></span>
[ Schulisch: <span id="sumEctsSchulisch"><?php echo $antragData->sumEctsSchulisch ?></span> |
Beruflich: <span id="sumEctsBeruflich"><?php echo $antragData->sumEctsBeruflich ?></span> ]
<span id="requestAnrechnung-maxEctsUeberschrittenMsg"></span>
</td>
</tr>
<tr> <tr>
<th><?php echo ucfirst($this->p->t('lehre', 'lektorInnen')); ?></th> <th><?php echo ucfirst($this->p->t('lehre', 'lektorInnen')); ?></th>
<td> <td>
@@ -151,6 +172,17 @@ $this->load->view(
</span> </span>
</label> </label>
</div> </div>
<div class="checkbox">
<label>
<input type="radio" name="begruendung" value="5" required
<?php echo $anrechnungData->begruendung_id == '5' ? 'checked' : ''; ?> />
<?php echo $this->p->t('anrechnung', 'antragStellenWegenHochschulzeugnis'); ?>&emsp;
<span id="requestAnrechnung-anrechnungGrundHochschulzeugnisTooltip" data-toggle="tooltip" data-placement="right"
title="<?php echo $this->p->t('anrechnung', 'anrechnungGrundZeugnisTooltipText'); ?>" />
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>
</span>
</label>
</div>
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="radio" name="begruendung" value="4" required <input type="radio" name="begruendung" value="4" required
@@ -179,7 +211,7 @@ $this->load->view(
<div class="form-inline panel-body"> <div class="form-inline panel-body">
<div class="form-group"> <div class="form-group">
<input type="file" id="requestAnrechnung-uploadfile" <input type="file" id="requestAnrechnung-uploadfile"
name="uploadfile" accept=".pdf" size="50" name="uploadfile" accept=".pdf" size="50" data-maxsize="<?php echo (int)ini_get('upload_max_filesize') * 1024 * 1024 ?>"
required> required>
</div> </div>
<span id="requestAnrechnung-uploadTooltip" data-toggle="tooltip" data-placement="right" <span id="requestAnrechnung-uploadTooltip" data-toggle="tooltip" data-placement="right"
@@ -260,6 +292,5 @@ $this->load->view(
</div> </div>
</div> </div>
</div> </div>
</body>
<?php $this->load->view('templates/FHC-Footer'); ?> <?php $this->load->view('templates/FHC-Footer'); ?>
@@ -3,10 +3,10 @@ $this->load->view(
'templates/FHC-Header', 'templates/FHC-Header',
array( array(
'title' => $this->p->t('anrechnung', 'anrechnungenPruefen'), 'title' => $this->p->t('anrechnung', 'anrechnungenPruefen'),
'jquery' => true, 'jquery3' => true,
'jqueryui' => true, 'jqueryui1' => true,
'bootstrap' => true, 'bootstrap3' => true,
'fontawesome' => true, 'fontawesome4' => true,
'ajaxlib' => true, 'ajaxlib' => true,
'dialoglib' => true, 'dialoglib' => true,
'phrases' => array( 'phrases' => array(
@@ -52,7 +52,6 @@ $this->load->view(
); );
?> ?>
<body>
<div id="page-wrapper"> <div id="page-wrapper">
<div class="container-fluid"> <div class="container-fluid">
<!-- title --> <!-- title -->
@@ -225,31 +224,29 @@ $this->load->view(
<div class="panel panel-default panel-body" style="display: none" id="reviewAnrechnungDetail-begruendung-panel"> <div class="panel panel-default panel-body" style="display: none" id="reviewAnrechnungDetail-begruendung-panel">
<div> <div>
<h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'empfehlungNegativQuestion'); ?></h4> <h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'empfehlungNegativQuestion'); ?></h4>
&ensp; <ul class="list-group">
<b>&ensp;<?php echo $this->p->t('anrechnung', 'bitteBegruendungAngeben'); ?></b><br><br> <li class="list-group-item">
<ul>
<li>
<span><?php echo $this->p->t('anrechnung', 'empfehlungNegativPruefungNichtMoeglich'); ?></span>&emsp; <span><?php echo $this->p->t('anrechnung', 'empfehlungNegativPruefungNichtMoeglich'); ?></span>&emsp;
<span class="btn-copyIntoTextarea" data-toggle="tooltip" <span class="btn-copyIntoTextarea pull-right" data-toggle="tooltip"
data-placement="right" data-placement="right"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>"> title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard" aria-hidden="true"></i> <i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span> </span>
</li> </li>
<li> <li class="list-group-item">
<span><?php echo $this->p->t('anrechnung', 'empfehlungNegativKenntnisseNichtGleichwertig'); ?></span>&emsp; <span><?php echo $this->p->t('anrechnung', 'empfehlungNegativKenntnisseNichtGleichwertig'); ?></span>&emsp;
<span class="btn-copyIntoTextarea" data-toggle="tooltip" <span class="btn-copyIntoTextarea pull-right" data-toggle="tooltip"
data-placement="right" data-placement="right"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>"> title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard" aria-hidden="true"></i> <i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span> </span>
</li> </li>
<li><?php echo $this->p->t('anrechnung', 'andereBegruendung'); ?></li>
</ul> </ul>
<br>
<textarea class="form-control" name="begruendung" <textarea class="form-control" name="begruendung"
id="reviewAnrechnungDetail-begruendung" id="reviewAnrechnungDetail-begruendung"
rows="2" required></textarea> rows="2"
placeholder="<?php echo $this->p->t('anrechnung', 'textUebernehmenOderEigenenBegruendungstext'); ?>"
required></textarea>
</div> </div>
<br> <br>
<!-- Button Abbrechen & Bestaetigen--> <!-- Button Abbrechen & Bestaetigen-->
@@ -318,6 +315,5 @@ $this->load->view(
</div> </div>
</div> </div>
</body>
<?php $this->load->view('templates/FHC-Footer'); ?> <?php $this->load->view('templates/FHC-Footer'); ?>
@@ -3,11 +3,11 @@ $this->load->view(
'templates/FHC-Header', 'templates/FHC-Header',
array( array(
'title' => $this->p->t('anrechnung', 'anrechnungenPruefen'), 'title' => $this->p->t('anrechnung', 'anrechnungenPruefen'),
'jquery' => true, 'jquery3' => true,
'jqueryui' => true, 'jqueryui1' => true,
'bootstrap' => true, 'bootstrap3' => true,
'fontawesome' => true, 'fontawesome4' => true,
'tabulator' => true, 'tabulator4' => true,
'ajaxlib' => true, 'ajaxlib' => true,
'dialoglib' => true, 'dialoglib' => true,
'tablewidget' => true, 'tablewidget' => true,
@@ -80,7 +80,6 @@ $this->load->view(
); );
?> ?>
<body>
<div id="page-wrapper"> <div id="page-wrapper">
<div class="container-fluid"> <div class="container-fluid">
<!-- title --> <!-- title -->
@@ -127,30 +126,31 @@ $this->load->view(
id="reviewAnrechnungUebersicht-begruendung-panel"> id="reviewAnrechnungUebersicht-begruendung-panel">
<div> <div>
<h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'empfehlungenNegativQuestion'); ?></h4> <h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'empfehlungenNegativQuestion'); ?></h4>
<b>&ensp;<?php echo $this->p->t('anrechnung', 'bitteBegruendungAngeben'); ?></b><br><br> <b><span>&ensp;<?php echo $this->p->t('anrechnung', 'bitteBegruendungAngeben'); ?></span>
<ul> <span class="text-danger">
<li>
<span><?php echo $this->p->t('anrechnung', 'empfehlungNegativPruefungNichtMoeglich'); ?></span>
<span class="btn-copyIntoTextarea" data-toggle="tooltip" data-placement="right"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard" aria-hidden="true"></i>
</span>
</li>
<li>
<span><?php echo $this->p->t('anrechnung', 'empfehlungNegativKenntnisseNichtGleichwertig'); ?></span>
<span class="btn-copyIntoTextarea" data-toggle="tooltip" data-placement="right"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard" aria-hidden="true"></i>
</span>
</li>
<li><?php echo $this->p->t('anrechnung', 'andereBegruendung'); ?></li>
</ul>
<br>
<span class="text-danger">
<?php echo $this->p->t('anrechnung', 'begruendungWirdFuerAlleUebernommen'); ?> <?php echo $this->p->t('anrechnung', 'begruendungWirdFuerAlleUebernommen'); ?>
</span><br><br> </span></b>
<br><br>
<ul class="list-group">
<li class="list-group-item">
<span><?php echo $this->p->t('anrechnung', 'empfehlungNegativPruefungNichtMoeglich'); ?></span>
<span class="btn-copyIntoTextarea pull-right" data-toggle="tooltip" data-placement="right"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span>
</li>
<li class="list-group-item">
<span><?php echo $this->p->t('anrechnung', 'empfehlungNegativKenntnisseNichtGleichwertig'); ?></span>
<span class="btn-copyIntoTextarea pull-right" data-toggle="tooltip" data-placement="right"
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
<i class="fa fa-clipboard fa-lg" aria-hidden="true"></i>
</span>
</li>
</ul>
<textarea class="form-control" name="begruendung" id="reviewAnrechnungUebersicht-begruendung" <textarea class="form-control" name="begruendung" id="reviewAnrechnungUebersicht-begruendung"
rows="2" required></textarea> rows="2"
placeholder="<?php echo $this->p->t('anrechnung', 'textUebernehmenOderEigenenBegruendungstext'); ?>"
required></textarea>
</div> </div>
<br> <br>
<!-- Action Button Abbrechen & Bestaetigen--> <!-- Action Button Abbrechen & Bestaetigen-->
@@ -235,7 +235,6 @@ $this->load->view(
</div> </div>
</div> </div>
</div> </div>
</body>
<?php $this->load->view('templates/FHC-Footer'); ?> <?php $this->load->view('templates/FHC-Footer'); ?>
@@ -3,11 +3,11 @@ $this->load->view(
'templates/FHC-Header', 'templates/FHC-Header',
array( array(
'title' => 'Lehrauftrag bestellen', 'title' => 'Lehrauftrag bestellen',
'jquery' => true, 'jquery3' => true,
'jqueryui' => true, 'jqueryui1' => true,
'bootstrap' => true, 'bootstrap3' => true,
'fontawesome' => true, 'fontawesome4' => true,
'sbadmintemplate' => true, 'sbadmintemplate3' => true,
'ajaxlib' => true, 'ajaxlib' => true,
'dialoglib' => true, 'dialoglib' => true,
'navigationwidget' => true, 'navigationwidget' => true,

Some files were not shown because too many files have changed in this diff Show More