Compare commits

..

7 Commits

Author SHA1 Message Date
Paolo b5b43eaa78 Merge branch 'master' into dbskel 2020-11-13 20:55:57 +01:00
Paolo fc5403d257 Merge branch 'master' into dbskel 2020-04-22 21:22:59 +02:00
Paolo 0d2e99860e Expanded DB structure 2020-04-22 21:21:55 +02:00
Paolo 2f34e13519 Added config file for DBSkel 2020-04-15 17:24:20 +02:00
Paolo d1e1957f28 Added previously deleted DBSkel files and dirs 2020-04-15 17:21:01 +02:00
Paolo 70a8e5deae Merge branch 'master' into dbskel 2020-04-15 17:11:24 +02:00
Paolo 4d35dc5ad7 Merge branch 'master' into dbskel 2020-04-15 17:00:15 +02:00
2304 changed files with 177600 additions and 210065 deletions
-1
View File
@@ -24,7 +24,6 @@ application/logs/
application/models/extensions/
application/views/extensions/
application/widgets/extensions/
application/components/extensions/
public/extensions/
+1 -1
View File
@@ -56,7 +56,7 @@
]
},
"devDependencies": {
"grunt": "^1.3.0",
"grunt": "^0.4.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "^0.7.0",
"grunt-contrib-concat": "^0.5.1",
+1 -1
View File
@@ -1,5 +1,5 @@
# FH-Complete
* [FH-Complete Homepage](https://www.fhcomplete.org)
* [Wiki](https://wiki.fhcomplete.info/)
* [Wiki](https://wiki.fhcomplete.org/)
* [Changelog](CHANGELOG.md)
@@ -1,19 +0,0 @@
<?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'
);
-14
View File
@@ -1,14 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
use CI3_Events as Events;
/**
* NOTE(chris): example:
Events::on('stv_conf_student', function (&$res) {
$res['test'] = [
'title' => 'TEST',
'component' => './Stv/Studentenverwaltung/Details/Notizen.js'
];
});
*/
-26
View File
@@ -1,26 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
// Deadline for Application given as Time-Interval after Semesterstart.
$config['interval_blocking_application'] = 'P1M';
// Lehrveranstaltungen with these grades will be blocked for application
$config['grades_blocking_application'] = array(
5, // nicht genügend
6, // angerechnet
9, // noch nicht eingetragen
13, // nicht erfolgreich absolviert
14, // nicht bestanden,
15, // nicht teilgenommen
18 // unentschuldigt
);
//Enables Fachbereichsleiter instead of LV Leiter
$config['fbl'] = FALSE;
//Enables Info Mails
$config['send_mail'] = TRUE;
// Display fields to explain equivalence of ECTS and LV-Inhalte
$config['explain_equivalence'] = TRUE;
+8
View File
@@ -57,6 +57,14 @@ define('AUTH_SUCCESS', 0);
define('AUTH_NOT_AUTHENTICATED', 1);
define('AUTH_INVALID_CREDENTIALS', 2);
/*
|--------------------------------------------------------------------------
| LDAP constants
|--------------------------------------------------------------------------
*/
define('LDAP_NO_USER_DN', 10);
define('LDAP_TOO_MANY_USER_DN', 11);
/*
|--------------------------------------------------------------------------
| Language constants
-29
View File
@@ -1,29 +0,0 @@
<?php
/**
* Copyright (C) 2023 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');
// NOTE: if database encryption is _not_ used then leave this array empty!
$config['encryption_passwords'] = array(
// 'password name 1' => 'password 1'
// 'password name 2' => 'password 2'
// 'password name ...' => 'password ...'
// 'password name N' => 'password N'
);
+28
View File
@@ -0,0 +1,28 @@
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable DBSkel procedure
|--------------------------------------------------------------------------
|
| DBSkel is disabled by default for security reasons.
| You should enable DBSkel whenever you intend to use DBSkel
|
*/
$config['dbskel_enabled'] = false;
/*
|--------------------------------------------------------------------------
| DBSkel mode
|--------------------------------------------------------------------------
|
| This is used to set the dbskel mode:
| - dryrun: run without changing the database, useful for testing
| - new: build a new database or if database is already present creates only new objects
| - diff: like new, but it also remove object from database that are NOT present in configuration files
|
*/
$config['dbskel_mode'] = 'dryrun';
-5
View File
@@ -1,5 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
$config['infocenter_studiengang_kz'] = '10021, 10027, 10002';
+4 -9
View File
@@ -17,8 +17,7 @@ if (defined('LDAP_SERVER')) // 1st LDAP server
'basedn' => LDAP_BASE_DN,
'username' => LDAP_BIND_USER,
'password' => LDAP_BIND_PASSWORD,
'usf' => LDAP_USER_SEARCH_FILTER,
'timeout' => 1
'usf' => LDAP_USER_SEARCH_FILTER
);
}
@@ -31,8 +30,7 @@ if (defined('LDAP2_SERVER')) // 2nd LDAP server
'basedn' => LDAP2_BASE_DN,
'username' => LDAP2_BIND_USER,
'password' => LDAP2_BIND_PASSWORD,
'usf' => LDAP2_USER_SEARCH_FILTER,
'timeout' => 1
'usf' => LDAP2_USER_SEARCH_FILTER
);
}
@@ -47,8 +45,7 @@ if (defined('LDAP_SERVER')) // 1st LDAP server
'basedn' => LDAP_BASE_DN,
'username' => LDAP_BIND_USER,
'password' => LDAP_BIND_PASSWORD,
'usf' => LDAP_USER_SEARCH_FILTER,
'timeout' => 1
'usf' => LDAP_USER_SEARCH_FILTER
);
}
@@ -61,8 +58,6 @@ if (defined('LDAP2_SERVER')) // 2nd LDAP server
'basedn' => LDAP2_BASE_DN,
'username' => LDAP2_BIND_USER,
'password' => LDAP2_BIND_PASSWORD,
'usf' => LDAP2_USER_SEARCH_FILTER,
'timeout' => 1
'usf' => LDAP2_USER_SEARCH_FILTER
);
}
-36
View File
@@ -1,36 +0,0 @@
<?php
/**
* Copyright (C) 2023 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');
$config['migratecontract_oe_default'] = 'TODO_OE_DEFAULT';
$config['migratecontract_matching_ba1_vertragsart'] = array(
'101'=>'dvbund',
'102'=>'dvanderengk',
'103'=>'echterdv',
'104'=>'studentischehilfskr',
'105'=>'externerlehrender',
'106'=>'dvanderenbet',
'107'=>'werkvertrag',
'108'=>'studentischehilfskr',
'109'=>'ueberlassungsvertrag',
'110'=>'echterfreier',
'111'=>'echterdv' //All-In
);
+7 -102
View File
@@ -15,7 +15,7 @@ $config['navigation_header'] = array(
'description' => 'Organisation',
'sort' => 20,
'requiredPermissions' => 'basis/vilesci:r',
'children' => array(
'children'=> array(
'vilesci' => array(
'link' => base_url('vilesci'),
'icon' => '',
@@ -23,22 +23,6 @@ $config['navigation_header'] = array(
'expand' => true,
'sort' => 10,
'requiredPermissions' => 'basis/vilesci:r'
),
'oehbeitragsverwaltung' => array(
'link' => site_url('codex/Oehbeitrag'),
'icon' => '',
'description' => 'ÖH-Beitragsverwaltung',
'expand' => true,
'sort' => 20,
'requiredPermissions' => 'admin:w'
),
'bismeldestichtagsverwaltung' => array(
'link' => site_url('codex/Bismeldestichtag'),
'icon' => '',
'description' => 'BIS-Meldestichtagsverwaltung',
'expand' => true,
'sort' => 30,
'requiredPermissions' => 'admin:w'
)
)
),
@@ -48,7 +32,7 @@ $config['navigation_header'] = array(
'description' => 'Lehre',
'sort' => 30,
'requiredPermissions' => 'basis/vilesci:r',
'children' => array(
'children'=> array(
'cis' => array(
'link' => CIS_ROOT,
'icon' => '',
@@ -78,25 +62,6 @@ $config['navigation_header'] = array(
'lehre/lehrauftrag_bestellen: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(
'link' => site_url('system/infocenter/ZGVUeberpruefung'),
'description' => 'ZGV Überprüfung',
'expand' => true,
'sort' => 50,
'requiredPermissions' => array(
'lehre/zgvpruefung:r'
)
)
)
),
@@ -106,7 +71,7 @@ $config['navigation_header'] = array(
'description' => 'Personen',
'sort' => 40,
'requiredPermissions' => 'basis/vilesci:r',
'children' => array(
'children'=> array(
'messages' => array(
'link' => site_url('system/messages/MessageClient/read'),
'icon' => '',
@@ -120,27 +85,6 @@ $config['navigation_header'] = array(
'description' => 'BPK Wartung',
'sort' => 20,
'requiredPermissions' => 'admin:r'
),
'errormonitoring' => array(
'link' => site_url('system/issues/Issues'),
'description' => 'Fehler Monitoring',
'expand' => true,
'sort' => 30,
'requiredPermissions' => 'system/issues_verwalten:r'
),
'plausichecks' => array(
'link' => site_url('system/issues/Plausichecks'),
'description' => 'Plausichecks',
'expand' => true,
'sort' => 40,
'requiredPermissions' => 'system/issues_verwalten:r'
),
'gruppenmanagement' => array(
'link' => site_url('person/Gruppenmanagement'),
'description' => 'Gruppenmanagement',
'expand' => true,
'sort' => 50,
'requiredPermissions' => 'lehre/gruppenmanager:r'
)
)
),
@@ -151,7 +95,7 @@ $config['navigation_header'] = array(
'expand' => false,
'sort' => 50,
'requiredPermissions' => 'admin:r',
'children' => array(
'children'=> array(
'extensions' => array(
'link' => site_url('system/extensions/Manager'),
'description' => 'Extensions Manager',
@@ -172,14 +116,7 @@ $config['navigation_header'] = array(
'expand' => true,
'sort' => 20,
'requiredPermissions' => 'system/developer:r'
),
'anrechnungen' => array(
'link' => site_url('lehre/anrechnung/AdminAnrechnung'),
'description' => 'Anrechnungen',
'expand' => true,
'sort' => 30,
'requiredPermissions' => 'lehre/anrechnungszeitfenster:rw'
)
)
)
)
)
@@ -199,15 +136,6 @@ $config['navigation_menu']['Vilesci/index'] = array(
)
);
$config['navigation_menu']['Vilesci/index'] = array(
'dashboard' => array(
'link' => '#',
'description' => 'Dashboard',
'icon' => 'dashboard',
'sort' => 1
)
);
$config['navigation_menu']['organisation/Reihungstest/index'] = array(
'reihungstestverwalung' => array(
'link' => base_url('vilesci/stammdaten/reihungstestverwaltung.php'),
@@ -232,8 +160,7 @@ $config['navigation_menu']['lehre/lehrauftrag/Lehrauftrag/*'] = array(
'icon' => 'dashboard',
'sort' => 1,
'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r','lehre/lehrauftrag_erteilen:r')
),
'lehrauftragBestellen' => array(
),'lehrauftragBestellen' => array(
'link' => site_url('lehre/lehrauftrag/Lehrauftrag'),
'description' => 'Lehrauftrag bestellen',
'icon' => '',
@@ -255,7 +182,6 @@ $config['navigation_menu']['lehre/lehrauftrag/Lehrauftrag/*'] = array(
'requiredPermissions' => array('lehre/lehrauftrag_erteilen:r')
)
);
$config['navigation_menu']['lehre/lehrauftrag/LehrauftragErteilen/*'] = array(
'lehrauftragDashboard' => array(
'link' => site_url('lehre/lehrauftrag/Lehrauftrag/Dashboard'),
@@ -263,8 +189,7 @@ $config['navigation_menu']['lehre/lehrauftrag/LehrauftragErteilen/*'] = array(
'icon' => 'dashboard',
'sort' => 1,
'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r','lehre/lehrauftrag_erteilen:r')
),
'lehrauftragBestellen' => array(
),'lehrauftragBestellen' => array(
'link' => site_url('lehre/lehrauftrag/Lehrauftrag'),
'description' => 'Lehrauftrag bestellen',
'icon' => '',
@@ -286,23 +211,3 @@ $config['navigation_menu']['lehre/lehrauftrag/LehrauftragErteilen/*'] = array(
'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' => 'users',
'sort' => 100,
'target' => '_blank',
'requiredPermissions' => array('admin:rw')
),
'fehlerkonfiguration' => array(
'link' => site_url('system/issues/IssuesKonfiguration'),
'description' => 'Fehler Konfiguration',
'icon' => 'cogs',
'sort' => 200,
'target' => '_blank',
'requiredPermissions' => array('admin:rw')
),
);
-23
View File
@@ -60,26 +60,3 @@ $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/ressource/[B|b]etriebsmittelperson/(:any)'] = 'api/v1/ressource/betriebsmittelperson2/$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);
}
}
}
}
-170
View File
@@ -1,170 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
$config['frist_rueckzahlung_studiengebuer_WS'] = '15.10.';
$config['frist_rueckzahlung_studiengebuer_SS'] = '15.03.';
// TODO(chris): review this!
#$config['unterbrechung_dms'] = ['oe_kurzbz' => null, 'dokument_kurzbz' => null, 'kategorie_kurzbz' => null];
$config['unterbrechung_dms'] = ['oe_kurzbz' => null, 'dokument_kurzbz' => null, 'kategorie_kurzbz' => 'Akte'];
/**
* UPLOAD
*/
/**
* Allowed filetypes for attachment upload in unterbrechung antrag
*
* @var array An array of fileextensions
*/
$config['unterbrechung_dms_filetypes'] = ['jpg', 'pdf'];
/**
* GRADES
*/
/**
* On wiederholung the student must repeat certain lvs.
* This lvs will be graded with this id
*
* @var integer tbl_note.note
*/
$config['wiederholung_note_angerechnet'] = 19;
/**
* On wiederholung the student can not attend certain lvs.
* Those lvs will be graded with this id
*
* @var integer tbl_note.note
*/
$config['wiederholung_note_nicht_zugelassen'] = 20;
/**
* JOBS
*/
/**
* The Job will remind for every Unterbrecher who has a
* wiedereinstieg_datum between the date the Job is run
* and the modified date
* e.g.: If the Job is running on 2023-04-20 and the modifier
* is '+3 days' it will remind of everyone that
* has a wiedereinstiegs_datum between 2023-04-20 and 2023-04-23
*
* @var string A string formated as PHP DateTime modifier
* @see https://www.php.net/manual/de/datetime.modify.php
*/
$config['unterbrechung_job_remind_wiedereinstieg_date_modifier'] = '+3 days';
/**
* The Job will sent a request to everyone who faild the 3rd committee exam
* and respecting the given conditions (not repeated yet, stg not in blacklist)
* to decide if he/she will repeat or not
*
* First request
*
* @var string A string formated as PHP DateTime modifier
* @see https://www.php.net/manual/de/datetime.modify.php
*/
$config['wiederholung_job_request_1_date_modifier'] = '+0 days';
/**
* Second request
*
* @var string A string formated as PHP DateTime modifier
* @see https://www.php.net/manual/de/datetime.modify.php
*/
$config['wiederholung_job_request_2_date_modifier'] = '+3 weeks';
/**
* Final deadline - after this the student will be abgemeldet if he hasn't chosen yet
*
* @var string A string formated as PHP DateTime modifier
* @see https://www.php.net/manual/de/datetime.modify.php
*/
$config['wiederholung_job_deadline_date_modifier'] = '+1 month';
/**
* before this exam dates for Wiederholer will be ignored
*
* @var string A string formated as Date
*
*/
$config['digitalization_start'] = '2022-07-01';
/**
* Objection period - the student will be abgemeldet if he hasn't objected in this period
*
* @var string A string formated as PHP DateTime modifier
* @see https://www.php.net/manual/de/datetime.modify.php
*/
$config['abmeldung_job_deadline_date_modifier'] = '+2 weeks';
/**
* System User - uid of a user that is allowed to set prestudentstatus
*
* @var string
*/
$config['antrag_job_systemuser'] = '';
/**
* WHITELISTS
*/
/**
* List of stati who entitle a prestudent to create an Antrag
*
* @var array Array of tbl_status.status_kurzbz's
*/
$config['antrag_prestudentstatus_whitelist'] = ['Student', 'Diplomand'];
$config['antrag_prestudentstatus_whitelist_abmeldung'] = ['Student', 'Diplomand', 'Unterbrecher'];
/**
* BLACKLISTS
*/
/**
* List of Statusgründe that prevent a prestudent from create an Wiederholungsantrag
*
* @var array An array of tbl_status_grund.statusgrund_id's
*/
$config['status_gruende_wiederholer'] = [16, 15];
/**
* Blacklisted for abmeldung anträge
*
* @var array An array of tbl_studiengang.studiengang_kz's
*/
$config['stgkz_blacklist_abmeldung'] = [];
/**
* Blacklisted for unterbrechung anträge
*
* @var array An array of tbl_studiengang.studiengang_kz's
*/
$config['stgkz_blacklist_unterbrechung'] = [];
/**
* Blacklisted for wiederholung anträge
*
* @var array An array of tbl_studiengang.studiengang_kz's
*/
$config['stgkz_blacklist_wiederholung'] = [];
/**
* Blacklisted noten for negative committee exams
* noten with this ids won't be seen as negative
*
* @var array An array of noten ids
*/
$config['note_blacklist_wiederholung'] = [];
+6 -10
View File
@@ -9,13 +9,6 @@
"name": {
"type": "string"
},
"type": {
"type": "string",
"enum": ["checkbox", "textfield", "textarea", "date", "dropdown", "multipledropdown"]
},
"requiredPermissions": {
"type": "array"
},
"description": {
"type": "array",
},
@@ -25,6 +18,10 @@
"title": {
"type": "array",
},
"type": {
"type": "string",
"enum": ["checkbox", "textfield", "textarea", "date", "dropdown", "multipledropdown"]
},
"sort": {
"type": "integer"
},
@@ -70,6 +67,5 @@
}
}
},
"required": ["type", "name", "requiredPermissions"]
}
"required": ["type", "name"]
}
@@ -1,40 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class Studentenverwaltung extends Auth_Controller
{
public function __construct()
{
$permissions = [];
$router = load_class('Router');
$permissions[$router->method] = ['admin:r', 'assistenz:r'];
parent::__construct($permissions);
// Load Libraries
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
}
/**
* @return void
*/
public function _remap()
{
$this->load->view('Studentenverwaltung', [
'permissions' => [
'student/bpk' => $this->permissionlib->isBerechtigt('student/bpk'),
'student/alias' => $this->permissionlib->isBerechtigt('student/alias'),
'basis/prestudent' => $this->permissionlib->isBerechtigt('basis/prestudent'),
'basis/prestudentstatus' => $this->permissionlib->isBerechtigt('basis/prestudentstatus'),
'assistenz_stgs' => $this->permissionlib->getSTG_isEntitledFor('assistenz'),
'admin' => $this->permissionlib->isBerechtigt('admin'),
'assistenz_schreibrechte' => $this->permissionlib->isBerechtigt('assistenz','suid'),
'student/keine_studstatuspruefung' => $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung'),
'lehre/reihungstestAufsicht' => $this->permissionlib->isBerechtigt('lehre/reihungstestAufsicht')
],
'variables' => [
'semester_aktuell' => $this->variablelib->getVar('semester_aktuell')
]
]);
}
}
-16
View File
@@ -1,16 +0,0 @@
<?php
if ( !defined("PHPUNIT_TEST") ) {
show_404();
}
class Test extends CI_Controller
{
public function index()
{
// Yep... This is all we need.
ini_set('error_reporting', E_ALL); // or error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
}
}
@@ -1,163 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (FAS) and the AntragLib (back-end)
* This controller works with calls on the HTTP GET or POST and the output is always RDF
*/
class Wiederholung extends Auth_Controller
{
/**
* Calls the parent's constructor and loads the FilterCmptLib
*/
public function __construct()
{
parent::__construct([
'getLvs' => ['student/studierendenantrag:r', 'student/noten:r'],
'moveLvsToZeugnis' => ['student/studierendenantrag:w', 'student/noten:w']
]);
// Libraries
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'global',
'studierendenantrag'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
public function getLvs($prestudent_id)
{
// header für no cache
$this->output->set_header("Cache-Control: no-cache");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0", false);
$this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$this->output->set_header("Pragma: no-cache");
$this->output->set_header("Content-type: application/xhtml+xml");
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
$sem_akt = $this->variablelib->getVar('semester_aktuell');
$result = $this->antraglib->getLvsForPrestudent($prestudent_id, $sem_akt);
if (isError($result))
return $result;
$lvs = $result->retval;
$rdf_url = 'http://www.technikum-wien.at/antragnote';
$this->load->view('lehre/Antrag/Wiederholung/getLvs.rdf.php', [
'url' => $rdf_url,
'lvs' => $lvs
]);
}
public function moveLvsToZeugnis()
{
$anzahl = $this->input->post('anzahl');
$student_uid = $this->input->post('student_uid');
$this->load->model('education/Studierendenantraglehrveranstaltung_model', 'StudierendenantraglehrveranstaltungModel');
$this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel');
$errormsg = array();
for($i=0; $i<$anzahl; $i++)
{
$id = $this->input->post('studierendenantrag_lehrveranstaltung_id_' . $i);
$result =$this->StudierendenantraglehrveranstaltungModel->load($id);
if(isError($result))
{
$errormsg[] = getError($result);
}
elseif(!hasData($result))
{
$errormsg[] = $this->p->t('studierendenantrag', 'error_no_lv_in_application');
}
else
{
$antragLv = getData($result)[0];
$result= $this->ZeugnisnoteModel->load([
'lehrveranstaltung_id'=> $antragLv->lehrveranstaltung_id,
'student_uid'=> $student_uid,
'studiensemester_kurzbz' => $antragLv->studiensemester_kurzbz
]);
if(isError($result))
{
$errormsg[] = getError($result);
}
else
{
if (hasData($result))
{
$result = $this->ZeugnisnoteModel->update(
[
'lehrveranstaltung_id'=> $antragLv->lehrveranstaltung_id,
'student_uid'=> $student_uid,
'studiensemester_kurzbz' => $antragLv->studiensemester_kurzbz
],
[
'note'=> $antragLv->note,
'uebernahmedatum' => date('c'),
'benotungsdatum' => $antragLv->insertamum,
'updateamum' => date('c'),
'bemerkung'=>$antragLv->anmerkung,
'updatevon'=>getAuthUID()
]
);
}
else
{
$result = $this->ZeugnisnoteModel->insert([
'lehrveranstaltung_id'=> $antragLv->lehrveranstaltung_id,
'student_uid'=> $student_uid,
'studiensemester_kurzbz' => $antragLv->studiensemester_kurzbz,
'note'=> $antragLv->note,
'uebernahmedatum' => date('c'),
'benotungsdatum' => $antragLv->insertamum,
'insertamum' => date('c'),
'bemerkung'=>$antragLv->anmerkung,
'insertvon'=>getAuthUID()
]);
}
if(isError($result))
{
$errormsg[] = getError($result);
}
}
}
}
if($errormsg)
$return = false;
else
$return = true;
$this->load->view('lehre/Antrag/Wiederholung/moveLvs.rdf.php', [
'return' => $return,
'errormsg' => $errormsg
]);
}
}
@@ -1,231 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* 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
*/
class Filter extends FHCAPI_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()
{
// NOTE: FilterCmpt has its own permissions checks
parent::__construct([
'getFilter' => self::PERM_LOGGED,
'removeFilterField' => self::PERM_LOGGED,
'addFilterField' => self::PERM_LOGGED,
'applyFilterFields' => self::PERM_LOGGED,
'removeCustomFilter' => self::PERM_LOGGED,
'saveCustomFilter' => self::PERM_LOGGED,
'reloadDataset' => self::PERM_LOGGED
]);
// Loads the FiltersModel
$this->load->model('system/Filters_model', 'FiltersModel');
// 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()
{
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$session = $this->filtercmptlib->getSession();
if (is_object($session)) {
// If stdClass it is an retval object
$session = $this->getDataOrTerminateWithError($session);
}
$this->terminateWithSuccess($session);
}
/**
* Remove an applied filter (SQL where condition) from the current filter
*/
public function removeFilterField()
{
$this->form_validation->set_rules('filterField', 'filterField', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$result = $this->filtercmptlib->removeFilterField($this->input->post('filterField'));
if (!$result)
$this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL);
$this->terminateWithSuccess('Field removed');
}
/**
* Add a filter (SQL where clause) to be applied to the current filter
*/
public function addFilterField()
{
$this->form_validation->set_rules('filterField', 'filterField', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$result = $this->filtercmptlib->addFilterField($this->input->post('filterField'));
if (!$result)
$this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL);
$this->terminateWithSuccess('Field added');
}
/**
* Apply the filter changes
*/
public function applyFilterFields()
{
$this->form_validation->set_rules('filterFields', 'filterFields', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$result = $this->filtercmptlib->applyFilterFields($this->input->post('filterFields'));
if (!$result)
$this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL);
$this->terminateWithSuccess('Applied');
}
/**
* Save the current filter as a custom filter for this user with the given description
*/
public function saveCustomFilter()
{
$this->form_validation->set_rules('customFilterName', 'customFilterName', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$result = $this->filtercmptlib->saveCustomFilter($this->input->post('customFilterName'));
if (!$result)
$this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL);
$this->terminateWithSuccess('Saved');
}
/**
* Remove a custom filter by its filterId
*/
public function removeCustomFilter()
{
$this->form_validation->set_rules('filterId', 'filterId', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$result = $this->filtercmptlib->removeCustomFilter($this->input->post('filterId'));
if (!$result)
$this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL);
$this->terminateWithSuccess('Removed');
}
/**
* Reloads the dataset
*/
public function reloadDataset()
{
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$this->filtercmptlib->reloadDataset();
$this->terminateWithSuccess('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;
$validations = [
[
'field' => self::FILTER_UNIQUE_ID,
'label' => self::FILTER_UNIQUE_ID,
'rules' => 'required'
],
[
'field' => self::FILTER_TYPE,
'label' => self::FILTER_TYPE,
'rules' => 'required'
],
];
$this->load->library('form_validation');
if ($this->input->method() == 'get')
$this->form_validation->set_data($this->input->get());
$this->form_validation->set_rules($validations);
if ($this->form_validation->run()) {
$filterUniqueId = $this->input->post_get(self::FILTER_UNIQUE_ID);
$filterType = $this->input->post_get(self::FILTER_TYPE);
$filterId = $this->input->post_get(self::FILTER_ID);
// 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();
}
}
}
@@ -1,101 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (GUI) and the NavigationLib (back-end)
* Provides data to the ajax get calls about the filter
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Navigation extends FHCAPI_Controller
{
const NAVIGATION_PAGE_PARAM = 'navigation_page'; // Navigation page parameter name
/**
* Loads the NavigationLib where the used logic lies
*/
public function __construct()
{
parent::__construct([
'menu' => self::PERM_LOGGED,
'header' => self::PERM_LOGGED
]);
$this->_loadNavigationLib(); // Loads the NavigationLib with parameters
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* This function creates the left Menu for each Page
* @param NAVIGATION_PAGE_PARAM GET Parameter witch holds the currently called Page
* @return JSON object with the Menu Entries
*/
public function menu()
{
$menuArray = $this->navigationlib->getMenuArray($this->input->get(self::NAVIGATION_PAGE_PARAM));
$this->terminateWithSuccess($menuArray);
}
/**
* This function creates the Top Menu for each Page
* @param NAVIGATION_PAGE_PARAM GET Parameter witch holds the currently called Page
* @return JSON object with the Menu Entries
*/
public function header()
{
$headerArray = $this->navigationlib->getHeaderArray($this->input->get(self::NAVIGATION_PAGE_PARAM));
$this->terminateWithSuccess($headerArray);
}
//------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Loads the NavigationLib with the NAVIGATION_PAGE_PARAM parameter
* If the parameter NAVIGATION_PAGE_PARAM is not given then the execution of the controller is terminated and
* an error message is printed
*/
private function _loadNavigationLib()
{
// If the parameter NAVIGATION_PAGE_PARAM is present in the HTTP GET or POST
if (isset($_GET[self::NAVIGATION_PAGE_PARAM]) || isset($_POST[self::NAVIGATION_PAGE_PARAM]))
{
// If it is present in the HTTP GET
if (isset($_GET[self::NAVIGATION_PAGE_PARAM]))
{
$navigationPage = $this->input->get(self::NAVIGATION_PAGE_PARAM); // is retrieved from the HTTP GET
}
elseif (isset($_POST[self::NAVIGATION_PAGE_PARAM])) // Else if it is present in the HTTP POST
{
$navigationPage = $this->input->post(self::NAVIGATION_PAGE_PARAM); // is retrieved from the HTTP POST
}
// Loads the NavigationLib that contains all the used logic
$this->load->library('NavigationLib', array(self::NAVIGATION_PAGE_PARAM => $navigationPage));
}
else // Otherwise an error will be written in the output
{
show_error('Parameter "' . self::NAVIGATION_PAGE_PARAM . '" not provided!');
}
}
}
@@ -1,46 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (GUI) and the PhrasesLib (back-end)
* Provides data to the ajax get calls about the Phrasen plugin
* This controller works with JSON calls on the HTTP GET and the output is always JSON
*/
class Phrasen extends FHCAPI_Controller
{
public function __construct()
{
parent::__construct([
'loadModule' => self::PERM_ANONYMOUS
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* @param string $module
*/
public function loadModule($module)
{
$this->load->library('PhrasesLib', [$module], 'pj');
$this->terminateWithSuccess(json_decode($this->pj->getJSON()));
}
}
@@ -1,69 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (GUI) and the SearchBarLib (back-end)
* Provides data to the ajax get calls about the searchbar component
* This controller works with JSON calls on the HTTP GET and the output is always JSON
*/
class Searchbar extends FHCAPI_Controller
{
const SEARCHSTR_PARAM = 'searchstr';
const TYPES_PARAM = 'types';
/**
* Object initialization
*/
public function __construct()
{
// NOTE(chris): additional permission checks will be done in SearchBarLib
parent::__construct([
'search' => self::PERM_LOGGED
]);
// Load the library SearchBarLib
$this->load->library('SearchBarLib');
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Gets a JSON body via HTTP POST and provides the parameters
*/
public function search()
{
$this->load->library('form_validation');
// Checks if the searchstr and the types parameters are in the POSTed JSON
$this->form_validation->set_rules(self::SEARCHSTR_PARAM, null, 'required');
$this->form_validation->set_rules(self::TYPES_PARAM . '[]', null, 'required');
if (!$this->form_validation->run())
$this->terminateWithError(SearchBarLib::ERROR_WRONG_JSON, self::ERROR_TYPE_GENERAL);
// Convert to json the result from searchbarlib->search
$result = $this->searchbarlib->search($this->input->post(self::SEARCHSTR_PARAM), $this->input->post(self::TYPES_PARAM));
if (property_exists($result, 'error'))
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
$this->terminateWithSuccess($result);
}
}
@@ -1,133 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (GUI) and the UDFLib (back-end)
* Provides data to the ajax get calls about the Udf component
* Listens to ajax post calls to change the Udf data
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Udf extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and prepares the UDFLib
*/
public function __construct()
{
// NOTE: UdfLib has its own permissions checks
parent::__construct([
'load' => self::PERM_LOGGED,
'save' => self::PERM_LOGGED
]);
// Libraries
$this->load->library('form_validation');
$this->load->library('UDFLib');
// Models
$this->load->model($this->getTargetModelPath(), 'TargetModel');
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Load all UDFs for a dataset
*
* @return void
*/
public function load()
{
$pks = $this->TargetModel->getPks();
foreach ($pks as $id)
$this->form_validation->set_rules($id, $id, 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$id = [];
foreach ($pks as $pk)
$id[$pk] = $this->input->post($pk);
if (!is_array($this->TargetModel->getPk()))
$id = current($id);
$result = $this->udflib->getFieldArray($this->TargetModel, $id);
$fields = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($fields);
}
/**
* Saves UDFs to a dataset
*
* @return void
*/
public function save()
{
$pks = $this->TargetModel->getPks();
foreach ($pks as $id)
$this->form_validation->set_rules($id, $id, 'required');
$result = $this->udflib->getCiValidations($this->TargetModel, $this->input->post());
$fieldValidations = $this->getDataOrTerminateWithError($result);
$this->form_validation->set_rules($fieldvalidations);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$id = [];
$fields = $this->input->post();
foreach ($pks as $pk) {
$id[$pk] = $fields[$pk];
unset($fields[$pk]);
}
if (!is_array($this->TargetModel->getPk()))
$id = current($id);
$result = $this->TargetModel->update($id, $fields);
$this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess(array_fill_keys(array_keys($fields), ''));
}
//------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Get the path to the target model from the url
*
* @return string
*/
private function getTargetModelPath()
{
$ci_model_path = array_slice($this->uri->rsegments, 2);
if ($ci_model_path)
$ci_model_path[] = ucfirst(array_pop($ci_model_path)) . '_model';
return implode(DIRECTORY_SEPARATOR, $ci_model_path);
}
}
@@ -1,387 +0,0 @@
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
use \DateTime as DateTime;
class BetriebsmittelP extends FHCAPI_Controller
{
private $person_id = null;
public function __construct()
{
parent::__construct([
'getAllBetriebsmittel' => ['admin:r', 'assistenz:r'],
'addNewBetriebsmittel' => self::PERM_LOGGED,
'updateBetriebsmittel' => self::PERM_LOGGED,
'loadBetriebsmittel' => ['admin:r', 'assistenz:r'],
'deleteBetriebsmittel' => self::PERM_LOGGED,
'getTypenBetriebsmittel' => ['admin:r', 'assistenz:r'],
'loadInventarliste' => ['admin:r', 'assistenz:r']
]);
//Load Models
$this->load->model('ressource/Betriebsmittel_model', 'BetriebsmittelModel');
$this->load->model('ressource/Betriebsmittelperson_model', 'BetriebsmittelpersonModel');
// Additional Permission Checks
if ($this->router->method == 'addNewBetriebsmittel') {
$this->person_id = current(array_slice($this->uri->rsegments, 2));
$this->checkPermissionsForPerson(
$this->person_id,
['admin:rw', 'mitarbeiter:rw', 'basis/betriebsmittel:rw'],
['admin:rw', 'assistenz:rw', 'basis/betriebsmittel:rw']
);
} elseif ($this->router->method == 'updateBetriebsmittel' || $this->router->method == 'deleteBetriebsmittel') {
$betriebsmittelperson_id = current(array_slice($this->uri->rsegments, 2));
$result = $this->BetriebsmittelpersonModel->load($betriebsmittelperson_id);
if (!hasData($result))
show_404();
$this->person_id = current(getData($result))->person_id;
$this->checkPermissionsForPerson(
$this->person_id,
['admin:rw', 'mitarbeiter:rw', 'basis/betriebsmittel:rw'],
['admin:rw', 'assistenz:rw', 'basis/betriebsmittel:rw']
);
}
// Load Libraries
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
$this->load->library('form_validation');
// Load language phrases
$this->loadPhrases([
'ui',
'wawi'
]);
}
public function getAllBetriebsmittel($type_id, $id)
{
$result = $this->BetriebsmittelpersonModel->getBetriebsmittelData($id, $type_id);
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess((getData($result) ?: []));
}
protected function validateNewOrUpdate()
{
$this->form_validation->set_rules('betriebsmitteltyp', 'Typ', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired')
]);
$this->form_validation->set_rules('kaution', 'Kaution', 'numeric|less_than_equal_to[9999.99]', [
'numeric' => $this->p->t('ui', 'error_fieldNotNumeric')
]);
$this->form_validation->set_rules('ausgegebenam', 'Ausgegeben am', 'required|is_valid_date', [
'required' => $this->p->t('ui', 'error_fieldRequired')
]);
if ($this->input->post('ausgegebenam') && $this->input->post('retouram')) {
$this->form_validation->set_rules('retouram', 'Retour am', [
'is_valid_date',
['is_not_before_ausgegebenam', function ($value) {
return (new DateTime($value) >= new DateTime($this->input->post('ausgegebenam')));
}]
], [
'is_not_before_ausgegebenam' => $this->p->t('wawi', 'error_retourdatumVorAusgabe')
]);
} else {
$this->form_validation->set_rules('retouram', 'Retour am', 'is_valid_date');
}
$this->form_validation->set_rules('anmerkung', 'Anmerkung', 'max_length[256]');
if ($this->input->post('betriebsmitteltyp') == 'Inventar') {
// Inventar
$this->form_validation->set_rules('betriebsmittel_id', 'Inventarnummer', 'required');
} elseif ($this->input->post('betriebsmitteltyp') == 'Zutrittskarte') {
// Zutrittskarte
if ($this->input->post('nummer') === null && $this->input->post('nummer') === null) {
$this->form_validation->set_rules('nummer', 'Nummer', 'required', [
'required' => $this->p->t('wawi', 'error_zutrittskarteOhneNummer')
]);
$this->form_validation->set_rules('nummer2', 'Nummer2', 'required', [
'required' => $this->p->t('wawi', 'error_zutrittskarteOhneNummer')
]);
} else {
if ($this->input->post('nummer') === null) {
$result = $this->BetriebsmittelpersonModel->loadViewWhere([
'betriebsmitteltyp' => $this->input->post('betriebsmitteltyp'),
'nummer2' => $this->input->post('nummer2'),
'person_id !=' => $this->person_id,
'retouram IS NULL' => null
]);
if (hasData($result))
$this->form_validation->set_rules('nummer2', 'Nummer2', 'is_array', [
'is_array' => $this->p->t('wawi', 'error_bmZutrittskarteOccupied', (array)current(getData($result)))
]);
} else {
$result = $this->BetriebsmittelpersonModel->loadViewWhere([
'betriebsmitteltyp' => $this->input->post('betriebsmitteltyp'),
'nummer' => $this->input->post('nummer'),
'person_id !=' => $this->person_id,
'retouram IS NULL' => null
]);
if (hasData($result))
$this->form_validation->set_rules('nummer', 'Nummer', 'is_array', [
'is_array' => $this->p->t('wawi', 'error_bmZutrittskarteOccupied', (array)current(getData($result)))
]);
}
}
}
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
public function addNewBetriebsmittel($person_id)
{
$this->form_validation->set_rules('uid', 'UID', [
['uid_in_person', function ($value) use ($person_id) {
if ($value === null)
return true;
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$result = $this->BenutzerModel->loadWhere([
'uid' => $value,
'person_id' => $person_id
]);
return hasData($result);
}]
], [
'uid_in_person' => $this->p->t('person', 'error_uidNotInPerson')
]);
$this->validateNewOrUpdate();
$betriebsmitteltyp = $this->input->post('betriebsmitteltyp');
$nummer = $this->input->post('nummer');
$nummer2 = $this->input->post('nummer2');
$beschreibung = $this->input->post('beschreibung');
$betriebsmittel_id = $this->input->post('betriebsmittel_id');
$anmerkung = $this->input->post('anmerkung');
$kaution = $this->input->post('kaution');
$ausgegebenam = $this->input->post('ausgegebenam');
$retouram = $this->input->post('retouram');
$uid = $this->input->post('uid');
// NOTE(chris): transform_kartennummer
if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer)
$nummer = is_numeric($nummer) ? ltrim($nummer, "0") : hexdec(implode("", array_reverse(str_split(trim($nummer)))));
$this->db->trans_start();
if ($betriebsmitteltyp != 'Inventar') {
$this->BetriebsmittelModel->addOrder('updateamum', 'DESC');
if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer === null) {
$result = $this->BetriebsmittelModel->loadWhere([
'betriebsmitteltyp' => $betriebsmitteltyp,
'nummer2' => $nummer2
]);
} else {
$result = $this->BetriebsmittelModel->loadWhere([
'betriebsmitteltyp' => $betriebsmitteltyp,
'nummer' => $nummer
]);
}
$data = $this->getDataOrTerminateWithError($result);
if ($data) {
$data = current($data);
if ($data->nummer !== $nummer || $data->nummer2 !== $nummer2 || $data->beschreibung !== $beschreibung) {
$result = $this->BetriebsmittelModel->update($data->betriebsmittel_id, [
'nummer' => $nummer,
'nummer2' => $nummer2,
'beschreibung' => $beschreibung,
'updateamum' => date('c'),
'updatevon' => getAuthUID()
]);
$this->getDataOrTerminateWithError($result);
}
$betriebsmittel_id = $data->betriebsmittel_id;
} else {
$result = $this->BetriebsmittelModel->insert([
'betriebsmitteltyp' => $betriebsmitteltyp,
'nummer' => $nummer,
'nummer2' => $nummer2,
'beschreibung' => $beschreibung,
'reservieren' => false,
'ort_kurzbz' => null,
'insertamum' => date('c'),
'insertvon' => getAuthUID(),
]);
$betriebsmittel_id = $this->getDataOrTerminateWithError($result);
}
}
$result = $this->BetriebsmittelpersonModel->insert([
'person_id' => $person_id,
'betriebsmittel_id' => $betriebsmittel_id,
'anmerkung' => $anmerkung,
'kaution' => $kaution,
'ausgegebenam' => $ausgegebenam,
'retouram' => $retouram,
'uid' => $uid,
'insertamum' => date('c'),
'insertvon' => getAuthUID()
]);
$data = $this->getDataOrTerminateWithError($result);
$this->db->trans_complete();
$this->terminateWithSuccess(true);
}
public function updateBetriebsmittel($betriebsmittelperson_id)
{
$this->validateNewOrUpdate();
$betriebsmitteltyp = $this->input->post('betriebsmitteltyp');
$nummer = $this->input->post('nummer');
$nummer2 = $this->input->post('nummer2');
$beschreibung = $this->input->post('beschreibung');
$betriebsmittel_id = $this->input->post('betriebsmittel_id');
$anmerkung = $this->input->post('anmerkung');
$kaution = $this->input->post('kaution');
$ausgegebenam = $this->input->post('ausgegebenam');
$retouram = $this->input->post('retouram');
// NOTE(chris): transform_kartennummer
if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer)
$nummer = is_numeric($nummer) ? ltrim($nummer, "0") : hexdec(implode("", array_reverse(str_split(trim($nummer)))));
$this->db->trans_start();
if ($betriebsmitteltyp != 'Inventar') {
$found = false;
if ($nummer !== null && $betriebsmittel_id !== null) {
$result = $this->BetriebsmittelModel->load($betriebsmittel_id);
$data = $this->getDataOrTerminateWithError($result);
if ($data && current($data)->nummer == $nummer) {
$found = true;
}
}
if (!$found) {
$this->BetriebsmittelModel->addOrder('updateamum', 'DESC');
if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer === null) {
$result = $this->BetriebsmittelModel->loadWhere([
'betriebsmitteltyp' => $betriebsmitteltyp,
'nummer2' => $nummer2
]);
} else {
$result = $this->BetriebsmittelModel->loadWhere([
'betriebsmitteltyp' => $betriebsmitteltyp,
'nummer' => $nummer
]);
}
$data = $this->getDataOrTerminateWithError($result);
}
if ($data) {
$data = current($data);
if ($data->nummer !== $nummer || $data->nummer2 !== $nummer2 || $data->beschreibung !== $beschreibung) {
$result = $this->BetriebsmittelModel->update($data->betriebsmittel_id, [
'nummer' => $nummer,
'nummer2' => $nummer2,
'beschreibung' => $beschreibung,
'updateamum' => date('c'),
'updatevon' => getAuthUID()
]);
$this->getDataOrTerminateWithError($result);
}
$betriebsmittel_id = $data->betriebsmittel_id;
} else {
$result = $this->BetriebsmittelModel->insert([
'betriebsmitteltyp' => $betriebsmitteltyp,
'nummer' => $nummer,
'nummer2' => $nummer2,
'beschreibung' => $beschreibung,
'reservieren' => false,
'ort_kurzbz' => null,
'insertamum' => date('c'),
'insertvon' => getAuthUID(),
]);
$betriebsmittel_id = $this->getDataOrTerminateWithError($result);
}
}
$result = $this->BetriebsmittelpersonModel->update($betriebsmittelperson_id, [
'betriebsmittel_id' => $betriebsmittel_id,
'anmerkung' => $anmerkung,
'kaution' => $kaution,
'ausgegebenam' => $ausgegebenam,
'retouram' => $retouram,
'updateamum' => date('c'),
'updatevon' => getAuthUID()
]);
$data = $this->getDataOrTerminateWithError($result);
$this->db->trans_complete();
$this->terminateWithSuccess(true);
}
public function loadBetriebsmittel($betriebsmittelperson_id)
{
$result = $this->BetriebsmittelpersonModel->getBetriebsmittelData($betriebsmittelperson_id, 'betriebsmittelperson_id');
if (isError($result)) {
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
if (!hasData($result)) {
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'Betriebsmittelperson_id']), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess(current(getData($result)));
}
public function deleteBetriebsmittel($betriebsmittelperson_id)
{
$result = $this->BetriebsmittelpersonModel->delete(
array('betriebsmittelperson_id' => $betriebsmittelperson_id,
)
);
if (isError($result)) {
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
if (!hasData($result)) {
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'Betriebsmittelperson_id']), self::ERROR_TYPE_GENERAL);
}
return $this->outputJsonSuccess(current(getData($result)));
}
public function getTypenBetriebsmittel()
{
$this->load->model('ressource/Betriebsmitteltyp_model', 'BetriebsmitteltypModel');
$this->BetriebsmitteltypModel->addOrder('beschreibung', 'ASC');
$result = $this->BetriebsmitteltypModel->load(); // load All
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
}
public function loadInventarliste($searchString)
{
$result = $this->BetriebsmittelModel->loadInventarliste($searchString);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
}
@@ -1,51 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \DateTime as DateTime;
class NotizPerson extends Notiz_Controller
{
public function __construct()
{
parent::__construct([
'getUid' => ['admin:r', 'assistenz:r'],
'getNotizen' => ['admin:r', 'assistenz:r'],
'loadNotiz' => ['admin:r', 'assistenz:r'],
'addNewNotiz' => ['admin:rw', 'assistenz:rw'],
'updateNotiz' => ['admin:rw', 'assistenz:rw'],
'deleteNotiz' => ['admin:rw', 'assistenz:rw'],
'loadDokumente' => ['admin:r', 'assistenz:r'],
'getMitarbeiter' => ['admin:r', 'assistenz:r'],
'isBerechtigt' => ['admin:r', 'assistenz:r'],
]);
}
public function isBerechtigt($id, $typeId)
{
if($typeId != "person_id")
{
return $this->terminateWithError($this->p->t('ui', 'error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL);
}
//TODO define permission
if (!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid'))
{
$result = $this->p->t('lehre', 'error_keineSchreibrechte');
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
return $this->outputJsonSuccess(true);
}
public function loadDokumente()
{
$notiz_id = $this->input->post('notiz_id');
// TODO(chris): make CI variant of endpoint
$this->NotizModel->addSelect($this->NotizModel->escape(base_url('content/notizdokdownload.php?id=')) . ' || campus.tbl_dms_version.dms_id AS preview');
return parent::loadDokumente();
}
}
@@ -1,187 +0,0 @@
<?php
/**
* Copyright (C) 2024 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 \REST_Controller as REST_Controller;
use \Studierendenantrag_model as Studierendenantrag_model;
/**
* This controller operates between (interface) the JS (GUI) and the AntragLib (back-end)
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Abmeldung extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and loads the AntragLib
*/
public function __construct()
{
parent::__construct([
'getDetailsForNewAntrag' => self::PERM_LOGGED,
'getDetailsForAntrag' => self::PERM_LOGGED,
'createAntrag' => self::PERM_LOGGED,
'cancelAntrag' => self::PERM_LOGGED
]);
// Libraries
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'studierendenantrag'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Retrieves data of the current studiengang for the current user
*/
public function getDetailsForNewAntrag($prestudent_id)
{
if (!$this->antraglib->isEntitledToCreateAntragFor($prestudent_id, true))
$this->terminateWithError('Forbidden', self::ERROR_TYPE_AUTH, REST_Controller::HTTP_FORBIDDEN);
$result = $this->antraglib->getPrestudentAbmeldeBerechtigt($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_no_student'),
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
} elseif ($result == -3) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_stg_blacklist'),
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
} elseif ($result == -1) {
$result = $this->antraglib->getDetailsForLastAntrag(
$prestudent_id,
[
Studierendenantrag_model::TYP_ABMELDUNG,
Studierendenantrag_model::TYP_ABMELDUNG_STGL
]
);
$data = $this->getDataOrTerminateWithError($result);
$data->canCancel = (
$data->status == Studierendenantragstatus_model::STATUS_CREATED &&
$this->antraglib->isEntitledToCancelAntrag($data->studierendenantrag_id)
);
$this->terminateWithSuccess($data);
}
$result = $this->antraglib->getDetailsForNewAntrag($prestudent_id);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getDetailsForAntrag($studierendenantrag_id)
{
if (!$this->antraglib->isEntitledToShowAntrag($studierendenantrag_id))
return show_404();
$result = $this->antraglib->getDetailsForAntrag($studierendenantrag_id);
$data = $this->getDataOrTerminateWithError($result);
if ($data->typ !== Studierendenantrag_model::TYP_ABMELDUNG_STGL && $data->typ !== Studierendenantrag_model::TYP_ABMELDUNG)
return show_404();
$data->canCancel = (
$data->status == Studierendenantragstatus_model::STATUS_CREATED &&
$this->antraglib->isEntitledToCancelAntrag($data->studierendenantrag_id)
);
$this->terminateWithSuccess($data);
}
public function createAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('studiensemester', 'Studiensemester', 'required');
$this->form_validation->set_rules('prestudent_id', 'Prestudent ID', 'required');
$this->form_validation->set_rules('grund', 'Grund', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$grund = $this->input->post('grund');
$studiensemester = $this->input->post('studiensemester');
$prestudent_id = $this->input->post('prestudent_id');
$result = $this->antraglib->getPrestudentAbmeldeBerechtigt($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_student'), self::ERROR_TYPE_GENERAL);
elseif ($result == -3)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_stg_blacklist'), self::ERROR_TYPE_GENERAL);
elseif ($result < 0)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_antrag_exists'), self::ERROR_TYPE_GENERAL);
$result = $this->antraglib->createAbmeldung($prestudent_id, $studiensemester, getAuthUID(), $grund);
$data = $this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getDetailsForAntrag($data);
if (!hasData($result))
return $this->terminateWithSuccess(true);
$data = getData($result);
$data->canCancel = (boolean)$this->antraglib->isEntitledToCancelAntrag($data->studierendenantrag_id);
$this->terminateWithSuccess($data);
}
public function cancelAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('antrag_id', 'Antrag ID', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$antrag_id = $this->input->post('antrag_id');
if (!$this->antraglib->isEntitledToCancelAntrag($antrag_id))
$this->terminateWithError('Forbidden', self::ERROR_TYPE_AUTH, REST_Controller::HTTP_FORBIDDEN);
$result = $this->antraglib->cancelAntrag($antrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getDetailsForAntrag($antrag_id);
if (!hasData($result))
$this->terminateWithSuccess($antrag_id);
$data = getData($result);
$this->terminateWithSuccess($data);
}
}
@@ -1,429 +0,0 @@
<?php
/**
* Copyright (C) 2024 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;
use \Studierendenantrag_model as Studierendenantrag_model;
/**
* This controller operates between (interface) the JS (GUI) and the AntragLib (back-end)
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Leitung extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and loads the AntragLib
*/
public function __construct()
{
parent::__construct([
'getActiveStgs' => ['student/antragfreigabe:r', 'student/studierendenantrag:r'],
'getAntraege' => ['student/antragfreigabe:r', 'student/studierendenantrag:r'],
'getHistory' => ['student/antragfreigabe:r', 'student/studierendenantrag:r'],
'getPrestudents' => 'student/studierendenantrag:w',
'approveAntrag' => 'student/antragfreigabe:w',
'rejectAntrag' => 'student/antragfreigabe:w',
'reopenAntrag' => 'student/studierendenantrag:w',
'pauseAntrag' => ['student/antragfreigabe:w', 'student/studierendenantrag:w'],
'unpauseAntrag' => ['student/antragfreigabe:w', 'student/studierendenantrag:w'],
'objectAntrag' => ['student/antragfreigabe:w', 'student/studierendenantrag:w'],
'approveObjection' => ['student/antragfreigabe:w', 'student/studierendenantrag:w'],
'denyObjection' => ['student/antragfreigabe:w', 'student/studierendenantrag:w']
]);
// Libraries
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'studierendenantrag',
'lehre'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
public function getActiveStgs()
{
$studiengaenge = $this->permissionlib->getSTG_isEntitledFor('student/antragfreigabe') ?: [];
$studiengaenge = array_merge($studiengaenge, $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag') ?: []);
$result = $this->StudierendenantragModel->loadStgsWithAntraege($studiengaenge);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getAntraege($studiengang = null, $extra = null)
{
if ($studiengang && $studiengang == 'todo') {
$studiengang = $extra;
$extra = true;
} else {
$extra = false;
}
$studiengaenge = $this->permissionlib->getSTG_isEntitledFor('student/antragfreigabe');
if(!is_array($studiengaenge))
$studiengaenge = [];
$stgsNeuanlage = $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag');
if(!is_array($stgsNeuanlage))
$stgsNeuanlage = [];
$studiengaenge = array_unique(array_merge($studiengaenge, $stgsNeuanlage));
if ($studiengang) {
if (!in_array($studiengang, $studiengaenge))
$this->terminateWithError(
'Forbidden',
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
$studiengaenge = [$studiengang];
}
$antraege = [];
if ($studiengaenge) {
$result = $extra
? $this->StudierendenantragModel->loadActiveForStudiengaenge($studiengaenge)
: $this->StudierendenantragModel->loadForStudiengaenge($studiengaenge);
$antraege = $this->getDataOrTerminateWithError($result);
}
$this->terminateWithSuccess($antraege ?: []);
}
public function getHistory($studierendenantrag_id)
{
if (!$this->antraglib->isEntitledToSeeHistoryForAntrag($studierendenantrag_id))
$this->terminateWithError(
'Forbidden',
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
$result = $this->antraglib->getAntragHistory($studierendenantrag_id);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data ?: []);
}
public function getPrestudents()
{
$query = $this->input->post('query');
$studiengaenge = $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag');
$result = $this->antraglib->getAktivePrestudentenInStgs($studiengaenge, $query);
$result = $this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($result ?: []);
}
public function approveAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToApproveAntrag', [$this->antraglib, 'isEntitledToApproveAntrag']],
],
[
'isEntitledToApproveAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
$this->form_validation->set_rules(
'typ',
'Typ',
'required|in_list[' . implode(',', [
Studierendenantrag_model::TYP_ABMELDUNG,
Studierendenantrag_model::TYP_ABMELDUNG_STGL,
Studierendenantrag_model::TYP_UNTERBRECHUNG,
Studierendenantrag_model::TYP_WIEDERHOLUNG
]) . ']'
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
switch ($this->input->post('typ')) {
case Studierendenantrag_model::TYP_ABMELDUNG:
case Studierendenantrag_model::TYP_ABMELDUNG_STGL:
$result = $this->antraglib->approveAbmeldung([$studierendenantrag_id], getAuthUID());
break;
case Studierendenantrag_model::TYP_UNTERBRECHUNG:
$result = $this->antraglib->approveUnterbrechung([$studierendenantrag_id], getAuthUID());
break;
case Studierendenantrag_model::TYP_WIEDERHOLUNG:
$result = $this->antraglib->approveWiederholung($studierendenantrag_id, getAuthUID());
break;
}
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function rejectAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToRejectAntrag', [$this->antraglib, 'isEntitledToRejectAntrag']],
],
[
'isEntitledToRejectAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
$this->form_validation->set_rules('grund', 'Grund', 'required');
$this->form_validation->set_rules(
'typ',
'Typ',
'required|in_list[' . implode(',', [
Studierendenantrag_model::TYP_UNTERBRECHUNG
]) . ']'
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$grund = $this->input->post('grund');
$result = $this->antraglib->rejectUnterbrechung([$studierendenantrag_id], getAuthUID(), $grund);
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function reopenAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToReopenAntrag', [$this->antraglib, 'isEntitledToReopenAntrag']],
],
[
'isEntitledToReopenAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
$this->form_validation->set_rules(
'typ',
'Typ',
'required|in_list[' . implode(',', [
Studierendenantrag_model::TYP_WIEDERHOLUNG
]) . ']'
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->reopenWiederholung($studierendenantrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function pauseAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToPauseAntrag', [$this->antraglib, 'isEntitledToPauseAntrag']],
['antragCanBeManualPaused', [$this->antraglib, 'antragCanBeManualPaused']]
],
[
'isEntitledToPauseAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'antragCanBeManualPaused' => $this->p->t(
'studierendenantrag',
'error_not_pauseable',
['id' => $this->input->post('studierendenantrag_id')]
)
]
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->pauseAntrag($studierendenantrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function unpauseAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToUnpauseAntrag', [$this->antraglib, 'isEntitledToUnpauseAntrag']],
['antragCanBeManualUnpaused', [$this->antraglib, 'antragCanBeManualUnpaused']]
],
[
'isEntitledToUnpauseAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'antragCanBeManualUnpaused' => $this->p->t(
'studierendenantrag',
'error_not_paused',
['id' => $this->input->post('studierendenantrag_id')]
)
]
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->unpauseAntrag($studierendenantrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function objectAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToObjectAntrag', [$this->antraglib, 'isEntitledToObjectAntrag']],
['canBeObjected', function ($a) {
return $this->antraglib->hasType($a, Studierendenantrag_model::TYP_ABMELDUNG_STGL);
}]
],
[
'isEntitledToObjectAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'canBeObjected' => $this->p->t(
'studierendenantrag',
'error_no_objection'
)
]
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->objectAbmeldung($studierendenantrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function approveObjection()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToObjectAntrag', [$this->antraglib, 'isEntitledToObjectAntrag']],
['isObjected', function ($a) {
return $this->antraglib->hasStatus($a, Studierendenantragstatus_model::STATUS_OBJECTED);
}]
],
[
'isEntitledToObjectAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'isObjected' => $this->p->t(
'studierendenantrag',
'error_not_objected'
)
]
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->cancelAntrag($studierendenantrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function denyObjection()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToObjectAntrag', [$this->antraglib, 'isEntitledToObjectAntrag']],
['isObjected', function ($a) {
return $this->antraglib->hasStatus($a, Studierendenantragstatus_model::STATUS_OBJECTED);
}]
],
[
'isEntitledToObjectAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'isObjected' => $this->p->t(
'studierendenantrag',
'error_not_objected'
)
]
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$grund = $this->input->post('grund');
$result = $this->antraglib->denyObjectionAbmeldung($studierendenantrag_id, getAuthUID(), $grund);
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
}
@@ -1,226 +0,0 @@
<?php
/**
* Copyright (C) 2024 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 \Studierendenantrag_model as Studierendenantrag_model;
use \DateTime as DateTime;
/**
* This controller operates between (interface) the JS (GUI) and the AntragLib (back-end)
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Unterbrechung extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and loads the AntragLib
*/
public function __construct()
{
parent::__construct([
'getDetailsForNewAntrag' => self::PERM_LOGGED,
'getDetailsForAntrag' => self::PERM_LOGGED,
'createAntrag' => self::PERM_LOGGED,
'cancelAntrag' => self::PERM_LOGGED
]);
// Configs
$this->load->config('studierendenantrag');
// Libraries
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'studierendenantrag',
'ui'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
public function getDetailsForNewAntrag($prestudent_id)
{
if (!$this->antraglib->isEntitledToCreateAntragFor($prestudent_id, false))
$this->terminateWithError('Forbidden', self::ERROR_TYPE_AUTH, REST_Controller::HTTP_FORBIDDEN);
$result = $this->antraglib->getPrestudentUnterbrechungsBerechtigt($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_no_student'),
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
} elseif ($result == -1) {
$result = $this->antraglib->getDetailsForLastAntrag($prestudent_id, Studierendenantrag_model::TYP_UNTERBRECHUNG);
$data = $this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($data);
} elseif ($result == -2) {
$result = $this->antraglib->getDetailsForLastAntrag($prestudent_id);
$data = $this->getDataOrTerminateWithError($result);
return $this->terminateWithError($this->p->t('studierendenantrag', 'error_antrag_pending', [
'typ' => $this->p->t('studierendenantrag', 'antrag_typ_' . $result->typ)
]));
} elseif ($result == -3) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_stg_blacklist'),
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
}
$result = $this->antraglib->getDetailsForNewAntrag($prestudent_id);
$data = $this->getDataOrTerminateWithError($result);
$data->studiensemester = $this->antraglib->getSemesterForUnterbrechung($prestudent_id, null);
$this->terminateWithSuccess($data);
}
public function getDetailsForAntrag($studierendenantrag_id)
{
if (!$this->antraglib->isEntitledToShowAntrag($studierendenantrag_id))
return show_404();
$result = $this->antraglib->getDetailsForAntrag($studierendenantrag_id);
$data = $this->getDataOrTerminateWithError($result);
if ($data->typ !== Studierendenantrag_model::TYP_UNTERBRECHUNG)
return show_404();
$this->terminateWithSuccess($data);
}
public function createAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('studiensemester', 'Studiensemester', 'required');
$this->form_validation->set_rules('prestudent_id', 'Prestudent ID', 'required');
$this->form_validation->set_rules('grund', 'Grund', 'required');
$this->form_validation->set_rules(
'datum_wiedereinstieg',
'Datum Wiedereinstieg',
'required|callback_isValidDate|callback_isDateInFuture',
[
'isValidDate' => $this->p->t('ui', 'error_invalid_date'),
'isDateInFuture' => $this->p->t('ui', 'error_invalid_date')
]
);
if (!$this->form_validation->run()) {
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$grund = $this->input->post('grund');
$studiensemester = $this->input->post('studiensemester');
$prestudent_id = $this->input->post('prestudent_id');
$datum_wiedereinstieg = $this->input->post('datum_wiedereinstieg');
$dms_id = null;
$result = $this->antraglib->getPrestudentUnterbrechungsBerechtigt($prestudent_id, $studiensemester, $datum_wiedereinstieg);
$result = $this->getDataOrTerminateWithError($result);
if (!$result)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_student'), self::ERROR_TYPE_GENERAL);
elseif ($result == -3)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_stg_blacklist'), self::ERROR_TYPE_GENERAL);
elseif ($result < 0)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_antrag_exists'), self::ERROR_TYPE_GENERAL);
if (isset($_FILES['attachment']) && (!isset($_FILES['attachment']['error']) || $_FILES['attachment']['error'] != UPLOAD_ERR_NO_FILE)) {
$this->load->library('DmsLib');
$dms = $this->config->item('unterbrechung_dms');
if (!count(array_filter($dms, function ($v) {
return $v !== null;
})))
$dms = ['kategorie_kurzbz' => 'Akte'];
$dms['version'] = 0;
$allowed_filetypes = $this->config->item('unterbrechung_dms_filetypes') ?: ['*'];
$result = $this->dmslib->upload($dms, 'attachment', $allowed_filetypes);
$data = $this->getDataOrTerminateWithError($result);
$dms_id = $data['dms_id'];
}
$result = $this->antraglib->createUnterbrechung($prestudent_id, $studiensemester, getAuthUID(), $grund, $datum_wiedereinstieg, $dms_id);
$antragId = $this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getDetailsForAntrag($antragId);
if (!hasData($result))
$this->terminateWithSuccess($antragId);
$this->terminateWithSuccess(getData($result));
}
public function cancelAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('antrag_id', 'Antrag ID', 'required');
if (!$this->form_validation->run()) {
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$antrag_id = $this->input->post('antrag_id');
$result = $this->antraglib->cancelAntrag($antrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getDetailsForAntrag($antrag_id);
if (!hasData($result))
return $this->terminateWithSuccess($antrag_id);
$this->terminateWithSuccess(getData($result));
}
public function isValidDate($date)
{
try {
new DateTime($date);
} catch (Exception $e) {
return false;
}
return true;
}
public function isDateInFuture($date)
{
return new DateTime() < new DateTime($date);
}
}
@@ -1,258 +0,0 @@
<?php
/**
* Copyright (C) 2024 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 \REST_Controller as REST_Controller;
use \Studierendenantragstatus_model as Studierendenantragstatus_model;
/**
* This controller operates between (interface) the JS (GUI) and the AntragLib (back-end)
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Wiederholung extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and loads the FilterCmptLib
*/
public function __construct()
{
parent::__construct([
'getDetailsForNewAntrag' => self::PERM_LOGGED,
'createAntrag' => self::PERM_LOGGED,
'cancelAntrag' => self::PERM_LOGGED,
'getLvs' => self::PERM_LOGGED,
'saveLvs' => ['student/studierendenantrag:w']
]);
// Libraries
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'global',
'studierendenantrag'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Retrieves data of the current studiengang for the current user
*/
public function getDetailsForNewAntrag($prestudent_id)
{
if (!$this->antraglib->isEntitledToCreateAntragFor($prestudent_id, false))
$this->terminateWithError('Forbidden', self::ERROR_TYPE_AUTH, REST_Controller::HTTP_FORBIDDEN);
$result = $this->antraglib->getPrestudentWiederholungsBerechtigt($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_no_student_no_failed_exam'),
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
} elseif ($result == -1) {
$result = $this->antraglib->getDetailsForLastAntrag($prestudent_id, Studierendenantrag_model::TYP_WIEDERHOLUNG);
$data = $this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getFailedExamForPrestudent($prestudent_id, $data->datum, $data->studiensemester_kurzbz);
// NOTE(chris): error handling for this function should already happenden in antraglib->getPrestudentWiederholungsBerechtigt()
$pruefungsdata = current(getData($result));
$data->studiensemester_kurzbz = $pruefungsdata->studiensemester_kurzbz;
$data->lvbezeichnung = $pruefungsdata->lvbezeichnung;
$data->pruefungsdatum = $pruefungsdata->datum;
$this->terminateWithSuccess($data);
} elseif ($result == -2) {
$result = $this->antraglib->getDetailsForLastAntrag($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_antrag_pending', [
'typ' => $this->p->t('studierendenantrag', 'antrag_typ_' . $result->typ)
]),
self::ERROR_TYPE_GENERAL,
REST_Controller::HTTP_BAD_REQUEST
);
} elseif ($result == -3) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_stg_blacklist'),
self::ERROR_TYPE_GENERAL,
REST_Controller::HTTP_BAD_REQUEST
);
}
$result = $this->antraglib->getDetailsForNewAntrag($prestudent_id);
$data = $this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getFailedExamForPrestudent($prestudent_id);
// NOTE(chris): error handling for this function should already happenden in antraglib->getPrestudentWiederholungsBerechtigt()
$pruefungsdata = current(getData($result));
$data->studiensemester_kurzbz = $pruefungsdata->studiensemester_kurzbz;
$data->lvbezeichnung = $pruefungsdata->lvbezeichnung;
$data->pruefungsdatum = $pruefungsdata->datum;
$this->terminateWithSuccess($data);
}
public function createAntrag()
{
$this->createAntragWithStatus(true);
}
public function cancelAntrag()
{
$this->createAntragWithStatus(false);
}
protected function createAntragWithStatus($repeat)
{
$this->load->library('form_validation');
$this->form_validation->set_rules('prestudent_id', 'Prestudent ID', 'required');
$this->form_validation->set_rules('studiensemester', 'Studiensemester', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$prestudent_id = $this->input->post('prestudent_id');
$studiensemester = $this->input->post('studiensemester');
$result = $this->antraglib->getPrestudentWiederholungsBerechtigt($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result) {
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_student'), self::ERROR_TYPE_GENERAL);
} elseif ($result == -1) {
$result = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_prestudentstatus', [
'prestudent_id' => $prestudent_id
]), self::ERROR_TYPE_GENERAL);
if (!in_array(current($result)->status_kurzbz, $this->config->item('antrag_prestudentstatus_whitelist')))
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_student'), self::ERROR_TYPE_GENERAL);
} elseif ($result == -2) {
$this->terminateWithError($this->p->t('studierendenantrag', 'error_antrag_exists'), self::ERROR_TYPE_GENERAL);
} elseif ($result == -3) {
$this->terminateWithError($this->p->t('studierendenantrag', 'error_stg_blacklist'), self::ERROR_TYPE_GENERAL);
}
$result = $this->antraglib->createWiederholung($prestudent_id, $studiensemester, getAuthUID(), $repeat);
$antragId = $this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getDetailsForAntrag($antragId);
if (!hasData($result))
$this->terminateWithSuccess(true);
$data = getData($result);
$result = $this->antraglib->getFailedExamForPrestudent($prestudent_id);
// NOTE(chris): error handling for this function should already happenden in antraglib->getPrestudentWiederholungsBerechtigt()
$pruefungsdata = current(getData($result));
$data->studiensemester_kurzbz = $pruefungsdata->studiensemester_kurzbz;
$data->lvbezeichnung = $pruefungsdata->lvbezeichnung;
$data->pruefungsdatum = $pruefungsdata->datum;
$this->terminateWithSuccess($data);
}
public function getLvs($antrag_id)
{
$result = $this->antraglib->getLvsForAntrag($antrag_id);
if (isError($result)) {
$error = getError($result);
if ($error == 'Forbidden')
$this->terminateWithError(
$error,
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
$this->terminateWithError(
$error,
self::ERROR_TYPE_GENERAL
);
}
$lvs = getData($result);
$this->terminateWithSuccess($lvs);
}
public function saveLvs()
{
$forbiddenLvs = $this->input->post('forbiddenLvs');
$mandatoryLvs = $this->input->post('mandatoryLvs');
$antragsLvs = array_merge($forbiddenLvs, $mandatoryLvs);
if (!$antragsLvs)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_lv'), self::ERROR_TYPE_GENERAL);
$insert = array_map(function ($lv) {
return [
'studierendenantrag_id' => $lv['studierendenantrag_id'],
'lehrveranstaltung_id' => $lv['lehrveranstaltung_id'],
'note' => $lv['zugelassen']
? ($lv['zugelassen'] == 1 ? 0 : $this->config->item('wiederholung_note_angerechnet'))
: $this->config->item('wiederholung_note_nicht_zugelassen'),
'anmerkung' => $lv['anmerkung'],
'insertvon' => getAuthUID(),
'studiensemester_kurzbz' => $lv['studiensemester_kurzbz']
];
}, $antragsLvs);
$antrag_ids = array_unique(array_map(function ($lv) {
return $lv['studierendenantrag_id'];
}, $insert));
foreach ($antrag_ids as $antrag_id) {
$result = $this->StudierendenantragModel->loadIdAndStatusWhere([
'studierendenantrag_id' => $antrag_id
]);
$antrag = $this->getDataOrTerminateWithError($result);
if (!$antrag)
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_no_antrag_found', ['id' => $antrag_id]),
self::ERROR_TYPE_GENERAL
);
$antrag = current($antrag);
if ($antrag->status != Studierendenantragstatus_model::STATUS_CREATED
&& $antrag->status != Studierendenantragstatus_model::STATUS_LVSASSIGNED)
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_antrag_locked'),
self::ERROR_TYPE_GENERAL
);
}
$result = $this->antraglib->saveLvs($insert);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
}
@@ -1,66 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (GUI) and the back-end
* Provides data to the ajax get calls about addresses
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Address extends FHCAPI_Controller
{
public function __construct()
{
parent::__construct([
'getNations' => self::PERM_LOGGED,
'getPlaces' => self::PERM_LOGGED
]);
}
public function getNations()
{
$this->load->model('codex/Nation_model', 'NationModel');
$this->NationModel->addOrder('kurztext');
$result = $this->NationModel->load();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getPlaces($plz)
{
$this->load->model('codex/Gemeinde_model', 'GemeindeModel');
$this->load->library('form_validation');
$this->form_validation->set_data(['address.plz' => $plz]);
$this->form_validation->set_rules('address.plz', 'PLZ', 'numeric|less_than[10000]');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$result = $this->GemeindeModel->getGemeindeByPlz($plz);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
}
@@ -1,233 +0,0 @@
<?php
/**
* Copyright (C) 2024 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 CI3_Events as Events;
/**
* This controller operates between (interface) the JS (GUI) and the back-end
* Provides data to the ajax get calls about the StV Config
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Config extends FHCAPI_Controller
{
public function __construct()
{
// TODO(chris): permissions
parent::__construct([
'student' => ['admin:r', 'assistenz:r'],
'students' => ['admin:r', 'assistenz:r']
]);
// Load Phrases
$this->loadPhrases([
'global',
'person',
'lehre',
'stv',
'konto'
]);
}
public function student()
{
$result = [];
$result['details'] = [
'title' => $this->p->t('stv', 'tab_details'),
'component' => './Stv/Studentenverwaltung/Details/Details.js'
];
$result['notes'] = [
'title' => $this->p->t('stv', 'tab_notes'),
'component' => './Stv/Studentenverwaltung/Details/Notizen.js'
];
$result['contact'] = [
'title' => $this->p->t('stv', 'tab_contact'),
'component' => './Stv/Studentenverwaltung/Details/Kontakt.js',
'config' => [
'showBankaccount' => $this->permissionlib->isBerechtigt('mitarbeiter/bankdaten')
|| $this->permissionlib->isBerechtigt('student/bankdaten')
]
];
$result['prestudent'] = [
'title' => $this->p->t('stv', 'tab_prestudent'),
'component' => './Stv/Studentenverwaltung/Details/Prestudent.js'
];
$result['status'] = [
'title' => 'Status',
'component' => './Stv/Studentenverwaltung/Details/MultiStatus.js'
];
$result['banking'] = [
'title' => $this->p->t('stv', 'tab_banking'),
'component' => './Stv/Studentenverwaltung/Details/Konto.js',
'config' => [
'showZahlungsbestaetigung' => (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN') && ZAHLUNGSBESTAETIGUNG_ANZEIGEN),
'showBuchungsnr' => $this->permissionlib->isBerechtigt('admin'),
'showMahnspanne' => (!defined('FAS_KONTO_SHOW_MAHNSPANNE') || FAS_KONTO_SHOW_MAHNSPANNE===true),
'showCreditpoints' => (defined('FAS_KONTO_SHOW_CREDIT_POINTS') && FAS_KONTO_SHOW_CREDIT_POINTS == 'true'),
'columns' => $this->kontoColumns(),
'additionalCols' => []
]
];
$result['resources'] = [
'title' => $this->p->t('stv', 'tab_resources'),
'component' => './Stv/Studentenverwaltung/Details/Betriebsmittel.js'
];
/* TODO(chris): Ausgeblendet für Testing
$result['grades'] = [
'title' => $this->p->t('stv', 'tab_grades'),
'component' => './Stv/Studentenverwaltung/Details/Noten.js'
];
*/
Events::trigger('stv_conf_student', function & () use (&$result) {
return $result;
});
$this->terminateWithSuccess($result);
}
public function students()
{
$result = [];
$result['banking'] = [
'title' => $this->p->t('stv', 'tab_banking'),
'component' => './Stv/Studentenverwaltung/Details/Konto.js',
'config' => [
'showZahlungsbestaetigung' => (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN') && ZAHLUNGSBESTAETIGUNG_ANZEIGEN),
'showBuchungsnr' => $this->permissionlib->isBerechtigt('admin'),
'showMahnspanne' => (!defined('FAS_KONTO_SHOW_MAHNSPANNE') || FAS_KONTO_SHOW_MAHNSPANNE===true),
'showCreditpoints' => (defined('FAS_KONTO_SHOW_CREDIT_POINTS') && FAS_KONTO_SHOW_CREDIT_POINTS == 'true'),
'columns' => $this->kontoColumnsMultiPerson(),
'additionalCols' => []
]
];
$result['status'] = [
'title' => 'Status',
'component' => './Stv/Studentenverwaltung/Details/MultiStatus.js',
'config' => [
'changeStatusToAbbrecherStgl' => $this->permissionlib->isBerechtigt('admin'),
'changeStatusToAbbrecherStud' => $this->permissionlib->isBerechtigt('admin'),
'changeStatusToUnterbrecher' => $this->permissionlib->isBerechtigt('admin'),
'changeStatusToDiplomand' => $this->permissionlib->isBerechtigt('admin'),
'changeStatusToAbsolvent' => $this->permissionlib->isBerechtigt('admin')
]
];
Events::trigger('stv_conf_students', function & () use (&$result) {
return $result;
});
$this->terminateWithSuccess($result);
}
protected function kontoColumns()
{
return [
'buchungsdatum' => [
'field' => "buchungsdatum",
'title' => $this->p->t('konto', 'buchungsdatum')
],
'buchungstext' => [
'field' => "buchungstext",
'title' => $this->p->t('konto', 'buchungstext')
],
'betrag' => [
'field' => "betrag",
'title' => $this->p->t('konto', 'betrag')
],
'studiensemester_kurzbz' => [
'field' => "studiensemester_kurzbz",
'title' => $this->p->t('lehre', 'studiensemester')
],
'buchungstyp_kurzbz' => [
'field' => "buchungstyp_kurzbz",
'title' => $this->p->t('konto', 'buchungstyp'),
'visible' => false
],
'buchungsnr' => [
'field' => "buchungsnr",
'title' => $this->p->t('konto', 'buchungsnr'),
'visible' => false
],
'insertvon' => [
'field' => "insertvon",
'title' => $this->p->t('global', 'insertvon'),
'visible' => false
],
'insertamum' => [
'field' => "insertamum",
'title' => $this->p->t('global', 'insertamum'),
'visible' => false
],
'kuerzel' => [
'field' => "kuerzel",
'title' => $this->p->t('lehre', 'studiengang'),
'visible' => false
],
'anmerkung' => [
'field' => "anmerkung",
'title' => $this->p->t('global', 'anmerkung')
],
'actions' => [
'title' => $this->p->t('global', 'actions'),
'frozen' => true
]
];
}
protected function kontoColumnsMultiPerson()
{
return [
'person_id' => [
'field' => "person_id",
'title' => $this->p->t('person', 'person_id')
],
'anrede' => [
'field' => "anrede",
'title' => $this->p->t('person', 'anrede'),
'visible' => false
],
'titelpost' => [
'field' => "titelpost",
'title' => $this->p->t('person', 'titelpost'),
'visible' => false
],
'titelpre' => [
'field' => "titelpre",
'title' => $this->p->t('person', 'titelpre'),
'visible' => false
],
'vorname' => [
'field' => "vorname",
'title' => $this->p->t('person', 'vorname')
],
'vornamen' => [
'field' => "vornamen",
'title' => $this->p->t('person', 'vornamen'),
'visible' => false
],
'nachname' => [
'field' => "nachname",
'title' => $this->p->t('person', 'nachname')
]
] + $this->kontoColumns();
}
}
@@ -1,71 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (GUI) and the back-end
* Provides data to the ajax get calls about favorite verbände
* Listens to ajax post calls to change the favorite verbände data
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Favorites extends FHCAPI_Controller
{
public function __construct()
{
parent::__construct([
'index' => self::PERM_LOGGED,
'set' => self::PERM_LOGGED
]);
// Load models
$this->load->model('system/Variable_model', 'VariableModel');
// TODO(chris): variable table might be to small to store favorites!
}
public function index()
{
$result = $this->VariableModel->getVariables(getAuthUID(), ['stv_favorites']);
$data = $this->getDataOrTerminateWithError($result);
if (!$data)
$this->terminateWithSuccess(null);
else
$this->terminateWithSuccess($data['stv_favorites']);
}
public function set()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('favorites', 'Favorites', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$favorites = $this->input->post('favorites');
$result = $this->VariableModel->setVariable(getAuthUID(), 'stv_favorites', $favorites);
$this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess(true);
}
}
@@ -1,84 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (GUI) and the back-end
* Provides data to the ajax get calls about the Studiengang filter
* Listens to ajax post calls to change the Studiengang filter data
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Filter extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and prepares libraries and phrases
*/
public function __construct()
{
parent::__construct([
'getStg' => self::PERM_LOGGED,
'setStg' => self::PERM_LOGGED
]);
// Load models
$this->load->model('system/Variable_model', 'VariableModel');
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Get current setting
*
* @return void
*/
public function getStg()
{
$result = $this->VariableModel->getVariables(getAuthUID(), ['kontofilterstg']);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data['kontofilterstg'] == 'true');
}
/**
* Set current setting
*
* @return void
*/
public function setStg()
{
$this->load->library('form_validation');
$studiengang_kz = $this->input->post('studiengang_kz');
if ($studiengang_kz === null) {
$this->form_validation->set_rules('studiengang_kz', 'Studiengang', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$result = $this->VariableModel->setVariable(getAuthUID(), 'kontofilterstg', $studiengang_kz ? 'true' : 'false');
$this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess(true);
}
}
@@ -1,754 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \DateTime as DateTime;
class Kontakt extends FHCAPI_Controller
{
public function __construct()
{
parent::__construct([
'getAdressen' => ['admin:r', 'assistenz:r'],
'addNewAddress' => ['admin:rw', 'assistenz:rw'],
'addNewContact' => ['admin:rw', 'assistenz:rw'],
'addNewBankverbindung' => ['mitarbeiter/bankdaten:rw', 'student/bankdaten:rw'],
'updateAddress' => ['admin:rw', 'assistenz:rw'],
'updateContact' => ['admin:rw', 'assistenz:rw'],
'updateBankverbindung' => ['mitarbeiter/bankdaten:rw', 'student/bankdaten:rw'],
'loadAddress' => ['admin:r', 'assistenz:r'],
'loadContact' => ['admin:r', 'assistenz:r'],
'loadBankverbindung' => ['mitarbeiter/bankdaten:r', 'student/bankdaten:r'],
'deleteAddress' => ['admin:rw', 'assistenz:rw'],
'deleteContact' => ['admin:rw','assistenz:rw'],
'deleteBankverbindung' => ['mitarbeiter/bankdaten:rw','astudent/bankdaten:rw'],
'getAdressentypen' => ['admin:r', 'assistenz:r'],
'getKontakttypen' => ['admin:r', 'assistenz:r'],
'getFirmen' => ['admin:r', 'assistenz:r'],
'getStandorte' => ['admin:r', 'assistenz:r'],
'getStandorteByFirma' => ['admin:r', 'assistenz:r'],
'getKontakte' => ['admin:r', 'assistenz:r'],
'getBankverbindung' => ['mitarbeiter/bankdaten:r', 'student/bankdaten:r']
]);
// Load Libraries
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
$this->load->library('form_validation');
// Load language phrases
$this->loadPhrases([
'ui',
'person'
]);
// Load models
$this->load->model('person/Adresse_model', 'AdresseModel');
$this->load->model('organisation/standort_model', 'StandortModel');
$this->load->model('ressource/firma_model', 'FirmaModel');
$this->load->model('person/Kontakt_model', 'KontaktModel');
// Extra Permissionchecks
$permsMa = [];
$permsStud = [];
switch ($this->router->method) {
case 'getBankverbindung':
case 'loadBankverbindung':
$permsMa = ['mitarbeiter/bankdaten:r'];
$permsStud = ['student/bankdaten:r'];
break;
case 'addNewBankverbindung':
case 'updateBankverbindung':
case 'deleteBankverbindung':
$permsMa = ['mitarbeiter/bankdaten:rw'];
$permsStud = ['student/bankdaten:rw'];
break;
case 'getAdressen':
case 'getKontakte':
case 'loadAddress':
case 'loadContact':
$permsMa = $permsStud = ['admin:r', 'assistenz:r'];
break;
case 'addNewAddress':
case 'addNewContact':
case 'updateAddress':
case 'updateContact':
case 'deleteAddress':
case 'deleteContact':
$permsMa = $permsStud = ['admin:rw', 'assistenz:rw'];
break;
}
if ($this->router->method == 'getAdressen'
|| $this->router->method == 'getKontakte'
|| $this->router->method == 'getBankverbindung'
|| $this->router->method == 'addNewAddress'
|| $this->router->method == 'addNewContact'
|| $this->router->method == 'addNewBankverbindung'
) {
$person_id = current(array_slice($this->uri->rsegments, 2));
$this->checkPermissionsForPerson($person_id, $permsMa, $permsStud);
} elseif ($this->router->method == 'loadAddress'
|| $this->router->method == 'loadContact'
|| $this->router->method == 'loadBankverbindung'
|| $this->router->method == 'updateAddress'
|| $this->router->method == 'updateContact'
|| $this->router->method == 'updateBankverbindung'
|| $this->router->method == 'deleteAddress'
|| $this->router->method == 'deleteContact'
|| $this->router->method == 'deleteBankverbindung'
) {
$id = current(array_slice($this->uri->rsegments, 2));
$model = 'person/Adresse_model';
if ($this->router->method == 'loadContact'
|| $this->router->method == 'updateContact'
|| $this->router->method == 'deleteContact'
) {
$model = 'person/Kontakt_model';
} elseif ($this->router->method == 'loadBankverbindung'
|| $this->router->method == 'updateBankverbindung'
|| $this->router->method == 'deleteBankverbindung'
) {
$model = 'person/Bankverbindung_model';
}
$this->load->model($model, 'TempModel');
$result = $this->TempModel->load($id);
$data = $this->getDataOrTerminateWithError($result);
if (!$result)
show_404();
$person_id = current($data)->person_id;
$this->checkPermissionsForPerson($person_id, $permsMa, $permsStud);
}
}
public function getAdressen($person_id)
{
$this->AdresseModel->addSelect('public.tbl_adresse.*');
$this->AdresseModel->addSelect('t.*');
$this->AdresseModel->addSelect('f.firma_id');
$this->AdresseModel->addSelect('f.name as firmenname');
$this->AdresseModel->addJoin('public.tbl_adressentyp t', 'ON (t.adressentyp_kurzbz = public.tbl_adresse.typ)');
$this->AdresseModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = public.tbl_adresse.firma_id)', 'LEFT');
$result = $this->AdresseModel->loadWhere(
array('person_id' => $person_id)
);
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess((getData($result) ?: []));
}
public function addNewAddress($person_id)
{
$this->form_validation->set_rules('plz', 'PLZ', 'required|numeric', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'PLZ']),
'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'PLZ'])
]);
if(isset($_POST['gemeinde']) && isset($_POST['ort']))
$this->form_validation->set_rules('plz', 'Postleitzahl', 'callback_validateLocationCombination', [
'validateLocationCombination' => $this->p->t('ui', 'error_location_combination')
]);
if ($this->form_validation->run() == false)
{
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$uid = getAuthUID();
$co_name = isset($_POST['co_name']) ? $_POST['co_name'] : null;
$strasse = isset($_POST['strasse']) ? $_POST['strasse'] : null;
$ort = isset($_POST['ort']) ? $_POST['ort'] : null;
$gemeinde = isset($_POST['gemeinde']) ? $_POST['gemeinde'] : null;
$nation = isset($_POST['nation']) ? $_POST['nation'] : null;
$name = isset($_POST['name']) ? $_POST['name'] : null;
$typ = isset($_POST['typ']) ? $_POST['typ'] : null;
$anmerkung = isset($_POST['anmerkung']) ? $_POST['anmerkung'] : null;
if(isset($_POST['firma']))
{
$firma_id = $_POST['firma']['firma_id'];
}
else
$firma_id = null;
$result = $this->AdresseModel->insert(
[
'person_id' => $person_id,
'strasse' => $strasse,
'insertvon' => $uid,
'insertamum' => date('c'),
'plz' => $_POST['plz'],
'ort' => $ort,
'gemeinde' => $gemeinde,
'nation' => $nation,
'heimatadresse' => $_POST['heimatadresse'],
'zustelladresse' => $_POST['zustelladresse'],
'co_name' => $co_name,
'typ' => $typ,
'firma_id' => $firma_id,
'name' => $name,
'rechnungsadresse' => $_POST['rechnungsadresse'],
'anmerkung' => $anmerkung
]
);
if (isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->outputJsonSuccess(true);
}
public function updateAddress($address_id)
{
$uid = getAuthUID();
$this->form_validation->set_rules('plz', 'PLZ', 'required|numeric', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'PLZ']),
'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'PLZ'])
]);
if(isset($_POST['gemeinde']) && isset($_POST['ort']))
$this->form_validation->set_rules('plz', 'Postleitzahl', 'callback_validateLocationCombination', [
'validateLocationCombination' => $this->p->t('ui', 'error_location_combination')
]);
if ($this->form_validation->run() == false)
{
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$this->load->model('person/Adresse_model', 'AdresseModel');
if(!$address_id)
{
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Adresse_id']), self::ERROR_TYPE_GENERAL);
}
if(isset($_POST['firma']))
{
$firma_id = $_POST['firma']['firma_id'];
}
elseif(isset($_POST['firma_id']))
{
$firma_id = $_POST['firma_id'];
}
else
$firma_id = null;
$person_id = isset($_POST['person_id']) ? $_POST['person_id'] : null;
$co_name = isset($_POST['co_name']) ? $_POST['co_name'] : null;
$strasse = isset($_POST['strasse']) ? $_POST['strasse'] : null;
$ort = isset($_POST['ort']) ? $_POST['ort'] : null;
$gemeinde = isset($_POST['gemeinde']) ? $_POST['gemeinde'] : null;
$nation = isset($_POST['nation']) ? $_POST['nation'] : null;
$name = isset($_POST['name']) ? $_POST['name'] : null;
$typ = isset($_POST['typ']) ? $_POST['typ'] : null;
$anmerkung = isset($_POST['anmerkung']) ? $_POST['anmerkung'] : null;
$result = $this->AdresseModel->update(
[
'adresse_id' => $address_id
],
[ 'person_id' => $person_id,
'strasse' => $strasse,
'updatevon' => $uid,
'updateamum' => date('c'),
'plz' => $_POST['plz'],
'ort' => $ort,
'gemeinde' => $gemeinde,
'nation' => $nation,
'heimatadresse' => $_POST['heimatadresse'],
'zustelladresse' => $_POST['zustelladresse'],
'co_name' => $co_name,
'typ' => $typ,
'firma_id' => $firma_id,
'name' => $name,
'rechnungsadresse' => $_POST['rechnungsadresse'],
'anmerkung' => $anmerkung
]
);
if (isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->outputJsonSuccess(true);
}
public function loadAddress($adresse_id)
{
$this->load->model('person/Adresse_model', 'AdresseModel');
$this->AdresseModel->addSelect('public.tbl_adresse.*');
$this->AdresseModel->addSelect('t.*');
$this->AdresseModel->addSelect('f.firma_id');
$this->AdresseModel->addSelect('f.name as firmenname');
$this->AdresseModel->addJoin('public.tbl_adressentyp t', 'ON (t.adressentyp_kurzbz = public.tbl_adresse.typ)');
$this->AdresseModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = public.tbl_adresse.firma_id)', 'LEFT');
$this->AdresseModel->addLimit(1);
$result = $this->AdresseModel->loadWhere(
array('adresse_id' => $adresse_id)
);
if (isError($result)) {
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
if (!hasData($result))
{
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Adresse_id']), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess(current(getData($result)) ? : null);
}
public function deleteAddress($adresse_id)
{
$this->load->model('person/Adresse_model', 'AdresseModel');
$result = $this->AdresseModel->load([
'adresse_id'=> $adresse_id,
]);
if(isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$result = current(getData($result));
if($result->heimatadresse)
$this->terminateWithError($this->p->t('person', 'error_deleteHomeAdress'), self::ERROR_TYPE_GENERAL);
$result = $this->AdresseModel->delete(
array('adresse_id' => $adresse_id)
);
if (isError($result))
{
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
if (!hasData($result))
{
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Adresse_id']), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(current(getData($result)) ? : null);
}
public function getAdressentypen()
{
$this->load->model('person/Adressentyp_model', 'AdressentypModel');
$result = $this->AdressentypModel->load();
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess(getData($result) ?: []);
}
public function getFirmen($searchString)
{
$this->load->model('ressource/firma_model', 'FirmaModel');
$result = $this->FirmaModel->searchFirmen($searchString);
if (isError($result)) {
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess($result ?: []);
}
public function getStandorte($searchString)
{
$this->load->model('organisation/standort_model', 'StandortModel');
$result = $this->StandortModel->searchStandorte($searchString);
if (isError($result)) {
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess($result ?: []);
}
public function getStandorteByFirma($firma_id)
{
$this->load->model('organisation/standort_model', 'StandortModel');
$result = $this->StandortModel->getStandorteByFirma($firma_id);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getKontakte($person_id)
{
$this->KontaktModel->addSelect("public.tbl_kontakt.*,
TO_CHAR (CASE
WHEN public.tbl_kontakt.updateamum >= public.tbl_kontakt.insertamum
THEN public.tbl_kontakt.updateamum
ELSE public.tbl_kontakt.insertamum
END::timestamp, 'DD.MM.YYYY HH24:MI:SS') AS lastUpdate, st.bezeichnung, f.name");
$this->StandortModel->addJoin('public.tbl_standort st', 'ON (public.tbl_kontakt.standort_id = st.standort_id)', 'LEFT');
$this->FirmaModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = st.firma_id)', 'LEFT');
$result = $this->KontaktModel->loadWhere(
array('person_id' => $person_id)
);
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess((getData($result) ?: []));
}
public function getKontakttypen()
{
$this->load->model('person/Kontakttyp_model', 'KontakttypModel');
$result = $this->KontakttypModel->load();
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
else
{
$this->terminateWithSuccess(getData($result) ?: []);
}
}
public function loadContact($kontakt_id)
{
$this->load->model('person/Kontakt_model', 'KontaktModel');
$this->KontaktModel->addSelect('*, public.tbl_kontakt.*');
$this->KontaktModel->addSelect('st.kurzbz');
$this->KontaktModel->addJoin('public.tbl_standort st', 'ON (public.tbl_kontakt.standort_id = st.standort_id)', 'LEFT');
$this->FirmaModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = st.firma_id)', 'LEFT');
$this->KontaktModel->addLimit(1);
$result = $this->KontaktModel->loadWhere(
array('kontakt_id' => $kontakt_id)
);
if (isError($result)) {
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
if (!hasData($result))
{
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Kontakt_id']), self::ERROR_TYPE_GENERAL);
}
// $this->outputJsonSuccess(current(getData($result)));
$this->terminateWithSuccess(current(getData($result)));
}
public function addNewContact($person_id)
{
if(($_POST['kontakttyp'] == 'email' && isset($_POST['kontakt'])))
{
$this->form_validation->set_rules('kontakt', 'Kontakt', 'required|valid_email', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Kontakt']),
'valid_email' => $this->p->t('ui', 'error_fieldNoValidEmail', ['field' => 'Kontakt'])
]);
}
else
{
$this->form_validation->set_rules('kontakt', 'Kontakt', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Kontakt'])
]);
}
if ($this->form_validation->run() == false)
{
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$this->load->model('person/Kontakt_model', 'KontaktModel');
$uid = getAuthUID();
$kontakttyp = $this->input->post('kontakttyp');
$anmerkung = $this->input->post('anmerkung');
$kontakt = $this->input->post('kontakt');
$ext_id = $this->input->post('ext_id');
$standort_id = $this->input->post('standort_id');
$result = $this->KontaktModel->insert(
[
'person_id' => $person_id,
'kontakttyp' => $kontakttyp,
'anmerkung' => $anmerkung,
'kontakt' => $kontakt,
'zustellung' => $_POST['zustellung'],
'insertvon' => $uid,
'insertamum' => date('c'),
'standort_id' => $standort_id,
'ext_id' => $ext_id
]
);
if (isError($result))
{
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
return $this->outputJsonSuccess(true);
}
public function updateContact($kontakt_id)
{
$this->load->model('person/Kontakt_model', 'KontaktModel');
if(!$kontakt_id)
{
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Kontakt_id']), self::ERROR_TYPE_GENERAL);
}
if(($_POST['kontakttyp'] == 'email' && isset($_POST['kontakt'])))
{
$this->form_validation->set_rules('kontakt', 'Kontakt', 'required|valid_email', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Kontakt']),
'valid_email' => $this->p->t('ui', 'error_fieldNoValidEmail', ['field' => 'Kontakt'])
]);
}
else
{
$this->form_validation->set_rules('kontakt', 'Kontakt', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Kontakt'])
]);
}
if ($this->form_validation->run() == false)
{
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
/* if(isset($_POST['standort']))
{
$standort_id = $_POST['standort']['standort_id'];
}
else
$standort_id = null;*/
$uid = getAuthUID();
$kontakttyp = $this->input->post('kontakttyp');
$anmerkung = $this->input->post('anmerkung');
$kontakt = $this->input->post('kontakt');
$ext_id = $this->input->post('ext_id');
$person_id = $this->input->post('person_id');
$standort_id = $this->input->post('standort_id');
//return $this->terminateWithError("in update " . $standort_id, self::ERROR_TYPE_GENERAL);
$result = $this->KontaktModel->update(
[
'kontakt_id' => $kontakt_id
],
[
'person_id' => $person_id,
'kontakttyp' => $kontakttyp,
'anmerkung' => $anmerkung,
'kontakt' => $kontakt,
'zustellung' => $_POST['zustellung'],
'insertvon' => $uid,
'insertamum' => date('c'),
'standort_id' => $standort_id,
'ext_id' => $ext_id
]
);
if (isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->outputJsonSuccess(true);
}
public function deleteContact($kontakt_id)
{
$this->load->model('person/Kontakt_model', 'KontaktModel');
$result = $this->KontaktModel->delete(
array('kontakt_id' => $kontakt_id)
);
if (isError($result))
{
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
elseif (!hasData($result))
{
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Kontakt_id']), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(current(getData($result)) ? : null);
}
public function getBankverbindung($person_id)
{
$this->load->model('person/Bankverbindung_model', 'BankverbindungModel');
$this->BankverbindungModel->addSelect('*');
$result = $this->BankverbindungModel->loadWhere(
array('person_id' => $person_id)
);
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess((getData($result) ?: []));
}
public function addNewBankverbindung($person_id)
{
$this->form_validation->set_rules('iban', 'IBAN', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'IBAN'])
]);
$this->form_validation->set_rules('typ', 'TYP', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'TYP'])
]);
if ($this->form_validation->run() == false)
{
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$this->load->model('person/Bankverbindung_model', 'BankverbindungModel');
$ext_id = $this->input->post('ext_id');
$oe_kurzbz = $this->input->post('oe_kurzbz');
$orgform_kurzbz = $this->input->post('orgform_kurzbz');
$name = $this->input->post('name');
$anschrift = $this->input->post('anschrift');
$bic = $this->input->post('bic');
$blz = $this->input->post('blz');
$kontonr = $this->input->post('kontonr');
$result = $this->BankverbindungModel->insert(
[
'person_id' => $person_id,
'name' => $name,
'anschrift' => $anschrift,
'bic' => $bic,
'iban' => $_POST['iban'],
'blz' => $blz,
'kontonr' => $kontonr,
'insertvon' => 'uid',
'insertamum' => date('c'),
'typ' => $_POST['typ'],
'verrechnung' => $_POST['verrechnung'],
'ext_id' => $ext_id,
'oe_kurzbz' => $oe_kurzbz,
'orgform_kurzbz' => $orgform_kurzbz
]
);
if (isError($result))
{
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
return $this->outputJsonSuccess(true);
}
public function loadBankverbindung($bankverbindung_id)
{
$this->load->model('person/Bankverbindung_model', 'BankverbindungModel');
$this->BankverbindungModel->addSelect('*');
$this->BankverbindungModel->addLimit(1);
$result = $this->BankverbindungModel->loadWhere(
array('bankverbindung_id' => $bankverbindung_id)
);
if (isError($result))
{
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
if (!hasData($result))
{
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Bankverbindung_id']), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess(current(getData($result)));
}
public function updateBankverbindung($bankverbindung_id)
{
$this->form_validation->set_rules('iban', 'IBAN', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'IBAN'])
]);
$this->form_validation->set_rules('typ', 'TYP', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'TYP'])
]);
if ($this->form_validation->run() == false)
{
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$this->load->model('person/Bankverbindung_model', 'BankverbindungModel');
if(!$bankverbindung_id)
{
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Bankverbindung_id']), self::ERROR_TYPE_GENERAL);
}
$uid = getAuthUID();
$result = $this->BankverbindungModel->update(
[
'bankverbindung_id' => $bankverbindung_id
],
[
'person_id' => $_POST['person_id'],
'name' => $_POST['name'],
'anschrift' => $_POST['anschrift'],
'bic' => $_POST['bic'],
'iban' => $_POST['iban'],
'blz' => $_POST['blz'],
'kontonr' => $_POST['kontonr'],
'updatevon' => $uid,
'updateamum' => date('c'),
'typ' => $_POST['typ'],
'verrechnung' => $_POST['verrechnung'],
'ext_id' => $_POST['ext_id'],
'oe_kurzbz' => $_POST['oe_kurzbz'],
'orgform_kurzbz' => $_POST['orgform_kurzbz']
]
);
if (isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->outputJsonSuccess(true);
}
public function deleteBankverbindung($bankverbindung_id)
{
$this->load->model('person/Bankverbindung_model', 'BankverbindungModel');
$result = $this->BankverbindungModel->delete(
array('bankverbindung_id' => $bankverbindung_id)
);
if (isError($result))
{
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
if (!hasData($result))
{
$this->outputJson($result);
}
return $this->terminateWithSuccess(current(getData($result)) ? : null);
}
public function validateLocationCombination()
{
$this->load->model('codex/Gemeinde_model', 'GemeindeModel');
return $this->GemeindeModel->checkLocation($_POST['plz'], $_POST['gemeinde'], $_POST['ort']);
}
}
@@ -1,495 +0,0 @@
<?php
/**
* Copyright (C) 2024 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 CI3_Events as Events;
/**
* This controller operates between (interface) the JS (GUI) and the back-end
* Provides data to the ajax get calls about a Konto
* Listens to ajax post calls to change the Konto data
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Konto extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and prepares libraries and phrases
*/
public function __construct()
{
parent::__construct([
'get' => 'student/stammdaten:r',
'getBuchungstypen' => self::PERM_LOGGED,
'checkDoubles' => ['admin:r', 'assistenz:r'],
'insert' => ['admin:w', 'assistenz:w'],
'counter' => ['admin:w', 'assistenz:w'],
'update' => ['admin:w', 'assistenz:w'],
'delete' => ['admin:w', 'assistenz:w']
]);
// Load models
$this->load->model('crm/Konto_model', 'KontoModel');
// Load language phrases
$this->loadPhrases([
'konto'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Get details for a prestudent
*
* @return void
*/
public function get()
{
$this->load->library('form_validation');
$person_id = $this->input->post('person_id');
if (!$person_id || !is_array($person_id)) {
$this->form_validation->set_rules('person_id', 'Person ID', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$studiengang_kz = $this->input->post('studiengang_kz');
if ($this->input->post('only_open')) {
$result = $this->KontoModel->getOffeneBuchungen($person_id, $studiengang_kz);
} else {
$result = $this->KontoModel->getAlleBuchungen($person_id, $studiengang_kz);
}
$result = $this->getDataOrTerminateWithError($result);
// sort into tree
$childs = [];
$data = [];
foreach ($result as $entry) {
if ($entry->buchungsnr_verweis) {
if (isset($data[$entry->buchungsnr_verweis])) {
if (!isset($data[$entry->buchungsnr_verweis]->_children))
$data[$entry->buchungsnr_verweis]->_children = [];
$data[$entry->buchungsnr_verweis]->_children[] = $entry;
} else {
if (!isset($childs[$entry->buchungsnr_verweis]))
$childs[$entry->buchungsnr_verweis] = [];
$childs[$entry->buchungsnr_verweis][] = $entry;
}
} else {
$data[$entry->buchungsnr] = $entry;
if (isset($childs[$entry->buchungsnr]))
$entry->_children = $childs[$entry->buchungsnr];
}
}
$this->terminateWithSuccess(array_values($data));
}
/**
* Get list of Buchungstypen
*
* @return void
*/
public function getBuchungstypen()
{
$this->load->model('crm/Buchungstyp_model', 'BuchungstypModel');
$result = $this->BuchungstypModel->load();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
/**
* Check double Buchungen
*
* @return void
*/
public function checkDoubles()
{
if (!defined('FAS_DOPPELTE_BUCHUNGSTYPEN_CHECK') || !FAS_DOPPELTE_BUCHUNGSTYPEN_CHECK)
$this->terminateWithSuccess(false);
$this->load->library('form_validation');
$person_ids = $this->input->post('person_id');
if (!$person_ids || !is_array($person_ids)) {
$person_ids = [$person_ids];
$this->form_validation->set_rules('person_id', 'Person ID', 'required');
}
$this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'required');
$this->form_validation->set_rules('buchungstyp_kurzbz', 'Buchungstyp', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$buchungstypen = unserialize(FAS_DOPPELTE_BUCHUNGSTYPEN_CHECK);
$buchung = $this->input->post('buchungstyp_kurzbz');
if (!isset($buchungstypen[$buchung]))
$this->terminateWithSuccess(false);
$result = $this->KontoModel->checkDoubleBuchung($person_ids, $this->input->post('studiensemester_kurzbz'), $buchungstypen[$buchung]);
$result = $this->getDataOrTerminateWithError($result);
if (!$result)
$this->terminateWithSuccess(false);
$persons = array_map(function ($row) {
return $row->nachname . ' ' . $row->vorname;
}, $result);
$result = $this->p->t('konto', 'confirm_overwrite') . "\n";
if (count($persons) > 10) {
$result .= "-" . implode("\n-", array_slice($persons, 0, 10)) . "\n";
if (count($persons) == 11) {
$result .= "\n" . $this->p->t('konto', 'confirm_overwrite_1_add_pers');
} else {
$result .= "\n" . $this->p->t('konto', 'confirm_overwrite_x_add_pers', [
'x' => count($persons) - 10
]);
}
} else {
$result .= "-" . implode("\n-", $persons) . "\n";
}
$result .= $this->p->t('konto', 'confirm_overwrite_proceed');
$this->addError($result, 'confirm');
$this->terminateWithSuccess(true);
}
/**
* Save Buchung
*
* @return void
*/
public function insert()
{
$this->load->library('form_validation');
$person_ids = $this->input->post('person_id');
if (!$person_ids || !is_array($person_ids)) {
$person_ids = [$person_ids];
$this->form_validation->set_rules('person_id', 'Person ID', 'required');
}
$this->form_validation->set_rules('betrag', 'Betrag', 'numeric');
$this->form_validation->set_rules('buchungsdatum', 'Buchungsdatum', 'is_valid_date');
$this->form_validation->set_rules('buchungstext', 'Buchungstext', 'max_length[256]');
$this->form_validation->set_rules('mahnspanne', 'Mahnspanne', 'integer');
$this->form_validation->set_rules('buchungstyp_kurzbz', 'Buchungstyp', 'required|max_length[32]');
$this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'required|max_length[16]');
$this->form_validation->set_rules('studiengang_kz', 'Studiengang', 'required|has_permissions_for_stg[admin:rw,assistenz:rw]');
$this->form_validation->set_rules('credit_points', 'Credit Points', 'numeric');
Events::trigger('konto_insert_validation', $this->form_validation);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$allowed = [
'betrag',
'buchungsdatum',
'buchungstext',
'mahnspanne',
'buchungstyp_kurzbz',
'studiensemester_kurzbz',
'studiengang_kz',
'credit_points',
'anmerkung'
];
$data = [
'insertamum' => date('c'),
'insertvon' => getAuthUID()
];
foreach ($allowed as $field)
if ($this->input->post($field) !== null)
$data[$field] = $this->input->post($field);
if (defined('FAS_BUCHUNGSTYP_FIXE_KOSTENSTELLE') && isset(unserialize(FAS_BUCHUNGSTYP_FIXE_KOSTENSTELLE)[$data['buchungstyp_kurzbz']])) {
$data['kostenstelle'] = unserialize(FAS_BUCHUNGSTYP_FIXE_KOSTENSTELLE)[$data['buchungstyp_kurzbz']];
}
$result = [];
foreach ($person_ids as $person_id) {
$id = $this->KontoModel->insert(array_merge($data, ['person_id' => $person_id]));
if (isError($id)) {
$this->addError(getError($id), self::ERROR_TYPE_DB);
} else {
$kontodata = $this->KontoModel->withAdditionalInfo()->load(getData($id));
if (isError($kontodata))
$this->addError(getError($kontodata), self::ERROR_TYPE_DB);
else
$result[] = current(getData($kontodata));
}
}
if ($result)
$this->terminateWithSuccess($result);
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
}
/**
* Save Counter Buchung
*
* @return void
*/
public function counter()
{
$this->load->library('form_validation');
$buchungsnrs = $this->input->post('buchungsnr');
if (!$buchungsnrs || !is_array($buchungsnrs)) {
$buchungsnrs = $buchungsnrs ? [$buchungsnrs] : [];
$this->form_validation->set_rules('buchungsnr', 'Buchungsnr', 'required');
}
$this->form_validation->set_rules('buchungsdatum', 'Buchungsdatum', 'is_valid_date');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$data = [];
$rules = [];
foreach ($buchungsnrs as $k => $buchungsnr) {
$result = $this->KontoModel->load($buchungsnr);
if (isError($result)) {
$rules[] = [
'field' => 'buchung[' . $k . ']',
'label' => 'Buchung #' . $buchungsnr,
'rules' => 'required',
'errors' => [
'required' => getError($result)
]
];
} elseif (!hasData($result)) {
$rules[] = [
'field' => 'buchung[' . $k . ']',
'label' => 'Buchung #' . $buchungsnr,
'rules' => 'required'
];
} else {
$data[$k] = get_object_vars(current(getData($result)));
$rules[] = [
'field' => 'buchung[' . $k . '][buchungsnr]',
'label' => 'Buchung # ' . $buchungsnr,
'rules' => 'required|numeric'
];
$rules[] = [
'field' => 'buchung[' . $k . '][studiengang_kz]',
'label' => 'Buchung # ' . $buchungsnr,
'rules' => 'required|has_permissions_for_stg[admin:rw,assistenz:rw]'
];
$rules[] = [
'field' => 'buchung[' . $k . '][buchungsnr_verweis]',
'label' => 'Buchung # ' . $buchungsnr,
'rules' => 'regex_match[/^$/]',
'errors' => [
'regex_match' => $this->p->t('konto', 'error_counter_level')
]
];
}
}
$this->form_validation->reset_validation();
$this->form_validation->set_data(['buchung' => $data]);
$this->form_validation->set_rules($rules);
Events::trigger('konto_counter_validation', $this->form_validation);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$buchungsdatum = $this->input->post('buchungsdatum');
$newItems = [];
foreach ($data as $buchung) {
$result = $this->KontoModel->getDifferenz($buchung['buchungsnr']);
if (isError($result)) {
$this->addError(getError($result), self::ERROR_TYPE_GENERAL);
continue;
}
$betrag = $result->retval;
if ($betrag === null) {
$this->addError($this->p->t(
'konto',
'error_missing',
$buchung
), self::ERROR_TYPE_GENERAL);
continue;
}
$result = $this->KontoModel->insert([
'person_id' => $buchung['person_id'],
'studiengang_kz' => $buchung['studiengang_kz'],
'studiensemester_kurzbz' => $buchung['studiensemester_kurzbz'],
'buchungstext' => $buchung['buchungstext'],
'buchungstyp_kurzbz' => $buchung['buchungstyp_kurzbz'],
'credit_points' => $buchung['credit_points'],
'zahlungsreferenz' => $buchung['zahlungsreferenz'],
'betrag' => $betrag,
'buchungsdatum' => $buchungsdatum,
'mahnspanne' => '0',
'buchungsnr_verweis' => $buchung['buchungsnr'],
'insertamum' => date('c'),
'insertvon' => getAuthUID(),
'anmerkung' => ''
]);
if (isError($result)) {
$this->addError(getError($result), self::ERROR_TYPE_GENERAL);
continue;
}
$newItems = null;
// TODO(chris): get as tree?
/*$result = $this->KontoModel->withAdditionalInfo()->load($result->retval);
if (!hasData($result))
$newItems = null;
elseif ($newItems !== null)
$newItems[] = current(getData($result));*/
}
$this->terminateWithSuccess($newItems);
}
/**
* Save Buchung
*
* @return void
*/
public function update()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('buchungsnr', 'Buchungsnr', 'required');
$this->form_validation->set_rules('betrag', 'Betrag', 'numeric');
$this->form_validation->set_rules('buchungsdatum', 'Buchungsdatum', 'is_valid_date');
$this->form_validation->set_rules('buchungstext', 'Buchungstext', 'max_length[256]');
$this->form_validation->set_rules('mahnspanne', 'Mahnspanne', 'integer');
$this->form_validation->set_rules('buchungstyp_kurzbz', 'Buchungstyp', 'required|max_length[32]');
$this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'required|max_length[16]');
$this->form_validation->set_rules('studiengang_kz', 'Studiengang', 'required|has_permissions_for_stg[admin:rw,assistenz:rw]');
$this->form_validation->set_rules('credit_points', 'Credit Points', 'numeric');
Events::trigger('konto_update_validation', $this->form_validation);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$id = $this->input->post('buchungsnr');
$allowed = [
'betrag',
'buchungsdatum',
'buchungstext',
'mahnspanne',
'buchungstyp_kurzbz',
'studiensemester_kurzbz',
'studiengang_kz',
'credit_points',
'anmerkung'
];
$data = [
'updateamum' => date('c'),
'updatevon' => getAuthUID()
];
foreach ($allowed as $field)
if ($this->input->post($field) !== null)
$data[$field] = $this->input->post($field);
$result = $this->KontoModel->update($id, $data);
$this->getDataOrTerminateWithError($result);
$result = null;
// TODO(chris): get as tree?
/*$result = $this->KontoModel->withAdditionalInfo()->load($id);
#$result = $this->getDataOrTerminateWithError($result);
if (isError($result))
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
$result = $result->retval;*/
$this->terminateWithSuccess($result);
}
/**
* Delete Buchung
*
* @return void
*/
public function delete()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('buchungsnr', 'Buchungsnr', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$buchungsnr = $this->input->post('buchungsnr');
$result = $this->KontoModel->load($buchungsnr);
$result = $this->getDataOrTerminateWithError($result);
if (!$result)
$this->terminateWithError($this->p->t('konto', 'error_missing', [
'buchungsnr' => $buchungsnr
]));
$_POST['studiengang_kz'] = current($result)->studiengang_kz;
$this->form_validation->set_rules('studiengang_kz', 'Studiengang', 'has_permissions_for_stg[admin:rw,assistenz:rw]');
Events::trigger('konto_delete_validation', $this->form_validation);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
Events::trigger('konto_delete', $buchungsnr);
$result = $this->KontoModel->delete($buchungsnr);
if (isError($result)) {
if (getCode($result) != 42)
$this->terminateWithError(getError($result));
$this->terminateWithError($this->p->t('konto', 'error_delete_level'));
}
$this->terminateWithSuccess();
}
}
@@ -1,147 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (GUI) and the back-end
* Provides data to the ajax get calls about generally used lists
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Lists extends FHCAPI_Controller
{
public function __construct()
{
parent::__construct([
'getStudiensemester' => self::PERM_LOGGED,
'getStgs' => self::PERM_LOGGED,
'getSprachen' => self::PERM_LOGGED,
'getGeschlechter' => self::PERM_LOGGED,
'getAusbildungen' => self::PERM_LOGGED,
'getOrgforms' => self::PERM_LOGGED,
'getStati' => self::PERM_LOGGED
]);
}
public function getStudiensemester()
{
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
$this->StudiensemesterModel->addOrder('ende');
$result = $this->StudiensemesterModel->load();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getStgs()
{
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
$this->StudiengangModel->addSelect('*');
$this->StudiengangModel->addSelect('UPPER(typ || kurzbz) AS kuerzel');
$this->StudiengangModel->addOrder('typ');
$this->StudiengangModel->addOrder('kurzbz');
$result = $this->StudiengangModel->load();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getSprachen()
{
$this->load->model('system/Sprache_model', 'SpracheModel');
$this->SpracheModel->addOrder('sprache');
$result = $this->SpracheModel->load();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getGeschlechter()
{
$this->load->model('person/Geschlecht_model', 'GeschlechtModel');
$this->GeschlechtModel->addOrder('sort');
$this->GeschlechtModel->addOrder('geschlecht');
$this->GeschlechtModel->addSelect('*');
#$this->GeschlechtModel->addTranslatedSelect("bezeichnung_mehrsprachig", "bezeichnung");
$this->GeschlechtModel->addSelect("bezeichnung_mehrsprachig[(SELECT index FROM public.tbl_sprache WHERE sprache=" . $this->GeschlechtModel->escape(DEFAULT_LANGUAGE) . " LIMIT 1)] AS bezeichnung");
$result = $this->GeschlechtModel->load();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getAusbildungen()
{
$this->load->model('codex/Ausbildung_model', 'AusbildungModel');
$this->AusbildungModel->addOrder('ausbildungcode');
$result = $this->AusbildungModel->load();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getOrgforms()
{
$this->load->model('codex/Orgform_model', 'OrgformModel');
$this->OrgformModel->addOrder('bezeichnung');
$result = $this->OrgformModel->loadWhere(['rolle' => true]);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getStati()
{
$lang = getUserLanguage();
$this->load->model('crm/Status_model', 'StatusModel');
$this->StatusModel->addSelect('*');
#$this->StatusModel->addTranslatedSelect('bezeichnung_mehrsprachig', 'bezeichnung');
$this->StatusModel->addSelect(
'bezeichnung_mehrsprachig[(
SELECT index
FROM public.tbl_sprache
WHERE sprache=' . $this->StatusModel->escape($lang) . '
LIMIT 1
)] AS bezeichnung',
false
);
#$this->StatusModel->addOrder('ext_id');
$result = $this->StatusModel->load();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
}
@@ -1,384 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \DateTime as DateTime;
class Notiz extends Notiz_Controller
{
public function __construct()
{
parent::__construct([
'getUid' => ['admin:r', 'assistenz:r'],
'getNotizen' => ['admin:r', 'assistenz:r'],
'loadNotiz' => ['admin:r', 'assistenz:r'], // TODO(manu): self::PERM_LOGGED
'addNewNotiz' => ['admin:rw', 'assistenz:rw'], // TODO(manu): self::PERM_LOGGED
'updateNotiz' => ['admin:rw', 'assistenz:rw'], // TODO(manu): self::PERM_LOGGED
'deleteNotiz' => ['admin:r', 'assistenz:r'],
'loadDokumente' => ['admin:r', 'assistenz:r'],
'getMitarbeiter' => ['admin:r', 'assistenz:r']
]);
//Load Models
$this->load->model('person/Notiz_model', 'NotizModel');
$this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel');
// Load Libraries
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
// Load language phrases
$this->loadPhrases([
'ui'
]);
}
/* public function getUid()
{
$this->terminateWithSuccess(getAuthUID());
}*/
public function getNotizen($id, $type)
{
//check if valid type
$result = $this->NotizzuordnungModel->isValidType($type);
if(isError($result))
$this->terminateWithError($result->retval, self::ERROR_TYPE_GENERAL);
//$this->terminateWithError(" after check type not valid", self::ERROR_TYPE_GENERAL);
$result = $this->NotizModel->getNotizWithDocEntries($id, $type);
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
// return $this->terminateWithError("type not valid", self::ERROR_TYPE_GENERAL);
}
/* public function loadNotiz()
{
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
$notiz_id = $this->input->post('notiz_id');
//$this->load->model('person/Notiz_model', 'NotizModel');
$this->NotizModel->addJoin('public.tbl_notiz_dokument', 'notiz_id', 'LEFT');
$this->NotizModel->addSelect('*');
$this->NotizModel->addSelect("TO_CHAR(CASE WHEN public.tbl_notiz.updateamum >= public.tbl_notiz.insertamum
THEN public.tbl_notiz.updateamum ELSE public.tbl_notiz.insertamum END::timestamp, 'DD.MM.YYYY HH24:MI:SS') AS lastUpdate");
$this->NotizModel->addLimit(1);
$result = $this->NotizModel->loadWhere(
array('notiz_id' => $notiz_id)
);
if (isError($result))
{
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
elseif (!hasData($result))
{
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=>'Notiz_id']), self::ERROR_TYPE_GENERAL);
}
else
{
$this->terminateWithSuccess(current(getData($result)));
}
}
public function updateNotiz()
{
$this->load->library('form_validation');
$this->load->library('DmsLib');
if (isset($_POST['data']))
{
$data = json_decode($_POST['data']);
unset($_POST['data']);
foreach ($data as $k => $v) {
$_POST[$k] = $v;
}
}
$notiz_id = $this->input->post('notiz_id');
if(!$notiz_id)
{
$this->terminateWithError($this->p->t('ui','error_missingId',['id'=>'Notiz_id']), self::ERROR_TYPE_GENERAL);
}
//Form Validation
$this->form_validation->set_rules('titel', 'Titel', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Titel'])
]);
$this->form_validation->set_rules('text', 'Text', 'required', [
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Text'])
]);
if ($this->form_validation->run() == false)
{
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
//update Notiz
$uid = getAuthUID();
$titel = $this->input->post('titel');
$text = $this->input->post('text');
$verfasser_uid = $this->input->post('verfasser');
$bearbeiter_uid = isset($_POST['bearbeiter']) ? $_POST['bearbeiter'] : $uid;
$erledigt = $this->input->post('erledigt');
$start = $this->input->post('start');
$ende = $this->input->post('ende');
$result = $this->NotizModel->update(
[
'notiz_id' => $notiz_id
],
[
'titel' => $titel,
'updatevon' => $uid,
'updateamum' => date('c'),
'text' => $text,
'verfasser_uid' => $verfasser_uid,
'bearbeiter_uid' => $bearbeiter_uid,
'start' => $start,
'ende' => $ende,
'erledigt' => $erledigt
]
);
if (isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
//update(1) laden aller bereits mit dieser notiz_id verknüpften DMS-Einträge
$this->load->model('person/Notizdokument_model', 'NotizdokumentModel');
$this->NotizdokumentModel->addJoin('campus.tbl_dms_version', 'dms_id');
$dms_uploaded = null;
$result = $this->NotizdokumentModel->loadWhere(array('notiz_id' => $notiz_id));
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
elseif (!hasData($result))
{
$dms_id_arr = null;
}
else
{
$result = getData($result);
foreach($result as $doc) {
$dms_id_arr[] = array(
'name' => $doc->name,
'dms_id' => $doc->dms_id
);
}
}
foreach ($_FILES as $k => $file)
{
//update(2) alle neuen files (alle außer type application/x.fhc-dms+json) anhängen
if($file["type"] == 'application/x.fhc-dms+json')
{
$dms_uploaded[] = array(
'name' => $file["name"]
);
}
else
{
$dms = array(
'kategorie_kurzbz' => 'notiz',
'version' => 0,
'name' => $file["name"],
'mimetype' => $file["type"],
'insertamum' => date('c'),
'insertvon' => $uid
);
//Todo(manu) check if filetypes weiter eingeschränkt werden sollen
//Todo(manu)check name files: nicht gleiches file 2mal hochladen
$result = $this->dmslib->upload($dms, $k, array('*'));
if (isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$dms_id = $result->retval['dms_id'];
$result = $this->NotizdokumentModel->insert(array('notiz_id' => $notiz_id, 'dms_id' => $dms_id));
if (isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
}
}
//update(3) check if Dateien gelöscht wurden
if(count($dms_uploaded) != count($dms_id_arr))
{
if (count($dms_uploaded) == 0)
{
$filesDeleted = $dms_id_arr;
}
else
{
$upload_new_names = array_column($dms_uploaded, "name");
$filesDeleted = array_filter($dms_id_arr, function ($file) use ($upload_new_names) {
return !in_array($file["name"], $upload_new_names);
});
}
foreach ($filesDeleted as $file)
{
$result = $this->dmslib->removeAll($file['dms_id']);
if (isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
else
$this->outputJson($result);
}
}
return $this->terminateWithSuccess($result);
}*/
/* public function deleteNotiz()
{
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
$notiz_id = $this->input->post('notiz_id');
$type = $this->input->post('type_id');
$id = $this->input->post('id');
//dms_id auslesen aus notizdokument wenn vorhanden
$dms_id_arr = [];
$this->load->model('person/Notizdokument_model', 'NotizdokumentModel');
$result = $this->NotizdokumentModel->loadWhere(array('notiz_id' => $notiz_id));
if (isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
if(hasData($result))
{
$result = getData($result);
foreach ($result as $doc) {
$dms_id_arr[] = $doc->dms_id;
}
}
if($dms_id_arr)
{
$this->load->library('DmsLib');
foreach($dms_id_arr as $dms_id)
{
$result = $this->dmslib->removeAll($dms_id);
if (isError($result))
{
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$this->outputJson($result);
}
}
//delete Notizzuordnung
if($type == "software_id")
{
// Loads extension Model
$this->load->model('extensions/FHC-Core-Softwarebereitstellung/Softwarenotizzuordnung_model', 'ExtensionnotizzuordnungModel');
$result = $this->ExtensionnotizzuordnungModel->delete([
'notiz_id' => $notiz_id,
'id' => strval($id)
],
[
'type_id' => $type
]);
}
else
{
//notizzuordnungsid!
$result = $this->NotizzuordnungModel->delete(['notiz_id' => $notiz_id, $type => $id]);
}
$this->load->model('person/Notiz_model', 'NotizModel');
//$this->NotizModel->addJoin('public.tbl_notizzuordnung', 'notiz_id');
//TODO (erweitern um Type_id) für Extensions, damit auch Notizzuordnung gelöscht werden kann
//Löschen von Notiz
$result = $this->NotizModel->delete(
array('notiz_id' => $notiz_id)
);
if (isError($result))
{
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
if(!hasData($result))
{
return $this->terminateWithError($this->p->t('ui','error_missingId', ['id'=> 'Notiz_id']), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(current(getData($result)));
}*/
/* public function loadDokumente()
{
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
$notiz_id = $this->input->post('notiz_id');
$this->NotizModel->addSelect('campus.tbl_dms_version.*');
$this->NotizModel->addJoin('public.tbl_notiz_dokument', 'ON (public.tbl_notiz_dokument.notiz_id = public.tbl_notiz.notiz_id)');
$this->NotizModel->addJoin('campus.tbl_dms_version', 'ON (public.tbl_notiz_dokument.dms_id = campus.tbl_dms_version.dms_id)');
$result = $this->NotizModel->loadWhere(
array('public.tbl_notiz.notiz_id' => $notiz_id)
);
if (isError($result)) {
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
if(!hasData($result))
{
return $this->terminateWithError($this->p->t('ui','error_missingId', ['id'=> 'Notiz_id']), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result));
}*/
/* public function getMitarbeiter($searchString)
{
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
$result = $this->MitarbeiterModel->searchMitarbeiter($searchString);
if (isError($result)) {
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess($result);
}*/
public function isBerechtigt($id, $typeId)
{
if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid'))
{
$result = $this->p->t('lehre','error_keineSchreibrechte');
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
return success("berechtigt in überschreibender Funktion");
/* return $this->terminateWithError('keine Berechtigung bro', self::ERROR_TYPE_GENERAL);*/
}
}
@@ -1,299 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \DateTime as DateTime;
class Prestudent extends FHCAPI_Controller
{
public function __construct()
{
parent::__construct([
'get' => ['admin:r', 'assistenz:r'],
'updatePrestudent' => ['admin:rw', 'assistenz:rw'],
'getHistoryPrestudents' => ['admin:r', 'assistenz:r'],
'getBezeichnungZGV' => ['admin:r', 'assistenz:r'],
'getBezeichnungDZgv' => ['admin:r', 'assistenz:r'],
'getBezeichnungMZgv' => ['admin:r', 'assistenz:r'],
'getAusbildung' => ['admin:r', 'assistenz:r'],
'getAufmerksamdurch' => ['admin:r', 'assistenz:r'],
'getBerufstaetigkeit' => ['admin:r', 'assistenz:r'],
'getTypenStg' => ['admin:r', 'assistenz:r'],
'getStudienplaene' => ['admin:r', 'assistenz:r'],
'getStudiengang' => ['admin:r', 'assistenz:r']
]);
if ($this->router->method == 'updatePrestudent') {
$prestudent_id = current(array_slice($this->uri->rsegments, 2));
$this->checkPermissionsForPrestudent($prestudent_id, ['admin:rw', 'assistenz:rw']);
} elseif ($this->router->method == 'get'
|| $this->router->method == 'getStudienplaene'
|| $this->router->method == 'getStudiengang'
) {
$prestudent_id = current(array_slice($this->uri->rsegments, 2));
$this->checkPermissionsForPrestudent($prestudent_id, ['admin:r', 'assistenz:r']);
} elseif ($this->router->method == 'getHistoryPrestudents') {
$person_id = current(array_slice($this->uri->rsegments, 2));
$this->checkPermissionsForPerson($person_id, ['admin:r', 'assistenz:r'], ['admin:r', 'assistenz:r']);
}
// Load Libraries
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
// Load language phrases
$this->loadPhrases([
'ui', 'studierendenantrag', 'lehre'
]);
}
public function get($prestudent_id)
{
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->PrestudentModel->addSelect('*');
$result = $this->PrestudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
if(!hasData($result))
{
return show_404();
}
$this->terminateWithSuccess(current(getData($result)));
}
public function updatePrestudent($prestudent_id)
{
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
// UDF
$this->load->library('UDFLib');
$result = $this->udflib->getCiValidations($this->PrestudentModel, $this->input->post());
$udf_field_validations = $this->getDataOrTerminateWithError($result);
//Form validation
$this->load->library('form_validation');
$this->form_validation->set_rules($udf_field_validations);
$this->form_validation->set_rules('priorisierung', 'Priorisierung', 'numeric', [
'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Priorisierung'])
]);
if ($this->form_validation->run() == false)
{
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$uid = getAuthUID();
$array_allowed_props_prestudent = [
'aufmerksamdurch_kurzbz',
'studiengang_kz',
'gsstudientyp_kurzbz',
'person_id',
'berufstaetigkeit_code',
'ausbildungcode',
'zgv_code',
'zgvort',
'zgvdatum',
'zgvnation',
'zgvmas_code',
'zgvmaort',
'zgvmadatum',
'zgvmanation',
'facheinschlberuf',
'bismelden',
'anmerkung',
'dual',
'zgvdoktor_code',
'zgvdoktorort',
'zgvdoktordatum',
'zgvdoktornation',
'aufnahmegruppe_kurzbz',
'priorisierung',
'foerderrelevant',
'zgv_erfuellt',
'zgvmas_erfuellt',
'zgvdoktor_erfuellt',
'mentor',
'aufnahmeschluessel',
'standort_code'
];
// add UDFs
$result = $this->udflib->getDefinitionForModel($this->PrestudentModel);
$definitions = $this->getDataOrTerminateWithError($result);
foreach ($definitions as $def)
$array_allowed_props_prestudent[] = $def['name'];
$update_prestudent = array();
foreach ($array_allowed_props_prestudent as $prop)
{
$val = $this->input->post($prop);
if ($val !== null || $prop == 'foerderrelevant') {
$update_prestudent[$prop] = $val;
}
}
$update_prestudent['updateamum'] = date('c');
$update_prestudent['updatevon'] = $uid;
if (count($update_prestudent))
{
$result = $this->PrestudentModel->update(
$prestudent_id,
$update_prestudent
);
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess(true);
}
return $this->terminateWithSuccess(false);
}
public function getHistoryPrestudents($person_id)
{
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$result = $this->PrestudentModel->getHistoryPrestudents($person_id);
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess(getData($result) ?: []);
}
public function getBezeichnungZGV()
{
$this->load->model('codex/Zgv_model', 'ZgvModel');
$this->ZgvModel->addOrder('zgv_code');
$result = $this->ZgvModel->load();
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
}
public function getBezeichnungDZgv()
{
$this->load->model('codex/Zgvdoktor_model', 'ZgvdoktorModel');
$this->ZgvdoktorModel->addOrder('zgvdoktor_code');
$result = $this->ZgvdoktorModel->load();
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
}
public function getBezeichnungMZgv()
{
$this->load->model('codex/Zgvmaster_model', 'ZgvmasterModel');
$this->ZgvmasterModel->addOrder('zgvmas_code');
$result = $this->ZgvmasterModel->load();
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
}
public function getAusbildung()
{
$this->load->model('codex/Ausbildung_model', 'AusbildungModel');
$this->AusbildungModel->addOrder('ausbildungcode');
$result = $this->AusbildungModel->load();
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
}
public function getAufmerksamdurch()
{
$this->load->model('codex/Aufmerksamdurch_model', 'AufmerksamdurchModel');
$this->AufmerksamdurchModel->addOrder('aufmerksamdurch_kurzbz');
$result = $this->AufmerksamdurchModel->load();
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
}
public function getBerufstaetigkeit()
{
$this->load->model('codex/Berufstaetigkeit_model', 'BerufstaetigkeitModel');
$this->BerufstaetigkeitModel->addOrder('berufstaetigkeit_code');
$result = $this->BerufstaetigkeitModel->load();
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
}
public function getTypenStg()
{
$this->load->model('education/Gsstudientyp_model', 'GsstudientypModel');
$this->GsstudientypModel->addOrder('gsstudientyp_kurzbz');
$result = $this->GsstudientypModel->load();
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
}
public function getStudienplaene($prestudent_id)
{
$this->load->model('organisation/Studienplan_model', 'StudienplanModel');
$result = $this->StudienplanModel->getStudienplaeneByPrestudents($prestudent_id);
$data = $this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($data);
}
/**
* Gets details for the Studiengang of the Prestudent
*
* @param integer $prestudent_id
*
* @return stdClass
*/
public function getStudiengang($prestudent_id)
{
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->PrestudentModel->addSelect('stg.*');
$this->PrestudentModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz');
$result = $this->PrestudentModel->load($prestudent_id);
$stg = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess(current($stg));
}
}
File diff suppressed because it is too large Load Diff
@@ -1,562 +0,0 @@
<?php
/**
* Copyright (C) 2024 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 \DateTime as DateTime;
/**
* This controller operates between (interface) the JS (GUI) and the back-end
* Provides data to the ajax get calls about a Student
* Listens to ajax post calls to change the Student data
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Student extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and prepares libraries and phrases
*/
public function __construct()
{
parent::__construct([
'get' => ['admin:r', 'assistenz:r'],
'save' => ['admin:rw', 'assistenz:rw'],
'check' => ['admin:rw', 'assistenz:rw'],
'add' => ['admin:rw', 'assistenz:rw'] // TODO(chris): extra permissions
]);
// Load Libraries
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
if ($this->router->method == 'get'
|| $this->router->method == 'save'
) {
$prestudent_id = current(array_slice($this->uri->rsegments, 2));
if ($this->router->method == 'get')
$this->checkPermissionsForPrestudent($prestudent_id, ['admin:r', 'assistenz:r']);
else
$this->checkPermissionsForPrestudent($prestudent_id, ['admin:rw', 'assistenz:rw']);
}
// Load language phrases
$this->loadPhrases([
'ui'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Get details for a prestudent
*
* @param string $prestudent_id
* @return void
*/
public function get($prestudent_id)
{
$studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell');
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->PrestudentModel->addSelect('p.*');
$this->PrestudentModel->addSelect('s.student_uid');
$this->PrestudentModel->addSelect('matrikelnr');
$this->PrestudentModel->addSelect('b.aktiv');
$this->PrestudentModel->addSelect('v.semester');
$this->PrestudentModel->addSelect('v.verband');
$this->PrestudentModel->addSelect('v.gruppe');
$this->PrestudentModel->addSelect('b.alias');
if (defined('ACTIVE_ADDONS') && strpos(ACTIVE_ADDONS, 'bewerbung') !== false) {
$this->PrestudentModel->addSelect(
"(
SELECT kontakt
FROM public.tbl_kontakt
WHERE kontakttyp='email'
AND person_id=p.person_id
AND zustellung
ORDER BY kontakt_id
LIMIT 1
) AS email_privat",
false
);
}
$this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_benutzer b', 'student_uid = uid', 'LEFT');
$this->PrestudentModel->addJoin(
'public.tbl_studentlehrverband v',
'b.uid = v.student_uid AND v.studiensemester_kurzbz = ' . $this->PrestudentModel->escape($studiensemester_kurzbz),
'LEFT'
);
$this->PrestudentModel->addJoin('public.tbl_person p', 'p.person_id = tbl_prestudent.person_id');
$result = $this->PrestudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
$student = $this->getDataOrTerminateWithError($result);
if (!$student)
return show_404();
$this->terminateWithSuccess(current($student));
}
/**
* Saves data to a prestudent
*
* @param string $prestudent_id
* @return void
*/
public function save($prestudent_id)
{
$studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell');
$this->load->model('person/Person_model', 'PersonModel');
$this->load->model('crm/Student_model', 'StudentModel');
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
$this->load->library('form_validation');
$this->form_validation->set_rules('gebdatum', 'Geburtsdatum', 'is_valid_date');
$this->form_validation->set_rules('semester', 'Semester', 'integer');
$this->load->library('UDFLib');
$result = $this->udflib->getCiValidations($this->PersonModel, $this->input->post());
//TODO(Manu) check with Chris: input number not allowed
$udf_field_validations = $this->getDataOrTerminateWithError($result);
$this->form_validation->set_rules($udf_field_validations);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$result = $this->StudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
$student = $this->getDataOrTerminateWithError($result);
$uid = $student ? current($student)->student_uid : null;
$result = $this->PrestudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
$person = $this->getDataOrTerminateWithError($result);
$person_id = $person ? current($person)->person_id : null;
$array_allowed_props_lehrverband = ['verband', 'semester', 'gruppe'];
$update_lehrverband = array();
foreach ($array_allowed_props_lehrverband as $prop) {
$val = $this->input->post($prop);
if ($val !== null) {
$update_lehrverband[$prop] = $val;
}
}
$array_allowed_props_person = [
'anrede',
'bpk',
'titelpre',
'titelpost',
'nachname',
'vorname',
'vornamen',
'wahlname',
'gebdatum',
'gebort',
'geburtsnation',
'svnr',
'ersatzkennzeichen',
'staatsbuergerschaft',
'matr_nr',
'sprache',
'geschlecht',
'familienstand',
'foto',
'anmerkung',
'homepage'
];
// add UDFs
$result = $this->udflib->getDefinitionForModel($this->PersonModel);
$definitions = $this->getDataOrTerminateWithError($result);
foreach ($definitions as $def)
$array_allowed_props_person[] = $def['name'];
$update_person = array();
foreach ($array_allowed_props_person as $prop) {
$val = $this->input->post($prop);
if ($val !== null) {
$update_person[$prop] = $val;
}
}
$array_allowed_props_student = ['matrikelnr'];
$update_student = array();
foreach ($array_allowed_props_student as $prop) {
$val = $this->input->post($prop);
if ($val !== null) {
$update_student[$prop] = $val;
}
}
// Check PKs
if (count($update_lehrverband) + count($update_student) && $uid === null) {
// TODO(chris): phrase
$this->terminateWithValidationErrors(['' => "Kein/e StudentIn vorhanden!"]);
}
if (count($update_person) && $person_id === null) {
// TODO(chris): phrase
$this->terminateWithValidationErrors(['' => "Keine Person vorhanden!"]);
}
// Do Updates
if (count($update_lehrverband)) {
$result = $this->StudentlehrverbandModel->update([
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'student_uid' => $uid
], $update_lehrverband);
$this->getDataOrTerminateWithError($result);
}
if (count($update_person)) {
$result = $this->PersonModel->update(
$person_id,
$update_person
);
$this->getDataOrTerminateWithError($result);
}
if (count($update_student)) {
$result = $this->StudentModel->update(
[$uid],
$update_student
);
$this->getDataOrTerminateWithError($result);
}
$this->terminateWithSuccess(array_fill_keys(array_merge(
array_keys($update_lehrverband),
array_keys($update_person),
array_keys($update_student)
), ''));
}
public function check()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('gebdatum', 'Geburtsdatum', 'is_valid_date');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$vorname = $this->input->post('vorname');
$nachname = $this->input->post('nachname');
$gebdatum = $this->input->post('gebdatum');
if (!$vorname && !$nachname && !$gebdatum)
$this->terminateWithValidationErrors(['At least one of vorname, nachname or gebdatum must be set']);
$this->load->model('person/Person_model', 'PersonModel');
if ($gebdatum)
$this->PersonModel->db->where('gebdatum', (new DateTime($gebdatum))->format('Y-m-d'));
if ($vorname && $nachname) {
$this->PersonModel->db->or_group_start();
$this->PersonModel->db->where('LOWER(nachname)', 'LOWER(' . $this->PersonModel->db->escape($nachname) . ')', false);
$this->PersonModel->db->where('LOWER(vorname)', 'LOWER(' . $this->PersonModel->db->escape($vorname) . ')', false);
$this->PersonModel->db->group_end();
} elseif ($nachname) {
$this->PersonModel->db->or_where('LOWER(nachname)', 'LOWER(' . $this->PersonModel->escape($nachname) . ')', false);
}
$result = $this->PersonModel->load();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function add()
{
if (!$this->input->post('person_id')) {
if (!isset($_POST['address']) || !is_array($_POST['address']))
$_POST['address'] = [];
$_POST['address']['func'] = 1;
}
if ($this->input->post('incoming')) {
$_POST['ausbildungssemester'] = 0;
}
$this->load->library('form_validation');
$this->form_validation->set_rules('nachname', 'Nachname', 'callback_requiredIfNotPersonId', [
'requiredIfNotPersonId' => $this->p->t('ui', 'error_required')
]);
$this->form_validation->set_rules('geschlecht', 'Geschlecht', 'callback_requiredIfNotPersonId', [
'requiredIfNotPersonId' => $this->p->t('ui', 'error_required')
]);
$this->form_validation->set_rules('gebdatum', 'Geburtsdatum', 'callback_isValidDate', [
'isValidDate' => $this->p->t('ui', 'error_invalid_date')
]);
$this->form_validation->set_rules('address[func]', 'Address', 'required|integer|less_than[2]|greater_than[-2]');
$this->form_validation->set_rules('address[plz]', 'PLZ', 'callback_requiredIfAddressFunc', [
'requiredIfAddressFunc' => $this->p->t('ui', 'error_required')
]);
$this->form_validation->set_rules('address[gemeinde]', 'Gemeinde', 'callback_requiredIfAddressFunc', [
'requiredIfAddressFunc' => $this->p->t('ui', 'error_required')
]);
$this->form_validation->set_rules('address[ort]', 'Ort', 'callback_requiredIfAddressFunc', [
'requiredIfAddressFunc' => $this->p->t('ui', 'error_required')
]);
$this->form_validation->set_rules('address[address]', 'Adresse', 'callback_requiredIfAddressFunc', [
'requiredIfAddressFunc' => $this->p->t('ui', 'error_required')
]);
$this->form_validation->set_rules('email', 'E-Mail', 'valid_email');
$this->form_validation->set_rules('studiengang_kz', 'Studiengang', 'required');
$this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'required');
$this->form_validation->set_rules('ausbildungssemester', 'Ausbildungssemester', 'required|integer|less_than[9]|greater_than[-1]');
// TODO(chris): validate studienplan with studiengang, semester and orgform?
// TODO(chris): validate person_id, studiengang_kz, studiensemester_kurzbz, orgform_kurzbz, nation, gemeinde, ort, geschlecht?
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
// TODO(chris): This should be in a library
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
$this->db->trans_start();
$result = $this->addInteressent();
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE)
$this->terminateWithError('TODO(chris): TEXT', self::ERROR_TYPE_GENERAL);
$this->terminateWithSuccess($result);
}
protected function addInteressent()
{
// Person anlegen wenn nötig
$person_id = $this->input->post('person_id');
if (!$person_id) {
$this->load->model('person/Person_model', 'PersonModel');
$data = [
'nachname' => $this->input->post('nachname'),
'insertamum' => date('c'),
'insertvon' => getAuthUID(),
'zugangscode' => uniqid(),
'aktiv' => true
];
if ($this->input->post('anrede'))
$data['anrede'] = $this->input->post('anrede');
if ($this->input->post('titelpre'))
$data['titelpre'] = $this->input->post('titelpre');
if ($this->input->post('titelpost'))
$data['titelpost'] = $this->input->post('titelpost');
if ($this->input->post('vorname'))
$data['vorname'] = $this->input->post('vorname');
if ($this->input->post('vornamen'))
$data['vornamen'] = $this->input->post('vornamen');
if ($this->input->post('wahlname'))
$data['wahlname'] = $this->input->post('wahlname');
if ($this->input->post('geschlecht'))
$data['geschlecht'] = $this->input->post('geschlecht');
if ($this->input->post('gebdatum'))
$data['gebdatum'] = (new DateTime($this->input->post('datum_obj')))->format('Y-m-d');
if ($this->input->post('geburtsnation'))
$data['geburtsnation'] = $this->input->post('geburtsnation');
if ($this->input->post('staatsbuergerschaft'))
$data['staatsbuergerschaft'] = $this->input->post('staatsbuergerschaft');
$result = $this->PersonModel->insert($data);
$person_id = $this->getDataOrTerminateWithError($result);
}
// Addresse anlegen
$anlegen = $this->input->post('address[func]');
if ($anlegen) {
$this->load->model('person/Adresse_model', 'AdresseModel');
$data = [
'nation' => $this->input->post('address[nation]'),
'strasse' => $this->input->post('address[address]'),
'plz' => $this->input->post('address[plz]'),
'ort' => $this->input->post('address[ort]'),
'gemeinde' => $this->input->post('address[gemeinde]'),
'typ' => 'h',
'zustelladresse' => true,
];
if ($anlegen < 0) { // Überschreiben
$this->AdresseModel->addOrder('zustelladresse', 'DESC');
$this->AdresseModel->addOrder('sort');
$result = $this->AdresseModel->loadWhere([
'person_id' => $person_id
]);
$address = $this->getDataOrTerminateWithError($result);
if ($address) {
$address = current($address);
$data['updateamum'] = date('c');
$data['updatevon'] = getAuthUID();
$result = $this->AdresseModel->update($address->adresse_id, $data);
$this->getDataOrTerminateWithError($result);
} else {
//Wenn keine Adrese vorhanden ist dann eine neue Anlegen
$anlegen = 1;
$data['heimatadresse'] = true;
}
}
if ($anlegen > 0) {
$data['person_id'] = $person_id;
$data['insertamum'] = date('c');
$data['insertvon'] = getAuthUID();
if (!isset($data['heimatadresse']))
$data['heimatadresse'] = !$this->input->post('person_id');
$result = $this->AdresseModel->insert($data);
$this->getDataOrTerminateWithError($result);
}
}
// Kontaktdaten
$kontaktdaten = [];
foreach (['email', 'telefon', 'mobil'] as $k) {
$v = $this->input->post($k);
if ($v)
$kontaktdaten[$k] = $v;
}
if (count($kontaktdaten)) {
$this->load->model('person/Kontakt_model', 'KontaktModel');
foreach ($kontaktdaten as $typ => $kontakt) {
$data = [
'person_id' => $person_id,
'kontakttyp' => $typ,
'kontakt' => $kontakt,
'zustellung' => true,
'insertamum' => date('c'),
'insertvon' => getAuthUID()
];
$result = $this->KontaktModel->insert($data);
$this->getDataOrTerminateWithError($result);
}
}
// Prestudent anlegen
$data = [
'aufmerksamdurch_kurzbz' => 'k.A.',
'person_id' => $person_id,
'studiengang_kz' => $this->input->post('studiengang_kz'),
'ausbildungcode' => $this->input->post('letzteausbildung'),
'anmerkung' => $this->input->post('anmerkungen'),
'reihungstestangetreten' => false,
'bismelden' => true
];
$ausbildungsart = $this->input->post('ausbildungsart');
if ($ausbildungsart)
$data['anmerkung'] .= ' Ausbildungsart:' . $ausbildungsart;
// Incomings und ausserordentliche sind bei Meldung nicht förderrelevant
$incoming = $this->input->post('incoming');
if ($incoming || substr($data['studiengang_kz'], 0, 1) == '9')
$data['foerderrelevant'] = false;
// Wenn die Person schon im System erfasst ist, dann die ZGV des Datensatzes uebernehmen
$this->PrestudentModel->addOrder('zgvmas_code');
$this->PrestudentModel->addOrder('zgv_code', 'DESC');
$this->PrestudentModel->addLimit(1);
$result = $this->PrestudentModel->loadWhere([
'person_id' => $person_id
]);
$prestudent = $this->getDataOrTerminateWithError($result);
if ($prestudent) {
$prestudent = current($prestudent);
if ($prestudent->zgv_code) {
$data['zgv_code'] = $prestudent->zgv_code;
$data['zgvort'] = $prestudent->zgvort;
$data['zgvdatum'] = $prestudent->zgvdatum;
$data['zgvmas_code'] = $prestudent->zgvmas_code;
$data['zgvmaort'] = $prestudent->zgvmaort;
$data['zgvmadatum'] = $prestudent->zgvmadatum;
}
}
// Prestudent speichern
$result = $this->PrestudentModel->insert($data);
$prestudent_id = $this->getDataOrTerminateWithError($result);
// Prestudent Rolle Anlegen
$data = [
'prestudent_id' => $prestudent_id,
'status_kurzbz' => $incoming ? 'Incoming' : 'Interessent',
'studiensemester_kurzbz' => $this->input->post('studiensemester_kurzbz'),
'ausbildungssemester' => $this->input->post('ausbildungssemester') ?: 0,
'orgform_kurzbz' => $this->input->post('orgform_kurzbz') ?: null,
'studienplan_id' => $this->input->post('studienplan_id') ?: null,
'datum' => date('Y-m-d'),
'insertamum' => date('c'),
'insertvon' => getAuthUID()
];
$result = $this->PrestudentstatusModel->insert($data);
$this->getDataOrTerminateWithError($result);
if ($incoming) {
// TODO(chris): IMPLEMENT!
//Matrikelnummer und UID generieren
//Benutzerdatensatz anlegen
//Studentendatensatz anlegen
//StudentLehrverband anlegen
}
// TODO(chris): DEBUG
/*$result = $this->PrestudentModel->loadWhere([
'pestudent_id' => 1
]);
if (isError($result)) {
return $result;
}*/
$this->terminateWithSuccess(true);
}
public function requiredIfNotPersonId($value)
{
if (isset($_POST['person_id']))
return true;
return !!$value;
}
public function requiredIfAddressFunc($value)
{
if (!$_POST['address']['func'])
return true;
return !!$value;
}
}
@@ -1,743 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (GUI) and the back-end
* Provides data to the ajax get calls about listing students
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Students extends FHCAPI_Controller
{
private $allowedStgs = [];
public function __construct()
{
$permissions = [];
$router = load_class('Router');
$permissions[$router->method] = ['admin:r', 'assistenz:r'];
parent::__construct($permissions);
$this->allowedStgs = $this->permissionlib->getSTG_isEntitledFor('admin') ?: [];
$this->allowedStgs = array_merge($this->allowedStgs, $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: []);
if (!$this->allowedStgs) {
$this->_outputAuthError([$router->method => ['admin:r', 'assistenz:r']]);
exit;
}
// Load Libraries
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
}
/**
* Remap calls:
* / => return []
* /inout => return []
* /inout/incoming => getIncoming
* /inout/outgoing => getOutgoing
* /inout/gemeinsamestudien => getGemeinsamestudien
* /(studiengang_kz) => getStudents
* /(studiengang_kz)/prestudent => getPrestudents
* /(studiengang_kz)/prestudent/* => getPrestudents
* /(studiengang_kz)/(semester) => getStudents
* /(studiengang_kz)/(semester)/grp/(gruppe_kurzbz) => getStudents
* /(studiengang_kz)/(semester)/(verband) => getStudents
* /(studiengang_kz)/(semester)/(verband)/(gruppe) => getStudents
* /(studiengang_kz)/(org_form) => getStudents
* /(studiengang_kz)/(org_form)/prestudent => getPrestudents
* /(studiengang_kz)/(org_form)/prestudent/* => getPrestudents
* /(studiengang_kz)/(org_form)/(semester) => getStudents
* /(studiengang_kz)/(org_form)/(semester)/grp/(gruppe_kurzbz)
* => getStudents
* /(studiengang_kz)/(org_form)/(semester)/(verband) => getStudents
* /(studiengang_kz)/(org_form)/(semester)/(verband)/(gruppe)
* => getStudents
* /uid/(student_uid) => getStudent
* /prestudent/(prestudent_id) => getPrestudent
* /person/(person_id) => getPerson
*
* @param string $method
* @param array $params (optional)
*
* @return void
*/
public function _remap($method, $params = [])
{
if ($method == '' || $method == 'index')
return $this->terminateWithSuccess([]);
if ($method == 'inout') {
if (!count($params))
return $this->terminateWithSuccess([]);
switch ($params[0]) {
case 'incoming':
return $this->getIncoming();
case 'outgoing':
return $this->getOutgoing();
case 'gemeinsamestudien':
return $this->getGemeinsamestudien();
default:
return show_404();
}
}
$count = count($params);
if (!$count)
return $this->getStudents($method);
if ($method == 'uid' && $count == 1)
return $this->getStudent($params[0]);
if ($method == 'prestudent' && $count == 1)
return $this->getPrestudent($params[0]);
if ($method == 'person' && $count == 1)
return $this->getPerson($params[0]);
if (is_numeric($params[0])) {
$sem = $params[0];
if ($count == 3 && $params[1] == 'grp') {
$g = $params[2];
$ver = null;
$grp = null;
} else {
$g = null;
$ver = $count > 1 ? $params[1] : null;
$grp = $count > 2 ? $params[2] : null;
}
return $this->getStudents($method, $sem, $ver, $grp, $g);
} elseif ($params[0] == 'prestudent') {
if ($count == 1)
return $this->getPrestudents($method);
if ($count == 2)
return $this->getPrestudents($method, $params[1]);
return $this->getPrestudents($method, $params[1], $params[$count-1]);
} else {
$org = $params[0];
if ($count > 1 && $params[1] == 'prestudent') {
if ($count == 2)
return $this->getPrestudents($method, null, null, $org);
if ($count == 3)
return $this->getPrestudents($method, $params[2], null, $org);
return $this->getPrestudents($method, $params[2], $params[$count-1], $org);
}
$sem = $count > 1 ? $params[1] : null;
if ($count == 4 && $params[2] == 'grp') {
$g = $params[3];
$ver = null;
$grp = null;
} else {
$g = null;
$ver = $count > 2 ? $params[2] : null;
$grp = $count > 3 ? $params[3] : null;
}
return $this->getStudents($method, $sem, $ver, $grp, $g, $org);
}
show_404();
}
/**
* @return void
*/
protected function getIncoming()
{
// TODO(chris): IMPLEMENT!
$this->terminateWithSuccess([]);
}
/**
* @return void
*/
protected function getOutgoing()
{
// TODO(chris): IMPLEMENT!
$this->terminateWithSuccess([]);
}
/**
* @return void
*/
protected function getGemeinsamestudien()
{
// TODO(chris): IMPLEMENT!
$this->terminateWithSuccess([]);
}
/**
* @param integer $studiengang_kz
* @param string $studiensemester_kurzbz (optional)
* @param string $filter (optional)
* @param string $orgform_kurzbz (optional)
*
* @return void
*/
protected function getPrestudents($studiengang_kz, $studiensemester_kurzbz = null, $filter = null, $orgform_kurzbz = null)
{
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$stdsemEsc = $studiensemester_kurzbz ? $this->PrestudentModel->escape($studiensemester_kurzbz) : 'NULL';
$selectRT = "
SELECT 1
FROM public.tbl_rt_person
JOIN public.tbl_reihungstest r ON (rt_id = reihungstest_id)
WHERE person_id=p.person_id
AND studienplan_id IN (
SELECT studienplan_id
FROM lehre.tbl_studienplan
JOIN lehre.tbl_studienordnung o USING(studienordnung_id)
WHERE o.studiengang_kz=tbl_prestudent.studiengang_kz
)
AND r.studiensemester_kurzbz=" . $stdsemEsc;
$where = ['tbl_prestudent.studiengang_kz' => $studiengang_kz];
if ($orgform_kurzbz) {
$where['ps.orgform_kurzbz'] = $orgform_kurzbz;
}
switch ($filter) {
case "interessenten":
$where['ps.status_kurzbz'] = 'Interessent';
break;
case "bewerbungnichtabgeschickt":
$where['ps.status_kurzbz'] = 'Interessent';
$where['bewerbung_abgeschicktamum'] = null;
break;
case "bewerbungabgeschickt":
$where['ps.status_kurzbz'] = 'Interessent';
$where['bewerbung_abgeschicktamum IS NOT NULL'] = null;
$where['bestaetigtam'] = null;
break;
case "statusbestaetigt":
$where['ps.status_kurzbz'] = 'Interessent';
$where['bestaetigtam IS NOT NULL'] = null;
break;
case "statusbestaetigtrtnichtangemeldet":
$where['ps.status_kurzbz'] = 'Interessent';
$where['bestaetigtam IS NOT NULL'] = null;
$this->PrestudentModel->db->where('NOT EXISTS(' . $selectRT . ')', null, false);
break;
case "statusbestaetigtrtangemeldet":
$where['ps.status_kurzbz'] = 'Interessent';
$where['bestaetigtam IS NOT NULL'] = null;
$this->PrestudentModel->db->where('EXISTS(' . $selectRT . ')', null, false);
break;
case "zgv":
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
$result = $this->StudiengangModel->load($studiengang_kz);
$stg = $this->getDataOrTerminateWithError($result);
if (!$stg)
$this->terminateWithValidationErrors(['' => 'Studiengang does not exist']); // TODO(chris): phrase
$stg = current($stg);
$where['ps.status_kurzbz'] = 'Interessent';
if ($stg->typ == 'm') {
$where['zgvmas_code IS NOT NULL'] = null;
if (defined('ZGV_ERFUELLT_ANZEIGEN') && ZGV_ERFUELLT_ANZEIGEN)
$where['zgvmas_erfuellt'] = true;
} elseif ($stg->typ == 'p') {
$where['zgvdoktor_code IS NOT NULL'] = null;
if (defined('ZGV_DOKTOR_ANZEIGEN') && ZGV_DOKTOR_ANZEIGEN)
$where['zgvdoktor_erfuellt'] = true;
} else {
$where['zgv_code IS NOT NULL'] = null;
if (defined('ZGV_ERFUELLT_ANZEIGEN') && ZGV_ERFUELLT_ANZEIGEN)
$where['zgv_erfuellt'] = true;
}
break;
case "reihungstestangemeldet":
$where['ps.status_kurzbz'] = 'Interessent';
$this->PrestudentModel->db->where('EXISTS(' . $selectRT . ')', null, false);
break;
case "reihungstestnichtangemeldet":
$where['ps.status_kurzbz'] = 'Interessent';
$this->PrestudentModel->db->where('NOT EXISTS(' . $selectRT . ')', null, false);
break;
case "bewerber":
$where['ps.status_kurzbz'] = 'Bewerber';
break;
case "bewerberrtnichtangemeldet":
$where['ps.status_kurzbz'] = 'Bewerber';
$this->PrestudentModel->db->where('NOT EXISTS(' . $selectRT . ')', null, false);
break;
case "bewerberrtangemeldet":
$where['ps.status_kurzbz'] = 'Bewerber';
$this->PrestudentModel->db->where('EXISTS(' . $selectRT . ')', null, false);
break;
case "bewerberrtangemeldetteilgenommen":
$where['ps.status_kurzbz'] = 'Bewerber';
$this->PrestudentModel->db->where('EXISTS(' . $selectRT . ')', null, false);
$where['reihungstestangetreten'] = true;
break;
case "bewerberrtangemeldetnichtteilgenommen":
$where['ps.status_kurzbz'] = 'Bewerber';
$this->PrestudentModel->db->where('EXISTS(' . $selectRT . ')', null, false);
$where['reihungstestangetreten'] = false;
break;
case "aufgenommen":
$where['ps.status_kurzbz'] = 'Aufgenommener';
break;
case "warteliste":
$where['ps.status_kurzbz'] = 'Wartender';
break;
case "absage":
$where['ps.status_kurzbz'] = 'Abgewiesener';
break;
case "incoming":
// NOTE(chris): in FAS it was not filtered for studiengang_kz
$where['ps.status_kurzbz'] = 'Incoming';
break;
case "absolvent":
$where['ps.status_kurzbz'] = 'Absolvent';
break;
case "diplomand":
$where['ps.status_kurzbz'] = 'Diplomand';
break;
default:
if (!$studiensemester_kurzbz) {
// TODO(chris): this does not work with $orgform_kurzbz != null
$where['ps.status_kurzbz'] = null;
} else {
$this->PrestudentModel->db->where_in('ps.status_kurzbz', [
'Interessent',
'Bewerber',
'Aufgenommener',
'Wartender',
'Abgewiesener'
]);
}
break;
}
/*
$this->PrestudentModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_person p', 'person_id');
$this->PrestudentModel->addJoin('public.tbl_prestudentstatus pls', '
pls.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL)
AND pls.prestudent_id=tbl_prestudent.prestudent_id
AND pls.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, NULL)
AND pls.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, NULL)', 'LEFT');
$this->PrestudentModel->addJoin('lehre.tbl_studienplan sp', 'studienplan_id', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_prestudentstatus ps', '
ps.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')
AND ps.prestudent_id=tbl_prestudent.prestudent_id
AND ps.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')
AND ps.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')', 'LEFT');*/
$this->prepareQuery($studiensemester_kurzbz);
$this->PrestudentModel->addSelect("
CASE WHEN ps.status_kurzbz IN ('Aufgenommener', 'Bewerber', 'Wartender', 'interessent')
THEN ps.ausbildungssemester::text
ELSE ''::text END AS semester", false);
$this->PrestudentModel->addSelect("'' AS verband");
$this->PrestudentModel->addSelect("'' AS gruppe");
$this->addSelectPrioRel();
$this->addFilter($studiensemester_kurzbz);
$result = $this->PrestudentModel->loadWhere($where);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
/**
* @param integer $studiengang_kz
* @param integer $semester (optional)
* @param string $verband (optional)
* @param integer $gruppe (optional)
* @param string $gruppe_kurzbz (optional)
* @param string $orgform_kurzbz (optional)
*
* @return void
*/
protected function getStudents($studiengang_kz, $semester = null, $verband = null, $gruppe = null, $gruppe_kurzbz = null, $orgform_kurzbz = null)
{
$studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell');
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
/*
$this->PrestudentModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_person p', 'person_id');
$this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id');
$this->PrestudentModel->addJoin('public.tbl_prestudentstatus pls', '
pls.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL)
AND pls.prestudent_id=tbl_prestudent.prestudent_id
AND pls.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, NULL)
AND pls.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, NULL)', 'LEFT');
$this->PrestudentModel->addJoin('lehre.tbl_studienplan sp', 'studienplan_id', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_benutzer b', 's.student_uid=b.uid');
$this->PrestudentModel->addJoin(
'public.tbl_studentlehrverband v',
'v.student_uid=s.student_uid AND v.studiensemester_kurzbz=' . $this->PrestudentModel->escape($studiensemester_kurzbz)
);*/
$this->prepareQuery($studiensemester_kurzbz, '');
$this->PrestudentModel->addSelect('v.semester');
$this->PrestudentModel->addSelect('v.verband');
$this->PrestudentModel->addSelect('v.gruppe');
$this->PrestudentModel->addSelect("'' AS priorisierung_relativ");
$where = [];
if ($gruppe_kurzbz !== null) {
$this->PrestudentModel->addJoin('public.tbl_benutzergruppe g', 'uid');
$where['g.gruppe_kurzbz'] = $gruppe_kurzbz;
$where['g.studiensemester_kurzbz'] = $studiensemester_kurzbz;
} else {
$where['v.studiengang_kz'] = $studiengang_kz;
if ($semester !== null)
$where['v.semester'] = $semester;
if ($verband !== null)
$where['v.verband'] = $verband;
if ($gruppe !== null)
$where['v.gruppe'] = $gruppe;
if (!$verband && !$gruppe && $orgform_kurzbz !== null) {
$this->PrestudentModel->db->where(
"(
SELECT orgform_kurzbz
FROM public.tbl_prestudentstatus
WHERE prestudent_id=tbl_prestudent.prestudent_id
AND studiensemester_kurzbz=" . $this->PrestudentModel->escape($studiensemester_kurzbz) . "
ORDER BY datum DESC, insertamum DESC, ext_id DESC LIMIT 1
) =",
$this->PrestudentModel->escape($orgform_kurzbz),
false
);
}
}
$this->addFilter($studiensemester_kurzbz);
$result = $this->PrestudentModel->loadWhere($where);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
/**
* @param string $prestudent_id
*
* @return void
*/
protected function getPrestudent($prestudent_id)
{
$studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell');
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
/*
$this->PrestudentModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_person p', 'person_id');
$this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_prestudentstatus pls', '
pls.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL)
AND pls.prestudent_id=tbl_prestudent.prestudent_id
AND pls.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, NULL)
AND pls.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, NULL)', 'LEFT');
$this->PrestudentModel->addJoin('lehre.tbl_studienplan sp', 'studienplan_id', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_benutzer b', 's.student_uid=b.uid', 'LEFT');
$this->PrestudentModel->addJoin(
'public.tbl_studentlehrverband v',
'v.student_uid=s.student_uid AND v.studiensemester_kurzbz=' . $this->PrestudentModel->escape($studiensemester_kurzbz),
'LEFT'
);*/
$this->prepareQuery($studiensemester_kurzbz);
$this->PrestudentModel->addSelect("COALESCE(v.semester::text, CASE WHEN public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL) IN ('Aufgenommener', 'Bewerber', 'Wartender', 'interessent') THEN public.get_absem_prestudent(tbl_prestudent.prestudent_id, NULL)::text ELSE ''::text END) AS semester", false);
$this->PrestudentModel->addSelect('v.verband');
$this->PrestudentModel->addSelect('v.gruppe');
$this->addSelectPrioRel();
$this->addFilter($studiensemester_kurzbz);
$result = $this->PrestudentModel->loadWhere([
'tbl_prestudent.prestudent_id' => $prestudent_id
]);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
/**
* @param string $student_uid
*
* @return void
*/
protected function getStudent($student_uid)
{
$studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell');
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
/*
$this->PrestudentModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_person p', 'person_id');
$this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id');
$this->PrestudentModel->addJoin('public.tbl_prestudentstatus pls', '
pls.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL)
AND pls.prestudent_id=tbl_prestudent.prestudent_id
AND pls.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, NULL)
AND pls.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, NULL)', 'LEFT');
$this->PrestudentModel->addJoin('lehre.tbl_studienplan sp', 'studienplan_id', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_benutzer b', 's.student_uid=b.uid');
$this->PrestudentModel->addJoin(
'public.tbl_studentlehrverband v',
'v.student_uid=s.student_uid AND v.studiensemester_kurzbz=' . $this->PrestudentModel->escape($studiensemester_kurzbz),
'LEFT'
);*/
$this->prepareQuery($studiensemester_kurzbz);
$this->PrestudentModel->addSelect('v.semester');
$this->PrestudentModel->addSelect('v.verband');
$this->PrestudentModel->addSelect('v.gruppe');
$this->addSelectPrioRel();
$this->addFilter($studiensemester_kurzbz);
$result = $this->PrestudentModel->loadWhere([
's.student_uid' => $student_uid
]);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
/**
* @param integer $person_id
*
* @return void
*/
protected function getPerson($person_id)
{
$studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell');
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
/*
$this->PrestudentModel->addJoin('public.tbl_person p', 'person_id');
$this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id');
$this->PrestudentModel->addJoin('public.tbl_benutzer b', 's.student_uid=b.uid');
$this->PrestudentModel->addJoin(
'public.tbl_studentlehrverband v',
'v.student_uid=s.student_uid AND v.studiensemester_kurzbz=' . $this->PrestudentModel->escape($studiensemester_kurzbz),
'LEFT'
);*/
$this->prepareQuery($studiensemester_kurzbz);
$this->PrestudentModel->addSelect('v.semester');
$this->PrestudentModel->addSelect('v.verband');
$this->PrestudentModel->addSelect('v.gruppe');
$this->addSelectPrioRel();
$this->addFilter($studiensemester_kurzbz);
$result = $this->PrestudentModel->loadWhere([
'p.person_id' => $person_id
]);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
/**
* @param string|null $studiensemester_kurzbz
* @param string $type
*
* @return void
*/
protected function prepareQuery($studiensemester_kurzbz, $type = 'LEFT')
{
$stdsemEsc = $studiensemester_kurzbz ? $this->PrestudentModel->escape($studiensemester_kurzbz) : 'NULL';
$this->PrestudentModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_person p', 'person_id');
$this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id', $type);
$this->PrestudentModel->addJoin('public.tbl_prestudentstatus pls', '
pls.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL)
AND pls.prestudent_id=tbl_prestudent.prestudent_id
AND pls.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, NULL)
AND pls.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, NULL)', 'LEFT');
$this->PrestudentModel->addJoin('lehre.tbl_studienplan sp', 'studienplan_id', 'LEFT');
$this->PrestudentModel->addJoin('public.tbl_benutzer b', 's.student_uid=b.uid', 'LEFT');
$this->PrestudentModel->addJoin(
'public.tbl_studentlehrverband v',
'v.student_uid=s.student_uid AND v.studiensemester_kurzbz' . ($studiensemester_kurzbz ? '=' . $stdsemEsc : ' IS NULL'),
$type
);
$this->PrestudentModel->addJoin('public.tbl_prestudentstatus ps', '
ps.status_kurzbz=public.get_rolle_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')
AND ps.prestudent_id=tbl_prestudent.prestudent_id
AND ps.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')
AND ps.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')', 'LEFT');
$this->PrestudentModel->addSelect("b.uid");
$this->PrestudentModel->addSelect('titelpre');
$this->PrestudentModel->addSelect('nachname');
$this->PrestudentModel->addSelect('vorname');
$this->PrestudentModel->addSelect('wahlname');
$this->PrestudentModel->addSelect('vornamen');
$this->PrestudentModel->addSelect('titelpost');
$this->PrestudentModel->addSelect('svnr');
$this->PrestudentModel->addSelect('ersatzkennzeichen');
$this->PrestudentModel->addSelect('gebdatum');
$this->PrestudentModel->addSelect('geschlecht');
// semester
// verband
// gruppe
$this->PrestudentModel->addSelect('UPPER(stg.typ || stg.kurzbz) AS studiengang');
$this->PrestudentModel->addSelect('tbl_prestudent.studiengang_kz');
$this->PrestudentModel->addSelect("s.matrikelnr");
$this->PrestudentModel->addSelect('p.person_id');
$this->PrestudentModel->addSelect('pls.status_kurzbz AS status');
$this->PrestudentModel->addSelect('pls.datum AS status_datum');
$this->PrestudentModel->addSelect('pls.bestaetigtam AS status_bestaetigung');
$this->PrestudentModel->addSelect(
"(SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp='email' AND person_id=p.person_id AND zustellung LIMIT 1) AS mail_privat",
false
);
$this->PrestudentModel->addSelect("
CASE WHEN b.uid IS NOT NULL AND b.uid<>''
THEN b.uid || " . $this->PrestudentModel->escape(DOMAIN) . "
ELSE '' END AS mail_intern", false);
$this->PrestudentModel->addSelect('p.anmerkung AS anmerkungen');
$this->PrestudentModel->addSelect('tbl_prestudent.anmerkung');
$this->PrestudentModel->addSelect('pls.orgform_kurzbz');
$this->PrestudentModel->addSelect('aufmerksamdurch_kurzbz');
$this->PrestudentModel->addSelect(
"(SELECT rt_gesamtpunkte AS punkte FROM public.tbl_prestudent WHERE prestudent_id=ps.prestudent_id) AS punkte",
false
);
$this->PrestudentModel->addSelect('tbl_prestudent.aufnahmegruppe_kurzbz');
$this->PrestudentModel->addSelect('tbl_prestudent.dual');
$this->PrestudentModel->addSelect('p.matr_nr');
$this->PrestudentModel->addSelect('sp.bezeichnung AS studienplan_bezeichnung');
$this->PrestudentModel->addSelect('tbl_prestudent.prestudent_id');
// priorisierung_relativ
$this->PrestudentModel->addSelect('mentor');
$this->PrestudentModel->addSelect('b.aktiv AS bnaktiv');
/*$this->PrestudentModel->addSelect('tbl_prestudent.reihungstest_id');
$this->PrestudentModel->addSelect('tbl_prestudent.anmeldungreihungstest');
$this->PrestudentModel->addSelect('tbl_prestudent.gsstudientyp_kurzbz');
$this->PrestudentModel->addSelect('tbl_prestudent.priorisierung');
$this->PrestudentModel->addSelect('p.zugangscode');
$this->PrestudentModel->addSelect('p.bpk');*/
$this->PrestudentModel->db->where_in('tbl_prestudent.studiengang_kz', $this->allowedStgs);
$this->PrestudentModel->addOrder('nachname');
$this->PrestudentModel->addOrder('vorname');
}
/**
* @return void
*/
protected function addSelectPrioRel()
{
$this->PrestudentModel->addSelect("(
SELECT count(*)
FROM (
SELECT *, public.get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL) AS laststatus
FROM PUBLIC.tbl_prestudent pss
JOIN PUBLIC.tbl_prestudentstatus USING (prestudent_id)
WHERE person_id = p.person_id
AND studiensemester_kurzbz = (
SELECT studiensemester_kurzbz
FROM PUBLIC.tbl_prestudentstatus
WHERE prestudent_id = tbl_prestudent.prestudent_id
AND status_kurzbz = 'Interessent'
LIMIT 1
)
AND status_kurzbz = 'Interessent'
) prest
WHERE laststatus NOT IN ('Abbrecher', 'Abgewiesener', 'Absolvent')
AND priorisierung <= tbl_prestudent.priorisierung
) || ' (' || tbl_prestudent.priorisierung || ')' AS priorisierung_relativ", false);
}
/**
* Adds additional filters to the query
*
* @param string $studiensemester_kurzbz
*
* @return void
*/
protected function addFilter($studiensemester_kurzbz)
{
$filter = $this->input->get('filter');
if (isset($filter['konto_count_0'])) {
$bt = $this->PrestudentModel->escape($filter['konto_count_0']);
$stdsem = $this->PrestudentModel->escape($studiensemester_kurzbz);
$this->PrestudentModel->db->where('(
SELECT count(*)
FROM public.tbl_konto
WHERE person_id=tbl_prestudent.person_id
AND buchungstyp_kurzbz=' . $bt . '
AND studiensemester_kurzbz=' . $stdsem . '
) =', 0);
$this->PrestudentModel->db->where('get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL) !=', 'Incoming');
}
if (isset($filter['konto_missing_counter'])) {
$bt = $this->PrestudentModel->escape($filter['konto_missing_counter']);
$stg = '';
if ($this->variablelib->getVar('kontofilterstg') == 'true')
$stg = ' AND studiengang_kz=tbl_prestudent.studiengang_kz';
$bt = $bt == 'alle' ? '' : ' AND buchungstyp_kurzbz=' . $bt;
$this->PrestudentModel->db->where('(
SELECT sum(betrag)
FROM public.tbl_konto
WHERE person_id=tbl_prestudent.person_id' .
$bt .
$stg . '
) !=', 0);
}
}
}
@@ -1,493 +0,0 @@
<?php
/**
* Copyright (C) 2024 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');
/**
* This controller operates between (interface) the JS (GUI) and the back-end
* Provides data to the ajax get calls about verbände
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Verband extends FHCAPI_Controller
{
public function __construct()
{
$permissions = [];
$router = load_class('Router');
$permissions[$router->method] = ['admin:r', 'assistenz:r'];
parent::__construct($permissions);
// Load Models
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
}
/**
* Remap calls:
* /
* /(studiengang_kz) => getStudiengang
* /(studiengang_kz)/(semester) => getSemester
* /(studiengang_kz)/(semester)/(verband) => getVerband
* /(studiengang_kz)/(org_form) => getStudiengang
* /(studiengang_kz)/(org_form)/(semester) => getSemester
* /(studiengang_kz)/(org_form)/(semester)/(verband) => getVerband
*
* @param string $method
* @param array $params (optional)
*
* @return void
*/
public function _remap($method, $params = [])
{
if ($method == '' || $method == 'index')
return $this->getBase();
// NOTE(chris): Test if access is allowed ($method is the Studiengang)
if (!$this->permissionlib->isBerechtigt('assistenz', 's', $method)
&& !$this->permissionlib->isBerechtigt('admin', 's', $method)
) {
return $this->_outputAuthError([$method => ['admin:r', 'assistenz:r']]);
}
$count = count($params);
if (!$count)
return $this->getStudiengang($method);
if ($count == 1) {
if (is_numeric($params[0]))
return $this->getSemester($method, $params[0]);
elseif ($params[0] == 'prestudent')
return $this->terminateWithSuccess($this->getStdSem($method . '/prestudent/', $method));
else
return $this->getStudiengang($method, $params[0]);
}
if ($count == 2) {
if (is_numeric($params[0]))
return $this->getVerband($method, $params[0], $params[1]);
elseif ($params[1] == 'prestudent')
return $this->terminateWithSuccess($this->getStdSem($method . '/' . $params[0] . '/prestudent/', $method));
else
return $this->getSemester($method, $params[1], $params[0]);
}
if ($count == 3 && !is_numeric($params[0]) && is_numeric($params[1]) && !is_numeric($params[2]))
return $this->getVerband($method, $params[1], $params[2], $params[0]);
show_404();
}
/**
* @return void
*/
protected function getBase()
{
$this->StudiengangModel->addJoin('public.tbl_lehrverband v', 'studiengang_kz');
$this->StudiengangModel->addDistinct();
$this->StudiengangModel->addSelect("v.studiengang_kz AS link");
$this->StudiengangModel->addSelect(
"CONCAT(kurzbzlang, ' (', UPPER(CONCAT(typ, kurzbz)), ') - ', tbl_studiengang.bezeichnung) AS name",
false
);
$this->StudiengangModel->addSelect('erhalter_kz');
$this->StudiengangModel->addSelect('typ');
$this->StudiengangModel->addSelect('kurzbz');
$this->StudiengangModel->addSelect('studiengang_kz');
$this->StudiengangModel->addSelect('studiengang_kz AS stg_kz');
$this->StudiengangModel->addOrder('erhalter_kz');
$this->StudiengangModel->addOrder('typ');
$this->StudiengangModel->addOrder('kurzbz');
$stgs = $this->permissionlib->getSTG_isEntitledFor('admin') ?: [];
$stgs = array_merge($stgs, $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: []);
if (!$stgs)
$this->terminateWithSuccess([]);
$this->StudiengangModel->db->where_in('studiengang_kz', $stgs);
$result = $this->StudiengangModel->loadWhere(['v.aktiv' => true]);
$list = $this->getDataOrTerminateWithError($result);
if ($this->permissionlib->isBerechtigt('inout/uebersicht'))
$list[] = [
'name' => 'International',
'link' => 'inout',
'children' => [
[
'name' => 'Incoming',
'link' => 'inout/incoming',
'leaf' => true
],
[
'name' => 'Outgoing',
'link' => 'inout/outgoing',
'leaf' => true
],
[
'name' => 'Gemeinsame Studien',
'link' => 'inout/gemeinsamestudien',
'leaf' => true
]
]
];
$this->terminateWithSuccess($list);
}
/**
* @param integer $studiengang_kz
* @param string $orgform (optional)
*
* @return void
*/
protected function getStudiengang($studiengang_kz, $org_form = null)
{
$link = $studiengang_kz . '/';
if ($org_form !== null)
$link .= $org_form . '/';
$this->StudiengangModel->addJoin('public.tbl_lehrverband v', 'studiengang_kz');
$this->StudiengangModel->addDistinct();
$this->StudiengangModel->addSelect("CONCAT(" . $this->StudiengangModel->escape($link) . ", semester) AS link", false);
$this->StudiengangModel->addSelect("CONCAT(UPPER(CONCAT(typ, kurzbz)), '-', semester, (SELECT CASE WHEN bezeichnung IS NULL OR bezeichnung='' THEN ''::TEXT ELSE CONCAT(' (', bezeichnung, ')') END FROM public.tbl_lehrverband WHERE studiengang_kz=v.studiengang_kz AND semester=v.semester ORDER BY verband, gruppe LIMIT 1)) AS name", false);
$this->StudiengangModel->addSelect('semester');
$this->StudiengangModel->addSelect($this->StudiengangModel->escape($studiengang_kz) . '::integer AS stg_kz', false);
$this->StudiengangModel->addOrder('semester');
if ($org_form !== null) {
$this->StudiengangModel->db->group_start();
$this->StudiengangModel->db->where('v.semester', 0);
$this->StudiengangModel->db->or_where('v.orgform_kurzbz', $org_form);
$this->StudiengangModel->db->group_end();
}
$result = $this->StudiengangModel->loadWhere([
'v.studiengang_kz' => $studiengang_kz,
'v.aktiv' => true
]);
$list = $this->getDataOrTerminateWithError($result);
array_unshift($list, [
'name' => 'PreStudent',
'link' => $link . 'prestudent',
'children' => $this->getStdSem($link . 'prestudent/', $studiengang_kz)
]);
if ($org_form === null) {
// NOTE(chris): if mischform show orgforms
$result = $this->StudiengangModel->load($studiengang_kz);
$result = $this->getDataOrTerminateWithError($result);
if ($result) {
if (current($result)->mischform) {
$this->load->model('organisation/Studienordnung_model', 'StudienordnungModel');
$this->StudienordnungModel->addDistinct();
$this->StudienordnungModel->addSelect("CONCAT(studiengang_kz, '/', p.orgform_kurzbz) AS link");
$this->StudienordnungModel->addSelect("p.orgform_kurzbz AS name");
$this->StudienordnungModel->addJoin('lehre.tbl_studienplan p', 'studienordnung_id');
$result = $this->StudienordnungModel->loadWhere([
'aktiv' => true,
'studiengang_kz' => $studiengang_kz,
'p.orgform_kurzbz !=' => 'DDP'
]);
$result = $this->getDataOrTerminateWithError($result);
$list = array_merge($list, $result);
}
}
}
$this->terminateWithSuccess($list);
}
/**
* @param integer $studiengang_kz
* @param integer $semester
* @param string $orgform
*
* @return void
*/
protected function getSemester($studiengang_kz, $semester, $org_form = null)
{
$link = $studiengang_kz . '/';
if ($org_form !== null)
$link .= $org_form . '/';
$link .= $semester . '/';
$this->load->model('organisation/Gruppe_model', 'GruppeModel');
$this->GruppeModel->addDistinct();
$this->GruppeModel->addSelect("CONCAT(" . $this->GruppeModel->escape($link . 'grp/') . ", gruppe_kurzbz) AS link", false);
$this->GruppeModel->addSelect("CONCAT(gruppe_kurzbz, ' (', bezeichnung, ')') AS name", false);
$this->GruppeModel->addSelect("TRUE AS leaf", false);
$this->GruppeModel->addSelect('sort');
$this->GruppeModel->addSelect('gruppe_kurzbz');
$this->GruppeModel->addSelect($this->GruppeModel->escape($studiengang_kz) . '::integer AS stg_kz', false);
$this->GruppeModel->addOrder('sort');
$this->GruppeModel->addOrder('gruppe_kurzbz');
$where = [
'studiengang_kz' => $studiengang_kz,
'semester' => $semester,
'lehre' => true,
'sichtbar' => true,
'aktiv' => true,
'direktinskription' => false
];
if ($org_form !== null)
$where['orgform_kurzbz'] = $org_form;
$result = $this->GruppeModel->loadWhere($where);
$list = $this->getDataOrTerminateWithError($result);
$this->StudiengangModel->addJoin('public.tbl_lehrverband v', 'studiengang_kz');
$this->StudiengangModel->addSelect("CONCAT(" . $this->StudiengangModel->escape($link) . ", verband) AS link", false);
$this->StudiengangModel->addSelect("CONCAT(UPPER(CONCAT(typ, kurzbz)), '-', semester, verband, (SELECT CASE WHEN bezeichnung IS NULL OR bezeichnung='' THEN ''::TEXT ELSE CONCAT(' (', bezeichnung, ')') END FROM public.tbl_lehrverband WHERE studiengang_kz=v.studiengang_kz AND semester=v.semester AND verband=v.verband ORDER BY gruppe LIMIT 1)) AS name", false);
$this->StudiengangModel->addSelect("CASE WHEN MAX(gruppe)='' OR MAX(gruppe)=' ' THEN TRUE ELSE FALSE END AS leaf");
$this->StudiengangModel->addSelect('verband');
$this->StudiengangModel->addSelect($this->StudiengangModel->escape($studiengang_kz) . '::integer AS stg_kz', false);
$this->StudiengangModel->addOrder('verband');
$this->StudiengangModel->addGroupBy('link, name, verband');
$where = [
'v.studiengang_kz' => $studiengang_kz,
'v.semester' => $semester,
'v.verband !=' => '',
'v.aktiv' => true
];
if ($org_form !== null && $semester) // NOTE(chris): on semester 0 show all?
$where['v.orgform_kurzbz'] = $org_form;
$result = $this->StudiengangModel->loadWhere($where);
$result = $this->getDataOrTerminateWithError($result);
$list = array_merge($list, $result);
$this->terminateWithSuccess($list);
}
/**
* @param integer $studiengang_kz
* @param integer $semester
* @param integer $verband
* @param string $orgform
*
* @return void
*/
protected function getVerband($studiengang_kz, $semester, $verband, $org_form = null)
{
$link = $studiengang_kz . '/';
if ($org_form !== null)
$link .= $org_form . '/';
$link .= $semester . '/'. $verband . '/';
$this->StudiengangModel->addJoin('public.tbl_lehrverband v', 'studiengang_kz');
$this->StudiengangModel->addDistinct();
$this->StudiengangModel->addSelect("CONCAT(" . $this->StudiengangModel->escape($link) . ", gruppe) AS link", false);
$this->StudiengangModel->addSelect("CONCAT(UPPER(CONCAT(typ, kurzbz)), '-', semester, verband, gruppe, (SELECT CASE WHEN bezeichnung IS NULL OR bezeichnung='' THEN ''::TEXT ELSE CONCAT(' (', bezeichnung, ')') END FROM public.tbl_lehrverband WHERE studiengang_kz=v.studiengang_kz AND semester=v.semester AND verband=v.verband AND gruppe=v.gruppe ORDER BY gruppe LIMIT 1)) AS name", false);
$this->StudiengangModel->addSelect("TRUE AS leaf", false);
$this->StudiengangModel->addSelect('gruppe');
$this->StudiengangModel->addSelect($this->StudiengangModel->escape($studiengang_kz) . '::integer AS stg_kz', false);
$this->StudiengangModel->addOrder('gruppe');
$where = [
'v.studiengang_kz' => $studiengang_kz,
'v.semester' => $semester,
'v.verband' => $verband,
'v.gruppe !=' => '',
'v.aktiv' => true
];
if ($org_form !== null && $semester) // NOTE(chris): on semester 0 show all?
$where['v.orgform_kurzbz'] = $org_form;
$result = $this->StudiengangModel->loadWhere($where);
$list = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($list);
}
/**
* @param string $link
* @param integer $studiengang_kz
*
* @return array
*/
protected function getStdSem($link, $studiengang_kz)
{
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
$this->load->model('system/Variable_model', 'VariableModel');
$result = $this->VariableModel->getVariables(getAuthUID(), ['number_displayed_past_studiensemester']);
$data = $this->getDataOrTerminateWithError($result);
$number_displayed_past_studiensemester = $data['number_displayed_past_studiensemester'] ?? null;
$this->StudiensemesterModel->addPlusMinus(null, $number_displayed_past_studiensemester);
$this->StudiensemesterModel->addOrder('ende');
$result = $this->StudiensemesterModel->load();
$studiensemester = $this->getDataOrTerminateWithError($result);
$result = [];
$studiengang_kz = (int)$studiengang_kz;
foreach ($studiensemester as $sem) {
$semlink = $link . $sem->studiensemester_kurzbz;
$intlink = $semlink . '/interessenten';
$result[] = [
'name' => $sem->studiensemester_kurzbz,
'link' => $semlink,
'stg_kz' => $studiengang_kz,
'children' => [
[
'name' => 'Interessenten',
'link' => $intlink,
'stg_kz' => $studiengang_kz,
'children' => [
[
'name' => 'Bewerbung nicht abgeschickt',
'link' => $intlink . '/bewerbungnichtabgeschickt',
'stg_kz' => $studiengang_kz,
'leaf' => true
],
[
'name' => 'Bewerbung abgeschickt, Status unbestätigt',
'link' => $intlink . '/bewerbungabgeschickt',
'stg_kz' => $studiengang_kz,
'leaf' => true
],
[
'name' => 'ZGV erfüllt',
'link' => $intlink . '/zgv',
'stg_kz' => $studiengang_kz,
'leaf' => true
],
[
'name' => 'Status bestätigt',
'link' => $intlink . '/statusbestaetigt',
'stg_kz' => $studiengang_kz,
'children' => [
[
'name' => 'Nicht zum Reihungstest angemeldet',
'link' => $intlink . '/statusbestaetigtrtnichtangemeldet',
'leaf' => true
],
[
'name' => 'Reihungstest angemeldet',
'link' => $intlink . '/statusbestaetigtrtangemeldet',
'leaf' => true
]
]
],
[
'name' => 'Nicht zum Reihungstest angemeldet',
'link' => $intlink . '/reihungstestnichtangemeldet',
'stg_kz' => $studiengang_kz,
'leaf' => true
],
[
'name' => 'Reihungstest angemeldet',
'link' => $intlink . '/reihungstestangemeldet',
'stg_kz' => $studiengang_kz,
'leaf' => true
]
]
],
[
'name' => 'Bewerber',
'link' => $semlink . '/bewerber',
'stg_kz' => $studiengang_kz,
'children' => [
[
'name' => 'Nicht zum Reihungstest angemeldet',
'link' => $intlink . '/bewerberrtnichtangemeldet',
'stg_kz' => $studiengang_kz,
'leaf' => true
],
[
'name' => 'Reihungstest angemeldet',
'link' => $intlink . '/bewerberrtangemeldet',
'stg_kz' => $studiengang_kz,
'children' => [
[
'name' => 'Teilgenommen',
'link' => $intlink . '/bewerberrtangemeldetteilgenommen',
'stg_kz' => $studiengang_kz,
'leaf' => true
],
[
'name' => 'Nicht teilgenommen',
'link' => $intlink . '/bewerberrtangemeldetnichtteilgenommen',
'stg_kz' => $studiengang_kz,
'leaf' => true
]
]
]
]
],
[
'name' => 'Aufgenommen',
'link' => $semlink . '/aufgenommen',
'stg_kz' => $studiengang_kz,
'leaf' => true
],
[
'name' => 'Warteliste',
'link' => $semlink . '/warteliste',
'stg_kz' => $studiengang_kz,
'leaf' => true
],
[
'name' => 'Absage',
'link' => $semlink . '/absage',
'stg_kz' => $studiengang_kz,
'leaf' => true
],
[
'name' => 'Incoming',
'link' => $semlink . '/incoming',
'stg_kz' => $studiengang_kz,
'leaf' => true
]
]
];
}
return $result;
}
}
@@ -12,7 +12,7 @@ class CheckUserAuth extends RESTFul_Controller
parent::__construct();
// Loads helper message to manage returning messages
// NOTE: loaded here because it does not extend the API_Controller
// NOTE: loaded here because it does not extend the APIv1_Controller
$this->load->helper('hlp_return_object');
}
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Aufteilung extends API_Controller
class Aufteilung extends APIv1_Controller
{
/**
* Aufteilung API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Bestelldetail extends API_Controller
class Bestelldetail extends APIv1_Controller
{
/**
* Bestelldetail API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Bestelldetailtag extends API_Controller
class Bestelldetailtag extends APIv1_Controller
{
/**
* Bestelldetailtag API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Bestellstatus extends API_Controller
class Bestellstatus extends APIv1_Controller
{
/**
* Bestellstatus API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Bestellung extends API_Controller
class Bestellung extends APIv1_Controller
{
/**
* Bestellung API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Bestellungtag extends API_Controller
class Bestellungtag extends APIv1_Controller
{
/**
* Bestellungtag API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Buchung extends API_Controller
class Buchung extends APIv1_Controller
{
/**
* Buchung API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Buchungstyp extends API_Controller
class Buchungstyp extends APIv1_Controller
{
/**
* Buchungstyp API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Budget extends API_Controller
class Budget extends APIv1_Controller
{
/**
* Budget API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Konto extends API_Controller
class Konto extends APIv1_Controller
{
/**
* Konto API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Kostenstelle extends API_Controller
class Kostenstelle extends APIv1_Controller
{
/**
* Kostenstelle API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Rechnung extends API_Controller
class Rechnung extends APIv1_Controller
{
/**
* Rechnung API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Rechnungsbetrag extends API_Controller
class Rechnungsbetrag extends APIv1_Controller
{
/**
* Rechnungsbetrag API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Rechnungstyp extends API_Controller
class Rechnungstyp extends APIv1_Controller
{
/**
* Rechnungstyp API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Vertrag extends API_Controller
class Vertrag extends APIv1_Controller
{
/**
* Vertrag API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Vertragsstatus extends API_Controller
class Vertragsstatus extends APIv1_Controller
{
/**
* Vertragsstatus API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Vertragstyp extends API_Controller
class Vertragstyp extends APIv1_Controller
{
/**
* Vertragstyp API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Zahlungstyp extends API_Controller
class Zahlungstyp extends APIv1_Controller
{
/**
* Zahlungstyp API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Akadgrad extends API_Controller
class Akadgrad extends APIv1_Controller
{
/**
* Akadgrad API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Archiv extends API_Controller
class Archiv extends APIv1_Controller
{
/**
* Archiv API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Aufmerksamdurch extends API_Controller
class Aufmerksamdurch extends APIv1_Controller
{
/**
* Aufmerksamdurch API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Ausbildung extends API_Controller
class Ausbildung extends APIv1_Controller
{
/**
* Ausbildung API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Berufstaetigkeit extends API_Controller
class Berufstaetigkeit extends APIv1_Controller
{
/**
* Berufstaetigkeit API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Beschaeftigungsausmass extends API_Controller
class Beschaeftigungsausmass extends APIv1_Controller
{
/**
* Beschaeftigungsausmass API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Besqual extends API_Controller
class Besqual extends APIv1_Controller
{
/**
* Besqual API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Bisfunktion extends API_Controller
class Bisfunktion extends APIv1_Controller
{
/**
* Bisfunktion API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Bisio extends API_Controller
class Bisio extends APIv1_Controller
{
/**
* Bisio API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Bisorgform extends API_Controller
class Bisorgform extends APIv1_Controller
{
/**
* Bisorgform API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Bisverwendung extends API_Controller
class Bisverwendung extends APIv1_Controller
{
/**
* Bisverwendung API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Bundesland extends API_Controller
class Bundesland extends APIv1_Controller
{
/**
* Course API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Entwicklungsteam extends API_Controller
class Entwicklungsteam extends APIv1_Controller
{
/**
* Entwicklungsteam API constructor.
@@ -14,7 +14,7 @@
if (!defined("BASEPATH")) exit("No direct script access allowed");
class Gemeinde extends API_Controller
class Gemeinde extends APIv1_Controller
{
/**
* Gemeinde API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Hauptberuf extends API_Controller
class Hauptberuf extends APIv1_Controller
{
/**
* Hauptberuf API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Lehrform extends API_Controller
class Lehrform extends APIv1_Controller
{
/**
* Lehrform API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Lgartcode extends API_Controller
class Lgartcode extends APIv1_Controller
{
/**
* Lgartcode API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Mobilitaetsprogramm extends API_Controller
class Mobilitaetsprogramm extends APIv1_Controller
{
/**
* Mobilitaetsprogramm API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Nation extends API_Controller
class Nation extends APIv1_Controller
{
/**
* Course API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Note extends API_Controller
class Note extends APIv1_Controller
{
/**
* Note API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Orgform extends API_Controller
class Orgform extends APIv1_Controller
{
/**
* Orgform API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Verwendung extends API_Controller
class Verwendung extends APIv1_Controller
{
/**
* Verwendung API constructor.
+1 -1
View File
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Zgv extends API_Controller
class Zgv extends APIv1_Controller
{
/**
* Zgv API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Zgvdoktor extends API_Controller
class Zgvdoktor extends APIv1_Controller
{
/**
* Zgvdoktor API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Zgvgruppe extends API_Controller
class Zgvgruppe extends APIv1_Controller
{
/**
* Zgvgruppe API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Zgvmaster extends API_Controller
class Zgvmaster extends APIv1_Controller
{
/**
* Zgvmaster API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Zweck extends API_Controller
class Zweck extends APIv1_Controller
{
/**
* Zweck API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Ampel extends API_Controller
class Ampel extends APIv1_Controller
{
/**
* Ampel API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Content extends API_Controller
class Content extends APIv1_Controller
{
/**
* Content API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Contentchild extends API_Controller
class Contentchild extends APIv1_Controller
{
/**
* Contentchild API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Contentgruppe extends API_Controller
class Contentgruppe extends APIv1_Controller
{
/**
* Contentgruppe API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Contentlog extends API_Controller
class Contentlog extends APIv1_Controller
{
/**
* Contentlog API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Contentsprache extends API_Controller
class Contentsprache extends APIv1_Controller
{
/**
* Contentsprache API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Dms extends API_Controller
class Dms extends APIv1_Controller
{
/**
*
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Infoscreen extends API_Controller
class Infoscreen extends APIv1_Controller
{
/**
* Infoscreen API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class News extends API_Controller
class News extends APIv1_Controller
{
/**
* News API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Template extends API_Controller
class Template extends APIv1_Controller
{
/**
* Template API constructor.
@@ -14,7 +14,7 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Veranstaltung extends API_Controller
class Veranstaltung extends APIv1_Controller
{
/**
* Veranstaltung API constructor.

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