mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 06:54:04 +00:00
Merge remote-tracking branch 'origin/master' into feature-54225/reihungstest_ablauf_fuer_quereinsteiger
# Conflicts: # cis/testtool/menu.php # system/dbupdate_3.4.php
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
documents/
|
documents/
|
||||||
vendor/
|
vendor/
|
||||||
|
public/vendor
|
||||||
|
|
||||||
/nbproject/
|
/nbproject/
|
||||||
.vscode
|
.vscode
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
$filterCmptArray = array(
|
||||||
|
"app" => 'core',
|
||||||
|
'datasetName' => 'vertragsverwaltung',
|
||||||
|
'query' => '
|
||||||
|
SELECT
|
||||||
|
uid,
|
||||||
|
person_id,
|
||||||
|
vorname,
|
||||||
|
nachname,
|
||||||
|
gebdatum,
|
||||||
|
vertragsarten,
|
||||||
|
unternehmen,
|
||||||
|
ids,
|
||||||
|
aktiv
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
b.uid , p.person_id,
|
||||||
|
p.vorname, p.nachname,
|
||||||
|
gebdatum,
|
||||||
|
STRING_AGG(DISTINCT va.bezeichnung, \', \') AS Vertragsarten,
|
||||||
|
STRING_AGG(DISTINCT u.bezeichnung, \', \') AS Unternehmen,
|
||||||
|
STRING_AGG(d.dienstverhaeltnis_id::TEXT, \', \') AS ids,
|
||||||
|
b.aktiv
|
||||||
|
FROM
|
||||||
|
hr.tbl_dienstverhaeltnis d
|
||||||
|
JOIN public.tbl_benutzer b ON d.mitarbeiter_uid = b.uid
|
||||||
|
JOIN public.tbl_person p ON p.person_id = b.person_id
|
||||||
|
JOIN public.tbl_organisationseinheit u ON d.oe_kurzbz = u.oe_kurzbz
|
||||||
|
JOIN hr.tbl_vertragsart va ON d.vertragsart_kurzbz = va.vertragsart_kurzbz
|
||||||
|
GROUP BY b.uid, p.person_id, p.vorname, p.nachname, b.aktiv
|
||||||
|
) as vertragsdaten
|
||||||
|
',
|
||||||
|
'requiredPermissions' => 'vertrag/mitarbeiter'
|
||||||
|
);
|
||||||
@@ -3,12 +3,35 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
|
|
||||||
use CI3_Events as Events;
|
use CI3_Events as Events;
|
||||||
|
|
||||||
/**
|
Events::on('loadRenderers', function ($renderers) {
|
||||||
* NOTE(chris): example:
|
$fhc_core_renderers =& $renderers();
|
||||||
Events::on('stv_conf_student', function (&$res) {
|
$fhc_core_renderers["lehreinheit"] = array(
|
||||||
$res['test'] = [
|
'calendarEvent' => absoluteJsImportUrl('public/js/components/Cis/Renderer/Lehreinheit/calendarEvent.js'),
|
||||||
'title' => 'TEST',
|
'modalTitle' => absoluteJsImportUrl('public/js/components/Cis/Renderer/Lehreinheit/modalTitle.js'),
|
||||||
'component' => './Stv/Studentenverwaltung/Details/Notizen.js'
|
'modalContent' => absoluteJsImportUrl('public/js/components/Cis/Renderer/Lehreinheit/modalContent.js'),
|
||||||
];
|
'calendarEventStyles' => APP_ROOT . 'public/css/Cis4/CoreCalendarEvents.css'
|
||||||
});
|
);
|
||||||
*/
|
});
|
||||||
|
|
||||||
|
Events::on('loadRenderers', function ($renderers) {
|
||||||
|
$fhc_core_renderers =& $renderers();
|
||||||
|
$fhc_core_renderers["reservierung"] = array(
|
||||||
|
'calendarEvent' => absoluteJsImportUrl('public/js/components/Cis/Renderer/Reservierungen/calendarEvent.js'),
|
||||||
|
'modalTitle' => absoluteJsImportUrl('public/js/components/Cis/Renderer/Reservierungen/modalTitle.js'),
|
||||||
|
'modalContent' => absoluteJsImportUrl('public/js/components/Cis/Renderer/Reservierungen/modalContent.js'),
|
||||||
|
'calendarEventStyles' => APP_ROOT . 'public/css/Cis4/CoreCalendarEvents.css'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
Events::on('loadRenderers', function ($renderers) {
|
||||||
|
$fhc_core_renderers =& $renderers();
|
||||||
|
$fhc_core_renderers["ferien"] = array(
|
||||||
|
'calendarEvent' => absoluteJsImportUrl('public/js/components/Cis/Renderer/Feiertage/calendarEvent.js'),
|
||||||
|
'modalTitle' => absoluteJsImportUrl('public/js/components/Cis/Renderer/Feiertage/modalTitle.js'),
|
||||||
|
'modalContent' => absoluteJsImportUrl('public/js/components/Cis/Renderer/Feiertage/modalContent.js'),
|
||||||
|
'calendarEventStyles' => APP_ROOT . 'public/css/Cis4/CoreCalendarEvents.css'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
$config['turnitin_link'] = 'https://technikum-wien.turnitin.com/sso/sp/redwood/saml/5IyfmBr2OcSIaWQTKlFCGj/start';
|
||||||
|
|
||||||
|
$config['old_abgabe_beurteilung_link'] = 'https://moodle.technikum-wien.at/mod/page/view.php?id=1005052';
|
||||||
|
|
||||||
|
$config['PAABGABE_EMAIL_JOB_INTERVAL'] = '1 day';
|
||||||
|
// used as APP_ROOT.URL_STUDENTS -> cis4
|
||||||
|
$config['URL_STUDENTS'] = 'cis.php/Cis/Abgabetool/Student';
|
||||||
|
// used as APP_ROOT.URL_MITARBEITER -> old cis
|
||||||
|
$config['URL_MITARBEITER'] = 'index.ci.php/Cis/Abgabetool/Mitarbeiter';
|
||||||
|
// used as APP_ROOT.URL_MITARBEITER -> old cis
|
||||||
|
$config['URL_ASSISTENZ'] = 'index.ci.php/Cis/Abgabetool/Assistenz';
|
||||||
|
|
||||||
|
// lehre.tbl_paabgabetyp bezeichnung
|
||||||
|
//$config['ALLOWED_ABGABETYPEN_BETREUER'] = ['Zwischenabgabe', 'Quality Gate 1', 'Quality Gate 2'];
|
||||||
|
$config['ALLOWED_ABGABETYPEN_BETREUER'] = ['abstract','zwischen', 'qualgate1', 'qualgate2']; // tbl_paabgabetyp pk
|
||||||
|
// paabgabetypen for which betreuer is benachrichtigt via sammelmail
|
||||||
|
$config['RELEVANT_PAABGABETYPEN_SAMMELMAIL_BETREUER'] = ['qualgate1', 'qualgate2', 'end'];
|
||||||
|
// paabgabetypen for which assistenz is benachrichtigt via sammelmail
|
||||||
|
$config['RELEVANT_PAABGABETYPEN_SAMMELMAIL_ASSISTENZ'] = ['end'];
|
||||||
|
// paabgabetypen for which student is benachrichtigt via sammelmail -> basically all of them but still defined for consistency
|
||||||
|
$config['RELEVANT_PAABGABETYPEN_SAMMELMAIL_STUDENT'] = ['qualgate1', 'qualgate2', 'zwischen', 'note', 'abstract', 'end', 'enda'];
|
||||||
|
//$config['ALLOWED_NOTEN_ABGABETOOL'] = ['Bestanden', 'Nicht bestanden'];
|
||||||
|
$config['ALLOWED_NOTEN_ABGABETOOL'] = [10, 14]; // tbl_note pk
|
||||||
|
// benotete projektarbeiten sperren weitere terminanlage & bearbeitung, diese noten sind ausnahmen dieser Regel
|
||||||
|
// wie zB "Nicht beurteilt" & "Noch nicht eingetragen"
|
||||||
|
$config['NONFINAL_NOTEN_ABGABETOOL'] = [9];
|
||||||
|
$config['beurteilung_link_fallback'] = 'cis/private/lehre/projektbeurteilungDocumentExport.php?projektarbeit_id=?&betreuerart_kurzbz=?&person_id=?';
|
||||||
|
|
||||||
|
$config['PROJEKTARBEITSBEURTEILUNG_MAIL_BASELINK_ERSTBEGUTACHTER'] = 'index.ci.php/extensions/FHC-Core-Projektarbeitsbeurteilung/ProjektarbeitsbeurteilungErstbegutachter';
|
||||||
|
$config['PROJEKTARBEITSBEURTEILUNG_MAIL_BASELINK_ZWEITBEGUTACHTER'] = 'index.ci.php/extensions/FHC-Core-Projektarbeitsbeurteilung/ProjektarbeitsbeurteilungErstbegutachter';
|
||||||
|
|
||||||
|
$config['SIGNATUR_CHECK_PAABGABETYPEN'] = ['end'];
|
||||||
|
|
||||||
|
// to be used as "https://moodle.technikum-wien.at/course/view.php?idnumber=dl{$stg_kz}" for stg specific moodle routing
|
||||||
|
$config['STG_MOODLE_LINK'] = 'https://moodle.technikum-wien.at/course/view.php?idnumber=dl';
|
||||||
|
// TODO: check if these links change if the file changes and how to better retrieve the link?
|
||||||
|
$config['SIGNATUR_INFO_LINK_GERMAN'] = 'https://cis.technikum-wien.at/cms/dms.php?id=214779';
|
||||||
|
$config['SIGNATUR_INFO_LINK_ENGLISH'] = 'https://cis.technikum-wien.at/cms/dms.php?id=264256';
|
||||||
|
|
||||||
|
$config['ASSISTENZ_SAMMELMAIL_BUTTON_STUDENT'] = true;
|
||||||
|
$config['ASSISTENZ_SAMMELMAIL_BUTTON_BETREUER'] = true;
|
||||||
|
|
||||||
|
$config['BETREUER_SAMMELMAIL_BUTTON_STUDENT'] = true;
|
||||||
|
|
||||||
|
$config['MULTIEDIT_TABLE'] = true;
|
||||||
|
|
||||||
|
$config['STUDENT_EDIT_PROJEKTARBEIT_TITLE'] = true;
|
||||||
|
|
||||||
|
$config['CONFETTI_ON_ENDUPLOAD'] = true;
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
|
||||||
// Deadline for Application given as Time-Interval after Semesterstart.
|
// Deadline for Application given as Time-Interval after Semesterstart.
|
||||||
@@ -24,3 +24,12 @@ $config['send_mail'] = TRUE;
|
|||||||
|
|
||||||
// Display fields to explain equivalence of ECTS and LV-Inhalte
|
// Display fields to explain equivalence of ECTS and LV-Inhalte
|
||||||
$config['explain_equivalence'] = TRUE;
|
$config['explain_equivalence'] = TRUE;
|
||||||
|
|
||||||
|
// Displays infobox if set to true
|
||||||
|
$config['display_infobox'] = [
|
||||||
|
'fristen' => TRUE,
|
||||||
|
'referenzbeispiele_ects' => TRUE,
|
||||||
|
'voraussetzungen' => TRUE,
|
||||||
|
'nachweisdokumente' => TRUE,
|
||||||
|
'herkunft_kenntnisse' => TRUE
|
||||||
|
];
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
// Define configuration parameters
|
||||||
|
$config['timezone'] = 'Europe/Vienna';
|
||||||
@@ -4,6 +4,12 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
|
|
||||||
|
|
||||||
// CMS Content Id for CIS4 Menu Root
|
// CMS Content Id for CIS4 Menu Root
|
||||||
$config['cis_menu_root_content_id'] = 11066;
|
$config['cis_menu_root_content_id'] = 11091;
|
||||||
// send Mails for ProfilUpdate
|
// send Mails for ProfilUpdate
|
||||||
$config['cis_send_profil_update_mails'] = true;
|
$config['cis_send_profil_update_mails'] = true;
|
||||||
|
// Vilesci CI BaseUrl
|
||||||
|
$config['cis_vilesci_base_url'] = defined('VILESCI_ROOT') ? VILESCI_ROOT : APP_ROOT;
|
||||||
|
$config['cis_vilesci_index_page'] = 'index.ci.php';
|
||||||
|
// Cis CI BaseUrl
|
||||||
|
$config['cis_base_url'] = defined('CIS_ROOT') ? CIS_ROOT : APP_ROOT;
|
||||||
|
$config['cis_index_page'] = 'cis.php';
|
||||||
|
|||||||
@@ -3,3 +3,4 @@
|
|||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
$config['infocenter_studiengang_kz'] = '10021, 10027, 10002';
|
$config['infocenter_studiengang_kz'] = '10021, 10027, 10002';
|
||||||
|
$config['infocenter_qualifikationskurs_kz'] = '10002';
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
// apps for which issues should be displayed
|
||||||
|
$config['issues_list_apps'] = array('core', 'dvuh');
|
||||||
|
|
||||||
|
// functions which enable users to see issues
|
||||||
|
$config['issues_list_functions'] = array('ass');
|
||||||
|
|
||||||
|
// functions which enable users to see issues
|
||||||
|
$config['issues_list_status'] = array('Aufgenommener', 'Student', 'Incoming', 'Diplomand', 'Abbrecher', 'Unterbrecher', 'Absolvent');
|
||||||
@@ -4,4 +4,9 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
// use vuejs dev version
|
// use vuejs dev version
|
||||||
$config['use_vuejs_dev_version'] = false;
|
$config['use_vuejs_dev_version'] = false;
|
||||||
// use bundled javascript
|
// use bundled javascript
|
||||||
$config['use_bundled_javascript'] = false;
|
$config['use_bundled_javascript'] = false;
|
||||||
|
// systemerror_mailto use in FHC-Alert Plugin - if empty Link will not be rendered
|
||||||
|
$config['systemerror_mailto'] = '';
|
||||||
|
// use fhcomplete_build_version as path element after public (requires apache mod_rewrite)
|
||||||
|
// see <fhc_base_dir>/public/.htaccess_sample for details
|
||||||
|
$config['use_fhcomplete_build_version_in_path'] = false;
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*It defines which tags are available in LVVerwaltung and whether they are editable
|
||||||
|
|
||||||
|
$config['lvverwaltung_tags'] = [
|
||||||
|
'tag_1' => ['readonly' => false],
|
||||||
|
'tag_1' => ['readonly' => true]
|
||||||
|
];
|
||||||
|
*/
|
||||||
|
|
||||||
|
$config['lvverwaltung_tags'] = [];
|
||||||
|
|
||||||
|
# Additional columns:
|
||||||
|
/*
|
||||||
|
$config["list_columns"] = [
|
||||||
|
'fieldname' => [
|
||||||
|
'js' => 'path/to/snippet.js', // tabulator config snippet (eg: return { name: 'Name', field: 'fieldname' }; )
|
||||||
|
// NOTE: 'default' & 'joins' like in stv.php config are currently not available here
|
||||||
|
]
|
||||||
|
];
|
||||||
|
*/
|
||||||
|
|
||||||
@@ -32,3 +32,18 @@ $config['validate'] = false; // If true then the email address will be validated
|
|||||||
|
|
||||||
// If enabled will be logged info about emails in Codeigniter error logs
|
// If enabled will be logged info about emails in Codeigniter error logs
|
||||||
$config['enable_debug'] = false;
|
$config['enable_debug'] = false;
|
||||||
|
|
||||||
|
// default sender
|
||||||
|
$config['sancho_mail_default_sender'] = defined('SANCHO_MAIL_DEFAULT_SENDER') ? SANCHO_MAIL_DEFAULT_SENDER : '';
|
||||||
|
|
||||||
|
// If to use images for custom mails
|
||||||
|
$config['sancho_mail_use_images'] = defined('SANCHO_MAIL_USE_IMAGES') ? SANCHO_MAIL_USE_IMAGES : false;
|
||||||
|
|
||||||
|
// image path for sancho mail, relativ to document root
|
||||||
|
$config['sancho_mail_img_path'] = defined('SANCHO_MAIL_IMG_PATH') ? SANCHO_MAIL_IMG_PATH : '';
|
||||||
|
|
||||||
|
// header image for custom mails
|
||||||
|
$config['sancho_mail_header_img'] = defined('SANCHO_MAIL_HEADER_IMG') ? SANCHO_MAIL_HEADER_IMG : '';
|
||||||
|
|
||||||
|
// footer image for custom mails
|
||||||
|
$config['sancho_mail_footer_img'] = defined('SANCHO_MAIL_FOOTER_IMG') ? SANCHO_MAIL_FOOTER_IMG : '';
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ $config['navigation_header'] = array(
|
|||||||
'lehrveranstaltungen' => array(
|
'lehrveranstaltungen' => array(
|
||||||
'link' => site_url('lehre/lvplanung/LvTemplateUebersicht'),
|
'link' => site_url('lehre/lvplanung/LvTemplateUebersicht'),
|
||||||
'icon' => '',
|
'icon' => '',
|
||||||
'description' => 'Lehrveranstaltungen',
|
'description' => 'Lehrveranstaltungen Templates',
|
||||||
'sort' => 15
|
'sort' => 15
|
||||||
),
|
),
|
||||||
'reihungstest' => array(
|
'reihungstest' => array(
|
||||||
@@ -81,6 +81,16 @@ $config['navigation_header'] = array(
|
|||||||
'sort' => 30,
|
'sort' => 30,
|
||||||
'requiredPermissions' => 'infocenter:r'
|
'requiredPermissions' => 'infocenter:r'
|
||||||
),
|
),
|
||||||
|
'lvverwaltung' => array(
|
||||||
|
'link' => site_url('LVVerwaltung'),
|
||||||
|
'icon' => '',
|
||||||
|
'description' => 'LV Verwaltung',
|
||||||
|
'requiredPermissions' => array(
|
||||||
|
'admin:r',
|
||||||
|
'assistenz:r'
|
||||||
|
),
|
||||||
|
'sort' => 35
|
||||||
|
),
|
||||||
'lehrauftrag' => array(
|
'lehrauftrag' => array(
|
||||||
'link' => site_url('lehre/lehrauftrag/Lehrauftrag/Dashboard'),
|
'link' => site_url('lehre/lehrauftrag/Lehrauftrag/Dashboard'),
|
||||||
'description' => 'Lehrauftrag',
|
'description' => 'Lehrauftrag',
|
||||||
@@ -93,7 +103,7 @@ $config['navigation_header'] = array(
|
|||||||
),
|
),
|
||||||
'zverfueg' => array(
|
'zverfueg' => array(
|
||||||
'link' => site_url('lehre/lvplanung/AdminZeitverfuegbarkeit'),
|
'link' => site_url('lehre/lvplanung/AdminZeitverfuegbarkeit'),
|
||||||
'description' => 'Zeitverfügbarkeit',
|
'description' => 'Zeitverfügbarkeit',
|
||||||
'expand' => true,
|
'expand' => true,
|
||||||
'sort' => 45,
|
'sort' => 45,
|
||||||
'requiredPermissions' => array(
|
'requiredPermissions' => array(
|
||||||
@@ -153,6 +163,20 @@ $config['navigation_header'] = array(
|
|||||||
'expand' => true,
|
'expand' => true,
|
||||||
'sort' => 50,
|
'sort' => 50,
|
||||||
'requiredPermissions' => 'lehre/gruppenmanager:r'
|
'requiredPermissions' => 'lehre/gruppenmanager:r'
|
||||||
|
),
|
||||||
|
'vertragsverwaltung' => array(
|
||||||
|
'link' => site_url('vertragsverwaltung'),
|
||||||
|
'description' => 'Vertragsverwaltung',
|
||||||
|
'expand' => true,
|
||||||
|
'sort' => 51,
|
||||||
|
'requiredPermissions' => 'vertrag/mitarbeiter:r'
|
||||||
|
),
|
||||||
|
'studierendenverwaltung' => array(
|
||||||
|
'link' => site_url('studentenverwaltung'),
|
||||||
|
'description' => 'Studierendenverwaltung',
|
||||||
|
'expand' => true,
|
||||||
|
'sort' => 52,
|
||||||
|
'requiredPermissions' => ['admin:r', 'assistenz:r']
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
@@ -191,7 +215,14 @@ $config['navigation_header'] = array(
|
|||||||
'expand' => true,
|
'expand' => true,
|
||||||
'sort' => 30,
|
'sort' => 30,
|
||||||
'requiredPermissions' => 'lehre/anrechnungszeitfenster:rw'
|
'requiredPermissions' => 'lehre/anrechnungszeitfenster:rw'
|
||||||
)
|
),
|
||||||
|
'dashboardadmin' => array(
|
||||||
|
'link' => site_url('dashboard/Admin'),
|
||||||
|
'description' => 'Dashboard Admin',
|
||||||
|
'expand' => true,
|
||||||
|
'sort' => 40,
|
||||||
|
'requiredPermissions' => 'dashboard/admin:r'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -325,4 +356,37 @@ $config['navigation_menu']['system/issues/Issues/*'] = array(
|
|||||||
'target' => '_blank',
|
'target' => '_blank',
|
||||||
'requiredPermissions' => array('admin:rw')
|
'requiredPermissions' => array('admin:rw')
|
||||||
),
|
),
|
||||||
);
|
|
||||||
|
);
|
||||||
|
|
||||||
|
$config['navigation_menu']['vertragsverwaltung/*'] = array(
|
||||||
|
'vertragsverwaltung' => array(
|
||||||
|
'link' => site_url('vertragsverwaltung'),
|
||||||
|
'description' => 'Vertragsverwaltung',
|
||||||
|
'icon' => 'home',
|
||||||
|
'sort' => 100,
|
||||||
|
'target' => '_blank',
|
||||||
|
'requiredPermissions' => array('vertrag/mitarbeiter:r')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$config['navigation_menu']['apps'] = [
|
||||||
|
'stv' => [
|
||||||
|
'link' => site_url('studentenverwaltung'),
|
||||||
|
'description' => 'Studierendenverwaltung',
|
||||||
|
#'icon' => 'users',
|
||||||
|
'requiredPermissions' => array('admin:r', 'assistenz:r')
|
||||||
|
],
|
||||||
|
'lvv' => [
|
||||||
|
'link' => site_url('lVVerwaltung'),
|
||||||
|
'description' => 'LV Verwaltung',
|
||||||
|
#'icon' => 'person-chalkboard',
|
||||||
|
'requiredPermissions' => array('admin:r', 'assistenz:r')
|
||||||
|
],
|
||||||
|
'lav' => [
|
||||||
|
'link' => site_url('lehre/lehrauftrag/Lehrauftrag/Dashboard'),
|
||||||
|
'description' => 'Lehrauftragsverwaltung',
|
||||||
|
#'icon' => 'person-chalkboard',
|
||||||
|
'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r', 'lehre/lehrauftrag_erteilen:r')
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
// liste von raumtyp_kurzbz welche in raumsuche studenten angezeigt werden
|
||||||
|
$config['roomtypes_student'] = array(
|
||||||
|
'LAB BM/Chem',
|
||||||
|
'xEDV 1-36',
|
||||||
|
'xEDV 37-60',
|
||||||
|
'EDV 60',
|
||||||
|
'EDV-HÖPL',
|
||||||
|
'EDV ES',
|
||||||
|
'LAB Elek',
|
||||||
|
'LAB ES/TK',
|
||||||
|
'Ener-EDV',
|
||||||
|
'Ener-Lab',
|
||||||
|
'Ener-SEM',
|
||||||
|
'Ener-HS',
|
||||||
|
'HS 59-109',
|
||||||
|
'HS 25-38',
|
||||||
|
'HS 39-58',
|
||||||
|
'LAB Inf',
|
||||||
|
'LAB Robo',
|
||||||
|
'LAB SET'
|
||||||
|
);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------------
|
| -------------------------------------------------------------------------
|
||||||
@@ -51,7 +51,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||||||
| my-controller/my-method -> my_controller/my_method
|
| my-controller/my-method -> my_controller/my_method
|
||||||
*/
|
*/
|
||||||
$route['default_controller'] = defined('CIS4') && CIS4 ? 'Cis4' : 'Vilesci';
|
$route['default_controller'] = defined('CIS4') && CIS4 ? 'Cis4' : 'Vilesci';
|
||||||
$route['translate_uri_dashes'] = FALSE;
|
$route['translate_uri_dashes'] = false;
|
||||||
|
|
||||||
// Class name conflicts
|
// Class name conflicts
|
||||||
$route['api/v1/organisation/[S|s]tudiengang/(:any)'] = 'api/v1/organisation/studiengang2/$1';
|
$route['api/v1/organisation/[S|s]tudiengang/(:any)'] = 'api/v1/organisation/studiengang2/$1';
|
||||||
@@ -61,27 +61,106 @@ $route['api/v1/organisation/[O|o]rganisationseinheit/(:any)'] = 'api/v1/organisa
|
|||||||
$route['api/v1/ressource/[B|b]etriebsmittelperson/(:any)'] = 'api/v1/ressource/betriebsmittelperson2/$1';
|
$route['api/v1/ressource/[B|b]etriebsmittelperson/(:any)'] = 'api/v1/ressource/betriebsmittelperson2/$1';
|
||||||
$route['api/v1/system/[S|s]prache/(:any)'] = 'api/v1/system/sprache2/$1';
|
$route['api/v1/system/[S|s]prache/(:any)'] = 'api/v1/system/sprache2/$1';
|
||||||
|
|
||||||
$route['CisVue'] = 'CisVue/dashboard';
|
$route['Cis/LvPlan/.*'] = 'Cis/LvPlan/index/$1';
|
||||||
$route['Cis/Stundenplan/(:any)'] = 'Cis/Stundenplan';
|
$route['Cis/MyLvPlan/.*'] = 'Cis/MyLvPlan/index/$1';
|
||||||
|
$route['Cis/MyLv/.*'] = 'Cis/MyLv/index/$1';
|
||||||
|
$route['Cis/OtherLvPlan/.*'] = 'Cis/OtherLvPlan/index/$1';
|
||||||
|
//Route for LV Plan Stg/Semester/Verband/Gruppe
|
||||||
|
$route['Cis/StgOrgLvPlan/.*'] = 'Cis/StgOrgLvPlan/index/$1';
|
||||||
|
|
||||||
// load routes from extensions
|
$route['Abgabetool/Assistenz'] = 'Cis/Abgabetool/Assistenz';
|
||||||
$subdir = 'application/config/extensions';
|
$route['Abgabetool/Assistenz/(:any)'] = 'Cis/Abgabetool/Assistenz/$1';
|
||||||
$dirlist = scandir($subdir);
|
$route['Abgabetool/Mitarbeiter'] = 'Cis/Abgabetool/Mitarbeiter';
|
||||||
|
$route['Abgabetool/Student'] = 'Cis/Abgabetool/Student';
|
||||||
|
$route['Abgabetool/Student/(:any)'] = 'Cis/Abgabetool/Student/$1';
|
||||||
|
$route['Abgabetool/Deadlines'] = 'Cis/Abgabetool/Deadlines';
|
||||||
|
|
||||||
if ($dirlist)
|
// Studierendenverwaltung App Routes
|
||||||
|
$route['studvw'] = 'studentenverwaltung/index';
|
||||||
|
$route['studvw/.*'] = 'studentenverwaltung/index';
|
||||||
|
// Old routes
|
||||||
|
$route['studentenverwaltung'] = 'redirect/301/studvw';
|
||||||
|
$route['studentenverwaltung/(:any)'] = 'redirect/301/studvw/stdsem/$1';
|
||||||
|
$route['studentenverwaltung/(:any)/(prestudent|student|person|search)/(:any)'] = 'redirect/301/studvw/stdsem/$1/$2/$3';
|
||||||
|
$route['studentenverwaltung/(:any)/prestudent/(:any)/tab/:any'] = 'redirect/301/studvw/stdsem/$1/prestudent/$2';
|
||||||
|
$route['studentenverwaltung/(:any)/search/(:any)/(:any)'] = 'redirect/301/studvw/stdsem/$1/search/$2/$3';
|
||||||
|
$route['studentenverwaltung/(:any)/(:any)'] = 'redirect/301/studvw/stdsem/$1/stg/$2';
|
||||||
|
|
||||||
|
// Studierendenverwaltung List Routes
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/inout/1/incoming/1'] = 'api/frontend/v1/stv/students/getIncoming/$1';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/inout/1/outgoing/1'] = 'api/frontend/v1/stv/students/getOutgoing/$1';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/inout/1/shared_studies/1'] = 'api/frontend/v1/stv/students/getGemeinsamestudien/$1';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/:any/stg/(:any)/prestudent/1/stdsem/(:any)/:any/1/:any/1/(:any)/1'] = 'api/frontend/v1/stv/students/getPrestudents/$1/$2/$3';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/:any/stg/(:any)/prestudent/1/stdsem/(:any)/:any/1/(:any)/1'] = 'api/frontend/v1/stv/students/getPrestudents/$1/$2/$3';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/:any/stg/(:any)/prestudent/1/stdsem/(:any)/(:any)/1'] = 'api/frontend/v1/stv/students/getPrestudents/$1/$2/$3';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/:any/stg/(:any)/prestudent/1/stdsem/(:any)'] = 'api/frontend/v1/stv/students/getPrestudents/$1/$2';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/:any/stg/(:any)/prestudent/1'] = 'api/frontend/v1/stv/students/getPrestudents/$1';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/:any/stg/(:any)/orgform/(:any)/prestudent/1/stdsem/(:any)/:any/1/:any/1/(:any)/1'] = 'api/frontend/v1/stv/students/getPrestudentsOrgform/$1/$2/$3/$4';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/:any/stg/(:any)/orgform/(:any)/prestudent/1/stdsem/(:any)/:any/1/(:any)/1'] = 'api/frontend/v1/stv/students/getPrestudentsOrgform/$1/$2/$3/$4';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/:any/stg/(:any)/orgform/(:any)/prestudent/1/stdsem/(:any)/(:any)/1'] = 'api/frontend/v1/stv/students/getPrestudentsOrgform/$1/$2/$3/$4';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/:any/stg/(:any)/orgform/(:any)/prestudent/1/stdsem/(:any)'] = 'api/frontend/v1/stv/students/getPrestudentsOrgform/$1/$2/$3';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/:any/stg/(:any)/orgform/(:any)/prestudent/1'] = 'api/frontend/v1/stv/students/getPrestudentsOrgform/$1/$2';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/stg/(:any)/semester/(:any)/verband/(:any)/group/(:any)'] = 'api/frontend/v1/stv/students/getStudents/$1/$2/$3/$4/$5';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/stg/(:any)/semester/(:any)/verband/(:any)'] = 'api/frontend/v1/stv/students/getStudents/$1/$2/$3/$4';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/stg/(:any)/semester/(:any)'] = 'api/frontend/v1/stv/students/getStudents/$1/$2/$3';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/stg/(:any)'] = 'api/frontend/v1/stv/students/getStudents/$1/$2';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/stg/(:any)/orgform/(:any)/semester/(:any)/verband/(:any)/group/(:any)'] = 'api/frontend/v1/stv/students/getStudentsOrgform/$1/$2/$3/$4/$5/$6';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/stg/(:any)/orgform/(:any)/semester/(:any)/verband/(:any)'] = 'api/frontend/v1/stv/students/getStudentsOrgform/$1/$2/$3/$4/$5';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/stg/(:any)/orgform/(:any)/semester/(:any)'] = 'api/frontend/v1/stv/students/getStudentsOrgform/$1/$2/$3/$4';
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/stg/(:any)/orgform/(:any)'] = 'api/frontend/v1/stv/students/getStudentsOrgform/$1/$2/$3';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/stg/(:any)/semester/(:any)/group/(:any)'] = 'api/frontend/v1/stv/students/getStudentsSpezialgruppe/$1/$2/$3/$4';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/stg/(:any)/orgform/(:any)/semester/(:any)/group/(:any)'] = 'api/frontend/v1/stv/students/getStudentsOrgformSpezialgruppe/$1/$3/$2/$4/$5';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/prestudent/(:any)'] = 'api/frontend/v1/stv/students/getPrestudent/$1/$2';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/student/(:any)'] = 'api/frontend/v1/stv/students/getStudent/$1/$2';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/stdsem/(:any)/person/(:any)'] = 'api/frontend/v1/stv/students/getPerson/$1/$2';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/stv/.*'] = 'api/frontend/v1/stv/students/index';
|
||||||
|
|
||||||
|
// Lvverwaltung List Routes
|
||||||
|
$route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/stg/(:any)'] = 'api/frontend/v1/Lehrveranstaltung/getByStg/$1/$2';
|
||||||
|
$route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/stg/(:any)/semester/(:any)'] = 'api/frontend/v1/Lehrveranstaltung/getByStg/$1/$2/$3';
|
||||||
|
$route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/stg/(:any)/semester/(:any)/.*'] = 'api/frontend/v1/Lehrveranstaltung/getByStg/$1/$2/$3';
|
||||||
|
$route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/stg/(:any)/orgform/(:any)'] = 'api/frontend/v1/Lehrveranstaltung/getByStg/$1/$2/$3';
|
||||||
|
$route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/stg/(:any)/orgform/(:any)/.*'] = 'api/frontend/v1/Lehrveranstaltung/getByStg/$1/$2/$3';
|
||||||
|
|
||||||
|
$route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/emp/(:any)'] = 'api/frontend/v1/Lehrveranstaltung/getByEmp/$1/$2';
|
||||||
|
$route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/emp/(:any)/stg/(:any)'] = 'api/frontend/v1/Lehrveranstaltung/getByEmp/$1/$2/$3';
|
||||||
|
$route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/emp/(:any)/stg/(:any)/.*'] = 'api/frontend/v1/Lehrveranstaltung/getByEmp/$1/$2/$3';
|
||||||
|
|
||||||
|
|
||||||
|
// load routes from extensions, also look for environment-specific configs
|
||||||
|
$subdirs = ['application/config/extensions', 'application/config/' . ENVIRONMENT . '/extensions'];
|
||||||
|
|
||||||
|
foreach($subdirs as $subdir)
|
||||||
{
|
{
|
||||||
$files = array_diff($dirlist, array('.','..'));
|
if(is_dir($subdir))
|
||||||
|
|
||||||
foreach ($files as &$item)
|
|
||||||
{
|
{
|
||||||
if (is_dir($subdir . DIRECTORY_SEPARATOR . $item))
|
$dirlist = scandir($subdir);
|
||||||
|
if ($dirlist)
|
||||||
{
|
{
|
||||||
$routes_file = $subdir . DIRECTORY_SEPARATOR . $item . DIRECTORY_SEPARATOR . 'routes.php';
|
$files = array_diff($dirlist, array('.','..'));
|
||||||
|
|
||||||
if (file_exists($routes_file))
|
foreach ($files as &$item)
|
||||||
{
|
{
|
||||||
require($routes_file);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,874 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
|
||||||
|
$config['person'] = [
|
||||||
|
'primarykey' => 'person_id',
|
||||||
|
'table' => 'public.tbl_person',
|
||||||
|
'searchfields' => [
|
||||||
|
'uid' => [
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => 'uid',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_benutzer",
|
||||||
|
'using' => "person_id"
|
||||||
|
],
|
||||||
|
'1-n' => true
|
||||||
|
],
|
||||||
|
'vorname' => [
|
||||||
|
'alias' => ['firstname'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'vorname'
|
||||||
|
],
|
||||||
|
'nachname' => [
|
||||||
|
'alias' => ['lastname', 'surename'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'nachname'
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => "(vorname || ' ' || nachname)"
|
||||||
|
],
|
||||||
|
'email' => [
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'kontakt',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_kontakt",
|
||||||
|
'on' => "kontakttyp = 'email' AND tbl_kontakt.person_id = tbl_person.person_id"
|
||||||
|
],
|
||||||
|
"1-n" => true
|
||||||
|
],
|
||||||
|
'tel' => [
|
||||||
|
'alias' => ['phone', 'telefon'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'kontakt',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_kontakt",
|
||||||
|
'on' => "kontakttyp IN ('telefon', 'so.tel', 'mobil') AND tbl_kontakt.person_id = tbl_person.person_id"
|
||||||
|
],
|
||||||
|
"1-n" => true
|
||||||
|
],
|
||||||
|
'preid' => [
|
||||||
|
'alias' => ['prestudent_id'],
|
||||||
|
'comparison' => 'equal-int',
|
||||||
|
'field' => 'prestudent_id',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_prestudent",
|
||||||
|
'using' => "person_id"
|
||||||
|
],
|
||||||
|
'1-n' => true
|
||||||
|
],
|
||||||
|
'pid' => [
|
||||||
|
'alias' => ['person_id'],
|
||||||
|
'comparison' => 'equal-int',
|
||||||
|
'field' => 'person_id'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'resultfields' => [
|
||||||
|
"ARRAY( SELECT uid FROM public.tbl_benutzer WHERE person_id = p.person_id ) AS uids",
|
||||||
|
"p.person_id",
|
||||||
|
"(p.vorname || ' ' || p.nachname) AS name",
|
||||||
|
"ARRAY( SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp = 'email' AND person_id=p.person_id ) AS email",
|
||||||
|
"CASE
|
||||||
|
WHEN p.foto IS NOT NULL THEN 'data:image/jpeg' || CONVERT_FROM(DECODE('3b','hex'), 'UTF8') || 'base64,' || p.foto
|
||||||
|
ELSE NULL END
|
||||||
|
AS photo_url"
|
||||||
|
],
|
||||||
|
'resultjoin' => "
|
||||||
|
JOIN public.tbl_person p USING (person_id)"
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['student'] = [
|
||||||
|
'primarykey' => 'student_uid',
|
||||||
|
'table' => 'public.tbl_student',
|
||||||
|
'searchfields' => [
|
||||||
|
'uid' => [
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => 'student_uid'
|
||||||
|
],
|
||||||
|
'vorname' => [
|
||||||
|
'alias' => ['firstname'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'vorname',
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_prestudent",
|
||||||
|
'using' => "prestudent_id"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'nachname' => [
|
||||||
|
'alias' => ['lastname', 'surename'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'nachname',
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_prestudent",
|
||||||
|
'using' => "prestudent_id"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => "(vorname || ' ' || nachname)",
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_prestudent",
|
||||||
|
'using' => "prestudent_id"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'email' => [
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'kontakt',
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_prestudent",
|
||||||
|
'using' => "prestudent_id"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_kontakt",
|
||||||
|
'on' => "kontakttyp = 'email' AND tbl_kontakt.person_id = tbl_prestudent.person_id"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"1-n" => true
|
||||||
|
],
|
||||||
|
'tel' => [
|
||||||
|
'alias' => ['phone', 'telefon'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'kontakt',
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_prestudent",
|
||||||
|
'using' => "prestudent_id"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_kontakt",
|
||||||
|
'on' => "kontakttyp IN ('telefon', 'so.tel', 'mobil') AND tbl_kontakt.person_id = tbl_prestudent.person_id"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"1-n" => true
|
||||||
|
],
|
||||||
|
'stg' => [
|
||||||
|
'alias' => ['studiengang'],
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => "typ || kurzbz",
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_prestudent",
|
||||||
|
'using' => "prestudent_id"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_studiengang",
|
||||||
|
'on' => "tbl_studiengang.studiengang_kz = tbl_prestudent.studiengang_kz"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'preid' => [
|
||||||
|
'alias' => ['prestudent_id'],
|
||||||
|
'comparison' => 'equal-int',
|
||||||
|
'field' => 'prestudent_id'
|
||||||
|
],
|
||||||
|
'pid' => [
|
||||||
|
'alias' => ['person_id'],
|
||||||
|
'comparison' => 'equal-int',
|
||||||
|
'field' => 'person_id',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_prestudent",
|
||||||
|
'using' => "prestudent_id"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'resultfields' => [
|
||||||
|
"s.student_uid AS uid",
|
||||||
|
"s.matrikelnr",
|
||||||
|
"p.person_id",
|
||||||
|
"(p.vorname || ' ' || p.nachname) AS name",
|
||||||
|
"(s.student_uid || '@" . DOMAIN . "') || ARRAY( SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp = 'email' AND person_id=p.person_id ) AS email",
|
||||||
|
"CASE
|
||||||
|
WHEN p.foto IS NOT NULL THEN 'data:image/jpeg' || CONVERT_FROM(DECODE('3b','hex'), 'UTF8') || 'base64,' || p.foto
|
||||||
|
ELSE NULL END
|
||||||
|
AS photo_url",
|
||||||
|
"b.aktiv"
|
||||||
|
],
|
||||||
|
'resultjoin' => "
|
||||||
|
JOIN public.tbl_student s USING (student_uid)
|
||||||
|
JOIN public.tbl_benutzer b ON(b.uid = s.student_uid)
|
||||||
|
JOIN public.tbl_person p USING(person_id)"
|
||||||
|
];
|
||||||
|
|
||||||
|
$prestudent_sort = [
|
||||||
|
"Student",
|
||||||
|
"Incoming",
|
||||||
|
"Outgoing",
|
||||||
|
"Diplomand",
|
||||||
|
"Unterbrecher",
|
||||||
|
"Aufgenommener",
|
||||||
|
"Wartender",
|
||||||
|
"Bewerber",
|
||||||
|
"Interessent",
|
||||||
|
"Abgewiesener",
|
||||||
|
"Absolvent",
|
||||||
|
"Abbrecher",
|
||||||
|
"Ausserordentlicher",
|
||||||
|
"Praktikant"
|
||||||
|
];
|
||||||
|
$prestudent_sort_array = "array['" . implode("','", $prestudent_sort) . "']";
|
||||||
|
$config['prestudent'] = [
|
||||||
|
'primarykey' => 'prestudent_id',
|
||||||
|
'table' => 'public.tbl_prestudent',
|
||||||
|
'searchfields' => [
|
||||||
|
'uid' => [
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => 'student_uid',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_student",
|
||||||
|
'using' => "prestudent_id"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'vorname' => [
|
||||||
|
'alias' => ['firstname'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'vorname',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'nachname' => [
|
||||||
|
'alias' => ['lastname', 'surename'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'nachname',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => "(vorname || ' ' || nachname)",
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'email' => [
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'kontakt',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_kontakt",
|
||||||
|
'on' => "kontakttyp = 'email' AND tbl_kontakt.person_id = tbl_prestudent.person_id"
|
||||||
|
],
|
||||||
|
"1-n" => true
|
||||||
|
],
|
||||||
|
'tel' => [
|
||||||
|
'alias' => ['phone', 'telefon'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'kontakt',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_kontakt",
|
||||||
|
'on' => "kontakttyp IN ('telefon', 'so.tel', 'mobil') AND tbl_kontakt.person_id = tbl_prestudent.person_id"
|
||||||
|
],
|
||||||
|
"1-n" => true
|
||||||
|
],
|
||||||
|
'stg' => [
|
||||||
|
'alias' => ['studiengang'],
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => "typ || kurzbz",
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_studiengang",
|
||||||
|
'using' => "studiengang_kz"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'preid' => [
|
||||||
|
'alias' => ['prestudent_id'],
|
||||||
|
'comparison' => 'equal-int',
|
||||||
|
'field' => 'prestudent_id'
|
||||||
|
],
|
||||||
|
'pid' => [
|
||||||
|
'alias' => ['person_id'],
|
||||||
|
'comparison' => 'equal-int',
|
||||||
|
'field' => 'person_id',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'resultfields' => [
|
||||||
|
"ps.prestudent_id",
|
||||||
|
"ps.studiengang_kz",
|
||||||
|
"s.matrikelnr",
|
||||||
|
"p.person_id",
|
||||||
|
"b.uid",
|
||||||
|
"(p.vorname || ' ' || p.nachname) AS name",
|
||||||
|
"(b.uid || '@" . DOMAIN . "') || ARRAY( SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp = 'email' AND person_id=p.person_id ) AS email",
|
||||||
|
"CASE
|
||||||
|
WHEN p.foto IS NOT NULL THEN 'data:image/jpeg' || CONVERT_FROM(DECODE('3b','hex'), 'UTF8') || 'base64,' || p.foto
|
||||||
|
ELSE NULL END
|
||||||
|
AS photo_url",
|
||||||
|
"UPPER(sg.typ || sg.kurzbz) AS stg_kuerzel",
|
||||||
|
"sg.bezeichnung",
|
||||||
|
"(
|
||||||
|
SELECT bezeichnung_mehrsprachig[(TABLE lang)]
|
||||||
|
FROM public.tbl_status
|
||||||
|
WHERE status_kurzbz = public.get_rolle_prestudent(ps.prestudent_id, NULL)
|
||||||
|
LIMIT 1
|
||||||
|
) AS status",
|
||||||
|
"COALESCE(
|
||||||
|
(
|
||||||
|
SELECT COALESCE(plan.orgform_kurzbz, pss.orgform_kurzbz)
|
||||||
|
FROM public.tbl_prestudentstatus pss
|
||||||
|
LEFT JOIN lehre.tbl_studienplan plan USING (studienplan_id)
|
||||||
|
WHERE pss.prestudent_id=ps.prestudent_id
|
||||||
|
ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC
|
||||||
|
LIMIT 1
|
||||||
|
),
|
||||||
|
sg.orgform_kurzbz
|
||||||
|
) AS orgform",
|
||||||
|
"b.aktiv",
|
||||||
|
"array_position(" . $prestudent_sort_array . ", public.get_rolle_prestudent(ps.prestudent_id, NULL)) AS sort"
|
||||||
|
],
|
||||||
|
'resultjoin' => "
|
||||||
|
LEFT JOIN public.tbl_prestudent ps USING (prestudent_id)
|
||||||
|
LEFT JOIN public.tbl_student s ON (ps.prestudent_id = s.prestudent_id)
|
||||||
|
LEFT JOIN public.tbl_benutzer b ON (b.uid = s.student_uid)
|
||||||
|
JOIN public.tbl_person p ON (p.person_id = ps.person_id)
|
||||||
|
LEFT JOIN public.tbl_studiengang sg ON (sg.studiengang_kz = ps.studiengang_kz)"
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['employee'] = [
|
||||||
|
'alias' => ['ma', 'mitarbeiter'],
|
||||||
|
'primarykey' => 'mitarbeiter_uid',
|
||||||
|
'table' => 'public.tbl_mitarbeiter',
|
||||||
|
'searchfields' => [
|
||||||
|
'uid' => [
|
||||||
|
'alias' => ['mitarbeiter_uid'],
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => "mitarbeiter_uid"
|
||||||
|
],
|
||||||
|
'vorname' => [
|
||||||
|
'alias' => ['firstname'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => "vorname",
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_benutzer",
|
||||||
|
'on' => "uid = mitarbeiter_uid"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'nachname' => [
|
||||||
|
'alias' => ['lastname', 'surename'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => "nachname",
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_benutzer",
|
||||||
|
'on' => "uid = mitarbeiter_uid"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => "(vorname || ' ' || nachname)",
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_benutzer",
|
||||||
|
'on' => "uid = mitarbeiter_uid"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'email' => [
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => "COALESCE(alias, uid) || '" . '@' . DOMAIN . "'",
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_benutzer",
|
||||||
|
'on' => "uid = mitarbeiter_uid"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'tel' => [
|
||||||
|
'alias' => ['phone', 'telefon'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => "TRIM(COALESCE(kontakt, '') || ' ' || COALESCE(telefonklappe, ''))",
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_kontakt",
|
||||||
|
'on' => "kontakttyp = 'telefon' AND tbl_kontakt.standort_id = tbl_mitarbeiter.standort_id"
|
||||||
|
],
|
||||||
|
"1-n" => true
|
||||||
|
],
|
||||||
|
'pid' => [
|
||||||
|
'alias' => ['person_id'],
|
||||||
|
'comparison' => 'equal-int',
|
||||||
|
'field' => "person_id",
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_benutzer",
|
||||||
|
'on' => "uid = mitarbeiter_uid"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'oe' => [
|
||||||
|
'alias' => ['ou', 'organisationseinheit', 'organisationunit'],
|
||||||
|
'comparison' => 'vector',
|
||||||
|
'field' => "fts_bezeichnung",
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_benutzerfunktion",
|
||||||
|
'on' => "mitarbeiter_uid = uid
|
||||||
|
AND funktion_kurzbz = 'oezuordnung'
|
||||||
|
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||||
|
AND (datum_bis IS NULL OR datum_bis >= NOW())"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_organisationseinheit",
|
||||||
|
'using' => "oe_kurzbz"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'1-n' => true
|
||||||
|
],
|
||||||
|
'kst' => [
|
||||||
|
'comparison' => 'vector',
|
||||||
|
'field' => "fts_bezeichnung",
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_benutzerfunktion",
|
||||||
|
'on' => "mitarbeiter_uid = uid
|
||||||
|
AND funktion_kurzbz = 'kstzuordnung'
|
||||||
|
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||||
|
AND (datum_bis IS NULL OR datum_bis >= NOW())"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_organisationseinheit",
|
||||||
|
'using' => "oe_kurzbz"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'1-n' => true
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'resultfields' => [
|
||||||
|
"b.uid",
|
||||||
|
"p.person_id",
|
||||||
|
"(p.vorname || ' ' || p.nachname) AS name",
|
||||||
|
"ARRAY(
|
||||||
|
SELECT
|
||||||
|
'[' || ot.bezeichnung || '] ' || o.bezeichnung AS bezeichnung
|
||||||
|
FROM public.tbl_benutzerfunktion bf
|
||||||
|
JOIN public.tbl_organisationseinheit o USING(oe_kurzbz)
|
||||||
|
JOIN public.tbl_organisationseinheittyp ot USING(organisationseinheittyp_kurzbz)
|
||||||
|
WHERE bf.funktion_kurzbz = 'oezuordnung'
|
||||||
|
AND (bf.datum_von IS NULL OR bf.datum_von <= NOW())
|
||||||
|
AND (bf.datum_bis IS NULL OR bf.datum_bis >= NOW())
|
||||||
|
AND bf.uid = b.uid
|
||||||
|
GROUP BY o.bezeichnung, ot.bezeichnung
|
||||||
|
) AS organisationunit_name",
|
||||||
|
"COALESCE(b.alias, b.uid) || '" . '@' . DOMAIN . "' AS email",
|
||||||
|
"TRIM(COALESCE(k.kontakt, '') || ' ' || COALESCE(m.telefonklappe, '')) AS phone",
|
||||||
|
"'" . base_url("/cis/public/bild.php?src=person&person_id=") . "' || p.person_id AS photo_url",
|
||||||
|
"ARRAY(
|
||||||
|
SELECT
|
||||||
|
'[' || ot.bezeichnung || '] ' || o.bezeichnung AS bezeichnung
|
||||||
|
FROM public.tbl_benutzerfunktion bf
|
||||||
|
JOIN public.tbl_organisationseinheit o USING(oe_kurzbz)
|
||||||
|
JOIN public.tbl_organisationseinheittyp ot USING(organisationseinheittyp_kurzbz)
|
||||||
|
WHERE bf.funktion_kurzbz = 'kstzuordnung'
|
||||||
|
AND (bf.datum_von IS NULL OR bf.datum_von <= NOW())
|
||||||
|
AND (bf.datum_bis IS NULL OR bf.datum_bis >= NOW())
|
||||||
|
AND bf.uid = b.uid
|
||||||
|
GROUP BY o.bezeichnung, ot.bezeichnung
|
||||||
|
) AS standardkostenstelle"
|
||||||
|
],
|
||||||
|
'resultjoin' => "
|
||||||
|
JOIN public.tbl_mitarbeiter m USING (mitarbeiter_uid)
|
||||||
|
JOIN public.tbl_benutzer b ON (b.uid = m.mitarbeiter_uid)
|
||||||
|
JOIN public.tbl_person p USING(person_id)
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT kontakt, standort_id
|
||||||
|
FROM public.tbl_kontakt
|
||||||
|
WHERE kontakttyp = 'telefon'
|
||||||
|
) k ON (k.standort_id = m.standort_id)"
|
||||||
|
];
|
||||||
|
|
||||||
|
// TODO(chris): move to searchpv21.php
|
||||||
|
$config['unassigned_employee'] = $config['employee'];
|
||||||
|
$config['unassigned_employee']['alias'] = ['mitarbeiter_ohne_zuordnung'];
|
||||||
|
$config['unassigned_employee']['prepare'] = "unassigned_employee AS (
|
||||||
|
SELECT tbl_mitarbeiter.*
|
||||||
|
FROM public.tbl_mitarbeiter
|
||||||
|
LEFT JOIN public.tbl_benutzerfunktion ON (
|
||||||
|
uid = mitarbeiter_uid
|
||||||
|
AND funktion_kurzbz = 'kstzuordnung'
|
||||||
|
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||||
|
AND (datum_bis IS NULL OR datum_bis >= NOW())
|
||||||
|
)
|
||||||
|
WHERE tbl_benutzerfunktion.bezeichnung IS NULL
|
||||||
|
UNION
|
||||||
|
SELECT tbl_mitarbeiter.*
|
||||||
|
FROM public.tbl_mitarbeiter
|
||||||
|
LEFT JOIN public.tbl_benutzerfunktion ON (
|
||||||
|
uid = mitarbeiter_uid
|
||||||
|
AND funktion_kurzbz = 'oezuordnung'
|
||||||
|
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||||
|
AND (datum_bis IS NULL OR datum_bis >= NOW())
|
||||||
|
)
|
||||||
|
WHERE tbl_benutzerfunktion.bezeichnung IS NULL
|
||||||
|
)";
|
||||||
|
$config['unassigned_employee']['table'] = "unassigned_employee";
|
||||||
|
$config['unassigned_employee']['searchfields']['tel']['join']['on'] = "
|
||||||
|
kontakttyp = 'telefon'
|
||||||
|
AND tbl_kontakt.standort_id = unassigned_employee.standort_id
|
||||||
|
";
|
||||||
|
$config['unassigned_employee']['renderer'] = 'employee';
|
||||||
|
|
||||||
|
$config['organisationunit'] = [
|
||||||
|
'alias' => ['ou', 'organisationseinheit', 'oe'],
|
||||||
|
'primarykey' => 'oe_kurzbz',
|
||||||
|
'table' => 'public.tbl_organisationseinheit',
|
||||||
|
'searchfields' => [
|
||||||
|
'uid' => [
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => 'uid',
|
||||||
|
'prepare' => "organisationunit_leader(oe_kurzbz, uid, vorname, nachname) AS (
|
||||||
|
SELECT oe_kurzbz, vorname, nachname, uid
|
||||||
|
FROM public.tbl_benutzerfunktion
|
||||||
|
JOIN public.tbl_benutzer USING (uid)
|
||||||
|
JOIN public.tbl_person USING (person_id)
|
||||||
|
WHERE funktion_kurzbz = 'Leitung'
|
||||||
|
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||||
|
AND (datum_bis IS NULL OR datum_bis >= NOW())
|
||||||
|
AND tbl_benutzer.aktiv = TRUE
|
||||||
|
)",
|
||||||
|
'join' => [
|
||||||
|
'table' => "organisationunit_leader",
|
||||||
|
'using' => "oe_kurzbz"
|
||||||
|
],
|
||||||
|
'1-n' => true
|
||||||
|
],
|
||||||
|
'vorname' => [
|
||||||
|
'alias' => ['firstname'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'vorname',
|
||||||
|
'prepare' => "organisationunit_leader(oe_kurzbz, uid, vorname, nachname) AS (
|
||||||
|
SELECT oe_kurzbz, vorname, nachname, uid
|
||||||
|
FROM public.tbl_benutzerfunktion
|
||||||
|
JOIN public.tbl_benutzer USING (uid)
|
||||||
|
JOIN public.tbl_person USING (person_id)
|
||||||
|
WHERE funktion_kurzbz = 'Leitung'
|
||||||
|
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||||
|
AND (datum_bis IS NULL OR datum_bis >= NOW())
|
||||||
|
AND tbl_benutzer.aktiv = TRUE
|
||||||
|
)",
|
||||||
|
'join' => [
|
||||||
|
'table' => "organisationunit_leader",
|
||||||
|
'using' => "oe_kurzbz"
|
||||||
|
],
|
||||||
|
'1-n' => true
|
||||||
|
],
|
||||||
|
'nachname' => [
|
||||||
|
'alias' => ['lastname', 'surename'],
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'nachname',
|
||||||
|
'prepare' => "organisationunit_leader(oe_kurzbz, uid, vorname, nachname) AS (
|
||||||
|
SELECT oe_kurzbz, vorname, nachname, uid
|
||||||
|
FROM public.tbl_benutzerfunktion
|
||||||
|
JOIN public.tbl_benutzer USING (uid)
|
||||||
|
JOIN public.tbl_person USING (person_id)
|
||||||
|
WHERE funktion_kurzbz = 'Leitung'
|
||||||
|
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||||
|
AND (datum_bis IS NULL OR datum_bis >= NOW())
|
||||||
|
AND tbl_benutzer.aktiv = TRUE
|
||||||
|
)",
|
||||||
|
'join' => [
|
||||||
|
'table' => "organisationunit_leader",
|
||||||
|
'using' => "oe_kurzbz"
|
||||||
|
],
|
||||||
|
'1-n' => true
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => "(vorname || ' ' || nachname)",
|
||||||
|
'prepare' => "organisationunit_leader(oe_kurzbz, uid, vorname, nachname) AS (
|
||||||
|
SELECT oe_kurzbz, vorname, nachname, uid
|
||||||
|
FROM public.tbl_benutzerfunktion
|
||||||
|
JOIN public.tbl_benutzer USING (uid)
|
||||||
|
JOIN public.tbl_person USING (person_id)
|
||||||
|
WHERE funktion_kurzbz = 'Leitung'
|
||||||
|
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||||
|
AND (datum_bis IS NULL OR datum_bis >= NOW())
|
||||||
|
AND tbl_benutzer.aktiv = TRUE
|
||||||
|
)",
|
||||||
|
'join' => [
|
||||||
|
'table' => "organisationunit_leader",
|
||||||
|
'using' => "oe_kurzbz"
|
||||||
|
],
|
||||||
|
'1-n' => true
|
||||||
|
],
|
||||||
|
'oe' => [
|
||||||
|
'alias' => ['ou', 'organisationseinheit', 'organisationunit'],
|
||||||
|
'comparison' => 'vector',
|
||||||
|
'field' => "fts_bezeichnung"
|
||||||
|
],
|
||||||
|
'kurzbz' => [
|
||||||
|
'alias' => ['oe_kurzbz'],
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => "oe_kurzbz"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'resultfields' => [
|
||||||
|
"oe.oe_kurzbz",
|
||||||
|
"('[' || type.bezeichnung || '] ' || oe.bezeichnung) AS name",
|
||||||
|
"oe_parent.oe_kurzbz AS parentoe_kurzbz",
|
||||||
|
"(CASE WHEN oe_parent.bezeichnung IS NOT NULL THEN '[' || type_parent.bezeichnung || '] ' || oe_parent.bezeichnung END) AS parentoe_name",
|
||||||
|
"ARRAY(
|
||||||
|
SELECT JSON_BUILD_OBJECT('uid', b.uid, 'vorname', p.vorname, 'nachname', p.nachname, 'name', (p.vorname || ' ' || p.nachname))
|
||||||
|
FROM public.tbl_benutzerfunktion bf
|
||||||
|
JOIN public.tbl_benutzer b USING (uid)
|
||||||
|
JOIN public.tbl_person p USING (person_id)
|
||||||
|
WHERE funktion_kurzbz = 'Leitung'
|
||||||
|
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||||
|
AND (datum_bis IS NULL OR datum_bis >= NOW())
|
||||||
|
AND b.aktiv = TRUE
|
||||||
|
AND oe_kurzbz = oe.oe_kurzbz
|
||||||
|
) AS leaders",
|
||||||
|
"(
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM public.tbl_benutzerfunktion
|
||||||
|
WHERE funktion_kurzbz = 'oezuordnung'
|
||||||
|
AND (datum_von IS NULL OR datum_von <= NOW())
|
||||||
|
AND (datum_bis IS NULL OR datum_bis >= NOW())
|
||||||
|
AND oe_kurzbz = oe.oe_kurzbz
|
||||||
|
) AS number_of_people",
|
||||||
|
"(CASE WHEN oe.mailverteiler THEN oe.oe_kurzbz || '" . '@' . DOMAIN . "' END) AS mailgroup"
|
||||||
|
],
|
||||||
|
'resultjoin' => "
|
||||||
|
JOIN public.tbl_organisationseinheit oe
|
||||||
|
USING (oe_kurzbz)
|
||||||
|
JOIN public.tbl_organisationseinheittyp type
|
||||||
|
USING (organisationseinheittyp_kurzbz)
|
||||||
|
LEFT JOIN public.tbl_organisationseinheit oe_parent
|
||||||
|
ON (oe_parent.oe_kurzbz = oe.oe_parent_kurzbz)
|
||||||
|
LEFT JOIN public.tbl_organisationseinheittyp type_parent
|
||||||
|
ON (oe_parent.organisationseinheittyp_kurzbz = type_parent.organisationseinheittyp_kurzbz)"
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['room'] = [
|
||||||
|
'alias' => ['raum'],
|
||||||
|
'primarykey' => 'ort_kurzbz',
|
||||||
|
'table' => 'public.tbl_ort',
|
||||||
|
'searchfields' => [
|
||||||
|
'name' => [
|
||||||
|
'comparison' => 'similar',
|
||||||
|
'field' => 'ort_kurzbz'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'resultfields' => [
|
||||||
|
"ort.ort_kurzbz",
|
||||||
|
"ort.gebteil AS building",
|
||||||
|
"ort.ausstattung AS equipment",
|
||||||
|
"ort.stockwerk AS floor",
|
||||||
|
"ort.dislozierung AS room_number",
|
||||||
|
"ort.content_id",
|
||||||
|
"address.ort AS city",
|
||||||
|
"address.plz AS zip",
|
||||||
|
"address.strasse AS street",
|
||||||
|
"ort.max_person",
|
||||||
|
"ort.arbeitsplaetze AS workplaces"
|
||||||
|
],
|
||||||
|
'resultjoin' => "
|
||||||
|
JOIN public.tbl_ort ort
|
||||||
|
USING (ort_kurzbz)
|
||||||
|
LEFT JOIN public.tbl_standort
|
||||||
|
USING (standort_id)
|
||||||
|
LEFT JOIN public.tbl_adresse address
|
||||||
|
USING (adresse_id)"
|
||||||
|
];
|
||||||
|
$sprache = getUserLanguage();
|
||||||
|
$config['cms'] = [
|
||||||
|
'primarykey' => 'contentsprache_id',
|
||||||
|
'table' => 'campus.tbl_contentsprache',
|
||||||
|
'prepare' => "
|
||||||
|
cms_auth (content_id) AS (
|
||||||
|
SELECT content_id
|
||||||
|
FROM campus.tbl_content c
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM campus.tbl_contentgruppe g WHERE g.content_id=c.content_id)
|
||||||
|
UNION
|
||||||
|
SELECT content_id
|
||||||
|
FROM public.vw_gruppen g
|
||||||
|
JOIN campus.tbl_contentgruppe c USING (gruppe_kurzbz)
|
||||||
|
WHERE uid = (TABLE auth)
|
||||||
|
),
|
||||||
|
cms_active (content_id, template_kurzbz) AS (
|
||||||
|
SELECT content_id, template_kurzbz
|
||||||
|
FROM cms_auth
|
||||||
|
JOIN campus.tbl_content USING (content_id)
|
||||||
|
WHERE aktiv = TRUE
|
||||||
|
),
|
||||||
|
cms_active_redirect (content_id) AS (
|
||||||
|
SELECT content_id
|
||||||
|
FROM cms_active
|
||||||
|
WHERE template_kurzbz = 'redirect'
|
||||||
|
),
|
||||||
|
cms_active_redirect_linked (content_id) AS (
|
||||||
|
SELECT content_id
|
||||||
|
FROM cms_active_redirect
|
||||||
|
JOIN campus.tbl_contentsprache USING (content_id)
|
||||||
|
WHERE LEFT((xpath('string(/content/url)', content))[1]::text, 1) <> '#'
|
||||||
|
),
|
||||||
|
cms_active_others (content_id) AS (
|
||||||
|
SELECT content_id
|
||||||
|
FROM cms_active
|
||||||
|
WHERE template_kurzbz IN ('contentmittitel', 'contentohnetitel', 'contentmittitel_filterwidget')
|
||||||
|
)
|
||||||
|
",
|
||||||
|
'searchfields' => [
|
||||||
|
'content' => [
|
||||||
|
'alias' => ['inhalt'],
|
||||||
|
'comparison' => "vector",
|
||||||
|
'field' => "(
|
||||||
|
setweight(to_tsvector('simple', COALESCE(titel, '')), 'A')
|
||||||
|
||
|
||||||
|
setweight(to_tsvector('simple', COALESCE(content, '')::text), 'B')
|
||||||
|
)"
|
||||||
|
],
|
||||||
|
'content_id' => [
|
||||||
|
'alias' => ['id'],
|
||||||
|
'comparison' => "equal-int",
|
||||||
|
'field' => "content_id"
|
||||||
|
],
|
||||||
|
'lang' => [
|
||||||
|
'alias' => ['language', 'sprache'],
|
||||||
|
'comparison' => "equals",
|
||||||
|
'field' => "sprache"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'resultfields' => [
|
||||||
|
"contentsprache.content_id",
|
||||||
|
"content.template_kurzbz",
|
||||||
|
"contentsprache.version",
|
||||||
|
"contentsprache.sprache AS language",
|
||||||
|
"contentsprache.titel AS title",
|
||||||
|
"contentsprache.content",
|
||||||
|
"(xpath('string(/content/url)', contentsprache.content))[1] AS content_url"
|
||||||
|
],
|
||||||
|
'resultjoin' => "
|
||||||
|
JOIN campus.tbl_contentsprache contentsprache
|
||||||
|
USING (contentsprache_id)
|
||||||
|
JOIN campus.tbl_content content
|
||||||
|
USING (content_id)
|
||||||
|
WHERE content_id IN (
|
||||||
|
SELECT content_id
|
||||||
|
FROM cms_active_redirect_linked
|
||||||
|
UNION
|
||||||
|
SELECT content_id
|
||||||
|
FROM cms_active_others
|
||||||
|
)
|
||||||
|
AND version = campus.get_highest_content_version(content_id)
|
||||||
|
AND contentsprache.sprache = '{$sprache}'"
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['dms'] = [
|
||||||
|
'primarykey' => 'dms_id, version',
|
||||||
|
'table' => 'campus.tbl_dms_version',
|
||||||
|
'searchfields' => [
|
||||||
|
'keywords' => [
|
||||||
|
'alias' => ['keyword', 'keywords', 'schlagwort', 'schlagworte'],
|
||||||
|
'comparison' => "vector",
|
||||||
|
'field' => "(to_tsvector('simple', COALESCE(schlagworte, '')))"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'resultfields' => [
|
||||||
|
"v.dms_id",
|
||||||
|
"v.version",
|
||||||
|
"v.filename",
|
||||||
|
"v.mimetype",
|
||||||
|
"v.name",
|
||||||
|
"v.beschreibung AS description",
|
||||||
|
"v.schlagworte AS keywords"
|
||||||
|
],
|
||||||
|
'resultjoin' => "
|
||||||
|
JOIN campus.tbl_dms_version v
|
||||||
|
USING (dms_id, version)
|
||||||
|
WHERE cis_suche = TRUE
|
||||||
|
AND version=(SELECT MAX(version) FROM campus.tbl_dms_version WHERE dms_id=v.dms_id)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT
|
||||||
|
1
|
||||||
|
FROM
|
||||||
|
fue.tbl_projekt_dokument p
|
||||||
|
WHERE p.dms_id = v.dms_id
|
||||||
|
) AND (
|
||||||
|
NOT EXISTS (
|
||||||
|
WITH RECURSIVE categories (kategorie_kurzbz) AS (
|
||||||
|
SELECT
|
||||||
|
kategorie_kurzbz
|
||||||
|
FROM
|
||||||
|
campus.tbl_dms c
|
||||||
|
WHERE c.dms_id = v.dms_id
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
cat.parent_kategorie_kurzbz AS kategorie_kurzbz
|
||||||
|
FROM
|
||||||
|
categories
|
||||||
|
JOIN campus.tbl_dms_kategorie cat USING (kategorie_kurzbz)
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
1
|
||||||
|
FROM
|
||||||
|
categories
|
||||||
|
JOIN campus.tbl_dms_kategorie_gruppe USING (kategorie_kurzbz)
|
||||||
|
UNION
|
||||||
|
SELECT
|
||||||
|
1
|
||||||
|
FROM
|
||||||
|
categories
|
||||||
|
JOIN campus.tbl_dms_kategorie USING (kategorie_kurzbz)
|
||||||
|
WHERE
|
||||||
|
berechtigung_kurzbz IS NOT NULL
|
||||||
|
) OR EXISTS (
|
||||||
|
WITH RECURSIVE categories (kategorie_kurzbz) AS (
|
||||||
|
SELECT
|
||||||
|
kategorie_kurzbz
|
||||||
|
FROM
|
||||||
|
campus.tbl_dms c
|
||||||
|
WHERE c.dms_id = v.dms_id
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
cat.parent_kategorie_kurzbz AS kategorie_kurzbz
|
||||||
|
FROM
|
||||||
|
categories
|
||||||
|
JOIN campus.tbl_dms_kategorie cat USING (kategorie_kurzbz)
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
1
|
||||||
|
FROM
|
||||||
|
categories
|
||||||
|
JOIN campus.tbl_dms_kategorie_gruppe USING (kategorie_kurzbz)
|
||||||
|
JOIN public.tbl_benutzergruppe USING(gruppe_kurzbz)
|
||||||
|
WHERE
|
||||||
|
uid = (TABLE auth)
|
||||||
|
)
|
||||||
|
)"
|
||||||
|
];
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
|
||||||
|
$CI =& get_instance();
|
||||||
|
|
||||||
|
|
||||||
|
$config['employee'] = $CI->config->item('employee', 'search');
|
||||||
|
$config['employee']['resultjoin'] = "
|
||||||
|
JOIN public.tbl_mitarbeiter m USING (mitarbeiter_uid)
|
||||||
|
JOIN public.tbl_benutzer b ON (b.uid = m.mitarbeiter_uid AND b.aktiv = true)
|
||||||
|
JOIN public.tbl_person p USING(person_id)
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT kontakt, standort_id
|
||||||
|
FROM public.tbl_kontakt
|
||||||
|
WHERE kontakttyp = 'telefon'
|
||||||
|
) k ON (k.standort_id = m.standort_id)";
|
||||||
|
|
||||||
|
$config['student'] = $CI->config->item('student', 'search');
|
||||||
|
unset($config['student']['searchfields']['email']);
|
||||||
|
unset($config['student']['searchfields']['tel']);
|
||||||
|
$config['student']['resultfields'] = [
|
||||||
|
"s.student_uid AS uid",
|
||||||
|
"s.matrikelnr AS personenkennzeichen",
|
||||||
|
"p.person_id",
|
||||||
|
"p.matr_nr AS matrikelnummer",
|
||||||
|
"(p.vorname || ' ' || p.nachname) AS name",
|
||||||
|
"ARRAY[s.student_uid || '@' || '" . DOMAIN . "'] AS email",
|
||||||
|
"CASE
|
||||||
|
WHEN (p.foto_sperre = false AND p.foto IS NOT NULL) THEN 'data:image/jpeg' || CONVERT_FROM(DECODE('3b','hex'), 'UTF8') || 'base64,' || p.foto
|
||||||
|
ELSE NULL END
|
||||||
|
AS photo_url",
|
||||||
|
"b.aktiv"
|
||||||
|
];
|
||||||
|
$config['student']['resultjoin'] = "
|
||||||
|
JOIN public.tbl_student s USING (student_uid)
|
||||||
|
JOIN public.tbl_benutzer b ON(b.uid = s.student_uid AND b.aktiv = true)
|
||||||
|
JOIN public.tbl_person p USING(person_id)";
|
||||||
|
|
||||||
|
$config['organisationunit'] = $CI->config->item('organisationunit', 'search');
|
||||||
|
$config['organisationunit']['prepare'] = 'active_organisationseinheit AS (SELECT * FROM public.tbl_organisationseinheit WHERE aktiv = true AND organisationseinheittyp_kurzbz <> \'Container\')';
|
||||||
|
$config['organisationunit']['table'] = 'active_organisationseinheit';
|
||||||
|
|
||||||
|
$config['room'] = $CI->config->item('room', 'search');
|
||||||
|
|
||||||
|
$config['cms'] = $CI->config->item('cms', 'search');
|
||||||
|
|
||||||
|
$config['dms'] = $CI->config->item('dms', 'search');
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
* TODO: 2025-07-21 ma0080 bare integer comparision results in db error
|
||||||
|
* if searchstring is numeric but out of range of int, think about
|
||||||
|
* more sophisticated solution using column data type - quick fix
|
||||||
|
* convert field and search string to text
|
||||||
|
*/
|
||||||
|
$config['equal-int'] = [
|
||||||
|
'priority' => 4,
|
||||||
|
'rank' => "0",
|
||||||
|
'compare' => "{field}::text = {word}::text",
|
||||||
|
'force_integer' => true
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['equals'] = [
|
||||||
|
'priority' => 3,
|
||||||
|
'rank' => "0",
|
||||||
|
'compare' => "LOWER({field}) = {word}"
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['similar'] = [
|
||||||
|
'priority' => 2,
|
||||||
|
'rank' => "(COALESCE({field}, '') <->> {word})",
|
||||||
|
'compare' => "COALESCE({field}, '') %> {word}",
|
||||||
|
'compare_boolean' => "COALESCE({field}, '') ILIKE {like:word}"
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['vector'] = [
|
||||||
|
'priority' => 1,
|
||||||
|
'rank' => "ts_rank({field}, plainto_tsquery('simple', {word}))",
|
||||||
|
'compare' => "plainto_tsquery('simple', {word}) @@ {field}"
|
||||||
|
];
|
||||||
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
|
||||||
|
$CI =& get_instance();
|
||||||
|
|
||||||
|
|
||||||
|
$config['student'] = $CI->config->item('student', 'search');
|
||||||
|
$config['student']['searchfields']['pkz'] = [
|
||||||
|
'alias' => ['personenkennzeichen', 'personalid'],
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => 'matrikelnr'
|
||||||
|
];
|
||||||
|
$config['student']['searchfields']['matrnr'] = [
|
||||||
|
'alias' => ['matrikelnr', 'matrikelnummer', 'matrno', 'matriculationno', 'matriculationnumber', 'studno', 'studentno', 'studentnumber'],
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => 'matr_nr',
|
||||||
|
'join' => [
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_prestudent",
|
||||||
|
'using' => "prestudent_id"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['prestudent'] = $CI->config->item('prestudent', 'search');
|
||||||
|
$config['prestudent']['searchfields']['pkz'] = [
|
||||||
|
'alias' => ['personenkennzeichen', 'personalid'],
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => 'matrikelnr',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_student",
|
||||||
|
'using' => "prestudent_id"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$config['prestudent']['searchfields']['matrnr'] = [
|
||||||
|
'alias' => ['matrikelnr', 'matrikelnummer', 'matrno', 'matriculationno', 'matriculationnumber', 'studno', 'studentno', 'studentnumber'],
|
||||||
|
'comparison' => 'equals',
|
||||||
|
'field' => 'matr_nr',
|
||||||
|
'join' => [
|
||||||
|
'table' => "public.tbl_person",
|
||||||
|
'using' => "person_id"
|
||||||
|
]
|
||||||
|
];
|
||||||
@@ -168,3 +168,40 @@ $config['stgkz_blacklist_wiederholung'] = [];
|
|||||||
* @var array An array of noten ids
|
* @var array An array of noten ids
|
||||||
*/
|
*/
|
||||||
$config['note_blacklist_wiederholung'] = [];
|
$config['note_blacklist_wiederholung'] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable the Abmeldung StG process
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
$config['abmeldung_stg_enabled'] = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable the Abmeldung process
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
$config['abmeldung_enabled'] = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable the Unterbrecher process
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
$config['unterbrechung_enabled'] = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable the Wiederholer process
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
$config['wiederholung_enabled'] = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modal with Infotext of TLC
|
||||||
|
* if true, there will be shown an info modal in the studentsView after the first button ABMELDUNG
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
$config['showInfoModalAbmeldung'] = true;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,184 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$config['number_displayed_past_studiensemester_default'] = 5;
|
||||||
|
|
||||||
|
# Additional columns:
|
||||||
|
/*
|
||||||
|
$config["list_columns"] = [
|
||||||
|
'fieldname' => [
|
||||||
|
'js' => 'path/to/snippet.js', // tabulator config snippet (eg: return { name: 'Name', field: 'fieldname' }; )
|
||||||
|
'default' => "SQL SELECT statement for value",
|
||||||
|
'joins' => [
|
||||||
|
// additional joins needed for the SELECT statement above
|
||||||
|
[
|
||||||
|
'tablename',
|
||||||
|
'join condition', // single fieldname for USING or full condition for ON
|
||||||
|
'LEFT|RIGHT', // optional - join type
|
||||||
|
'after_xxx|before_xxx|end' // optional - position in query
|
||||||
|
]
|
||||||
|
// ...
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
*/
|
||||||
|
|
||||||
|
$config['tabs'] =
|
||||||
|
[
|
||||||
|
'details' => [
|
||||||
|
//all fields can be configured to be hidden, see class attribute stv-details-details-name for name
|
||||||
|
'hiddenFields' => [],
|
||||||
|
'hideUDFs' => false
|
||||||
|
],
|
||||||
|
|
||||||
|
'prestudent' => [
|
||||||
|
|
||||||
|
//all fields can be configured to be hidden, see class attribute stv-details-prestudent-name for name
|
||||||
|
'hiddenFields' => [
|
||||||
|
|
||||||
|
//propably used by FH-Communities
|
||||||
|
'aufnahmeschluessel', 'standort_code', 'facheinschlaegigBerufstaetig'
|
||||||
|
|
||||||
|
],
|
||||||
|
'hideUDFs' => false
|
||||||
|
],
|
||||||
|
'finalexam' => [
|
||||||
|
'documents' => [
|
||||||
|
'pruefungsprotokoll' => [
|
||||||
|
'de' => [
|
||||||
|
'Bakk' => 'PrProtBA',
|
||||||
|
'Master' => 'PrProtMA',
|
||||||
|
],
|
||||||
|
'en' => [
|
||||||
|
'Bakk' => 'PrProtBAEng',
|
||||||
|
'Master' => 'PrProtMAEng',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'pruefungszeugnis' => [
|
||||||
|
'de' => [
|
||||||
|
'Bakk' => 'Bakkzeugnis',
|
||||||
|
'Master' => 'Diplomzeugnis',
|
||||||
|
],
|
||||||
|
'en' => [
|
||||||
|
'Bakk' => 'BakkzeugnisEng',
|
||||||
|
'Master' => 'DiplomzeugnisEng',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'urkunde' => [
|
||||||
|
'de' => [
|
||||||
|
'Bakk' => 'Bakkurkunde',
|
||||||
|
'Master' => 'Diplomurkunde',
|
||||||
|
],
|
||||||
|
'en' => [
|
||||||
|
'Bakk' => 'BakkurkundeEng',
|
||||||
|
'Master' => 'DiplomurkundeEng',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'exemptions' => [
|
||||||
|
//if true, Anrechnungen can be added and edited in tab Anrechnungen
|
||||||
|
'editableAnrechnungen' => false,
|
||||||
|
],
|
||||||
|
'notes' => [
|
||||||
|
//if true, the count of Messages will be shown in the header of the Tab Messages
|
||||||
|
'showCountNotes' => true,
|
||||||
|
|
||||||
|
//if true: section with following fields will be displayed: 'verfasser', 'bearbeiter', 'von', 'bis' and 'erledigt'
|
||||||
|
'showErweitert' => false,
|
||||||
|
|
||||||
|
//notizlayout: choose of "classicFas", "twoColumnsFormLeft", twoColumnsFormRight, popupModal"
|
||||||
|
'notizLayout' => 'popupModal'
|
||||||
|
],
|
||||||
|
'combinePeople' => [
|
||||||
|
//multitab should only be shown with this length of selection
|
||||||
|
'validCountMulti' => 2,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// List of fields to show when ZGV_DOKTOR_ANZEIGEN is defined
|
||||||
|
$fieldsZgvDoktor = ['zgvdoktorort', 'zgvdoktordatum', 'zgvdoktornation', 'zgvdoktor_erfuellt', 'zgvdoktor_code'];
|
||||||
|
|
||||||
|
// List of fields to show when ZGV_ERFUELLT_ANZEIGEN is defined
|
||||||
|
$fieldsZgvErfuellt = ['zgv_erfuellt', 'zgvmas_erfuellt','zgvdoktor_erfuellt'];
|
||||||
|
|
||||||
|
//order important: to show zgf_erfuellt_doktor just in case visibility of doktor is true
|
||||||
|
if (!defined('ZGV_ERFUELLT_ANZEIGEN') || !ZGV_ERFUELLT_ANZEIGEN) {
|
||||||
|
$config['tabs']['prestudent']['hiddenFields'] = array_merge(
|
||||||
|
$config['tabs']['prestudent']['hiddenFields'], $fieldsZgvErfuellt
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined('ZGV_DOKTOR_ANZEIGEN') || !ZGV_DOKTOR_ANZEIGEN) {
|
||||||
|
$config['tabs']['prestudent']['hiddenFields'] = array_merge(
|
||||||
|
$config['tabs']['prestudent']['hiddenFields'],
|
||||||
|
$fieldsZgvDoktor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['tabs']['projektarbeit']['defaultProjektbetreuerStunden'] =
|
||||||
|
defined('FAS_STUDIERENDE_PROJEKTARBEIT_DEFAULT_BETREUER_STUNDEN_BACHELOR')
|
||||||
|
? FAS_STUDIERENDE_PROJEKTARBEIT_DEFAULT_BETREUER_STUNDEN_BACHELOR
|
||||||
|
: '0.0';
|
||||||
|
$config['tabs']['projektarbeit']['defaultProjektbetreuerStundenDiplom'] =
|
||||||
|
defined('FAS_STUDIERENDE_PROJEKTARBEIT_DEFAULT_BETREUER_STUNDEN_MASTER')
|
||||||
|
? FAS_STUDIERENDE_PROJEKTARBEIT_DEFAULT_BETREUER_STUNDEN_MASTER
|
||||||
|
: '0.0';
|
||||||
|
$config['tabs']['projektarbeit']['defaultProjektbetreuerStundensatz'] = '80.0';
|
||||||
|
|
||||||
|
$config['student_tab_order'] = [
|
||||||
|
'details',
|
||||||
|
'notes',
|
||||||
|
'messages',
|
||||||
|
'contact',
|
||||||
|
'prestudent',
|
||||||
|
'status',
|
||||||
|
'documents',
|
||||||
|
'archive',
|
||||||
|
'banking',
|
||||||
|
'grades',
|
||||||
|
'exam',
|
||||||
|
'exemptions',
|
||||||
|
'projektarbeit',
|
||||||
|
'finalexam',
|
||||||
|
'mobility',
|
||||||
|
'jointstudies',
|
||||||
|
'admissionDates',
|
||||||
|
'groups',
|
||||||
|
'functions',
|
||||||
|
'coursedates',
|
||||||
|
'resources',
|
||||||
|
];
|
||||||
|
$config['students_tab_order'] = [
|
||||||
|
'banking',
|
||||||
|
'status',
|
||||||
|
'messages',
|
||||||
|
'groups',
|
||||||
|
'finalexam',
|
||||||
|
'combinePeople',
|
||||||
|
'archive',
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['stv_prestudent_tags'] = [
|
||||||
|
'prioone' => ['readonly' => false],
|
||||||
|
'priotwo' => ['readonly' => false],
|
||||||
|
'hinweis' => ['readonly' => false],
|
||||||
|
'hinweis_assistenz' => ['readonly' => false],
|
||||||
|
'hinweis_kf' => ['readonly' => false],
|
||||||
|
'hinweis_lehrende' => ['readonly' => false],
|
||||||
|
'hinweis_stg_kf' => ['readonly' => false],
|
||||||
|
'finished_stg' => ['readonly' => false],
|
||||||
|
'finished_kf' => ['readonly' => false],
|
||||||
|
'inwork_kf' => ['readonly' => false],
|
||||||
|
'dd_auto' => ['readonly' => true],
|
||||||
|
'wh_auto' => ['readonly' => true],
|
||||||
|
'prewh_auto' => ['readonly' => true],
|
||||||
|
'out_auto' => ['readonly' => true],
|
||||||
|
'zgv_auto' => ['readonly' => true],
|
||||||
|
'unterbrecher_auto' => ['readonly' => true],
|
||||||
|
'stbtr_erh_auto' => ['readonly' => true],
|
||||||
|
'jgv_auto' => ['readonly' => true],
|
||||||
|
'in_auto' => ['readonly' => true],
|
||||||
|
'preabbr_auto' => ['readonly' => true],
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['userAutomatedTags'] = 'sftest';
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
|
||||||
|
// changing the color theme
|
||||||
|
|
||||||
|
$config['theme_name']='default';
|
||||||
|
$config['theme_css']= "public/css/theme/default.css";
|
||||||
|
$config['theme_logo']= "public/images/logo_fh-complete_300x46.png";
|
||||||
|
$config['theme_modes']=['light','dark'];
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2026 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['stv'] = [
|
||||||
|
"library" => "treemenu/StudVwLib",
|
||||||
|
"permissions" => ["admin:r", "assistenz:r"]
|
||||||
|
];
|
||||||
|
$config['lvv'] = [
|
||||||
|
"library" => "treemenu/LvVwLib",
|
||||||
|
"permissions" => ["admin:r", "assistenz:r"]
|
||||||
|
];
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2026 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['root'] = [
|
||||||
|
'stg' => [
|
||||||
|
'semester' => [
|
||||||
|
'group',
|
||||||
|
'verband' => [
|
||||||
|
'group'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'orgform'
|
||||||
|
]
|
||||||
|
];
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2026 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['root'] = [
|
||||||
|
'stg' => [
|
||||||
|
'prestudent' => [
|
||||||
|
'stdsem' => [
|
||||||
|
'interessenten' => [
|
||||||
|
'bewerbungnichtabgeschickt',
|
||||||
|
'bewerbungabgeschickt',
|
||||||
|
'zgv',
|
||||||
|
'statusbestaetigt' => [
|
||||||
|
'statusbestaetigtrtnichtangemeldet',
|
||||||
|
'statusbestaetigtrtangemeldet'
|
||||||
|
],
|
||||||
|
'reihungstestnichtangemeldet',
|
||||||
|
'reihungstestangemeldet'
|
||||||
|
],
|
||||||
|
'bewerber' => [
|
||||||
|
'bewerberrtnichtangemeldet',
|
||||||
|
'bewerberrtangemeldet' => [
|
||||||
|
'bewerberrtangemeldetteilgenommen',
|
||||||
|
'bewerberrtangemeldetnichtteilgenommen'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'aufgenommen',
|
||||||
|
'warteliste',
|
||||||
|
'absage',
|
||||||
|
'incoming'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'semester' => [
|
||||||
|
'group',
|
||||||
|
'verband' => [
|
||||||
|
'group'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'inout' => [
|
||||||
|
'incoming',
|
||||||
|
'outgoing',
|
||||||
|
'shared_studies'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
// copy stg tree into stg/orgforms
|
||||||
|
$config['root']['stg']['orgform'] = $config['root']['stg'];
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Abgabetool extends Auth_Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'index' => self::PERM_LOGGED,
|
||||||
|
'Mitarbeiter' => array('basis/abgabe_lektor:rw', 'basis/abgabe_assistenz:rw'),
|
||||||
|
'Assistenz' => array('basis/abgabe_assistenz:rw'),
|
||||||
|
'Student' => array('basis/abgabe_student:rw', 'basis/abgabe_lektor:rw', 'basis/abgabe_assistenz:rw'),
|
||||||
|
'Deadlines' => array('basis/abgabe_lektor:rw', 'basis/abgabe_assistenz:rw')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
// TODO: routing from index based on berechtigung?
|
||||||
|
|
||||||
|
if(defined('CIS4') && CIS4) {
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'Abgabetool']);
|
||||||
|
} else {
|
||||||
|
$this->load->view('Cis/Abgabetool.php', ['uid' => getAuthUID(), 'route' => 'Abgabetool']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Student($student_uid_prop = '')
|
||||||
|
{
|
||||||
|
if(defined('CIS4') && CIS4) {
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'AbgabetoolStudent']);
|
||||||
|
} else {
|
||||||
|
$this->load->view('Cis/Abgabetool.php', ['uid' => getAuthUID(), 'route' => 'AbgabetoolStudent', 'student_uid_prop' => $student_uid_prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Mitarbeiter()
|
||||||
|
{
|
||||||
|
if(defined('CIS4') && CIS4) {
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'AbgabetoolMitarbeiter']);
|
||||||
|
} else {
|
||||||
|
$this->load->view('Cis/Abgabetool.php', ['uid' => getAuthUID(), 'route' => 'AbgabetoolMitarbeiter']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Assistenz($stg_kz_prop = '')
|
||||||
|
{
|
||||||
|
if(defined('CIS4') && CIS4) {
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'AbgabetoolAssistenz']);
|
||||||
|
} else {
|
||||||
|
$this->load->view('Cis/Abgabetool.php', ['uid' => getAuthUID(), 'route' => 'AbgabetoolAssistenz', 'stg_kz_prop' => $stg_kz_prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Deadlines()
|
||||||
|
{
|
||||||
|
if(defined('CIS4') && CIS4) {
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'DeadlinesOverview']);
|
||||||
|
} else {
|
||||||
|
$this->load->view('Cis/Abgabetool.php', ['uid' => getAuthUID(), 'route' => 'DeadlinesOverview']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@ class Auth extends FHC_Controller
|
|||||||
|
|
||||||
if ($this->form_validation->run())
|
if ($this->form_validation->run())
|
||||||
{
|
{
|
||||||
redirect($this->authlib->getLandingPage('/CisVue/Dashboard'));
|
redirect($this->authlib->getLandingPage('/Cis4'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -72,6 +72,7 @@ class Auth extends FHC_Controller
|
|||||||
{
|
{
|
||||||
$this->load->library('AuthLib');
|
$this->load->library('AuthLib');
|
||||||
$this->authlib->logout();
|
$this->authlib->logout();
|
||||||
redirect('/Cis/Auth/login', 'refresh');
|
setcookie('fhclogout', 'fhclogout', 0, '/');
|
||||||
|
redirect(base_url('/cis/private/logout.php'), 'refresh');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class Documents extends Auth_Controller
|
|||||||
|
|
||||||
$stgs = [];
|
$stgs = [];
|
||||||
$stsemArray = [];
|
$stsemArray = [];
|
||||||
$buchungstypen = implode('\',\'', defined("CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN") ? unserialize(CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN) : []);
|
$buchungstypen = defined("CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN") ? unserialize(CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN) : [];
|
||||||
$person_ids = [];
|
$person_ids = [];
|
||||||
foreach ($stati as $status) {
|
foreach ($stati as $status) {
|
||||||
$person_ids[] = $status->person_id;
|
$person_ids[] = $status->person_id;
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class InfoTerminal extends Auth_Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'index' => ['basis/cis:r'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->load->view('Cis/InfoTerminal.php', []);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class LvPlan extends Auth_Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'index' => ['basis/cis:r']
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load Config
|
||||||
|
$this->load->config('calendar');
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'LvPlan']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,11 +26,6 @@ class MyLv extends Auth_Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->load->view('Cis/MyLv');
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'MyLv']);
|
||||||
}
|
|
||||||
|
|
||||||
public function Info($studien_semester,$lvid)
|
|
||||||
{
|
|
||||||
$this->load->view('Cis/LvInfo',['lvid'=> $lvid, 'studien_semester' => $studien_semester]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class MyLvPlan extends Auth_Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'index' => ['basis/cis:r']
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load Config
|
||||||
|
$this->load->config('calendar');
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'MyLvPlan']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('BASEPATH'))
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class OtherLvPlan extends Auth_Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'index' => ['basis/other_lv_plan:r']
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load Config
|
||||||
|
$this->load->config('calendar');
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'OtherLvPlan']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -55,7 +55,7 @@ class Profil extends Auth_Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->load->view('Cis/Profil');
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'profilIndex']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,13 +65,13 @@ class Profil extends Auth_Controller
|
|||||||
*/
|
*/
|
||||||
public function View($uid)
|
public function View($uid)
|
||||||
{
|
{
|
||||||
$this->load->view('Cis/Profil');
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'profilViewUid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks whether a specific userID is a mitarbeiter or not (foreword declaration of the function isMitarbeiter in Mitarbeiter_model.php)
|
* checks whether a specific userID is a student or not (foreword declaration of the function isStudent in Student_model.php)
|
||||||
* @access public
|
* @access public
|
||||||
* @param $uid the userID used to check if it is a mitarbeiter
|
* @param $uid the userID used to check if it is a student
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isStudent($uid)
|
public function isStudent($uid)
|
||||||
@@ -101,7 +101,7 @@ class Profil extends Auth_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the adressen that are marked as zustell from the currenlty logged in user
|
* gets the adressen that are marked as zustell from the currently logged in user
|
||||||
* @access public
|
* @access public
|
||||||
* @return array a list of adresse_id's
|
* @return array a list of adresse_id's
|
||||||
*/
|
*/
|
||||||
@@ -244,23 +244,23 @@ class Profil extends Auth_Controller
|
|||||||
$this->GemeindeModel->addDistinct();
|
$this->GemeindeModel->addDistinct();
|
||||||
$this->GemeindeModel->addSelect(["name"]);
|
$this->GemeindeModel->addSelect(["name"]);
|
||||||
if ($nation == "A") {
|
if ($nation == "A") {
|
||||||
if (isset($zip) && $zip > 999 && $zip < 32000) {
|
if (isset($zip) && $zip > 999 && $zip < 32000) {
|
||||||
|
|
||||||
$gemeinde_res = $this->GemeindeModel->loadWhere(['plz' => $zip]);
|
$gemeinde_res = $this->GemeindeModel->loadWhere(['plz' => $zip]);
|
||||||
if (isError($gemeinde_res)) {
|
if (isError($gemeinde_res)) {
|
||||||
show_error("error while trying to query bis.tbl_gemeinde");
|
show_error("error while trying to query bis.tbl_gemeinde");
|
||||||
}
|
|
||||||
$gemeinde_res = hasData($gemeinde_res) ? getData($gemeinde_res) : null;
|
|
||||||
$gemeinde_res = array_map(function ($obj) {
|
|
||||||
return $obj->name;
|
|
||||||
}, $gemeinde_res);
|
|
||||||
echo json_encode($gemeinde_res);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
echo json_encode(error("ortschaftskennziffer code was not valid"));
|
|
||||||
}
|
}
|
||||||
|
$gemeinde_res = hasData($gemeinde_res) ? getData($gemeinde_res) : null;
|
||||||
|
$gemeinde_res = array_map(function ($obj) {
|
||||||
|
return $obj->name;
|
||||||
|
}, $gemeinde_res);
|
||||||
|
echo json_encode($gemeinde_res);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo json_encode(error("ortschaftskennziffer code was not valid"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
echo json_encode(error("Nation was not 'A' (Austria)"));
|
echo json_encode(error("Nation was not 'A' (Austria)"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -732,6 +732,4 @@ class Profil extends Auth_Controller
|
|||||||
$zutrittskarte_ausgegebenam = str_replace("-", ".", $zutrittskarte_ausgegebenam);
|
$zutrittskarte_ausgegebenam = str_replace("-", ".", $zutrittskarte_ausgegebenam);
|
||||||
return $zutrittskarte_ausgegebenam;
|
return $zutrittskarte_ausgegebenam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,54 +9,21 @@ if (!defined('BASEPATH'))
|
|||||||
class ProfilUpdate extends Auth_Controller
|
class ProfilUpdate extends Auth_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public static $STATUS_PENDING = NULL;
|
|
||||||
public static $STATUS_ACCEPTED = NULL;
|
|
||||||
public static $STATUS_REJECTED = NULL;
|
|
||||||
|
|
||||||
public static $TOPICS = [];
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct([
|
parent::__construct([
|
||||||
'index' => ['student/stammdaten:r', 'mitarbeiter/stammdaten:r'],
|
'index' => ['student/stammdaten:r', 'mitarbeiter/stammdaten:r'],
|
||||||
'id' => ['student/stammdaten:r', 'mitarbeiter/stammdaten:r'],
|
'show' => ['student/stammdaten:r', 'mitarbeiter/stammdaten:r', 'basis/cis:r'],
|
||||||
'getProfilUpdateWithPermission' => ['student/stammdaten:r', 'mitarbeiter/stammdaten:r'],
|
'id' => ['student/stammdaten:r', 'mitarbeiter/stammdaten:r']
|
||||||
'acceptProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'],
|
|
||||||
'denyProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'],
|
|
||||||
'show' => ['basis/cis:r'],
|
|
||||||
|
|
||||||
'insertProfilRequest' => ['basis/cis:rw'],
|
|
||||||
'updateProfilRequest' => ['basis/cis:rw'],
|
|
||||||
'deleteProfilRequest' => ['basis/cis:rw'],
|
|
||||||
'selectProfilRequest' => ['basis/cis:r'],
|
|
||||||
'insertFile' => ['basis/cis:rw'],
|
|
||||||
'getProfilRequestFiles' => ['basis/cis:r'],
|
|
||||||
'getStatus' => ['basis/cis:r'],
|
|
||||||
'getTopic' => ['basis/cis:r'],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->load->config('cis');
|
|
||||||
|
|
||||||
$this->load->model('person/Profil_update_model', 'ProfilUpdateModel');
|
$this->load->model('person/Profil_update_model', 'ProfilUpdateModel');
|
||||||
$this->load->model('person/Kontakt_model', 'KontaktModel');
|
|
||||||
$this->load->model('person/Adresse_model', 'AdresseModel');
|
|
||||||
$this->load->model('person/Adressentyp_model', 'AdressenTypModel');
|
|
||||||
$this->load->model('person/Person_model', 'PersonModel');
|
|
||||||
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
|
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
|
||||||
$this->load->model('crm/Student_model', 'StudentModel');
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
|
||||||
$this->load->model('system/Sprache_model', 'SpracheModel');
|
|
||||||
$this->load->model('person/Profil_update_status_model', 'ProfilUpdateStatusModel');
|
|
||||||
$this->load->model('person/Profil_update_topic_model', 'ProfilUpdateTopicModel');
|
|
||||||
|
|
||||||
// Load language phrases
|
// Load language phrases
|
||||||
$this->loadPhrases(
|
$this->loadPhrases(
|
||||||
array(
|
array(
|
||||||
'ui',
|
|
||||||
'global',
|
|
||||||
'person',
|
|
||||||
'profil',
|
|
||||||
'profilUpdate'
|
'profilUpdate'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -64,32 +31,10 @@ class ProfilUpdate extends Auth_Controller
|
|||||||
$this->load->library('DmsLib');
|
$this->load->library('DmsLib');
|
||||||
$this->load->library('PermissionLib');
|
$this->load->library('PermissionLib');
|
||||||
|
|
||||||
//? put the uid and pid inside the controller for reusability
|
|
||||||
$this->uid = getAuthUID();
|
$this->uid = getAuthUID();
|
||||||
$this->pid = getAuthPersonID();
|
$this->pid = getAuthPersonID();
|
||||||
|
|
||||||
// setup the ProfilUpdate states
|
|
||||||
$this->ProfilUpdateStatusModel->addSelect(['status_kurzbz']);
|
|
||||||
$status_kurzbz = $this->ProfilUpdateStatusModel->load();
|
|
||||||
if (hasData($status_kurzbz)) {
|
|
||||||
list($status_pending, $status_accepted, $status_rejected) = getData($status_kurzbz);
|
|
||||||
|
|
||||||
self::$STATUS_PENDING = $status_pending->status_kurzbz;
|
|
||||||
self::$STATUS_ACCEPTED = $status_accepted->status_kurzbz;
|
|
||||||
self::$STATUS_REJECTED = $status_rejected->status_kurzbz;
|
|
||||||
}
|
|
||||||
// setup the ProfilUpdate topics
|
|
||||||
$this->ProfilUpdateTopicModel->addSelect(['topic_kurzbz']);
|
|
||||||
$topic_kurzbz = $this->ProfilUpdateTopicModel->load();
|
|
||||||
|
|
||||||
if (hasData($topic_kurzbz)) {
|
|
||||||
foreach (getData($topic_kurzbz) as $topic) {
|
|
||||||
self::$TOPICS[$topic->topic_kurzbz] = $topic->topic_kurzbz;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->load->view('Cis/ProfilUpdate');
|
$this->load->view('Cis/ProfilUpdate');
|
||||||
@@ -100,129 +45,14 @@ class ProfilUpdate extends Auth_Controller
|
|||||||
$this->load->view('Cis/ProfilUpdate', ['profil_update_id' => $profil_update_id]);
|
$this->load->view('Cis/ProfilUpdate', ['profil_update_id' => $profil_update_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStatus()
|
|
||||||
{
|
|
||||||
echo json_encode([self::$STATUS_PENDING => self::$STATUS_PENDING, self::$STATUS_ACCEPTED => self::$STATUS_ACCEPTED, self::$STATUS_REJECTED => self::$STATUS_REJECTED]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTopic()
|
|
||||||
{
|
|
||||||
echo json_encode(self::$TOPICS);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function sendEmail_onProfilUpdate_response($uid, $topic, $status)
|
|
||||||
{
|
|
||||||
if($this->config->item('cis_send_profil_update_mails') === false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->load->helper('hlp_sancho_helper');
|
|
||||||
$email = $uid . "@" . DOMAIN;
|
|
||||||
|
|
||||||
|
|
||||||
function languageQuery($language)
|
|
||||||
{
|
|
||||||
return "select index from public.tbl_sprache where sprache = '" + $language + "'";
|
|
||||||
}
|
|
||||||
$this->ProfilUpdateStatusModel->addSelect(["bezeichnung_mehrsprachig[(" . languageQuery('German') . ")] as status_de", "bezeichnung_mehrsprachig[(" . languageQuery('English') . ")] as status_en"]);
|
|
||||||
$status_translation = $this->ProfilUpdateStatusModel->loadWhere(["status_kurzbz" => $status]);
|
|
||||||
if (isError($status_translation)) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'ProfilUpdateStatusTranslationError'));
|
|
||||||
}
|
|
||||||
$status_translation = hasData($status_translation) ? getData($status_translation)[0] : null;
|
|
||||||
if (isset($status_translation)) {
|
|
||||||
$mail_res = sendSanchoMail("profil_update_response", ['topic' => $topic, 'status_de' => $status_translation->status_de, 'status_en' => $status_translation->status_en, 'href' => APP_ROOT . 'Cis/Profil'], $email, ("Profil Änderung " . $this->p->t('profilUpdate', 'pending')));
|
|
||||||
if (!$mail_res) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_email_error'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private function sendEmail_onProfilUpdate_insertion($uid, $profil_update_id, $topic)
|
|
||||||
{
|
|
||||||
if($this->config->item('cis_send_profil_update_mails') === false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->load->helper('hlp_sancho_helper');
|
|
||||||
$emails = [];
|
|
||||||
|
|
||||||
$isMitarbeiter_res = $this->MitarbeiterModel->isMitarbeiter($uid);
|
|
||||||
if (isError($isMitarbeiter_res)) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_mitarbeiterCheck_error'));
|
|
||||||
}
|
|
||||||
$isMitarbeiter_res = getData($isMitarbeiter_res);
|
|
||||||
|
|
||||||
//! if the $uid is a mitarbeiter and student, only the hr is notified by email
|
|
||||||
if ($isMitarbeiter_res) {
|
|
||||||
//? user is not a student therefore he is a mitarbeiter, send email to Personalverwaltung
|
|
||||||
//? use constant variable MAIL_GST to mail to the personalverwaltung
|
|
||||||
$this->MitarbeiterModel->addSelect([TRUE]);
|
|
||||||
$this->MitarbeiterModel->addJoin("public.tbl_benutzer", "public.tbl_benutzer.uid = public.tbl_mitarbeiter.mitarbeiter_uid");
|
|
||||||
//? check if the the userID is a mitarbeiter and if the benutzer is active
|
|
||||||
$res = $this->MitarbeiterModel->loadWhere(["public.tbl_mitarbeiter.mitarbeiter_uid" => $uid, "public.tbl_benutzer.aktiv" => TRUE]);
|
|
||||||
if (isError($res)) {
|
|
||||||
show_error("was not able to query the mitarbeiter and benutzer by the uid: " . $uid);
|
|
||||||
}
|
|
||||||
if (hasData($res)) {
|
|
||||||
array_push($emails, MAIL_GST);
|
|
||||||
} else {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_mitarbeiterCheck_error'));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//? if it is not a mitarbeiter, check whether it is a student and send email to studiengang
|
|
||||||
$isStudent_res = $this->StudentModel->isStudent($uid);
|
|
||||||
if (isError($isStudent_res)) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_studentCheck_error'));
|
|
||||||
}
|
|
||||||
$isStudent_res = getData($isStudent_res);
|
|
||||||
if ($isStudent_res) {
|
|
||||||
//? Send email to the Studiengangsassistentinnen
|
|
||||||
$this->StudentModel->addSelect(["public.tbl_studiengang.email"]);
|
|
||||||
$this->StudentModel->addJoin("public.tbl_benutzer", "public.tbl_benutzer.uid = public.tbl_student.student_uid");
|
|
||||||
$this->StudentModel->addJoin("public.tbl_prestudent", "public.tbl_benutzer.person_id = public.tbl_prestudent.person_id");
|
|
||||||
$this->StudentModel->addJoin("public.tbl_prestudentstatus", "public.tbl_prestudentstatus.prestudent_id = public.tbl_prestudent.prestudent_id");
|
|
||||||
$this->StudentModel->addJoin("public.tbl_studiengang", "public.tbl_studiengang.studiengang_kz = public.tbl_prestudent.studiengang_kz");
|
|
||||||
//* check if the benutzer itself is active
|
|
||||||
//* check if the student status is Student or Diplomand (active students)
|
|
||||||
$this->StudentModel->db->where_in("public.tbl_prestudentstatus.status_kurzbz", ['Student', 'Diplomand']);
|
|
||||||
$res = $this->StudentModel->loadWhere(["public.tbl_benutzer.aktiv" => TRUE, "public.tbl_student.student_uid" => $uid]);
|
|
||||||
if (isError($res)) {
|
|
||||||
show_error(getData($res));
|
|
||||||
} else {
|
|
||||||
$res = hasData($res) ? getData($res) : [];
|
|
||||||
foreach ($res as $emailObj) {
|
|
||||||
array_push($emails, $emailObj->email);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$mail_res = [];
|
|
||||||
//? sending email
|
|
||||||
foreach ($emails as $email) {
|
|
||||||
array_push($mail_res, sendSanchoMail("profil_update", ['uid' => $uid, 'topic' => $topic, 'href' => APP_ROOT . 'Cis/ProfilUpdate/id/' . $profil_update_id], $email, ("Profil Änderung von " . $uid)));
|
|
||||||
}
|
|
||||||
foreach ($mail_res as $m_res) {
|
|
||||||
if (!$m_res) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_email_error'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function show($dms_id)
|
public function show($dms_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
$profil_update = $this->ProfilUpdateModel->loadWhere(['attachment_id' => $dms_id]);
|
$profil_update = $this->ProfilUpdateModel->loadWhere(['attachment_id' => $dms_id]);
|
||||||
$profil_update = hasData($profil_update) ? getData($profil_update)[0] : null;
|
$profil_update = hasData($profil_update) ? getData($profil_update)[0] : null;
|
||||||
|
|
||||||
//? checks if an profil update exists with the dms_id requested from the user
|
//? checks if an profil update exists with the dms_id requested from the user
|
||||||
if ($profil_update) {
|
if ($profil_update)
|
||||||
|
{
|
||||||
$is_mitarbeiter_profil_update = getData($this->MitarbeiterModel->isMitarbeiter($profil_update->uid));
|
$is_mitarbeiter_profil_update = getData($this->MitarbeiterModel->isMitarbeiter($profil_update->uid));
|
||||||
$is_student_profil_update = getData($this->StudentModel->isStudent($profil_update->uid));
|
$is_student_profil_update = getData($this->StudentModel->isStudent($profil_update->uid));
|
||||||
|
|
||||||
@@ -230,7 +60,8 @@ class ProfilUpdate extends Auth_Controller
|
|||||||
$this->permissionlib->isBerechtigt('student/stammdaten:r') && $is_student_profil_update ||
|
$this->permissionlib->isBerechtigt('student/stammdaten:r') && $is_student_profil_update ||
|
||||||
$this->permissionlib->isBerechtigt('mitarbeiter/stammdaten:r') && $is_mitarbeiter_profil_update ||
|
$this->permissionlib->isBerechtigt('mitarbeiter/stammdaten:r') && $is_mitarbeiter_profil_update ||
|
||||||
$this->uid == $profil_update->uid
|
$this->uid == $profil_update->uid
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
// Get file to be downloaded from DMS
|
// Get file to be downloaded from DMS
|
||||||
$newFilename = $this->uid . "/document_" . $dms_id;
|
$newFilename = $this->uid . "/document_" . $dms_id;
|
||||||
$download = $this->dmslib->download($dms_id);
|
$download = $this->dmslib->download($dms_id);
|
||||||
@@ -239,576 +70,17 @@ class ProfilUpdate extends Auth_Controller
|
|||||||
|
|
||||||
// Download file
|
// Download file
|
||||||
$this->outputFile(getData($download));
|
$this->outputFile(getData($download));
|
||||||
|
}
|
||||||
|
else
|
||||||
} else {
|
{
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_permission_error'));
|
show_error($this->p->t('profilUpdate', 'profilUpdate_permission_error'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
else
|
||||||
|
{
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_dms_error'));
|
show_error($this->p->t('profilUpdate', 'profilUpdate_dms_error'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function insertFile($replace)
|
|
||||||
{
|
|
||||||
$replace = json_decode($replace);
|
|
||||||
|
|
||||||
if (!count($_FILES)) {
|
|
||||||
echo json_encode([]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//? if replace is set it contains the profil_update_id in which the attachment_id has to be replaced
|
|
||||||
if (isset($replace)) {
|
|
||||||
$this->ProfilUpdateModel->addSelect(["attachment_id"]);
|
|
||||||
$profilUpdate = $this->ProfilUpdateModel->load([$replace]);
|
|
||||||
if (isError($profilUpdate)) {
|
|
||||||
return json_encode(error($this->p->t('profilUpdate', 'profilUpdate_loading_error')));
|
|
||||||
}
|
|
||||||
//? get the attachmentID
|
|
||||||
$dms_id = hasData($profilUpdate) ? getData($profilUpdate)[0]->attachment_id : null;
|
|
||||||
|
|
||||||
//? delete old dms_file of Profil Update
|
|
||||||
$this->deleteOldVersionFile($dms_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$files = $_FILES['files'];
|
|
||||||
$file_count = count($files['name']);
|
|
||||||
|
|
||||||
$res = [];
|
|
||||||
|
|
||||||
for ($i = 0; $i < $file_count; $i++) {
|
|
||||||
$_FILES['files']['name'] = $files['name'][$i];
|
|
||||||
$_FILES['files']['type'] = $files['type'][$i];
|
|
||||||
$_FILES['files']['tmp_name'] = $files['tmp_name'][$i];
|
|
||||||
$_FILES['files']['error'] = $files['error'][$i];
|
|
||||||
$_FILES['files']['size'] = $files['size'][$i];
|
|
||||||
|
|
||||||
$dms = [
|
|
||||||
"kategorie_kurzbz" => "profil_aenderung",
|
|
||||||
"version" => 0,
|
|
||||||
"name" => $_FILES['files']['name'],
|
|
||||||
"mimetype" => $_FILES['files']['type'],
|
|
||||||
"beschreibung" => $this->uid . " Profil Änderung",
|
|
||||||
"insertvon" => $this->uid,
|
|
||||||
"insertamum" => "NOW()",
|
|
||||||
];
|
|
||||||
|
|
||||||
$tmp_res = $this->dmslib->upload($dms, 'files', array("jpg", "png", "pdf"));
|
|
||||||
|
|
||||||
$tmp_res = hasData($tmp_res) ? getData($tmp_res) : null;
|
|
||||||
array_push($res, $tmp_res);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($res);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function selectProfilRequest()
|
|
||||||
{
|
|
||||||
$_GET = json_decode($this->input->raw_input_stream, true);
|
|
||||||
$uid = $this->input->get('uid');
|
|
||||||
$id = $this->input->get('id');
|
|
||||||
$whereClause = ['uid' => $this->uid];
|
|
||||||
|
|
||||||
if (isset($uid))
|
|
||||||
$whereClause['uid'] = $uid;
|
|
||||||
if (isset($id))
|
|
||||||
$whereClause['id'] = $id;
|
|
||||||
|
|
||||||
$res = $this->ProfilUpdateModel->getProfilUpdatesWhere($whereClause);
|
|
||||||
$res = hasData($res) ? getData($res) : null;
|
|
||||||
echo json_encode($res);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getProfilRequestFiles()
|
|
||||||
{
|
|
||||||
$id = json_decode($this->input->raw_input_stream);
|
|
||||||
|
|
||||||
$this->ProfilUpdateModel->addSelect(["attachment_id"]);
|
|
||||||
$attachmentID = $this->ProfilUpdateModel->load([$id]);
|
|
||||||
if (isError($attachmentID)) {
|
|
||||||
return json_encode(error($this->p->t('profilUpdate', 'profilUpdate_loading_error')));
|
|
||||||
}
|
|
||||||
//? get the attachmentID
|
|
||||||
$dms_id = hasData($attachmentID) ? getData($attachmentID)[0]->attachment_id : null;
|
|
||||||
|
|
||||||
//? get the name to the file
|
|
||||||
$this->DmsVersionModel->addSelect(["name", "dms_id"]);
|
|
||||||
$attachment = $this->DmsVersionModel->load([$dms_id, 0]);
|
|
||||||
if (isError($attachment)) {
|
|
||||||
return json_encode(error($this->p->t('profilUpdate', 'profilUpdate_dmsVersion_error')));
|
|
||||||
}
|
|
||||||
$attachment = hasData($attachment) ? getData($attachment) : null;
|
|
||||||
//? returns {name:..., dms_id:...}
|
|
||||||
echo json_encode($attachment);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function insertProfilRequest()
|
|
||||||
{
|
|
||||||
|
|
||||||
$json = json_decode($this->input->raw_input_stream);
|
|
||||||
|
|
||||||
$payload = $json->payload;
|
|
||||||
$identifier = property_exists($json->payload, "kontakt_id") ? "kontakt_id" : (property_exists($json->payload, "adresse_id") ? "adresse_id" : null);
|
|
||||||
|
|
||||||
$data = ["topic" => $json->topic, "uid" => $this->uid, "requested_change" => json_encode($payload), "insertamum" => "NOW()", "insertvon" => $this->uid, "status" => self::$STATUS_PENDING ?: 'Pending'];
|
|
||||||
|
|
||||||
//? insert fileID in the dataset if sent with post request
|
|
||||||
if (isset($json->fileID)) {
|
|
||||||
$data['attachment_id'] = $json->fileID;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//? loops over all updateRequests from a user to validate if the new request is valid
|
|
||||||
$res = $this->ProfilUpdateModel->getProfilUpdatesWhere(["uid" => $this->uid]);
|
|
||||||
if (isError($res)) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_loading_error'));
|
|
||||||
}
|
|
||||||
$res = hasData($res) ? getData($res) : null;
|
|
||||||
|
|
||||||
//? the user cannot delete a zustelladresse/kontakt
|
|
||||||
if (isset($payload->delete) && $payload->{$identifier == "kontakt_id" ? "zustellung" : "zustelladresse"}) {
|
|
||||||
echo json_encode(error($this->p->t('profilUpdate', 'profilUpdate_deleteZustellung_error')));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//? if the user tries to delete a adresse, checks whether the adresse is a heimatadresse, if so an error is raised
|
|
||||||
if (isset($payload->delete) && $identifier == "adresse_id") {
|
|
||||||
$adr = $this->AdresseModel->load($payload->$identifier);
|
|
||||||
$adr = getData($adr)[0];
|
|
||||||
if ($adr->heimatadresse) {
|
|
||||||
echo json_encode(error($this->p->t('profilUpdate', 'profilUpdate_deleteZustellung_error')));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($res) {
|
|
||||||
$pending_changes = array_filter($res, function ($element) {
|
|
||||||
return $element->status == (self::$STATUS_PENDING ?: "Pending");
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach ($pending_changes as $update_request) {
|
|
||||||
$existing_change = $update_request->requested_change;
|
|
||||||
|
|
||||||
//? the user can add as many new kontakte/adressen as he likes
|
|
||||||
if (!isset($payload->add) && property_exists($existing_change, $identifier) && property_exists($payload, $identifier) && $existing_change->$identifier == $payload->$identifier) {
|
|
||||||
//? the kontakt_id / adresse_id of a change has to be unique
|
|
||||||
echo json_encode(error($this->p->t('profilUpdate', 'profilUpdate_changeTwice_error')));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//? if it is not updating any kontakt/adresse, the topic has to be unique
|
|
||||||
elseif (!$identifier && $update_request->topic == $json->topic) {
|
|
||||||
echo json_encode(error($this->p->t('profilUpdate', 'profilUpdate_changeTopicTwice_error', ['0' => $update_request->topic])));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$insertID = $this->ProfilUpdateModel->insert($data);
|
|
||||||
|
|
||||||
if (isError($insertID)) {
|
|
||||||
show_error(getData($insertID));
|
|
||||||
} else {
|
|
||||||
$insertID = hasData($insertID) ? getData($insertID) : null;
|
|
||||||
|
|
||||||
//? sends emails to the correspondents of the $uid
|
|
||||||
$this->sendEmail_onProfilUpdate_insertion($this->uid, $insertID, $json->topic);
|
|
||||||
echo json_encode(success($insertID));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updateProfilRequest()
|
|
||||||
{
|
|
||||||
$json = json_decode($this->input->raw_input_stream);
|
|
||||||
|
|
||||||
$updateData = ["requested_change" => json_encode($json->payload), "updateamum" => "NOW()", "updatevon" => $this->uid];
|
|
||||||
if (isset($json->fileID)) {
|
|
||||||
$updateData['attachment_id'] = json_decode($json->fileID);
|
|
||||||
}
|
|
||||||
$updateID = $this->ProfilUpdateModel->update([$json->ID], $updateData);
|
|
||||||
//? insert fileID in the dataset if sent with post request
|
|
||||||
|
|
||||||
if (isError($updateID)) {
|
|
||||||
//catch error
|
|
||||||
} else {
|
|
||||||
$updateID = hasData($updateID) ? getData($updateID)[0] : null;
|
|
||||||
//TODO: should an email be sent to the responsable people when the user changes his profil update
|
|
||||||
echo json_encode(success($updateID));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function deleteProfilRequest()
|
|
||||||
{
|
|
||||||
|
|
||||||
$json = json_decode($this->input->raw_input_stream);
|
|
||||||
$delete_res = $this->ProfilUpdateModel->delete([$json]);
|
|
||||||
echo json_encode($delete_res);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getProfilUpdateWithPermission($status = null)
|
|
||||||
{
|
|
||||||
// early return if no status has been passed as argument
|
|
||||||
if (!isset($status)) {
|
|
||||||
echo json_encode($this->ProfilUpdateModel->getProfilUpdateWithPermission());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the sprache of the user
|
|
||||||
$sprachenIndex = $this->SpracheModel->loadWhere(["sprache" => getUserLanguage()]);
|
|
||||||
$sprachenIndex = hasData($sprachenIndex) ? getData($sprachenIndex)[0]->index : null;
|
|
||||||
|
|
||||||
if (isset($sprachenIndex) && isset($status)) {
|
|
||||||
// get the corresponding status kurz_bz primary key out of the translation
|
|
||||||
$status = $this->ProfilUpdateStatusModel->execReadOnlyQuery("select * from public.tbl_profil_update_status where ? = ANY(bezeichnung_mehrsprachig)", [$status]);
|
|
||||||
$status = hasData($status) ? getData($status)[0]->status_kurzbz : null;
|
|
||||||
$res = $this->ProfilUpdateModel->getProfilUpdateWithPermission(isset($status) ? ['status' => $status] : null);
|
|
||||||
|
|
||||||
echo json_encode($res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function getOE_from_student($student_uid)
|
|
||||||
{
|
|
||||||
|
|
||||||
//? returns the oe_einheit eines Studenten
|
|
||||||
$query = "SELECT public.tbl_studiengang.oe_kurzbz
|
|
||||||
FROM public.tbl_student
|
|
||||||
JOIN public.tbl_studiengang ON tbl_student.studiengang_kz = public.tbl_studiengang.studiengang_kz
|
|
||||||
WHERE public.tbl_student.student_uid = ?;";
|
|
||||||
|
|
||||||
$res = $this->StudentModel->execReadOnlyQuery($query, [$student_uid]);
|
|
||||||
if (!isSuccess($res)) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_loadingOE_error'));
|
|
||||||
}
|
|
||||||
$res = hasData($res) ? getData($res) : [];
|
|
||||||
$res = array_map(
|
|
||||||
function ($item) {
|
|
||||||
return $item->oe_kurzbz;
|
|
||||||
},
|
|
||||||
$res
|
|
||||||
);
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function acceptProfilRequest()
|
|
||||||
{
|
|
||||||
$_POST = json_decode($this->input->raw_input_stream, true);
|
|
||||||
$id = $this->input->post('profil_update_id', true);
|
|
||||||
$uid = $this->input->post('uid', true);
|
|
||||||
|
|
||||||
//? fetching person_id using UID
|
|
||||||
$personID = $this->PersonModel->getByUid($uid);
|
|
||||||
$personID = hasData($personID) ? getData($personID)[0]->person_id : null;
|
|
||||||
$status_message = $this->input->post('status_message', true);
|
|
||||||
$topic = $this->input->post('topic', true);
|
|
||||||
|
|
||||||
//! somehow the xss check converted boolean false to empty string
|
|
||||||
$requested_change = $this->input->post('requested_change');
|
|
||||||
|
|
||||||
//! check for required information
|
|
||||||
if (!isset($id) || !isset($uid) || !isset($personID) || !isset($requested_change) || !isset($topic)) {
|
|
||||||
return json_encode(error($this->p->t('profilUpdate', 'profilUpdate_requiredInformation_error')));
|
|
||||||
}
|
|
||||||
|
|
||||||
$is_mitarbeiter_profil_update = getData($this->MitarbeiterModel->isMitarbeiter($uid));
|
|
||||||
$is_student_profil_update = getData($this->StudentModel->isStudent($uid));
|
|
||||||
|
|
||||||
|
|
||||||
//? check if the permissions are set correctly
|
|
||||||
if (
|
|
||||||
$this->permissionlib->isBerechtigt('student/stammdaten', "suid", $this->getOE_from_student($uid)) && $is_student_profil_update ||
|
|
||||||
$this->permissionlib->isBerechtigt('mitarbeiter/stammdaten', "suid") && $is_mitarbeiter_profil_update
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (is_array($requested_change) && array_key_exists("adresse_id", $requested_change)) {
|
|
||||||
$insertID = $this->handleAdresse($requested_change, $personID);
|
|
||||||
$insertID = hasData($insertID) ? getData($insertID) : null;
|
|
||||||
if (isset($insertID)) {
|
|
||||||
$requested_change['adresse_id'] = $insertID;
|
|
||||||
$update_res = $this->updateRequestedChange($id, $requested_change);
|
|
||||||
if (isError($update_res)) {
|
|
||||||
echo json_encode(error($this->p->t('profilUpdate', 'profilUpdate_address_error', [$insertID])));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (is_array($requested_change) && array_key_exists("kontakt_id", $requested_change)) {
|
|
||||||
$insertID = $this->handleKontakt($requested_change, $personID);
|
|
||||||
$insertID = hasData($insertID) ? getData($insertID) : null;
|
|
||||||
if (isset($insertID)) {
|
|
||||||
$requested_change['kontakt_id'] = $insertID;
|
|
||||||
$update_res = $this->updateRequestedChange($id, $requested_change);
|
|
||||||
if (isError($update_res)) {
|
|
||||||
echo json_encode(error($this->p->t('profilUpdate', 'profilUpdate_kontakt_error', [$insertID])));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
switch ($topic) {
|
|
||||||
// mapping phrasen to database columns to make the update with the correct column names
|
|
||||||
case self::$TOPICS['Titel']:
|
|
||||||
$topic = "titelpre";
|
|
||||||
break;
|
|
||||||
case self::$TOPICS['Postnomen']:
|
|
||||||
$topic = "titelpost";
|
|
||||||
break;
|
|
||||||
case self::$TOPICS['Vorname']:
|
|
||||||
$topic = "vorname";
|
|
||||||
break;
|
|
||||||
case self::$TOPICS['Nachname']:
|
|
||||||
$topic = "nachname";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_topic_error', [$topic]));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $this->PersonModel->update($personID, [$topic => $requested_change["value"]]);
|
|
||||||
if (isError($result)) {
|
|
||||||
echo json_encode(error($this->p->t('profilUpdate', 'profilUpdate_insert_error')));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->sendEmail_onProfilUpdate_response($uid, $topic, self::$STATUS_ACCEPTED);
|
|
||||||
|
|
||||||
echo json_encode($this->setStatusOnUpdateRequest($id, self::$STATUS_ACCEPTED, $status_message, $requested_change));
|
|
||||||
} else {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_permission_error'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function denyProfilRequest()
|
|
||||||
{
|
|
||||||
|
|
||||||
$_POST = json_decode($this->input->raw_input_stream, true);
|
|
||||||
$id = $this->input->post('profil_update_id', true);
|
|
||||||
$uid = $this->input->post('uid', true);
|
|
||||||
$topic = $this->input->post('topic', true);
|
|
||||||
$status_message = $this->input->post('status_message', true);
|
|
||||||
|
|
||||||
$is_mitarbeiter_profil_update = getData($this->MitarbeiterModel->isMitarbeiter($uid));
|
|
||||||
$is_student_profil_update = getData($this->StudentModel->isStudent($uid));
|
|
||||||
|
|
||||||
|
|
||||||
if (
|
|
||||||
$this->permissionlib->isBerechtigt('student/stammdaten', "suid", $this->getOE_from_student($uid)) && $is_student_profil_update ||
|
|
||||||
$this->permissionlib->isBerechtigt('mitarbeiter/stammdaten', "suid") && $is_mitarbeiter_profil_update
|
|
||||||
) {
|
|
||||||
$this->sendEmail_onProfilUpdate_response($uid, $topic, self::$STATUS_REJECTED);
|
|
||||||
echo json_encode($this->setStatusOnUpdateRequest($id, self::$STATUS_REJECTED, $status_message));
|
|
||||||
} else {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_permission_error'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private function updateRequestedChange($id, $requested_change)
|
|
||||||
{
|
|
||||||
return $this->ProfilUpdateModel->update([$id], ['requested_change' => json_encode($requested_change)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function setStatusOnUpdateRequest($id, $status, $status_message)
|
|
||||||
{
|
|
||||||
return $this->ProfilUpdateModel->update([$id], ["status" => $status, "status_timestamp" => "NOW()", "status_message" => $status_message]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function deleteOldVersionFile($dms_id)
|
|
||||||
{
|
|
||||||
if (!isset($dms_id)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//? collect all the results of the deleted versions in an array
|
|
||||||
$res = array();
|
|
||||||
|
|
||||||
//? delete all the different versions of the dms_file
|
|
||||||
$dmsVersions = $this->DmsVersionModel->loadWhere(["dms_id" => $dms_id]);
|
|
||||||
$dmsVersions = hasData($dmsVersions) ? getData($dmsVersions) : null;
|
|
||||||
if (isset($dmsVersions)) {
|
|
||||||
$zwischen_res = array_map(function ($item) {
|
|
||||||
return $item->version;
|
|
||||||
}, $dmsVersions);
|
|
||||||
foreach ($zwischen_res as $version) {
|
|
||||||
array_push($res, $this->DmsVersionModel->delete([$dms_id, $version]));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo json_encode(error($this->p->t('profilUpdate', 'profilUpdate_dmsVersion_error')));
|
|
||||||
}
|
|
||||||
|
|
||||||
//? returns a result for each deleted dms_file
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private function handleKontakt($requested_change, $personID)
|
|
||||||
{
|
|
||||||
$kontakt_id = $requested_change["kontakt_id"];
|
|
||||||
//? removes the kontakt_id because we don't want to update the kontakt_id in the database
|
|
||||||
unset($requested_change["kontakt_id"]);
|
|
||||||
|
|
||||||
|
|
||||||
//! ADD
|
|
||||||
if (array_key_exists('add', $requested_change) && $requested_change['add']) {
|
|
||||||
//? removes add flag
|
|
||||||
unset($requested_change['add']);
|
|
||||||
$requested_change['person_id'] = $personID;
|
|
||||||
$requested_change['insertamum'] = "NOW()";
|
|
||||||
$requested_change['insertvon'] = getAuthUID();
|
|
||||||
$insertID = $this->KontaktModel->insert($requested_change);
|
|
||||||
$insert_kontakt_id = $insertID;
|
|
||||||
if (isError($insert_kontakt_id)) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_insertKontakt_error'));
|
|
||||||
}
|
|
||||||
$insert_kontakt_id = hasData($insert_kontakt_id) ? getData($insert_kontakt_id) : null;
|
|
||||||
if ($insert_kontakt_id) {
|
|
||||||
$this->handleDupplicateZustellKontakte($requested_change['zustellung'], $insert_kontakt_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
//! DELETE
|
|
||||||
elseif (array_key_exists('delete', $requested_change) && $requested_change['delete']) {
|
|
||||||
$this->KontaktModel->delete($kontakt_id);
|
|
||||||
}
|
|
||||||
//! UPDATE
|
|
||||||
else {
|
|
||||||
$requested_change['updateamum'] = "NOW()";
|
|
||||||
$requested_change['updatevon'] = getAuthUID();
|
|
||||||
|
|
||||||
$update_kontakt_id = $this->KontaktModel->update($kontakt_id, $requested_change);
|
|
||||||
|
|
||||||
if (isError($update_kontakt_id)) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_updateKontakt_error'));
|
|
||||||
}
|
|
||||||
$update_kontakt_id = hasData($update_kontakt_id) ? getData($update_kontakt_id) : null;
|
|
||||||
if ($update_kontakt_id) {
|
|
||||||
$this->handleDupplicateZustellKontakte($requested_change['zustellung'], $update_kontakt_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return isset($insertID) ? $insertID : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function handleAdresse($requested_change, $personID)
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->AdressenTypModel->addSelect(["adressentyp_kurzbz"]);
|
|
||||||
$adr_kurzbz = $this->AdressenTypModel->loadWhere(["bezeichnung" => $requested_change['typ']]);
|
|
||||||
$adr_kurzbz = hasData($adr_kurzbz) ? getData($adr_kurzbz)[0]->adressentyp_kurzbz : null;
|
|
||||||
//? replace the address_typ with its correct kurzbz foreign key
|
|
||||||
$requested_change['typ'] = $adr_kurzbz;
|
|
||||||
|
|
||||||
$adresse_id = $requested_change["adresse_id"];
|
|
||||||
//? removes the adresse_id because we don't want to update the kontakt_id in the database
|
|
||||||
unset($requested_change["adresse_id"]);
|
|
||||||
|
|
||||||
|
|
||||||
//! ADD
|
|
||||||
if (array_key_exists('add', $requested_change) && $requested_change['add']) {
|
|
||||||
|
|
||||||
//? removes add flag
|
|
||||||
unset($requested_change['add']);
|
|
||||||
$requested_change['insertamum'] = "NOW()";
|
|
||||||
$requested_change['insertvon'] = getAuthUID();
|
|
||||||
$requested_change['person_id'] = $personID;
|
|
||||||
//TODO: zustelladresse, heimatadresse, rechnungsadresse und nation werden nicht beachtet
|
|
||||||
$insertID = $this->AdresseModel->insert($requested_change);
|
|
||||||
$insert_adresse_id = $insertID;
|
|
||||||
if (isError($insert_adresse_id)) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_insertAdresse_error'));
|
|
||||||
}
|
|
||||||
$insert_adresse_id = hasData($insert_adresse_id) ? getData($insert_adresse_id) : null;
|
|
||||||
if ($insert_adresse_id) {
|
|
||||||
$this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $insert_adresse_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//! DELETE
|
|
||||||
elseif (array_key_exists('delete', $requested_change) && $requested_change['delete']) {
|
|
||||||
$this->AdresseModel->delete($adresse_id);
|
|
||||||
}
|
|
||||||
//! UPDATE
|
|
||||||
else {
|
|
||||||
$requested_change['updateamum'] = "NOW()";
|
|
||||||
$requested_change['updatevon'] = getAuthUID();
|
|
||||||
$update_adresse_id = $this->AdresseModel->update($adresse_id, $requested_change);
|
|
||||||
if (isError($update_adresse_id)) {
|
|
||||||
show_error($this->p->t('profilUpdate', 'profilUpdate_updateAdresse_error'));
|
|
||||||
}
|
|
||||||
$update_adresse_id = hasData($update_adresse_id) ? getData($update_adresse_id) : null;
|
|
||||||
if ($update_adresse_id) {
|
|
||||||
$this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $update_adresse_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return isset($insertID) ? $insertID : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private function handleDupplicateZustellKontakte($zustellung, $kontakt_id)
|
|
||||||
{
|
|
||||||
if ($zustellung) {
|
|
||||||
$this->PersonModel->addSelect("public.tbl_kontakt.kontakt_id");
|
|
||||||
$this->PersonModel->addJoin("public.tbl_kontakt", "public.tbl_kontakt.person_id = public.tbl_person.person_id");
|
|
||||||
$zustellKontakteArray = $this->PersonModel->loadWhere(["public.tbl_person.person_id" => $this->pid, "zustellung" => TRUE]);
|
|
||||||
if (!isSuccess($zustellKontakteArray)) {
|
|
||||||
return error($this->p->t('profilUpdate', 'profilUpdate_loadingZustellkontakte_error'));
|
|
||||||
}
|
|
||||||
$zustellKontakteArray = hasData($zustellKontakteArray) ? getData($zustellKontakteArray) : null;
|
|
||||||
|
|
||||||
if ($zustellung && count($zustellKontakteArray) > 0) {
|
|
||||||
$zustellKontakteArray = array_filter($zustellKontakteArray, function ($kontakt) use ($kontakt_id) {
|
|
||||||
return $kontakt->kontakt_id != $kontakt_id;
|
|
||||||
});
|
|
||||||
foreach ($zustellKontakteArray as $kontakt) {
|
|
||||||
$this->KontaktModel->update($kontakt->kontakt_id, ["zustellung" => FALSE]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function handleDupplicateZustellAdressen($zustellung, $adresse_id)
|
|
||||||
{
|
|
||||||
if ($zustellung) {
|
|
||||||
$this->PersonModel->addSelect("public.tbl_adresse.adresse_id");
|
|
||||||
$this->PersonModel->addJoin("public.tbl_adresse", "public.tbl_adresse.person_id = public.tbl_person.person_id");
|
|
||||||
$zustellAdressenArray = $this->PersonModel->loadWhere(["public.tbl_person.person_id" => $this->pid, "zustelladresse" => TRUE]);
|
|
||||||
if (!isSuccess($zustellAdressenArray)) {
|
|
||||||
return error($this->p->t('profilUpdate', 'profilUpdate_loadingZustellAdressen_error'));
|
|
||||||
}
|
|
||||||
$zustellAdressenArray = hasData($zustellAdressenArray) ? getData($zustellAdressenArray) : null;
|
|
||||||
|
|
||||||
if ($zustellung && count($zustellAdressenArray) > 0) {
|
|
||||||
|
|
||||||
$zustellAdressenArray = array_filter($zustellAdressenArray, function ($adresse) use ($adresse_id) {
|
|
||||||
|
|
||||||
return $adresse->adresse_id != $adresse_id;
|
|
||||||
});
|
|
||||||
foreach ($zustellAdressenArray as $adresse) {
|
|
||||||
$this->AdresseModel->update($adresse->adresse_id, ["zustelladresse" => FALSE]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Pub extends Auth_Controller
|
|||||||
{
|
{
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
array(
|
array(
|
||||||
'bild' => ['basis/cis:r']
|
'bild' => ['basis/cis:r', 'assistenz:r']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Stundenplan extends Auth_Controller
|
class Raumsuche extends Auth_Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@@ -25,6 +25,6 @@ class Stundenplan extends Auth_Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->load->view('Cis/Stundenplan');
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'Raumsuche']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class StgOrgLvPlan extends Auth_Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'index' => ['basis/cis:r']
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load Config
|
||||||
|
$this->load->config('calendar');
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'StgOrgLvPlan']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('BASEPATH'))
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Studium extends Auth_Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'index' => ['basis/cis:r'],
|
||||||
|
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* index loads the Studium view
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php',['route' => 'studium']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (!defined('BASEPATH'))
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -13,10 +14,13 @@ class Cis4 extends Auth_Controller
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
array(
|
array(
|
||||||
'index' => 'basis/cis:r'
|
'index' => 'basis/cis:r'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Load Config
|
||||||
|
$this->load->config('calendar');
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
@@ -27,15 +31,6 @@ class Cis4 extends Auth_Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->load->model('person/Person_model','PersonModel');
|
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'FhcDashboard']);
|
||||||
$personData = getData($this->PersonModel->getByUid(getAuthUID()))[0];
|
|
||||||
|
|
||||||
$viewData = array(
|
|
||||||
'uid' => getAuthUID(),
|
|
||||||
'name' => $personData->vorname,
|
|
||||||
'person_id' => $personData->person_id
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->load->view('CisVue/Dashboard.php',['viewData' => $viewData]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,14 @@ class Cms extends Auth_Controller
|
|||||||
|
|
||||||
$content = current($content);
|
$content = current($content);
|
||||||
|
|
||||||
$this->load->view('CisVue/Cms/Content', ['content_id' => $content_id, 'template_kurzbz' => $content->template_kurzbz, 'version' => $version, 'sprache' => $sprache, 'sichtbar' => $sichtbar]);
|
$viewData = array(
|
||||||
|
'content_id' => $content_id,
|
||||||
|
'template_kurzbz' => $content->template_kurzbz,
|
||||||
|
'version' => $version,
|
||||||
|
'sichtbar' => $sichtbar
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'Content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,53 +82,20 @@ class Cms extends Auth_Controller
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function news($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true)
|
public function news($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true)
|
||||||
{
|
{
|
||||||
$this->load->view('CisVue/Cms/Content', ['infoscreen' => $infoscreen, 'studiengang_kz' => $studiengang_kz, 'semester' => $semester, 'mischen' => $mischen, 'titel' => $titel, 'edit' => $edit, 'sichtbar' => $sichtbar]);
|
$viewData = array();
|
||||||
|
$this->load->view('CisRouterView/CisRouterView.php', ['viewData'=>$viewData, 'route' => 'News']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNews($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true)
|
public function getRoomInformation($ort_kurzbz)
|
||||||
{
|
{
|
||||||
$get_page = intval($this->input->get('page', true));
|
// Load Config
|
||||||
$get_page_size = intval($this->input->get('page_size', true));
|
$this->load->config('calendar');
|
||||||
if ($get_page) {
|
|
||||||
$page = $get_page;
|
|
||||||
}
|
|
||||||
if ($get_page_size) {
|
|
||||||
$page_size = $get_page_size;
|
|
||||||
} else {
|
|
||||||
$page_size = $this->page_size;
|
|
||||||
}
|
|
||||||
$news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size);
|
|
||||||
|
|
||||||
if (isError($news)) {
|
$viewData = array(
|
||||||
$this->terminateWithJsonError(getError($news));
|
'ort_kurzbz' => $ort_kurzbz,
|
||||||
}
|
'timezone' => $this->config->item('timezone')
|
||||||
$news = hasData($news) ? getData($news) : null;
|
);
|
||||||
if ($news) {
|
$this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'CmsRoom']);
|
||||||
echo json_encode($news);
|
|
||||||
} else {
|
|
||||||
show_error("News: No data found");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNewsRowCount($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $fachbereich_kurzbz = null, $maxalter = 0, $edit = false, $sichtbar = true, $page = 1, $page_size = 10)
|
|
||||||
{
|
|
||||||
list($studiengang_kz, $semester) = $this->cmslib->getStgAndSem($studiengang_kz, $semester);
|
|
||||||
$all = $edit;
|
|
||||||
$num_rows = $this->NewsModel->countNewsWithContent(getSprache(), $studiengang_kz, $semester, $fachbereich_kurzbz, $sichtbar, $maxalter, $page, $this->page_size, $all, $mischen);
|
|
||||||
if (isError($num_rows)) {
|
|
||||||
$this->terminateWithJsonError(getError($num_rows));
|
|
||||||
}
|
|
||||||
$num_rows = hasData($num_rows) ? getData($num_rows) : null;
|
|
||||||
if ($num_rows) {
|
|
||||||
echo json_encode($num_rows);
|
|
||||||
} else {
|
|
||||||
show_error("News number rows: No data found");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRoomInformation($ort_kurzbz){
|
|
||||||
$this->load->view('CisVue/Cms/RoomInformation',['ort_kurzbz'=>$ort_kurzbz]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class Dashboard extends Auth_Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct(
|
|
||||||
array(
|
|
||||||
'index' => 'dashboard/benutzer:r'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
|
||||||
// Public methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->load->model('person/Person_model','PersonModel');
|
|
||||||
$begruesung = $this->PersonModel->getFirstName(getAuthUID());
|
|
||||||
if(isError($begruesung))
|
|
||||||
{
|
|
||||||
show_error("name couldn't be loaded for username ".getAuthUID());
|
|
||||||
}
|
|
||||||
$begruesung = getData($begruesung);
|
|
||||||
$viewData = array(
|
|
||||||
'name' => $begruesung
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->load->view('CisVue/Dashboard.php', ['viewData' => $viewData]);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,294 @@
|
|||||||
|
<?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 handles output and access to documents.
|
||||||
|
* It creates a XML file, transforms it with the XSL-FO Vorlage from the
|
||||||
|
* database and generates a PDF file with unoconv or docsbox.
|
||||||
|
* This file is then outputted as download.
|
||||||
|
*
|
||||||
|
* It is the CodeIgniter version of content/pdfExport.php when not using the
|
||||||
|
* get paremeters: "archivdokument" and "archive".
|
||||||
|
* Use exportSigned() instead of providing the "sign" get parameter and
|
||||||
|
* export() otherwise.
|
||||||
|
*/
|
||||||
|
class Documents extends Auth_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'export' => self::PERM_LOGGED,
|
||||||
|
'exportSigned' => self::PERM_LOGGED
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load Phrases
|
||||||
|
$this->loadPhrases([
|
||||||
|
'stv'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download a not signed document.
|
||||||
|
*
|
||||||
|
* @param string $xml
|
||||||
|
* @param string $xsl
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function export($xml, $xsl)
|
||||||
|
{
|
||||||
|
return $this->_export($xml, $xsl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download a signed document.
|
||||||
|
*
|
||||||
|
* @param string $xml
|
||||||
|
* @param string $xsl
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function exportSigned($xml, $xsl)
|
||||||
|
{
|
||||||
|
return $this->_export($xml, $xsl, getAuthUID());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for export() and exportSigned()
|
||||||
|
*
|
||||||
|
* @param string $xml
|
||||||
|
* @param string $xsl
|
||||||
|
* @param string $sign_user (optional)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function _export($xml, $xsl, $sign_user = null)
|
||||||
|
{
|
||||||
|
$xsl_oe_kurzbz = null;
|
||||||
|
$version = $this->input->post_get('version') ?: null;
|
||||||
|
|
||||||
|
// Get the OE or STG of the document
|
||||||
|
$xsl_oe_kurzbz = $this->input->post_get('xsl_oe_kurzbz')
|
||||||
|
?: $this->input->post_get('xsl_stg_kz')
|
||||||
|
?: $this->input->post_get('stg_kz');
|
||||||
|
if (is_null($xsl_oe_kurzbz)) {
|
||||||
|
$uid = $this->input->post_get('uid');
|
||||||
|
if ($uid) {
|
||||||
|
$uid = current(explode(';', $uid));
|
||||||
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
|
$result = $this->StudentModel->load([$uid]);
|
||||||
|
if (!isError($result) && hasData($result))
|
||||||
|
$xsl_oe_kurzbz = current(getData($result))->studiengang_kz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_null($xsl_oe_kurzbz)) {
|
||||||
|
$prestudent_id = $this->input->post_get('prestudent_id');
|
||||||
|
if ($prestudent_id) {
|
||||||
|
$prestudent_id = current(explode(';', $prestudent_id));
|
||||||
|
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||||
|
$result = $this->PrestudentModel->load($prestudent_id);
|
||||||
|
if (!isError($result) && hasData($result))
|
||||||
|
$xsl_oe_kurzbz = current(getData($result))->studiengang_kz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_null($xsl_oe_kurzbz))
|
||||||
|
$xsl_oe_kurzbz = 0;
|
||||||
|
|
||||||
|
// Access rights
|
||||||
|
if ($xsl == 'AccountInfo') {
|
||||||
|
$this->load->model('resource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||||
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
|
$uids = $this->input->post_get('uid');
|
||||||
|
if ($uids) {
|
||||||
|
$uids = explode(';', $uids);
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
$result = $this->MitarbeiterModel->load($uid);
|
||||||
|
if (!isError($result) && hasData($result)) {
|
||||||
|
if (!$this->permissionlib->isBerechtigt('admin', 'suid', 0)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('mitarbeiter', 'suid', 0))
|
||||||
|
return $this->_outputAuthError([$this->router->method => ['admin:rw', 'mitarbeiter:rw']]);
|
||||||
|
} else {
|
||||||
|
$result = $this->StudentModel->load([$uid]);
|
||||||
|
if (!isError($result) && hasData($result)) {
|
||||||
|
$student = current(getData($result));
|
||||||
|
if (!$this->permissionlib->isBerechtigt('admin', 'suid', $student->studiengang_kz)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('admin', 'suid', 0)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('assistenz', 'suid', $student->studiengang_kz)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('assistenz', 'suid', 0)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('support', 'suid', 0))
|
||||||
|
return $this->_outputAuthError([$this->router->method => ['admin:rw', 'assistenz:rw', 'support:rw']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->load->model('system/Vorlagestudiengang_model', 'VorlagestudiengangModel');
|
||||||
|
|
||||||
|
$result = $this->VorlagestudiengangModel->getCurrent($xsl, $xsl_oe_kurzbz, $version);
|
||||||
|
if (isError($result))
|
||||||
|
return show_error(getError($result));
|
||||||
|
if (!hasData($result))
|
||||||
|
return show_404();
|
||||||
|
|
||||||
|
$access_rights = current(getData($result))->berechtigung;
|
||||||
|
if (!$access_rights)
|
||||||
|
return show_404();
|
||||||
|
$allowed = false;
|
||||||
|
foreach ($access_rights as $access_right) {
|
||||||
|
if ($this->permissionlib->isBerechtigt($access_right)) {
|
||||||
|
$allowed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$allowed)
|
||||||
|
return $this->_outputAuthError([$this->router->method => $access_rights]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output format
|
||||||
|
$outputformat = $this->input->post_get('output') ?: 'pdf';
|
||||||
|
if ($outputformat != 'pdf'
|
||||||
|
// An der FHTW darf das Studienblatt und das Prüfungsprotokoll auch in anderen Formaten exportiert werden
|
||||||
|
&& !(CAMPUS_NAME == 'FH Technikum Wien'
|
||||||
|
&& ($xsl == 'Studienblatt'
|
||||||
|
|| $xsl == 'StudienblattEng'
|
||||||
|
|| $xsl == 'PrProtBA'
|
||||||
|
|| $xsl == 'PrProtBAEng'
|
||||||
|
|| $xsl == 'PrProtMA'
|
||||||
|
|| $xsl == 'PrProtMAEng'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('system/change_outputformat', null, $xsl_oe_kurzbz)
|
||||||
|
) {
|
||||||
|
$outputformat = 'pdf';
|
||||||
|
}
|
||||||
|
|
||||||
|
// XML Params
|
||||||
|
$params = 'xmlformat=xml';
|
||||||
|
foreach ([
|
||||||
|
'uid',
|
||||||
|
'stg_kz',
|
||||||
|
'person_id',
|
||||||
|
'id',
|
||||||
|
'prestudent_id',
|
||||||
|
'buchungsnummern',
|
||||||
|
'ss',
|
||||||
|
'abschlusspruefung_id',
|
||||||
|
'typ',
|
||||||
|
'all',
|
||||||
|
'preoutgoing_id',
|
||||||
|
'lvid',
|
||||||
|
'projekt_kurzbz',
|
||||||
|
'von',
|
||||||
|
'bis',
|
||||||
|
'stundevon',
|
||||||
|
'stundebis',
|
||||||
|
'sem',
|
||||||
|
'lehreinheit',
|
||||||
|
'mitarbeiter_uid',
|
||||||
|
'studienordnung_id',
|
||||||
|
'fixangestellt',
|
||||||
|
'standort',
|
||||||
|
'abrechnungsmonat',
|
||||||
|
'form',
|
||||||
|
'projektarbeit_id',
|
||||||
|
'betreuerart_kurzbz',
|
||||||
|
'studiensemester_kurzbz'
|
||||||
|
] as $key) {
|
||||||
|
$value = $this->input->post_get($key);
|
||||||
|
if ($value !== null)
|
||||||
|
$params .= '&' . $key . '=' . urlencode($value);
|
||||||
|
}
|
||||||
|
$value = $this->input->post_get('vertrag_id');
|
||||||
|
if ($value !== null) {
|
||||||
|
foreach ($value as $id)
|
||||||
|
$params .= '&vertrag_id[]=' . urlencode($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->load->library('DocumentExportLib');
|
||||||
|
$this->load->model('system/Vorlage_model', 'VorlageModel');
|
||||||
|
|
||||||
|
$result = $this->VorlageModel->load($xsl);
|
||||||
|
if (isError($result))
|
||||||
|
return show_error(getError($result));
|
||||||
|
if (!hasData($result))
|
||||||
|
show_404();
|
||||||
|
|
||||||
|
$vorlage = current(getData($result));
|
||||||
|
if ($sign_user && !$vorlage->signierbar)
|
||||||
|
return show_error($this->p->t("stv", "grades_error_sign"));
|
||||||
|
|
||||||
|
|
||||||
|
// Filename
|
||||||
|
$filename = ($vorlage->bezeichnung ?: $vorlage->vorlage_kurzbz);
|
||||||
|
switch ($xsl) {
|
||||||
|
case 'LV_Informationen':
|
||||||
|
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||||
|
$result = $this->StudiengangModel->load($this->input->post_get('stg_kz'));
|
||||||
|
if (!isError($result) && hasData($result))
|
||||||
|
$filename .= '_' . sanitizeProblemChars(current(getData($result))->kurzbzlang);
|
||||||
|
|
||||||
|
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||||
|
$result = $this->StudiensemesterModel->load($this->input->post_get('ss'));
|
||||||
|
if (!isError($result) && hasData($result))
|
||||||
|
$filename .= '_' . sanitizeProblemChars(current(getData($result))->studiensemester_kurzbz);
|
||||||
|
break;
|
||||||
|
case 'Honorarvertrag':
|
||||||
|
$uid = str_replace(';', '', $this->input->post_get('uid') ?: '');
|
||||||
|
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||||
|
$this->BenutzerModel->addJoin('public.tbl_person', 'person_id', 'LEFT');
|
||||||
|
$result = $this->BenutzerModel->load([$uid]);
|
||||||
|
if (!isError($result) && hasData($result)) {
|
||||||
|
$user = current(getData($result));
|
||||||
|
$filename .= '_' . sanitizeProblemChars($user->nachname) . '_' . sanitizeProblemChars($user->vorname);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Studienordnung':
|
||||||
|
$filename = 'Studienordnung-Studienplan-';
|
||||||
|
|
||||||
|
$this->load->model('organisation/Studienordnung_model', 'StudienordnungModel');
|
||||||
|
$result = $this->StudienordnungModel->load($this->input->post_get('studienordnung_id'));
|
||||||
|
if (!isError($result) && hasData($result)) {
|
||||||
|
$so = current(getData($result));
|
||||||
|
$filename .= sprintf("%'.04d", $so->studiengang_kz) . '-' . $so->studiengangkurzbzlang;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$uid = str_replace(';', '', $this->input->post_get('uid') ?: '');
|
||||||
|
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||||
|
$this->BenutzerModel->addJoin('public.tbl_person', 'person_id', 'LEFT');
|
||||||
|
$result = $this->BenutzerModel->load([$uid]);
|
||||||
|
if (!isError($result) && hasData($result)) {
|
||||||
|
$user = current(getData($result));
|
||||||
|
$filename .= '_' . sanitizeProblemChars($user->nachname);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XML Data
|
||||||
|
$result = $this->documentexportlib->getDataURL($xml, $params);
|
||||||
|
if (isError($result))
|
||||||
|
return show_error(getError($result));
|
||||||
|
|
||||||
|
$data = getData($result);
|
||||||
|
|
||||||
|
// Output
|
||||||
|
$this->documentexportlib->showContent($filename, $vorlage, $data, $xsl_oe_kurzbz, $version, $outputformat, $sign_user);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class LVVerwaltung extends Auth_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$permissions = [];
|
||||||
|
|
||||||
|
$router = load_class('Router');
|
||||||
|
$permissions[$router->method] = ['admin:r', 'assistenz:r'];
|
||||||
|
parent::__construct($permissions);
|
||||||
|
|
||||||
|
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function _remap()
|
||||||
|
{
|
||||||
|
$this->load->view('LVVerwaltung', [
|
||||||
|
'permissions' => [
|
||||||
|
'lehre/lehrveranstaltung' => $this->permissionlib->isBerechtigt('lehre/lehrveranstaltung'),
|
||||||
|
'lv-plan/gruppenentfernen' => $this->permissionlib->isBerechtigt('lv-plan/gruppenentfernen'),
|
||||||
|
'lv-plan/lektorentfernen' => $this->permissionlib->isBerechtigt('lv-plan/lektorentfernen'),
|
||||||
|
],
|
||||||
|
'variables' => [
|
||||||
|
'semester_aktuell' => $this->variablelib->getVar('semester_aktuell')
|
||||||
|
],
|
||||||
|
'configs' => [
|
||||||
|
'showVertragsdetails' => defined('FAS_LV_LEKTORINNENZUTEILUNG_VERTRAGSDETAILS_ANZEIGEN') && FAS_LV_LEKTORINNENZUTEILUNG_VERTRAGSDETAILS_ANZEIGEN,
|
||||||
|
'showGewichtung' => defined('CIS_GESAMTNOTE_GEWICHTUNG') && CIS_GESAMTNOTE_GEWICHTUNG,
|
||||||
|
'lehreinheitAnmerkungDefault' => defined('LEHREINHEIT_ANMERKUNG_DEFAULT') ? LEHREINHEIT_ANMERKUNG_DEFAULT : '',
|
||||||
|
'lehreinheitRaumtypDefault' => defined('DEFAULT_LEHREINHEIT_RAUMTYP') ? DEFAULT_LEHREINHEIT_RAUMTYP : '',
|
||||||
|
'lehreinheitRaumtypAlternativeDefault' => defined('DEFAULT_LEHREINHEIT_RAUMTYP_ALTERNATIV') ? DEFAULT_LEHREINHEIT_RAUMTYP_ALTERNATIV : ''
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class NeueNachricht extends Auth_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$permissions = [];
|
||||||
|
$router = load_class('Router');
|
||||||
|
$permissions[$router->method] = ['vertrag/mitarbeiter:r'];
|
||||||
|
parent::__construct($permissions);
|
||||||
|
|
||||||
|
// Load Libraries
|
||||||
|
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function _remap()
|
||||||
|
{
|
||||||
|
$typeid = $this->input->post('typeid');
|
||||||
|
$ids = ($this->input->post('ids') && strpos($this->input->post('ids'), ','))
|
||||||
|
? explode(',', $this->input->post('ids'))
|
||||||
|
: $this->input->post('ids');
|
||||||
|
|
||||||
|
//now working
|
||||||
|
$this->load->view('Nachrichten', [
|
||||||
|
'permissions' => [
|
||||||
|
'assistenz_schreibrechte' => $this->permissionlib->isBerechtigt('assistenz','suid'),
|
||||||
|
],
|
||||||
|
'ids' => $ids,
|
||||||
|
'typeid' => $typeid
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2026 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 redirects urls to another location. This is mainly used
|
||||||
|
* with the $routes config
|
||||||
|
*/
|
||||||
|
class Redirect extends CI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main function to handle all redirects.
|
||||||
|
*
|
||||||
|
* @param string $method - the redirect code (30x)
|
||||||
|
* @param array $params - the url to redirect to
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function _remap($method, $params)
|
||||||
|
{
|
||||||
|
redirect($params, 'location', $method);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,9 +28,14 @@ class Studentenverwaltung extends Auth_Controller
|
|||||||
'basis/prestudentstatus' => $this->permissionlib->isBerechtigt('basis/prestudentstatus'),
|
'basis/prestudentstatus' => $this->permissionlib->isBerechtigt('basis/prestudentstatus'),
|
||||||
'assistenz_stgs' => $this->permissionlib->getSTG_isEntitledFor('assistenz'),
|
'assistenz_stgs' => $this->permissionlib->getSTG_isEntitledFor('assistenz'),
|
||||||
'admin' => $this->permissionlib->isBerechtigt('admin'),
|
'admin' => $this->permissionlib->isBerechtigt('admin'),
|
||||||
'assistenz_schreibrechte' => $this->permissionlib->isBerechtigt('assistenz','suid'),
|
'assistenz_schreibrechte' => $this->permissionlib->isBerechtigt('assistenz', 'suid'),
|
||||||
'student/keine_studstatuspruefung' => $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung'),
|
'student/keine_studstatuspruefung' => $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung'),
|
||||||
'lehre/reihungstestAufsicht' => $this->permissionlib->isBerechtigt('lehre/reihungstestAufsicht')
|
'lehre/reihungstestAufsicht' => $this->permissionlib->isBerechtigt('lehre/reihungstestAufsicht'),
|
||||||
|
'system/change_outputformat' => $this->permissionlib->getOE_isEntitledFor('system/change_outputformat'),
|
||||||
|
'student/editBakkZgv' => $this->permissionlib->getSTG_isEntitledFor('student/editBakkZgv') ?: array(),
|
||||||
|
'student/editMakkZgv' => $this->permissionlib->getSTG_isEntitledFor('student/editMakkZgv') ?: array(),
|
||||||
|
'student/editDokZgv' => $this->permissionlib->getSTG_isEntitledFor('student/editDokZgv') ?: array(),
|
||||||
|
'student/editBismelden' => $this->permissionlib->isBerechtigt('student/editBismelden')
|
||||||
],
|
],
|
||||||
'variables' => [
|
'variables' => [
|
||||||
'semester_aktuell' => $this->variablelib->getVar('semester_aktuell')
|
'semester_aktuell' => $this->variablelib->getVar('semester_aktuell')
|
||||||
@@ -38,3 +43,5 @@ class Studentenverwaltung extends Auth_Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Vertragsverwaltung extends Auth_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$permissions = [];
|
||||||
|
$router = load_class('Router');
|
||||||
|
$permissions[$router->method] = ['vertrag/mitarbeiter:r'];
|
||||||
|
#$permissions[$router->method] = ['admin:rw'];
|
||||||
|
parent::__construct($permissions);
|
||||||
|
|
||||||
|
// Load Libraries
|
||||||
|
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function _remap()
|
||||||
|
{
|
||||||
|
$this->load->view('Vertragsverwaltung', [
|
||||||
|
'permissions' => [
|
||||||
|
'vertragsverwaltung_schreibrechte' => $this->permissionlib->isBerechtigt('vertrag/mitarbeiter', 'suid')
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,70 @@
|
|||||||
|
<?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');
|
||||||
|
|
||||||
|
class AuthInfo extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
protected $uid;
|
||||||
|
protected $pid;
|
||||||
|
protected $isMitarbeiter;
|
||||||
|
protected $isStudent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object initialization
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getAuthUID' => self::PERM_LOGGED,
|
||||||
|
'getAuthInfo' => self::PERM_LOGGED,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
|
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||||
|
|
||||||
|
$this->uid = getAuthUID();
|
||||||
|
$this->pid = getAuthPersonID();
|
||||||
|
$this->isMitarbeiter = getData($this->MitarbeiterModel->isMitarbeiter($this->uid)) ?? false;
|
||||||
|
$this->isStudent = getData($this->StudentModel->isStudent($this->uid)) ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the uid of the currently logged in user
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function getAuthUID()
|
||||||
|
{
|
||||||
|
$this->terminateWithSuccess(['uid'=>$this->uid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAuthInfo()
|
||||||
|
{
|
||||||
|
$data = (object) array(
|
||||||
|
'uid' => $this->uid,
|
||||||
|
'isMitarbeiter' => $this->isMitarbeiter,
|
||||||
|
'isStudent' => $this->isStudent
|
||||||
|
);
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
|
||||||
class Bookmark extends FHCAPI_Controller
|
class Bookmark extends FHCAPI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -28,82 +30,162 @@ class Bookmark extends FHCAPI_Controller
|
|||||||
{
|
{
|
||||||
parent::__construct([
|
parent::__construct([
|
||||||
'getBookmarks' => self::PERM_LOGGED,
|
'getBookmarks' => self::PERM_LOGGED,
|
||||||
'delete' => self::PERM_LOGGED,
|
'delete' => self::PERM_LOGGED,
|
||||||
'insert' => self::PERM_LOGGED,
|
'insert' => self::PERM_LOGGED,
|
||||||
]);
|
'update' => self::PERM_LOGGED,
|
||||||
|
'changeOrder' => self::PERM_LOGGED
|
||||||
|
]);
|
||||||
|
|
||||||
$this->load->model('dashboard/Bookmark_model', 'BookmarkModel');
|
$this->load->model('dashboard/Bookmark_model', 'BookmarkModel');
|
||||||
|
|
||||||
$this->uid = getAuthUID();
|
$this->uid = getAuthUID();
|
||||||
$this->pid = getAuthPersonID();
|
$this->pid = getAuthPersonID();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
// Public methods
|
// Public methods
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the bookmarks associated to a user
|
* gets the bookmarks associated to a user
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function getBookmarks()
|
public function getBookmarks()
|
||||||
{
|
{
|
||||||
$bookmarks = $this->BookmarkModel->loadWhere(["uid"=>$this->uid]);
|
$this->BookmarkModel->addOrder("sort");
|
||||||
|
$bookmarks = $this->BookmarkModel->loadWhere(["uid"=>$this->uid]);
|
||||||
|
|
||||||
$bookmarks = $this->getDataOrTerminateWithError($bookmarks);
|
$bookmarks = $this->getDataOrTerminateWithError($bookmarks);
|
||||||
|
|
||||||
$this->terminateWithSuccess($bookmarks);
|
$this->terminateWithSuccess($bookmarks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* deletes bookmark from associated user
|
* deletes bookmark from associated user
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete($bookmark_id)
|
public function delete($bookmark_id)
|
||||||
{
|
{
|
||||||
$bookmark = $this->BookmarkModel->load($bookmark_id);
|
$bookmark = $this->BookmarkModel->load($bookmark_id);
|
||||||
|
|
||||||
$bookmark = current($this->getDataOrTerminateWithError($bookmark));
|
$bookmark = current($this->getDataOrTerminateWithError($bookmark));
|
||||||
|
|
||||||
// only delete bookmark if the user is the owner of the bookmark
|
// only delete bookmark if the user is the owner of the bookmark
|
||||||
if($bookmark->uid == $this->uid || $this->permissionlib->isBerechtigt('admin')){
|
if ($bookmark->uid == $this->uid || $this->permissionlib->isBerechtigt('admin')) {
|
||||||
|
$delete_result = $this->BookmarkModel->delete($bookmark_id);
|
||||||
|
|
||||||
$delete_result = $this->BookmarkModel->delete($bookmark_id);
|
$delete_result = $this->getDataOrTerminateWithError($delete_result);
|
||||||
|
|
||||||
$delete_result = $this->getDataOrTerminateWithError($delete_result);
|
$this->terminateWithSuccess($delete_result);
|
||||||
|
} else {
|
||||||
|
$this->_outputAuthError(['delete' => ['admin:rw']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->terminateWithSuccess($delete_result);
|
/**
|
||||||
}else{
|
* inserts new bookmark into the bookmark table
|
||||||
$this->_outputAuthError(['delete' => ['admin:rw']]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* inserts new bookmark into the bookmark table
|
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function insert()
|
public function insert()
|
||||||
{
|
{
|
||||||
// form validation
|
// form validation
|
||||||
$this->load->library('form_validation');
|
$this->load->library('form_validation');
|
||||||
$this->form_validation->set_rules('url', 'URL', 'required|valid_url|max_length[511]');
|
$this->form_validation->set_rules('url', 'URL', 'required|valid_url|max_length[511]');
|
||||||
$this->form_validation->set_rules('title', 'Title', 'required|max_length[255]');
|
$this->form_validation->set_rules('title', 'Title', 'required|max_length[255]');
|
||||||
if($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
$url = $this->input->post('url',true);
|
$url = $this->input->post('url', true);
|
||||||
$title = $this->input->post('title',true);
|
$title = $this->input->post('title', true);
|
||||||
$tag = $this->input->post('tag', true);
|
$tag = $this->input->post('tag', true);
|
||||||
|
if (is_array($tag)) {
|
||||||
|
$tag = json_encode($tag); // convert PHP array to JSON string
|
||||||
|
}
|
||||||
|
$sort = $this->input->post('sort', true);
|
||||||
|
|
||||||
$insert_into_result = $this->BookmarkModel->insert(['uid'=>$this->uid, 'url'=>$url, 'title'=>$title,'tag'=>$tag, 'insertvon'=>$this->uid, 'updateamum'=>NULL, 'updatevon'=>NULL]);
|
$insert_into_result = $this->BookmarkModel->insert([
|
||||||
|
'uid' => $this->uid,
|
||||||
|
'url' => $url,
|
||||||
|
'title' => $title,
|
||||||
|
'tag' => $tag,
|
||||||
|
'insertvon' => $this->uid,
|
||||||
|
'updateamum' => null,
|
||||||
|
'updatevon' => null,
|
||||||
|
'sort' => $sort
|
||||||
|
]);
|
||||||
|
|
||||||
$insert_into_result = $this->getDataOrTerminateWithError($insert_into_result);
|
$insert_into_result = $this->getDataOrTerminateWithError($insert_into_result);
|
||||||
|
|
||||||
$this->terminateWithSuccess($insert_into_result);
|
$this->terminateWithSuccess($insert_into_result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* updates bookmark in the bookmark table
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function update($bookmark_id)
|
||||||
|
{
|
||||||
|
// form validation
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
$this->form_validation->set_rules('url', 'URL', 'required|valid_url|max_length[511]');
|
||||||
|
$this->form_validation->set_rules('title', 'Title', 'required|max_length[255]');
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
$url = $this->input->post('url', true);
|
||||||
|
$title = $this->input->post('title', true);
|
||||||
|
$tag = $this->input->post('tag', true);
|
||||||
|
if (is_array($tag)) {
|
||||||
|
$tag = json_encode($tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
$now = new DateTime();
|
||||||
|
$now = $now->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
$update_result = $this->BookmarkModel->update($bookmark_id, [
|
||||||
|
'url' => $url,
|
||||||
|
'title' => $title,
|
||||||
|
'tag' => $tag,
|
||||||
|
'updateamum' => $now
|
||||||
|
]);
|
||||||
|
|
||||||
|
$update_result = $this->getDataOrTerminateWithError($update_result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($update_result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* changes sort of two bookmarks in the bookmark table
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function changeOrder($bookmark_id1, $bookmark_id2)
|
||||||
|
{
|
||||||
|
$update_result = [];
|
||||||
|
|
||||||
|
$result1 = $this->BookmarkModel->load($bookmark_id1);
|
||||||
|
$data1 = $this->getDataOrTerminateWithError($result1);
|
||||||
|
$sort1 = current($data1)->sort;
|
||||||
|
|
||||||
|
$result2 = $this->BookmarkModel->load(["bookmark_id"=>$bookmark_id2]);
|
||||||
|
$data2 = $this->getDataOrTerminateWithError($result2);
|
||||||
|
$sort2 = current($data2)->sort;
|
||||||
|
|
||||||
|
$update_result1 = $this->BookmarkModel->update($bookmark_id1, [
|
||||||
|
'sort' => $sort2
|
||||||
|
]);
|
||||||
|
$update_result[] = $this->getDataOrTerminateWithError($update_result1);
|
||||||
|
|
||||||
|
$update_result2 = $this->BookmarkModel->update($bookmark_id2, [
|
||||||
|
'sort' => $sort1
|
||||||
|
]);
|
||||||
|
$update_result[] = $this->getDataOrTerminateWithError($update_result2);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($update_result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?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');
|
||||||
|
|
||||||
|
class Cis4FhcApi extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object initialization
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'dashboardViewData' => self::PERM_LOGGED,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* retrieves view data for dashboard view
|
||||||
|
* @access public
|
||||||
|
* @param $uid the userID for which profile is being viewed, null or missing value implies one's own profile
|
||||||
|
*/
|
||||||
|
public function dashboardViewData()
|
||||||
|
{
|
||||||
|
$this->load->model('person/Person_model','PersonModel');
|
||||||
|
$personData = getData($this->PersonModel->getByUid(getAuthUID()))[0];
|
||||||
|
|
||||||
|
$this->load->config('calendar');
|
||||||
|
|
||||||
|
$viewData = array(
|
||||||
|
'uid' => getAuthUID(),
|
||||||
|
'name' => $personData->vorname,
|
||||||
|
'person_id' => $personData->person_id,
|
||||||
|
'timezone' => $this->config->item('timezone'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($viewData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
<?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');
|
||||||
|
|
||||||
|
|
||||||
|
class CisMenu extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object initialization
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getMenu' => self::PERM_LOGGED,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetches the menu for CIS from the database based on the userLanguage
|
||||||
|
*/
|
||||||
|
public function getMenu()
|
||||||
|
{
|
||||||
|
$this->load->model('content/Content_model', 'ContentModel');
|
||||||
|
$this->load->config('cis');
|
||||||
|
$cis4_content_id = $this->config->item('cis_menu_root_content_id');
|
||||||
|
$result = $this->ContentModel->getMenu($cis4_content_id, getAuthUID(), getUserLanguage());
|
||||||
|
$result = $this->getDataOrTerminateWithError($result);
|
||||||
|
$menu = $result->childs ?? [];
|
||||||
|
|
||||||
|
$menu = $this->generateUrlsForMenuItems($menu);
|
||||||
|
$this->terminateWithSuccess($menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateUrlsForMenuItems($menuItems)
|
||||||
|
{
|
||||||
|
return array_map(
|
||||||
|
function ($menuItem) {
|
||||||
|
return $this->generateUrlForMenuItem($menuItem);
|
||||||
|
},
|
||||||
|
$menuItems
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateUrlForMenuItem($menuItem)
|
||||||
|
{
|
||||||
|
$menuItem->url = $this->menuItemUrlHelper($menuItem);
|
||||||
|
unset($menuItem->content);
|
||||||
|
|
||||||
|
if ($menuItem->childs && count($menuItem->childs)) {
|
||||||
|
$menuItem->childs = $this->generateUrlsForMenuItems($menuItem->childs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $menuItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function menuItemUrlHelper($menuItem)
|
||||||
|
{
|
||||||
|
if ($menuItem->template_kurzbz !== 'redirect') {
|
||||||
|
return site_url("/CisVue/Cms/content/" . $menuItem->content_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$menuItem->content || !mb_strlen($menuItem->content)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$doc = new DOMDocument();
|
||||||
|
$doc->loadXML($menuItem->content);
|
||||||
|
$urlElem = $doc->getElementsByTagName('url')->item(0);
|
||||||
|
|
||||||
|
$this->menuItemUrlTargetHelper($menuItem, $doc);
|
||||||
|
|
||||||
|
if (!$urlElem) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = $urlElem->textContent;
|
||||||
|
|
||||||
|
if (strpos($url, '../cms/news.php') !== false) {
|
||||||
|
$newsRegex = '/^\.\.\/cms\/news\.php/';
|
||||||
|
$url = preg_replace($newsRegex, site_url("/CisVue/Cms/news"), $url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($url, '../cms/content.php?') !== false) {
|
||||||
|
$contentRegex = '/^\.\.\/cms\/content\.php\?content_id=([0-9]+)/';
|
||||||
|
$matches = [];
|
||||||
|
preg_match($contentRegex, $url, $matches);
|
||||||
|
$url = site_url('/CisVue/Cms/content/' . $matches[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($url, '../index.ci.php') !== false) {
|
||||||
|
$indexRegex = '/^\.\.\/index\.ci\.php/';
|
||||||
|
$url = preg_replace($indexRegex, site_url(), $url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($url, '../') !== false) {
|
||||||
|
$relativeRegex = '/^\.\.\//';
|
||||||
|
$url = preg_replace($relativeRegex, base_url(), $url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function menuItemUrlTargetHelper($menuItem, $xmldoc)
|
||||||
|
{
|
||||||
|
if($menuItem->template_kurzbz === 'redirect')
|
||||||
|
{
|
||||||
|
$targetElem = $xmldoc->getElementsByTagName('target')->item(0);
|
||||||
|
$target = ($targetElem) ? $targetElem->textContent : '';
|
||||||
|
if(!in_array($target, array('_self', '_top', '_blank')))
|
||||||
|
{
|
||||||
|
$target = '_self';
|
||||||
|
}
|
||||||
|
$menuItem->target = $target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -106,7 +106,6 @@ class Cms extends FHCAPI_Controller
|
|||||||
$this->terminateWithSuccess($content_id);
|
$this->terminateWithSuccess($content_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo: there is the method news and getNews but only one should exist
|
|
||||||
public function news()
|
public function news()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -125,25 +124,35 @@ class Cms extends FHCAPI_Controller
|
|||||||
|
|
||||||
//get the data or terminate with error
|
//get the data or terminate with error
|
||||||
$news = $this->getDataOrTerminateWithError($news);
|
$news = $this->getDataOrTerminateWithError($news);
|
||||||
|
// array that keeps track of which news don't have a betreff and have to be removed from the news array
|
||||||
|
$newsToRemove = array();
|
||||||
// collect the content of the news
|
// collect the content of the news
|
||||||
foreach($news as $news_element){
|
foreach($news as $index=>$news_element){
|
||||||
$this->addMeta("content_id",$news_element->content_id);
|
|
||||||
|
|
||||||
//todo: quick fix, for query builder error when fetching content
|
|
||||||
$this->NewsModel->resetQuery();
|
$this->NewsModel->resetQuery();
|
||||||
$content = $this->cmslib->getContent($news_element->content_id);
|
$content = $this->cmslib->getContent($news_element->content_id);
|
||||||
|
if(isError($content))
|
||||||
$content = getData($content);
|
{
|
||||||
|
// removes the news from the news array, so that the response does not include a invalid news
|
||||||
$news_element->content_obj = $content;
|
array_push($newsToRemove,$index);
|
||||||
|
//add the error to the api response? visual feedback
|
||||||
|
//$this->addError(print_r($content->retval,true));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$content = getData($content);
|
||||||
|
$news_element->content_obj = $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//removes all news that don't have a betreff
|
||||||
|
foreach($newsToRemove as $removeNewsIndex)
|
||||||
|
{
|
||||||
|
unset($news[$removeNewsIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
$withContent = function($news) {
|
$withContent = function($news) {
|
||||||
return $news->content_obj != null;
|
return $news->content_obj != null;
|
||||||
};
|
};
|
||||||
|
|
||||||
$newsWithContent = array_filter($news, $withContent);
|
$newsWithContent = array_filter($news, $withContent);
|
||||||
|
|
||||||
$this->terminateWithSuccess($newsWithContent);
|
$this->terminateWithSuccess($newsWithContent);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -176,15 +185,18 @@ class Cms extends FHCAPI_Controller
|
|||||||
// getting the GET parameters
|
// getting the GET parameters
|
||||||
$page = intval($this->input->get('page', true));
|
$page = intval($this->input->get('page', true));
|
||||||
$page_size = intval($this->input->get('page_size', true));
|
$page_size = intval($this->input->get('page_size', true));
|
||||||
|
$sprache = $this->input->get('sprache', true);
|
||||||
|
if(!$sprache)
|
||||||
|
{
|
||||||
|
$sprache = getUserLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
// default value for the page_size is 10
|
// default value for the page_size is 10
|
||||||
$page_size = $page_size ?? 10;
|
$page_size = $page_size ?? 10;
|
||||||
|
|
||||||
$news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size);
|
$news = $this->cmslib->getNews($infoscreen, $studiengang_kz, $semester, $mischen, $titel, $edit, $sichtbar, $page, $page_size, $sprache);
|
||||||
|
|
||||||
$news = $this->getDataOrTerminateWithError($news);
|
$news = $this->getDataOrTerminateWithError($news);
|
||||||
|
|
||||||
$this->addMeta('test', $this->p->t('global', 'studiengangsleitung'));
|
|
||||||
$this->addMeta('phrases', json_decode($this->p->getJson()));
|
$this->addMeta('phrases', json_decode($this->p->getJson()));
|
||||||
$this->terminateWithSuccess($news);
|
$this->terminateWithSuccess($news);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,496 @@
|
|||||||
|
<?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 documents
|
||||||
|
* Listens to ajax post calls to change the documents data
|
||||||
|
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||||
|
*
|
||||||
|
* This controller handles output and access to documents.
|
||||||
|
* It checks permissions to render documents in an alternative format
|
||||||
|
* or it creates a XML file, transforms it with the XSL-FO Vorlage from the
|
||||||
|
* database and generates a PDF file with unoconv or docsbox.
|
||||||
|
* This file is then archivated in the database.
|
||||||
|
*
|
||||||
|
* The last part is the CodeIgniter version of content/pdfExport.php when not
|
||||||
|
* using the get paremeter: "archivdokument" but using the get parameter:
|
||||||
|
* "archive".
|
||||||
|
* Use archiveSigned() instead of providing the "sign" get parameter and
|
||||||
|
* archive() otherwise.
|
||||||
|
*/
|
||||||
|
class Documents extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'permissionAlternativeFormat' => self::PERM_LOGGED,
|
||||||
|
'archive' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'archiveSigned' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'download' => ['admin:rw', 'assistenz:rw']
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load Phrases
|
||||||
|
$this->loadPhrases([
|
||||||
|
'stv'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the current user has permission to render documents in an
|
||||||
|
* alternative format.
|
||||||
|
*
|
||||||
|
* @param string $oe_kurzbz Or studiengang_kz
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function permissionAlternativeFormat($oe_kurzbz)
|
||||||
|
{
|
||||||
|
$this->terminateWithSuccess($this->permissionlib->isBerechtigt('system/change_outputformat', null, $oe_kurzbz));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Archive a not signed document.
|
||||||
|
*
|
||||||
|
* @param string $xml (optional)
|
||||||
|
* @param string $xsl (optional)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function archive($xml = null, $xsl = null)
|
||||||
|
{
|
||||||
|
return $this->_archive($xml, $xsl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Archive a signed document.
|
||||||
|
*
|
||||||
|
* @param string $xml (optional)
|
||||||
|
* @param string $xsl (optional)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function archiveSigned($xml = null, $xsl = null)
|
||||||
|
{
|
||||||
|
return $this->_archive($xml, $xsl, getAuthUID());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function download($xml, $xsl, $sign_user = null)
|
||||||
|
{
|
||||||
|
$akteExportData = $this->_getAkteExportData($xml, $xsl, $sign_user);
|
||||||
|
|
||||||
|
$akteData = $akteData['akteData'];
|
||||||
|
$exportData = $akteData['exportData'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [
|
||||||
|
'vorlage' => $vorlage,
|
||||||
|
'xml_data' => $data,
|
||||||
|
'oe_kurzbz' => $xsl_oe_kurzbz,
|
||||||
|
'version' => $version,
|
||||||
|
'outputformat' => $outputformat,
|
||||||
|
'sign_user' => $sign_user
|
||||||
|
]
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Output
|
||||||
|
$result = $this->documentexportlib->showContent(
|
||||||
|
$akteData['akteData']['inhalt'],
|
||||||
|
$exportData['vorlage'],
|
||||||
|
$exportData['xml_data'],
|
||||||
|
$exportData['oe_kurzbz'],
|
||||||
|
$exportData['version'],
|
||||||
|
$exportData['outputformat'],
|
||||||
|
$exportData['sign_user']
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for archive() and archiveSigned()
|
||||||
|
*
|
||||||
|
* @param string $xml
|
||||||
|
* @param string $xsl
|
||||||
|
* @param string $sign_user (optional)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function _archive($xml, $xsl, $sign_user = null)
|
||||||
|
{
|
||||||
|
$akteData = $this->_getAkteExportData($xml, $xsl, $sign_user);
|
||||||
|
|
||||||
|
$this->load->model('crm/Akte_model', 'AkteModel');
|
||||||
|
$result = $this->AkteModel->insert($akteData['akteData']);
|
||||||
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $xml
|
||||||
|
* @param string $xsl
|
||||||
|
* @param string $sign_user (optional)
|
||||||
|
*
|
||||||
|
* @return array with Akte data and export data
|
||||||
|
*/
|
||||||
|
private function _getAkteExportData($xml, $xsl, $sign_user = null)
|
||||||
|
{
|
||||||
|
if (!$xml || !$xsl) {
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
if (!$xml) {
|
||||||
|
$xml = $this->input->post_get('xml');
|
||||||
|
$this->addMeta('xml', $xml);
|
||||||
|
$this->form_validation->set_rules('xml', 'xml', 'required');
|
||||||
|
}
|
||||||
|
if (!$xsl) {
|
||||||
|
$xsl = $this->input->post_get('xsl');
|
||||||
|
$this->addMeta('xsl', $xsl);
|
||||||
|
$this->form_validation->set_rules('xsl', 'xsl', 'required');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
}
|
||||||
|
|
||||||
|
$xsl_oe_kurzbz = null;
|
||||||
|
$version = $this->input->post_get('version') ?: null;
|
||||||
|
|
||||||
|
// Get the OE or STG of the document
|
||||||
|
$xsl_oe_kurzbz = $this->input->post_get('xsl_oe_kurzbz')
|
||||||
|
?: $this->input->post_get('xsl_stg_kz')
|
||||||
|
?: $this->input->post_get('stg_kz');
|
||||||
|
if (is_null($xsl_oe_kurzbz)) {
|
||||||
|
$uid = $this->input->post_get('uid');
|
||||||
|
if ($uid) {
|
||||||
|
$uid = current(explode(';', $uid));
|
||||||
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
|
$result = $this->StudentModel->load([$uid]);
|
||||||
|
if (!isError($result) && hasData($result))
|
||||||
|
$xsl_oe_kurzbz = current(getData($result))->studiengang_kz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_null($xsl_oe_kurzbz)) {
|
||||||
|
$prestudent_id = $this->input->post_get('prestudent_id');
|
||||||
|
if ($prestudent_id) {
|
||||||
|
$prestudent_id = current(explode(';', $prestudent_id));
|
||||||
|
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||||
|
$result = $this->PrestudentModel->load($prestudent_id);
|
||||||
|
if (!isError($result) && hasData($result))
|
||||||
|
$xsl_oe_kurzbz = current(getData($result))->studiengang_kz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_null($xsl_oe_kurzbz))
|
||||||
|
$xsl_oe_kurzbz = 0;
|
||||||
|
|
||||||
|
// Vorlage
|
||||||
|
$this->load->model('system/Vorlage_model', 'VorlageModel');
|
||||||
|
|
||||||
|
$result = $this->VorlageModel->load($xsl);
|
||||||
|
$vorlage = current($this->getDataOrTerminateWithError($result));
|
||||||
|
if (!$vorlage)
|
||||||
|
show_404();
|
||||||
|
|
||||||
|
// Akte Data
|
||||||
|
$akteData = [
|
||||||
|
'dokument_kurzbz' => $vorlage->dokument_kurzbz ?: 'Zeugnis',
|
||||||
|
'mimetype' => 'application/pdf',
|
||||||
|
'erstelltam' => date('Y-m-d'),
|
||||||
|
'gedruckt' => true,
|
||||||
|
'insertamum' => date('c'),
|
||||||
|
'insertvon' => getAuthUID(),
|
||||||
|
'uid' => $this->input->post_get('uid') ?: null,
|
||||||
|
'archiv' => true,
|
||||||
|
'signiert' => !!$sign_user,
|
||||||
|
'stud_selfservice' => $vorlage->stud_selfservice
|
||||||
|
];
|
||||||
|
$studiengang_kz = null;
|
||||||
|
if ($akteData['uid']) {
|
||||||
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
|
$this->StudentModel->addSelect('tbl_student.*, UPPER(typ || kurzbz) AS kuerzel');
|
||||||
|
$this->StudentModel->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT');
|
||||||
|
$result = $this->StudentModel->load([$akteData['uid']]);
|
||||||
|
$student = current($this->getDataOrTerminateWithError($result));
|
||||||
|
|
||||||
|
$ss = $this->input->post_get('ss');
|
||||||
|
|
||||||
|
if ($ss !== null) {
|
||||||
|
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
|
||||||
|
$result = $this->PrestudentstatusModel->getLastStatus($student->prestudent_id, $ss);
|
||||||
|
$status = current($this->getDataOrTerminateWithError($result));
|
||||||
|
if (!$status)
|
||||||
|
$this->terminateWithError($this->p->t("stv", "grades_error_prestudentstatus"));
|
||||||
|
$semester = $status->ausbildungssemester;
|
||||||
|
|
||||||
|
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
|
||||||
|
$this->StudentlehrverbandModel->addJoin('public.tbl_benutzer', 'uid = student_uid');
|
||||||
|
$this->StudentlehrverbandModel->addJoin('public.tbl_studiengang', 'studiengang_kz');
|
||||||
|
$result = $this->StudentlehrverbandModel->load([
|
||||||
|
'studiensemester_kurzbz' => $ss,
|
||||||
|
'student_uid' => $akteData['uid']
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!hasData($result)) $this->terminateWithError($this->p->t("stv", "error_noLehrverbandAssigned"));
|
||||||
|
|
||||||
|
$res = current($this->getDataOrTerminateWithError($result));
|
||||||
|
|
||||||
|
$studiengang_kz = $res->studiengang_kz;
|
||||||
|
$akteData['person_id'] = $res->person_id;
|
||||||
|
switch ($xsl) {
|
||||||
|
case 'Ausbildungsver':
|
||||||
|
case 'AusbVerEng':
|
||||||
|
$akteData['titel'] = mb_substr($xsl .
|
||||||
|
"_" .
|
||||||
|
strtoupper($res->typ) .
|
||||||
|
strtoupper($res->kurzbz) .
|
||||||
|
"_" .
|
||||||
|
$semester .
|
||||||
|
"_" .
|
||||||
|
$ss, 0, 64);
|
||||||
|
$akteData['bezeichnung'] = mb_substr($vorlage->bezeichnung . " " . $student->kuerzel, 0, 64);
|
||||||
|
break;
|
||||||
|
case 'LVZeugnisEng':
|
||||||
|
case 'LVZeugnis':
|
||||||
|
case 'Zertifikat':
|
||||||
|
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
$result = $this->LehrveranstaltungModel->load($this->input->post_get('lvid'));
|
||||||
|
$lv = current($this->getDataOrTerminateWithError($result));
|
||||||
|
$akteData['dokument_kurzbz'] = $xsl;
|
||||||
|
$akteData['titel'] = mb_substr($xsl .
|
||||||
|
"_" .
|
||||||
|
strtoupper($res->typ) .
|
||||||
|
strtoupper($res->kurzbz) .
|
||||||
|
"_" .
|
||||||
|
$semester .
|
||||||
|
'_' .
|
||||||
|
$ss .
|
||||||
|
'_' .
|
||||||
|
str_replace(' ', '_', $lv->bezeichnung), 0, 60);
|
||||||
|
$akteData['bezeichnung'] = mb_substr($xsl .
|
||||||
|
" " .
|
||||||
|
strtoupper($res->typ) .
|
||||||
|
strtoupper($res->kurzbz) .
|
||||||
|
" " .
|
||||||
|
$semester .
|
||||||
|
". Semester" .
|
||||||
|
' ' .
|
||||||
|
$ss .
|
||||||
|
' ' .
|
||||||
|
$lv->bezeichnung, 0, 64);
|
||||||
|
break;
|
||||||
|
case 'SZeugnis':
|
||||||
|
$akteData['titel'] = mb_substr($vorlage->bezeichnung . " " . $student->kuerzel, 0, 64);
|
||||||
|
$akteData['bezeichnung'] = mb_substr($vorlage->bezeichnung . " " . $student->kuerzel, 0, 64);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$akteData['titel'] = mb_substr($xsl .
|
||||||
|
"_" .
|
||||||
|
strtoupper($res->typ) .
|
||||||
|
strtoupper($res->kurzbz) .
|
||||||
|
"_" .
|
||||||
|
$semester .
|
||||||
|
"_" .
|
||||||
|
$ss, 0, 64);
|
||||||
|
$akteData['bezeichnung'] = mb_substr($xsl .
|
||||||
|
" " .
|
||||||
|
strtoupper($res->typ) .
|
||||||
|
strtoupper($res->kurzbz) .
|
||||||
|
" " .
|
||||||
|
$semester .
|
||||||
|
". Semester" .
|
||||||
|
' ' .
|
||||||
|
$ss, 0, 64);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$studiengang_kz = $student->studiengang_kz;
|
||||||
|
$akteData['person_id'] = $student->person_id;
|
||||||
|
$akteData['titel'] = $vorlage->bezeichnung . '_' . $student->kuerzel;
|
||||||
|
$akteData['bezeichnung'] = mb_substr($vorlage->bezeichnung . " " . $student->kuerzel, 0, 64);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$prestudent_id = $this->input->post_get('prestudent_id');
|
||||||
|
if ($prestudent_id) {
|
||||||
|
$this->load->model('crm/prestudent_model', 'PrestudentModel');
|
||||||
|
$this->PrestudentModel->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT');
|
||||||
|
$this->PrestudentModel->addSelect('tbl_prestudent.*, UPPER(typ || kurzbz) AS kuerzel');
|
||||||
|
$result = $this->PrestudentModel->load($prestudent_id);
|
||||||
|
$prestudent = current($this->getDataOrTerminateWithError($result));
|
||||||
|
|
||||||
|
$studiengang_kz = $prestudent->studiengang_kz;
|
||||||
|
$akteData['person_id'] = $prestudent->person_id;
|
||||||
|
$akteData['titel'] = mb_substr($xsl . "_" . $prestudent->kuerzel, 0, 64);
|
||||||
|
$akteData['bezeichnung'] = mb_substr($vorlage->bezeichnung . " " . $prestudent->kuerzel, 0, 64);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Access rights
|
||||||
|
if (!$this->permissionlib->isBerechtigt('admin', 'suid', $studiengang_kz)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('assistenz', 'suid', $studiengang_kz))
|
||||||
|
return $this->_outputAuthError([$this->router->method => ['admin:rw', 'assistenz:rw']]);
|
||||||
|
if ($xsl == 'AccountInfo') {
|
||||||
|
$this->load->model('resource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||||
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
|
$uids = $this->input->post_get('uid');
|
||||||
|
if ($uids) {
|
||||||
|
$uids = explode(';', $uids);
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
$result = $this->MitarbeiterModel->load($uid);
|
||||||
|
if (!isError($result) && hasData($result)) {
|
||||||
|
if (!$this->permissionlib->isBerechtigt('admin', 'suid', 0)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('mitarbeiter', 'suid', 0))
|
||||||
|
return $this->_outputAuthError([$this->router->method => ['admin:rw', 'mitarbeiter:rw']]);
|
||||||
|
} else {
|
||||||
|
$result = $this->StudentModel->load([$uid]);
|
||||||
|
if (!isError($result) && hasData($result)) {
|
||||||
|
$student = current(getData($result));
|
||||||
|
if (!$this->permissionlib->isBerechtigt('admin', 'suid', $student->studiengang_kz)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('admin', 'suid', 0)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('assistenz', 'suid', $student->studiengang_kz)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('assistenz', 'suid', 0)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('support', 'suid', 0))
|
||||||
|
return $this->_outputAuthError([$this->router->method => ['admin:rw', 'assistenz:rw', 'support:rw']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->load->model('system/Vorlagestudiengang_model', 'VorlagestudiengangModel');
|
||||||
|
|
||||||
|
$result = $this->VorlagestudiengangModel->getCurrent($xsl, $xsl_oe_kurzbz, $version);
|
||||||
|
$access_rights = current($this->getDataOrTerminateWithError($result));
|
||||||
|
// TODO: was bedeutet wenn keine berechtigung?
|
||||||
|
if (!$access_rights || !$access_rights->berechtigung)
|
||||||
|
return show_404();
|
||||||
|
|
||||||
|
$allowed = false;
|
||||||
|
foreach ($access_rights->berechtigung as $access_right) {
|
||||||
|
if ($this->permissionlib->isBerechtigt($access_right)) {
|
||||||
|
$allowed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$allowed)
|
||||||
|
return $this->_outputAuthError([$this->router->method => $access_rights]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output format
|
||||||
|
$outputformat = $this->input->post_get('output') ?: 'pdf';
|
||||||
|
if ($outputformat != 'pdf'
|
||||||
|
// An der FHTW darf das Studienblatt und das Prüfungsprotokoll auch in anderen Formaten exportiert werden
|
||||||
|
&& !(CAMPUS_NAME == 'FH Technikum Wien'
|
||||||
|
&& ($xsl == 'Studienblatt'
|
||||||
|
|| $xsl == 'StudienblattEng'
|
||||||
|
|| $xsl == 'PrProtBA'
|
||||||
|
|| $xsl == 'PrProtBAEng'
|
||||||
|
|| $xsl == 'PrProtMA'
|
||||||
|
|| $xsl == 'PrProtMAEng'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
&& !$this->permissionlib->isBerechtigt('system/change_outputformat', null, $xsl_oe_kurzbz)
|
||||||
|
) {
|
||||||
|
$outputformat = 'pdf';
|
||||||
|
}
|
||||||
|
|
||||||
|
// XML Params
|
||||||
|
$params = 'xmlformat=xml';
|
||||||
|
foreach ([
|
||||||
|
'uid',
|
||||||
|
'stg_kz',
|
||||||
|
'person_id',
|
||||||
|
'id',
|
||||||
|
'prestudent_id',
|
||||||
|
'buchungsnummern',
|
||||||
|
'ss',
|
||||||
|
'abschlusspruefung_id',
|
||||||
|
'typ',
|
||||||
|
'all',
|
||||||
|
'preoutgoing_id',
|
||||||
|
'lvid',
|
||||||
|
'projekt_kurzbz',
|
||||||
|
'von',
|
||||||
|
'bis',
|
||||||
|
'stundevon',
|
||||||
|
'stundebis',
|
||||||
|
'sem',
|
||||||
|
'lehreinheit',
|
||||||
|
'mitarbeiter_uid',
|
||||||
|
'studienordnung_id',
|
||||||
|
'fixangestellt',
|
||||||
|
'standort',
|
||||||
|
'abrechnungsmonat',
|
||||||
|
'form',
|
||||||
|
'projektarbeit_id',
|
||||||
|
'betreuerart_kurzbz',
|
||||||
|
'studiensemester_kurzbz'
|
||||||
|
] as $key) {
|
||||||
|
if (in_array($xsl, array('Ausbildungsver', 'AusbVerEng')) && $key === 'uid')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$value = $this->input->post_get($key);
|
||||||
|
if ($value !== null)
|
||||||
|
$params .= '&' . $key . '=' . urlencode($value);
|
||||||
|
}
|
||||||
|
$value = $this->input->post_get('vertrag_id');
|
||||||
|
if ($value !== null) {
|
||||||
|
foreach ($value as $id)
|
||||||
|
$params .= '&vertrag_id[]=' . urlencode($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$vorlage->archivierbar)
|
||||||
|
$this->terminateWithError($this->p->t("stv", "grades_error_archive"));
|
||||||
|
|
||||||
|
if ($sign_user && !$vorlage->signierbar)
|
||||||
|
$this->terminateWithError($this->p->t("stv", "grades_error_sign"));
|
||||||
|
|
||||||
|
|
||||||
|
$this->load->library('DocumentExportLib');
|
||||||
|
|
||||||
|
// XML Data
|
||||||
|
$result = $this->documentexportlib->getDataURL($xml, $params);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$this->documentexportlib->addArchiveToData($data);
|
||||||
|
|
||||||
|
// Output
|
||||||
|
$result = $this->documentexportlib->getContent($vorlage, $data, $xsl_oe_kurzbz, $version, $outputformat, $sign_user);
|
||||||
|
|
||||||
|
$content = $this->getDataOrTerminateWithError($result);
|
||||||
|
$akteData['titel'] .= '.pdf';
|
||||||
|
$akteData['inhalt'] = base64_encode($content);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'akteData' => $akteData,
|
||||||
|
'exportData' =>
|
||||||
|
[
|
||||||
|
'vorlage' => $vorlage,
|
||||||
|
'xml_data' => $data,
|
||||||
|
'oe_kurzbz' => $xsl_oe_kurzbz,
|
||||||
|
'version' => $version,
|
||||||
|
'outputformat' => $outputformat,
|
||||||
|
'sign_user' => $sign_user
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
-10
@@ -20,8 +20,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This controller operates between (interface) the JS (GUI) and the back-end
|
* This controller operates between (interface) the JS (GUI) and the back-end
|
||||||
* Provides data to the ajax get calls about favorite verbände
|
* Provides data to the ajax get calls about favorite treemenu entries
|
||||||
* Listens to ajax post calls to change the favorite verbände data
|
* Listens to ajax post calls to change the favorite treemenu entries
|
||||||
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||||
*/
|
*/
|
||||||
class Favorites extends FHCAPI_Controller
|
class Favorites extends FHCAPI_Controller
|
||||||
@@ -29,29 +29,27 @@ class Favorites extends FHCAPI_Controller
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct([
|
parent::__construct([
|
||||||
'index' => self::PERM_LOGGED,
|
'get' => self::PERM_LOGGED,
|
||||||
'set' => self::PERM_LOGGED
|
'set' => self::PERM_LOGGED
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Load models
|
// Load models
|
||||||
$this->load->model('system/Variable_model', 'VariableModel');
|
$this->load->model('system/Variable_model', 'VariableModel');
|
||||||
|
|
||||||
// TODO(chris): variable table might be to small to store favorites!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function get($app)
|
||||||
{
|
{
|
||||||
$result = $this->VariableModel->getVariables(getAuthUID(), ['stv_favorites']);
|
$result = $this->VariableModel->getVariables(getAuthUID(), [$app . '_favorites']);
|
||||||
|
|
||||||
$data = $this->getDataOrTerminateWithError($result);
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
if (!$data)
|
if (!$data)
|
||||||
$this->terminateWithSuccess(null);
|
$this->terminateWithSuccess(null);
|
||||||
else
|
else
|
||||||
$this->terminateWithSuccess($data['stv_favorites']);
|
$this->terminateWithSuccess($data[$app . '_favorites'] ?? null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set()
|
public function set($app)
|
||||||
{
|
{
|
||||||
$this->load->library('form_validation');
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
@@ -62,7 +60,7 @@ class Favorites extends FHCAPI_Controller
|
|||||||
|
|
||||||
$favorites = $this->input->post('favorites');
|
$favorites = $this->input->post('favorites');
|
||||||
|
|
||||||
$result = $this->VariableModel->setVariable(getAuthUID(), 'stv_favorites', $favorites);
|
$result = $this->VariableModel->setVariable(getAuthUID(), $app . '_favorites', $favorites);
|
||||||
|
|
||||||
$this->getDataOrTerminateWithError($result);
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ class Filter extends FHCAPI_Controller
|
|||||||
*/
|
*/
|
||||||
public function applyFilterFields()
|
public function applyFilterFields()
|
||||||
{
|
{
|
||||||
$this->form_validation->set_rules('filterFields', 'filterFields', 'required');
|
$this->form_validation->set_rules('filterFields[]', 'filterFields', 'required');
|
||||||
|
|
||||||
if (!$this->form_validation->run())
|
if (!$this->form_validation->run())
|
||||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?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 languages
|
||||||
|
* This controller works with JSON calls on the HTTP GET and the output is always JSON
|
||||||
|
*/
|
||||||
|
class Language extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'get' => self::PERM_LOGGED
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load models
|
||||||
|
$this->load->model('system/Sprache_model', 'SpracheModel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get()
|
||||||
|
{
|
||||||
|
$this->SpracheModel->addOrder('sprache');
|
||||||
|
|
||||||
|
$result = $this->SpracheModel->load();
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,14 @@
|
|||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
//require_once('../../../include/studiengang.class.php');
|
||||||
|
//require_once('../../../include/student.class.php');
|
||||||
|
//require_once('../../../include/datum.class.php');
|
||||||
|
//require_once('../../../include/mail.class.php');
|
||||||
|
//require_once('../../../include/benutzerberechtigung.class.php');
|
||||||
|
//require_once('../../../include/phrasen.class.php');
|
||||||
|
//require_once('../../../include/projektarbeit.class.php');
|
||||||
|
//require_once('../../../include/projektbetreuer.class.php');
|
||||||
|
|
||||||
class Lehre extends FHCAPI_Controller
|
class Lehre extends FHCAPI_Controller
|
||||||
{
|
{
|
||||||
@@ -30,10 +38,10 @@ class Lehre extends FHCAPI_Controller
|
|||||||
parent::__construct([
|
parent::__construct([
|
||||||
'lvStudentenMail' => self::PERM_LOGGED,
|
'lvStudentenMail' => self::PERM_LOGGED,
|
||||||
'LV' => self::PERM_LOGGED,
|
'LV' => self::PERM_LOGGED,
|
||||||
|
'Pruefungen' => self::PERM_LOGGED,
|
||||||
|
'semesterAverageGrade' => self::PERM_LOGGED,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -76,10 +84,66 @@ class Lehre extends FHCAPI_Controller
|
|||||||
|
|
||||||
$this->terminateWithSuccess($result);
|
$this->terminateWithSuccess($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetches all Pruefungen of a student for a specific lehrveranstaltung
|
||||||
|
* if the student passed the Pruefung on the first attempt, no information about the Pruefungen is stored in the database
|
||||||
|
* @param mixed $lehrveranstaltung_id
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function Pruefungen($lehrveranstaltung_id)
|
||||||
|
{
|
||||||
|
$this->load->model('education/Pruefung_model', 'PruefungModel');
|
||||||
|
|
||||||
|
$result = $this->PruefungModel->getByStudentAndLv(getAuthUID(), $lehrveranstaltung_id, getUserLanguage());
|
||||||
|
|
||||||
|
$result = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* calculates and returns the grade average and weighted average for a specific semester
|
||||||
|
* @param string $studiensemester_kurzbz
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function semesterAverageGrade($studiensemester_kurzbz)
|
||||||
|
{
|
||||||
|
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
$semesterLvs = $this->LehrveranstaltungModel->getLvsByStudentWithGrades(getAuthUID(), $studiensemester_kurzbz, getUserLanguage());
|
||||||
|
|
||||||
|
if (isError($semesterLvs))
|
||||||
|
return $this->outputJsonError(getError($semesterLvs));
|
||||||
|
|
||||||
|
$semesterLvsData = getData($semesterLvs);
|
||||||
|
|
||||||
|
$doGradesExist = false;
|
||||||
|
$sum = 0;
|
||||||
|
$count = 0;
|
||||||
|
$sumWeighted = 0;
|
||||||
|
$sumEcts = 0;
|
||||||
|
|
||||||
|
foreach ($semesterLvsData as $lv) {
|
||||||
|
if (!$lv->znote || $lv->znote < 1 || $lv->znote > 5)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$doGradesExist = true;
|
||||||
|
|
||||||
|
$sum += $lv->znote;
|
||||||
|
$count++;
|
||||||
|
$sumWeighted += $lv->znote * floatval($lv->ects);
|
||||||
|
$sumEcts += floatval($lv->ects);
|
||||||
|
}
|
||||||
|
|
||||||
|
$averageGrade = null;
|
||||||
|
$weightedAverageGrade = null;
|
||||||
|
if ($doGradesExist) {
|
||||||
|
$averageGrade = $sum/$count;
|
||||||
|
$weightedAverageGrade = $sumWeighted/$sumEcts;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(['average_grade' => $averageGrade, 'weighted_average_grade' => $weightedAverageGrade]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,316 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2025 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');
|
||||||
|
|
||||||
|
class Lehrveranstaltung extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
private $_ci;
|
||||||
|
private $_uid;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getByEmp' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getByStg' => ['admin:r', 'assistenz:r'],
|
||||||
|
'loadByLV' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->_ci = &get_instance();
|
||||||
|
$this->_setAuthUID();
|
||||||
|
|
||||||
|
$this->_ci->load->model('education/Lehreinheit_model', 'LehreinheitModel');
|
||||||
|
$this->_ci->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
$this->_ci->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||||
|
|
||||||
|
$this->_ci->load->library('VariableLib', ['uid' => $this->_uid]);
|
||||||
|
|
||||||
|
$this->loadPhrases(
|
||||||
|
array(
|
||||||
|
'ui'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getByEmp($studiensemester_kurzbz = null, $mitarbeiter_uid = null, $stg_kz = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (is_null($mitarbeiter_uid))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$studiensemester_kurzbz = $this->getStudiensemesterKurzbz($studiensemester_kurzbz);
|
||||||
|
|
||||||
|
$studiengang_kz = $this->getStudiengangKz($stg_kz);
|
||||||
|
|
||||||
|
$lehrveranstaltungen = $this->_ci->LehreinheitModel->getLvsByEmployee($mitarbeiter_uid, $studiensemester_kurzbz, $studiengang_kz);
|
||||||
|
$lehrveranstaltungen_data = $this->getDataOrTerminateWithError($lehrveranstaltungen);
|
||||||
|
|
||||||
|
$tree = [];
|
||||||
|
|
||||||
|
foreach ($lehrveranstaltungen_data as $lehrveranstaltung)
|
||||||
|
{
|
||||||
|
$lehreinheiten = $this->_ci->LehreinheitModel->getByLvidStudiensemester($lehrveranstaltung->lehrveranstaltung_id, $studiensemester_kurzbz, $mitarbeiter_uid);
|
||||||
|
$lehreinheiten_data = $this->getDataOrTerminateWithError($lehreinheiten);
|
||||||
|
|
||||||
|
if (!isset($lehrveranstaltung->_children))
|
||||||
|
{
|
||||||
|
$lehrveranstaltung->_children = $lehreinheiten_data;
|
||||||
|
}
|
||||||
|
$tree[] = $lehrveranstaltung;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($tree);
|
||||||
|
}
|
||||||
|
public function getByStg($studiensemester_kurzbz = null, $stg_kz = null, $semester = null)
|
||||||
|
{
|
||||||
|
$studiengang_kz = $this->getStudiengangKz($stg_kz);
|
||||||
|
|
||||||
|
if (is_null($studiengang_kz) || !preg_match("/^(-?[1-9][0-9]*|0)$/", (string)$studiengang_kz))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$verband = null;
|
||||||
|
if (!is_null($semester) && !is_numeric($semester))
|
||||||
|
{
|
||||||
|
$verband = $this->getOrgformKurzbz($semester);
|
||||||
|
$semester = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_ci->load->model('organisation/Studienplan_model', 'StudienplanModel');
|
||||||
|
|
||||||
|
$studiensemester_kurzbz = $this->getStudiensemesterKurzbz($studiensemester_kurzbz);
|
||||||
|
$studienplan_data = $this->_ci->StudienplanModel->getStudienplaeneBySemester($studiengang_kz, $studiensemester_kurzbz, $semester, $verband);
|
||||||
|
|
||||||
|
$studienplan_ids = array();
|
||||||
|
$only_ids = array();
|
||||||
|
$placeholders = array();
|
||||||
|
|
||||||
|
if (hasData($studienplan_data))
|
||||||
|
{
|
||||||
|
foreach (getData($studienplan_data) as $studienplan) {
|
||||||
|
$placeholders[] = "(?, ?)";
|
||||||
|
$studienplan_ids[] = $studienplan->studienplan_id;
|
||||||
|
$studienplan_ids[] = $studienplan->semester;
|
||||||
|
$only_ids[] = $studienplan->studienplan_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$lehrveranstaltungen_data = $this->_ci->LehrveranstaltungModel->getLvsByStudiengang($studienplan_ids, $placeholders, $only_ids, $studiengang_kz, $studiensemester_kurzbz, $semester, $verband);
|
||||||
|
$lehrveranstaltungen_data = hasData($lehrveranstaltungen_data) ? getData($lehrveranstaltungen_data) : array();
|
||||||
|
|
||||||
|
$tree = [];
|
||||||
|
foreach ($lehrveranstaltungen_data as $row)
|
||||||
|
{
|
||||||
|
$rowData = $row;
|
||||||
|
|
||||||
|
$lehreinheiten_data = $this->_ci->LehreinheitModel->getByLvidStudiensemester($row->lehrveranstaltung_id, $studiensemester_kurzbz);
|
||||||
|
|
||||||
|
if (hasData($lehreinheiten_data))
|
||||||
|
{
|
||||||
|
$lehreinheiten = getData($lehreinheiten_data);
|
||||||
|
|
||||||
|
if (!isset($row->_children))
|
||||||
|
{
|
||||||
|
$row->_children = $lehreinheiten;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!is_array($row->_children))
|
||||||
|
{
|
||||||
|
$row->_children = [$row->_children];
|
||||||
|
}
|
||||||
|
$row->_children = array_merge($row->_children, $lehreinheiten);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isEmptyString($row->studienplan_lehrveranstaltung_id_parent))
|
||||||
|
{
|
||||||
|
$child = $this->_ci->StudienplanModel->loadStudienplanLehrveranstaltung($row->studienplan_lehrveranstaltung_id_parent);
|
||||||
|
|
||||||
|
if (hasData($child))
|
||||||
|
{
|
||||||
|
$child = getData($child)[0];
|
||||||
|
$searchId = $child->lehrveranstaltung_id;
|
||||||
|
|
||||||
|
foreach ($lehrveranstaltungen_data as &$searchParent)
|
||||||
|
{
|
||||||
|
if ($searchParent->lehrveranstaltung_id === $searchId)
|
||||||
|
{
|
||||||
|
if (!isset($searchParent->_children))
|
||||||
|
{
|
||||||
|
$searchParent->_children = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($searchParent->_children))
|
||||||
|
{
|
||||||
|
$searchParent->_children[] = $row;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$searchParent->_children = [$searchParent->_children, $row];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tree[] = $rowData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$counter = 0;
|
||||||
|
$this->assignUniqueIndex($tree, $counter);
|
||||||
|
$this->terminateWithSuccess($tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function loadByLV($lehrveranstaltung_id = null)
|
||||||
|
{
|
||||||
|
if (is_null($lehrveranstaltung_id) || !ctype_digit((string)$lehrveranstaltung_id))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$this->_ci->LehrveranstaltungModel->addSelect('lehrveranstaltung_id, lehrform_kurzbz, lehre, bezeichnung as lvbezeichnung, sprache');
|
||||||
|
$lehrveranstaltung_result = $this->_ci->LehrveranstaltungModel->loadWhere(array('lehrveranstaltung_id' => $lehrveranstaltung_id));
|
||||||
|
$lehrveranstaltung_result = $this->getDataOrTerminateWithError($lehrveranstaltung_result);
|
||||||
|
$lehrveranstaltung = $lehrveranstaltung_result[0];
|
||||||
|
|
||||||
|
$this->_ci->LehreinheitModel->addSelect('lehrveranstaltung_id_kompatibel');
|
||||||
|
$this->_ci->LehreinheitModel->addJoin('lehre.tbl_lehrveranstaltung_kompatibel', 'lehrveranstaltung_id');
|
||||||
|
$lehrfaecher = $this->_ci->LehreinheitModel->loadWhere(array('lehrveranstaltung_id' => $lehrveranstaltung->lehrveranstaltung_id));
|
||||||
|
|
||||||
|
$lehrfaecher_array = [];
|
||||||
|
if (hasData($lehrfaecher))
|
||||||
|
$lehrfaecher_array = array_merge($lehrfaecher_array, array_column(getData($lehrfaecher), 'lehrveranstaltung_id_kompatibel'));
|
||||||
|
|
||||||
|
$lehrfaecher_array[] = $lehrveranstaltung->lehrveranstaltung_id;
|
||||||
|
|
||||||
|
$this->_ci->LehrveranstaltungModel->addDistinct('lehrfach_id');
|
||||||
|
$this->_ci->LehrveranstaltungModel->addSelect("tbl_lehrveranstaltung.lehrveranstaltung_id, CONCAT(tbl_lehrveranstaltung.bezeichnung || '(' || tbl_lehrveranstaltung.oe_kurzbz || ')') as lehrfach");
|
||||||
|
$this->_ci->LehrveranstaltungModel->db->where_in('tbl_lehrveranstaltung.lehrveranstaltung_id', $lehrfaecher_array);
|
||||||
|
$lehrfaecher_result = $this->_ci->LehrveranstaltungModel->load();
|
||||||
|
|
||||||
|
$lehrfaecher_array = hasData($lehrfaecher_result) ? getData($lehrfaecher_result) : array();
|
||||||
|
|
||||||
|
$lehrveranstaltung->lehrfaecher = $lehrfaecher_array;
|
||||||
|
$this->terminateWithSuccess($lehrveranstaltung);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (david) ggf. im naechsten release
|
||||||
|
* public function loadByOrganization($oe_kurzbz)
|
||||||
|
{
|
||||||
|
$studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell');
|
||||||
|
|
||||||
|
$lehrveranstaltungen = $this->LehrveranstaltungModel->getLvsByOrganization($oe_kurzbz);
|
||||||
|
$lehrveranstaltungen_data = $this->getDataOrTerminateWithError($lehrveranstaltungen);
|
||||||
|
$tree = [];
|
||||||
|
|
||||||
|
foreach ($lehrveranstaltungen_data as $lehrveranstaltung)
|
||||||
|
{
|
||||||
|
$lehreinheiten = $this->LehreinheitModel->getByLvidStudiensemester($lehrveranstaltung->lehrveranstaltung_id, $studiensemester_kurzbz);
|
||||||
|
$lehreinheiten_data = $this->getDataOrTerminateWithError($lehreinheiten);
|
||||||
|
|
||||||
|
if (!isset($lehrveranstaltung->_children))
|
||||||
|
{
|
||||||
|
|
||||||
|
$lehrveranstaltung->_children = $lehreinheiten_data;
|
||||||
|
}
|
||||||
|
$tree[] = $lehrveranstaltung;
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess($tree);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*public function loadByFachbereich($fachbereich, $mitarbeiter_uid = null)
|
||||||
|
{
|
||||||
|
$studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell');
|
||||||
|
|
||||||
|
$this->LehreinheitModel->getLvsByFachbereich($fachbereich, $studiensemester_kurzbz, $mitarbeiter_uid);
|
||||||
|
}*/
|
||||||
|
private function _setAuthUID()
|
||||||
|
{
|
||||||
|
$this->_uid = getAuthUID();
|
||||||
|
|
||||||
|
if (!$this->_uid)
|
||||||
|
show_error('User authentification failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function assignUniqueIndex(&$nodes, &$counter)
|
||||||
|
{
|
||||||
|
foreach ($nodes as &$node)
|
||||||
|
{
|
||||||
|
$node->uniqueindex = $counter++;
|
||||||
|
if (!empty($node->_children) && is_array($node->_children))
|
||||||
|
{
|
||||||
|
$this->assignUniqueIndex($node->_children, $counter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getStudiengangKz($studiengang_typ_kurzbz)
|
||||||
|
{
|
||||||
|
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||||
|
$result = $this->StudiengangModel->loadWhere([
|
||||||
|
'LOWER(CONCAT(typ, kurzbz)) =' => strtolower($studiengang_typ_kurzbz)
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
if (!$data)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return current($data)->studiengang_kz;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getStudiensemesterKurzbz($studiensemester_kurzbz = null)
|
||||||
|
{
|
||||||
|
if (!is_null($studiensemester_kurzbz))
|
||||||
|
{
|
||||||
|
$studiensemester_result = $this->_ci->StudiensemesterModel->loadWhere([
|
||||||
|
'LOWER(studiensemester_kurzbz)' => strtolower($studiensemester_kurzbz)
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (isError($studiensemester_result) || !hasData($studiensemester_result))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
return getData($studiensemester_result)[0]->studiensemester_kurzbz;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getOrgformKurzbz($orgform_kurzbz)
|
||||||
|
{
|
||||||
|
if ($orgform_kurzbz === null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
$this->load->model('codex/Orgform_model', 'OrgformModel');
|
||||||
|
$result = $this->OrgformModel->loadWhere([
|
||||||
|
'LOWER(orgform_kurzbz) =' => strtolower($orgform_kurzbz)
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
if (!$data)
|
||||||
|
return $orgform_kurzbz;
|
||||||
|
|
||||||
|
return current($data)->orgform_kurzbz;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,13 +51,29 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
|
|
||||||
$this->load->library("PermissionLib", null, 'PermissionLib');
|
$this->load->library("PermissionLib", null, 'PermissionLib');
|
||||||
|
|
||||||
$this->load->library("PhrasesLib");
|
$this->load->library("PhrasesLib", null, 'PhrasesLib');
|
||||||
$this->loadPhrases(array('global', 'lehre'));
|
$this->loadPhrases(array('global', 'lehre'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
// Public methods
|
// Public methods
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* alternative function to get multiple lvMenus with a single http request
|
||||||
|
*/
|
||||||
|
public function getMultipleLvMenu($lvMenuOptionList){
|
||||||
|
$result =[];
|
||||||
|
foreach($lvMenuOptionList as $lvMenuOptions){
|
||||||
|
$lvMenu = $this->getLvMenu($lvMenuOptions['lvid'],$lvMenuOptions['studiensemester_kurzbz']);
|
||||||
|
if(isError($lvMenu)){
|
||||||
|
// TODO: some lvMenu threw an error, handle error here
|
||||||
|
}
|
||||||
|
$result[$lvMenuOptions['lvid']]=$lvMenu;
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -91,20 +107,24 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
$lvres = $this->Lehrveranstaltung_model->load($lvid);
|
$lvres = $this->Lehrveranstaltung_model->load($lvid);
|
||||||
if(!hasData($lvres))
|
if(!hasData($lvres))
|
||||||
{
|
{
|
||||||
$this->terminateWithError('LV ' . $lvid . ' not found.');
|
$this->terminateWithError('LV ' . $lvid . ' not found.');
|
||||||
}
|
}
|
||||||
$lv = (getData($lvres))[0];
|
$lv = (getData($lvres))[0];
|
||||||
|
$this->addMeta('lvInfo',$lv);
|
||||||
// define studiengang_kz / semester / lehrverzeichnis
|
// define studiengang_kz / semester / lehrverzeichnis
|
||||||
$studiengang_kz = $lv->studiengang_kz;
|
$studiengang_kz = $lv->studiengang_kz;
|
||||||
$semester = $lv->semester;
|
$semester = $lv->semester;
|
||||||
$short = $lv->lehreverzeichnis;
|
$short = $lv->lehreverzeichnis;
|
||||||
|
// return empty menu for studiengang_kz = 0
|
||||||
|
if($studiengang_kz == 0){
|
||||||
|
$this->terminateWithSuccess("organisatorische_einheit");
|
||||||
|
}
|
||||||
|
|
||||||
// load studiengang
|
// load studiengang
|
||||||
$stgres = $this->Studiengang_model->load($lv->studiengang_kz);
|
$stgres = $this->Studiengang_model->load(strval($studiengang_kz));
|
||||||
if(!hasData($stgres))
|
if(!hasData($stgres))
|
||||||
{
|
{
|
||||||
$this->terminateWithError('Stg ' . $lv->studiengang_kz . ' nof found.');
|
$this->terminateWithError('Stg ' . $lv->studiengang_kz . ' not found.');
|
||||||
}
|
}
|
||||||
$stg = (getData($stgres))[0];
|
$stg = (getData($stgres))[0];
|
||||||
$kurzbz = strtoupper($stg->typ . $stg->kurzbz);
|
$kurzbz = strtoupper($stg->typ . $stg->kurzbz);
|
||||||
@@ -249,6 +269,8 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
'lehrfach_id'=>$lehrfach_id,
|
'lehrfach_id'=>$lehrfach_id,
|
||||||
'lektor_der_lv'=>$lektor_der_lv,
|
'lektor_der_lv'=>$lektor_der_lv,
|
||||||
'lehrfach_oe_kurzbz_arr'=>$lehrfach_oe_kurzbz_arr,
|
'lehrfach_oe_kurzbz_arr'=>$lehrfach_oe_kurzbz_arr,
|
||||||
|
'permissionLib' => &$this->PermissionLib,
|
||||||
|
'phrasesLib' => &$this->PhrasesLib
|
||||||
];
|
];
|
||||||
|
|
||||||
Events::trigger('lvMenuBuild',
|
Events::trigger('lvMenuBuild',
|
||||||
@@ -284,24 +306,6 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function fhc_menu_digitale_anwesenheiten(&$menu, $angemeldet, $studiengang_kz, $semester, $lvid, $angezeigtes_stsem){
|
|
||||||
|
|
||||||
// DIGITALE ANWESENHEITEN
|
|
||||||
if (defined('CIS_LEHRVERANSTALTUNG_ANWESENHEIT_ANZEIGEN') && CIS_LEHRVERANSTALTUNG_ANWESENHEIT_ANZEIGEN && $angemeldet) {
|
|
||||||
|
|
||||||
$menu[] = array
|
|
||||||
(
|
|
||||||
'id' => 'core_menu_digitale_anwesenheitslisten',
|
|
||||||
'position' => '50',
|
|
||||||
'name' => $this->p->t('lehre', 'digiAnw'),
|
|
||||||
'c4_icon' => base_url('skin/images/button_kreuzerltool.png'),
|
|
||||||
'c4_link' => base_url("index.ci.php/extensions/FHC-Core-Anwesenheiten/?stg_kz=$studiengang_kz&sem=$semester&lvid=$lvid&sem_kurzbz=$angezeigtes_stsem&nav=false"),
|
|
||||||
'c4_linkList' => []
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function fhc_menu_lvinfo(&$menu, $lvid, $studiengang_kz, $lektor_der_lv, $is_lector, $lehrfach_oe_kurzbz_arr){
|
private function fhc_menu_lvinfo(&$menu, $lvid, $studiengang_kz, $lektor_der_lv, $is_lector, $lehrfach_oe_kurzbz_arr){
|
||||||
|
|
||||||
// LVINFO
|
// LVINFO
|
||||||
@@ -329,6 +333,7 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
'id'=>'core_menu_lvinfo',
|
'id'=>'core_menu_lvinfo',
|
||||||
'position'=>'10',
|
'position'=>'10',
|
||||||
'name'=>$this->p->t('lehre', 'lehrveranstaltungsinformation'),
|
'name'=>$this->p->t('lehre', 'lehrveranstaltungsinformation'),
|
||||||
|
'phrase' => 'lehre/lehrveranstaltungsinformation',
|
||||||
'icon'=>'../../../skin/images/button_lvinfo.png',
|
'icon'=>'../../../skin/images/button_lvinfo.png',
|
||||||
'link'=>'',
|
'link'=>'',
|
||||||
'c4_icon'=> base_url('skin/images/button_lvinfo.png'),
|
'c4_icon'=> base_url('skin/images/button_lvinfo.png'),
|
||||||
@@ -347,6 +352,7 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
'id'=>'core_menu_feedback',
|
'id'=>'core_menu_feedback',
|
||||||
'position'=>'60',
|
'position'=>'60',
|
||||||
'name'=>$this->p->t('lehre', 'feedback'),
|
'name'=>$this->p->t('lehre', 'feedback'),
|
||||||
|
'phrase' => 'lehre/feedback',
|
||||||
'c4_icon'=> base_url('skin/images/button_feedback.png'),
|
'c4_icon'=> base_url('skin/images/button_feedback.png'),
|
||||||
'c4_link'=> base_url('feedback.php?lvid='.$lvid),
|
'c4_link'=> base_url('feedback.php?lvid='.$lvid),
|
||||||
);
|
);
|
||||||
@@ -364,6 +370,7 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
'id'=>'core_menu_gesamtnote',
|
'id'=>'core_menu_gesamtnote',
|
||||||
'position'=>'80',
|
'position'=>'80',
|
||||||
'name'=>$this->p->t('lehre', 'gesamtnote'),
|
'name'=>$this->p->t('lehre', 'gesamtnote'),
|
||||||
|
'phrase' => 'lehre/gesamtnote',
|
||||||
'c4_icon'=> base_url('skin/images/button_endnote.png'),
|
'c4_icon'=> base_url('skin/images/button_endnote.png'),
|
||||||
'c4_link'=> base_url('cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php?lvid='.urlencode($lvid).'&stsem='.urlencode($angezeigtes_stsem))
|
'c4_link'=> base_url('cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php?lvid='.urlencode($lvid).'&stsem='.urlencode($angezeigtes_stsem))
|
||||||
//'c4_link'=> base_url('benotungstool/lvgesamtnoteverwalten.php?lvid='.urlencode($lvid).'&stsem='.urlencode($angezeigtes_stsem))
|
//'c4_link'=> base_url('benotungstool/lvgesamtnoteverwalten.php?lvid='.urlencode($lvid).'&stsem='.urlencode($angezeigtes_stsem))
|
||||||
@@ -376,6 +383,7 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
'id'=>'core_menu_gesamtnote',
|
'id'=>'core_menu_gesamtnote',
|
||||||
'position'=>'80',
|
'position'=>'80',
|
||||||
'name'=>$this->p->t('lehre', 'gesamtnote'),
|
'name'=>$this->p->t('lehre', 'gesamtnote'),
|
||||||
|
'phrase'=>'lehre/gesamtnote',
|
||||||
'c4_icon'=>base_url('skin/images/button_endnote.png'),
|
'c4_icon'=>base_url('skin/images/button_endnote.png'),
|
||||||
'c4_link'=>'#',
|
'c4_link'=>'#',
|
||||||
'c4_linkList'=>[[$this->p->t('lehre', 'noteneingabedeaktiviert'),'#']],
|
'c4_linkList'=>[[$this->p->t('lehre', 'noteneingabedeaktiviert'),'#']],
|
||||||
@@ -448,6 +456,7 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
'id'=>'core_menu_mailanstudierende',
|
'id'=>'core_menu_mailanstudierende',
|
||||||
'position'=>'100',
|
'position'=>'100',
|
||||||
'name'=>$this->p->t('lehre', 'mail'),
|
'name'=>$this->p->t('lehre', 'mail'),
|
||||||
|
'phrase' => 'lehre/mail',
|
||||||
'c4_icon'=>base_url('skin/images/button_feedback.png'),
|
'c4_icon'=>base_url('skin/images/button_feedback.png'),
|
||||||
'c4_icon2' => 'fa-regular fa-envelope',
|
'c4_icon2' => 'fa-regular fa-envelope',
|
||||||
'c4_link'=>$mailto,
|
'c4_link'=>$mailto,
|
||||||
@@ -472,6 +481,7 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
'id'=>'core_menu_abmeldung',
|
'id'=>'core_menu_abmeldung',
|
||||||
'position'=>'120',
|
'position'=>'120',
|
||||||
'name'=>$this->p->t('lehre', 'abmelden'),
|
'name'=>$this->p->t('lehre', 'abmelden'),
|
||||||
|
'phrase'=>'lehre/abmelden',
|
||||||
'c4_icon'=>base_url('skin/images/button_studiupload.png'),
|
'c4_icon'=>base_url('skin/images/button_studiupload.png'),
|
||||||
'c4_link'=>base_url('abmeldung.php?lvid='.urlencode($lvid).'&stsem='.urlencode($angezeigtes_stsem)),
|
'c4_link'=>base_url('abmeldung.php?lvid='.urlencode($lvid).'&stsem='.urlencode($angezeigtes_stsem)),
|
||||||
);
|
);
|
||||||
@@ -506,6 +516,7 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
'id' => 'core_menu_anerkennungNachgewiesenerKenntnisse',
|
'id' => 'core_menu_anerkennungNachgewiesenerKenntnisse',
|
||||||
'position' => '128',
|
'position' => '128',
|
||||||
'name' => $this->p->t('lehre', 'anrechnung'),
|
'name' => $this->p->t('lehre', 'anrechnung'),
|
||||||
|
'phrase' => 'lehre/anrechnung',
|
||||||
'c4_icon' => base_url('skin/images/button_listen.png'),
|
'c4_icon' => base_url('skin/images/button_listen.png'),
|
||||||
'c4_icon2' => 'fa-regular fa-folder-open',
|
'c4_icon2' => 'fa-regular fa-folder-open',
|
||||||
'c4_link' => base_url('cis.php/lehre/anrechnung/RequestAnrechnung?studiensemester='.urlencode($angezeigtes_stsem).'&lv_id='.urlencode($lvid))
|
'c4_link' => base_url('cis.php/lehre/anrechnung/RequestAnrechnung?studiensemester='.urlencode($angezeigtes_stsem).'&lv_id='.urlencode($lvid))
|
||||||
@@ -523,6 +534,7 @@ class LvMenu extends FHCAPI_Controller
|
|||||||
'id' => 'core_menu_anerkennungNachgewiesenerKenntnisse_empfehlen',
|
'id' => 'core_menu_anerkennungNachgewiesenerKenntnisse_empfehlen',
|
||||||
'position' => '128',
|
'position' => '128',
|
||||||
'name' => $this->p->t('lehre', 'anrechnungen'),
|
'name' => $this->p->t('lehre', 'anrechnungen'),
|
||||||
|
'phrase' => 'lehre/anrechnung',
|
||||||
'c4_icon'=> base_url('skin/images/button_listen.png'),
|
'c4_icon'=> base_url('skin/images/button_listen.png'),
|
||||||
'c4_icon2' => 'fa-regular fa-folder-open',
|
'c4_icon2' => 'fa-regular fa-folder-open',
|
||||||
'c4_link' => base_url('cis.php/lehre/anrechnung/ReviewAnrechnungUebersicht?studiensemester='.urlencode($angezeigtes_stsem))
|
'c4_link' => base_url('cis.php/lehre/anrechnung/ReviewAnrechnungUebersicht?studiensemester='.urlencode($angezeigtes_stsem))
|
||||||
|
|||||||
@@ -0,0 +1,530 @@
|
|||||||
|
<?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;
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
use \DateTimeZone as DateTimeZone;
|
||||||
|
|
||||||
|
class LvPlan extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object initialization
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
parent::__construct([
|
||||||
|
'getRoomplan' => self::PERM_LOGGED,
|
||||||
|
'Stunden' => self::PERM_LOGGED,
|
||||||
|
'getReservierungen' => self::PERM_LOGGED,
|
||||||
|
'LvPlanEvents' => self::PERM_LOGGED,
|
||||||
|
'eventsPersonal' => self::PERM_LOGGED,
|
||||||
|
'eventsLv' => self::PERM_LOGGED,
|
||||||
|
'getLehreinheitStudiensemester' => self::PERM_LOGGED,
|
||||||
|
'studiensemesterDateInterval' => self::PERM_LOGGED,
|
||||||
|
'getLvPlanForStudiensemester' => self::PERM_LOGGED,
|
||||||
|
'getLv' => self::PERM_LOGGED,
|
||||||
|
'eventsStgOrg' => self::PERM_LOGGED,
|
||||||
|
'fetchFerienEvents' => self::PERM_LOGGED,
|
||||||
|
'getStudiengaenge' => self::PERM_LOGGED,
|
||||||
|
'getLehrverband' => self::PERM_LOGGED,
|
||||||
|
'permissionOtherLvPlan' => self::PERM_LOGGED,
|
||||||
|
'compactibleEventTypes' => self::PERM_LOGGED,
|
||||||
|
'getLeEvents' => self::PERM_LOGGED,
|
||||||
|
'getLvEvents' => self::PERM_LOGGED,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load->library('LogLib');
|
||||||
|
$this->loglib->setConfigs(array(
|
||||||
|
'classIndex' => 5,
|
||||||
|
'functionIndex' => 5,
|
||||||
|
'lineIndex' => 4,
|
||||||
|
'dbLogType' => 'API', // required
|
||||||
|
'dbExecuteUser' => 'RESTful API'
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
$this->load->library('PhrasesLib');
|
||||||
|
$this->loadPhrases(
|
||||||
|
array(
|
||||||
|
'ui'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetches LvPlan and Moodle events together
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function LvPlanEvents()
|
||||||
|
{
|
||||||
|
$hasLv = $this->input->post('lv_id');
|
||||||
|
|
||||||
|
return $hasLv ? $this->eventsLv() : $this->eventsPersonal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetches LvPlan, Moodle and Ferien events together for the logged in user
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function eventsPersonal()
|
||||||
|
{
|
||||||
|
$this->load->library('StundenplanLib');
|
||||||
|
|
||||||
|
// form validation
|
||||||
|
$this->form_validation->set_rules('start_date', "start_date", "required");
|
||||||
|
$this->form_validation->set_rules('end_date', "end_date", "required");
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
// storing the post parameter in local variables
|
||||||
|
$start_date = $this->input->post('start_date', true);
|
||||||
|
$end_date = $this->input->post('end_date', true);
|
||||||
|
$uid = $this->input->post('uid', true);
|
||||||
|
|
||||||
|
// disallow accessing other user's events if missing permission
|
||||||
|
if ($uid && $uid !== getAuthUID() && !$this->permissionlib->isBerechtigt('basis/other_lv_plan')) {
|
||||||
|
$this->terminateWithError("Missing permission to view other users' timetables!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetching lvplan events
|
||||||
|
$result = $this->stundenplanlib->getEventsUser($start_date, $end_date, $uid);
|
||||||
|
|
||||||
|
$lvplanEvents = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
// fetching moodle events
|
||||||
|
$moodleEvents = $this->fetchMoodleEvents($start_date, $end_date, $uid);
|
||||||
|
|
||||||
|
// fetching ferien events
|
||||||
|
$ferienEvents = $this->fetchFerienEvents($start_date, $end_date, $uid);
|
||||||
|
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(array_merge(
|
||||||
|
$lvplanEvents,
|
||||||
|
$moodleEvents,
|
||||||
|
$ferienEvents
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetches LvPlan for studiengang / semester / verband / gruppe
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function eventsStgOrg()
|
||||||
|
{
|
||||||
|
$this->load->library('StundenplanLib');
|
||||||
|
|
||||||
|
// form validation
|
||||||
|
$this->form_validation->set_rules('start_date', "start_date", "required");
|
||||||
|
$this->form_validation->set_rules('end_date', "end_date", "required");
|
||||||
|
//$this->form_validation->set_rules('stg_kz', "stg_kz", "required"); //no validation show empty calendar
|
||||||
|
|
||||||
|
if (!$this->form_validation->run()) {
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
$stgOrgEvents = [];
|
||||||
|
$ferienEvents = [];
|
||||||
|
} else {
|
||||||
|
$start_date = $this->input->post('start_date', true);
|
||||||
|
$end_date = $this->input->post('end_date', true);
|
||||||
|
$stg_kz = $this->input->post('stg_kz', true);
|
||||||
|
$sem = $this->input->post('sem', true);
|
||||||
|
$verband = $this->input->post('verband', true);
|
||||||
|
$gruppe = $this->input->post('gruppe', true);
|
||||||
|
|
||||||
|
$result = $this->stundenplanlib->getEventsStgOrg($start_date, $end_date, $stg_kz, $sem, $verband, $gruppe);
|
||||||
|
$stgOrgEvents = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$result = $this->stundenplanlib->fetchFerienTageEvents($start_date, $end_date, $stg_kz);
|
||||||
|
$ferienEvents = $this->getDataOrTerminateWithError($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(array_merge(
|
||||||
|
$stgOrgEvents,
|
||||||
|
$ferienEvents
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetches LvPlan and Ferien events together for the lv
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function eventsLv()
|
||||||
|
{
|
||||||
|
$this->load->library('StundenplanLib');
|
||||||
|
|
||||||
|
// form validation
|
||||||
|
$this->form_validation->set_rules('start_date', "start_date", "required");
|
||||||
|
$this->form_validation->set_rules('end_date', "end_date", "required");
|
||||||
|
$this->form_validation->set_rules('lv_id', "lv_id", "required|integer");
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
// storing the post parameter in local variables
|
||||||
|
$start_date = $this->input->post('start_date', true);
|
||||||
|
$end_date = $this->input->post('end_date', true);
|
||||||
|
$lv_id = $this->input->post('lv_id', true);
|
||||||
|
|
||||||
|
// fetching lvplan events
|
||||||
|
$result = $this->stundenplanlib->getEventsLv($lv_id, $start_date, $end_date);
|
||||||
|
$lvplanEvents = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
// fetching ferien events
|
||||||
|
$ferienEvents = $this->fetchFerienEvents($start_date, $end_date);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(array_merge(
|
||||||
|
$lvplanEvents,
|
||||||
|
$ferienEvents
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLeEvents($le_id = null, $start_date = null, $end_date = null, $stundenplan = 'stundenplandev')
|
||||||
|
{
|
||||||
|
|
||||||
|
if (is_null($le_id) || is_null($start_date) || is_null($end_date))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
if ($stundenplan !== 'stundenplandev' && $stundenplan !== 'stundenplan')
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$this->load->library('StundenplanLib');
|
||||||
|
|
||||||
|
$result = $this->stundenplanlib->getEventsByLE($le_id, $start_date, $end_date, $stundenplan);
|
||||||
|
$lvplanEvents = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($lvplanEvents);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLvEvents($lv_id = null, $start_date = null, $end_date = null, $stundenplan = 'stundenplandev')
|
||||||
|
{
|
||||||
|
if (is_null($lv_id) || is_null($start_date) || is_null($end_date))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
if ($stundenplan !== 'stundenplandev' && $stundenplan !== 'stundenplan')
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$this->load->library('StundenplanLib');
|
||||||
|
|
||||||
|
$result = $this->stundenplanlib->getEventsByLV($lv_id, $start_date, $end_date, $stundenplan);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(hasData($result) ? getData($result) : []);
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: delete this function if we don't use the old calendar export endpoints anymore
|
||||||
|
public function studiensemesterDateInterval($date)
|
||||||
|
{
|
||||||
|
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||||
|
$studiensemester = $this->StudiensemesterModel->getByDate(date_format(date_create($date), 'Y-m-d'));
|
||||||
|
$studiensemester = current($this->getDataOrTerminateWithError($studiensemester));
|
||||||
|
$this->terminateWithSuccess($studiensemester);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLvPlanForStudiensemester($studiensemester, $lvid)
|
||||||
|
{
|
||||||
|
$this->load->library('StundenplanLib');
|
||||||
|
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||||
|
|
||||||
|
$studiensemester_result = $this->StudiensemesterModel->loadWhere(["studiensemester_kurzbz" => $studiensemester]);
|
||||||
|
$studiensemester_result = current($this->getDataOrTerminateWithError($studiensemester_result));
|
||||||
|
$timespan_start = new DateTime($studiensemester_result->start);
|
||||||
|
$timespan_ende = new DateTime($studiensemester_result->ende);
|
||||||
|
$lvplan = $this->stundenplanlib->getStundenplan(date_format($timespan_start, 'Y-m-d'), date_format($timespan_ende, 'Y-m-d'), $lvid);
|
||||||
|
$this->terminateWithSuccess($lvplan);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetches Stunden layout from database
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function Stunden()
|
||||||
|
{
|
||||||
|
$this->load->model('ressource/Stunde_model', 'StundeModel');
|
||||||
|
|
||||||
|
$this->StundeModel->addOrder('stunde', 'ASC');
|
||||||
|
$stunden = $this->StundeModel->load();
|
||||||
|
|
||||||
|
$stunden = $this->getDataOrTerminateWithError($stunden);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($stunden);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetches room events from a certain date
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getRoomplan()
|
||||||
|
{
|
||||||
|
$this->form_validation->set_rules('ort_kurzbz', "Ort", "required");
|
||||||
|
$this->form_validation->set_rules('start_date', "start_date", "required");
|
||||||
|
$this->form_validation->set_rules('end_date', "end_date", "required");
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
// storing the post parameter in local variables
|
||||||
|
$ort_kurzbz = $this->input->post('ort_kurzbz', true);
|
||||||
|
$start_date = $this->input->post('start_date', true);
|
||||||
|
$end_date = $this->input->post('end_date', true);
|
||||||
|
|
||||||
|
// get data
|
||||||
|
$this->load->library('StundenplanLib');
|
||||||
|
|
||||||
|
$roomplan_data = $this->stundenplanlib->getRoomplan($ort_kurzbz, $start_date, $end_date);
|
||||||
|
|
||||||
|
$roomplan_data = $this->getDataOrTerminateWithError($roomplan_data);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($roomplan_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets the reservierungen of a room if the ort_kurzbz parameter is
|
||||||
|
* supplied otherwise gets the reservierungen of the lvplan of a student
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param string $ort_kurzbz
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getReservierungen($ort_kurzbz = null)
|
||||||
|
{
|
||||||
|
$this->form_validation->set_rules('start_date', "StartDate", "required");
|
||||||
|
$this->form_validation->set_rules('end_date', "EndDate", "required");
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
// storing the post parameter in local variables
|
||||||
|
$start_date = $this->input->post('start_date', true);
|
||||||
|
$end_date = $this->input->post('end_date', true);
|
||||||
|
$uid = $this->input->post('uid', true);
|
||||||
|
|
||||||
|
// disallow accessing other user's reservierungen if missing permission
|
||||||
|
if ($uid && $uid !== getAuthUID() && !$this->permissionlib->isBerechtigt('basis/other_lv_plan')) {
|
||||||
|
$this->terminateWithError("Missing permission to view other users' timetables!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// get data
|
||||||
|
$this->load->library('StundenplanLib');
|
||||||
|
|
||||||
|
$result = $this->stundenplanlib->getReservierungen($start_date, $end_date, $ort_kurzbz, $uid);
|
||||||
|
|
||||||
|
$result = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLehreinheitStudiensemester($lehreinheit_id)
|
||||||
|
{
|
||||||
|
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
|
||||||
|
$this->LehreinheitModel->addSelect(["studiensemester_kurzbz"]);
|
||||||
|
$result = $this->LehreinheitModel->load($lehreinheit_id);
|
||||||
|
$result = current($this->getDataOrTerminateWithError($result))->studiensemester_kurzbz;
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get details for a lv
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
* @param integer $lehrveranstaltung_id
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function getLv($lehrveranstaltung_id)
|
||||||
|
{
|
||||||
|
if (!$lehrveranstaltung_id && $lehrveranstaltung_id !== 0 && $lehrveranstaltung_id !== '0')
|
||||||
|
return show_404();
|
||||||
|
|
||||||
|
// Load Phrases
|
||||||
|
$this->loadPhrases(['lehre']);
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
$this->form_validation->set_data([
|
||||||
|
'lehrveranstaltung_id' => $lehrveranstaltung_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('lehrveranstaltung_id', $this->p->t('lehre', 'lehrveranstaltung_id'), 'integer');
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
// Get Data
|
||||||
|
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
|
||||||
|
$result = $this->LehrveranstaltungModel->load($lehrveranstaltung_id);
|
||||||
|
|
||||||
|
$result = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
return $this->terminateWithSuccess(current($result));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStudiengaenge()
|
||||||
|
{
|
||||||
|
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||||
|
|
||||||
|
$this->StudiengangModel->addOrder('typ');
|
||||||
|
$this->StudiengangModel->addOrder('kurzbz');
|
||||||
|
$result = $this->StudiengangModel->loadWhere([
|
||||||
|
'aktiv' => true
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
return $this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLehrverband($studiengang_kz, $semester = null, $verband = null)
|
||||||
|
{
|
||||||
|
$this->load->model('organisation/Lehrverband_model', 'LehrverbandModel');
|
||||||
|
|
||||||
|
$where = [
|
||||||
|
'aktiv' => true,
|
||||||
|
'studiengang_kz' => $studiengang_kz,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($semester !== null && $semester !== 'null' && $semester !== 'undefined') {
|
||||||
|
$where['semester'] = $semester;
|
||||||
|
}
|
||||||
|
if ($verband !== null && $verband !== 'null' && $verband !== 'undefined') {
|
||||||
|
$where['verband'] = $verband;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->LehrverbandModel->addOrder('studiengang_kz');
|
||||||
|
$this->LehrverbandModel->addOrder('semester');
|
||||||
|
$this->LehrverbandModel->addOrder('verband');
|
||||||
|
$this->LehrverbandModel->addOrder('gruppe');
|
||||||
|
$result = $this->LehrverbandModel->loadWhere($where);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
return $this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the current user has permission to view other users' timetables
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function permissionOtherLvPlan()
|
||||||
|
{
|
||||||
|
$this->terminateWithSuccess($this->permissionlib->isBerechtigt('basis/other_lv_plan'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get event types which can be compacted in lv plan display
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function compactibleEventTypes()
|
||||||
|
{
|
||||||
|
$this->terminateWithSuccess(["lehreinheit", "reservierung", "ferien", "moodle"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetch moodle events
|
||||||
|
*
|
||||||
|
* @param string $start_date
|
||||||
|
* @param string $end_date
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function fetchMoodleEvents($start_date, $end_date, $uid = null)
|
||||||
|
{
|
||||||
|
if ($uid && $uid !== getAuthUID()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->load->config('calendar');
|
||||||
|
|
||||||
|
$tz = new DateTimeZone($this->config->item('timezone'));
|
||||||
|
|
||||||
|
$start = new DateTime($start_date);
|
||||||
|
$start->setTimezone($tz);
|
||||||
|
|
||||||
|
$end = new DateTime($end_date);
|
||||||
|
$end->setTimezone($tz);
|
||||||
|
$end->modify('+1 day -1 second');
|
||||||
|
|
||||||
|
$moodle_events = [];
|
||||||
|
|
||||||
|
Events::trigger(
|
||||||
|
'moodleCalendarEvents',
|
||||||
|
function &() use (&$moodle_events) {
|
||||||
|
return $moodle_events;
|
||||||
|
},
|
||||||
|
[
|
||||||
|
'start_date' => $start->format('c'),
|
||||||
|
'end_date' => $end->format('c'),
|
||||||
|
'username' => $uid ?? getAuthUID()
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $moodle_events;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetch ferien events
|
||||||
|
*
|
||||||
|
* @param string $start_date
|
||||||
|
* @param string $end_date
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function fetchFerienEvents($start_date, $end_date, $uid = null)
|
||||||
|
{
|
||||||
|
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||||
|
$this->load->model('education/Studentlehrverband_model', 'StudentLehrverbandModel');
|
||||||
|
|
||||||
|
$currentStudiensemester = $this->StudiensemesterModel->getByDate($start_date);
|
||||||
|
$currentStudiensemester = $this->getDataOrTerminateWithError($currentStudiensemester);
|
||||||
|
|
||||||
|
if ($currentStudiensemester) {
|
||||||
|
$studentsemester_kurzbz = current($currentStudiensemester)->studiensemester_kurzbz;
|
||||||
|
|
||||||
|
$studiengang = $this->StudentLehrverbandModel->loadWhere([
|
||||||
|
"student_uid" => $uid ?? getAuthUID(),
|
||||||
|
"studiensemester_kurzbz" => $studentsemester_kurzbz
|
||||||
|
]);
|
||||||
|
$studiengang = $this->getDataOrTerminateWithError($studiengang);
|
||||||
|
|
||||||
|
if ($studiengang)
|
||||||
|
$studiengang_kz = current($studiengang)->studiengang_kz;
|
||||||
|
else
|
||||||
|
$studiengang_kz = 0;
|
||||||
|
} else {
|
||||||
|
$studiengang_kz = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ferienEvents = $this->stundenplanlib->fetchFerienTageEvents($start_date, $end_date, $studiengang_kz);
|
||||||
|
|
||||||
|
return $this->getDataOrTerminateWithError($ferienEvents);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,15 +35,98 @@ class Ort extends FHCAPI_Controller
|
|||||||
parent::__construct([
|
parent::__construct([
|
||||||
'ContentID' => self::PERM_LOGGED,
|
'ContentID' => self::PERM_LOGGED,
|
||||||
'getOrtKurzbzContent' => self::PERM_LOGGED,
|
'getOrtKurzbzContent' => self::PERM_LOGGED,
|
||||||
|
'getRooms' => self::PERM_LOGGED,
|
||||||
|
'getTypes' => self::PERM_LOGGED
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->load->model('ressource/Ort_model', 'OrtModel');
|
$this->load->model('ressource/Ort_model', 'OrtModel');
|
||||||
|
$this->config->load('raumsuche');
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
// Public methods
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all Ort entries filtered by the provided parameters
|
||||||
|
*/
|
||||||
|
public function getRooms()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
$this->form_validation->set_data($_GET);
|
||||||
|
$this->form_validation->set_rules('datum','Datum','required');
|
||||||
|
$this->form_validation->set_rules('von','Uhrzeit Von','required|regex_match[/^[0-9]{2}:[0-9]{2}$/]');
|
||||||
|
$this->form_validation->set_rules('bis','Uhrzeit Bis','required|regex_match[/^[0-9]{2}:[0-9]{2}$/]');
|
||||||
|
if($this->form_validation->run() == FALSE) {
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
}
|
||||||
|
|
||||||
|
$datum = $this->input->get('datum', TRUE);
|
||||||
|
$von = $this->input->get('von', TRUE);
|
||||||
|
$bis = $this->input->get('bis', TRUE);
|
||||||
|
$typ = $this->input->get('typ', TRUE);
|
||||||
|
$personenanzahl = $this->input->get('personenanzahl', TRUE);
|
||||||
|
|
||||||
|
|
||||||
|
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||||
|
$isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter(getAuthUID())->retval;
|
||||||
|
|
||||||
|
$this->load->model('ressource/Stunde_model', 'StundeModel');
|
||||||
|
$vonStunde = getData($this->StundeModel->getStundeForTime($von))[0]->stunde;
|
||||||
|
$bisStunde = getData($this->StundeModel->getStundeForTime($bis))[0]->stunde;
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
$qry = "SELECT DISTINCT tbl_ort.*
|
||||||
|
FROM public.tbl_ort JOIN public.tbl_ortraumtyp USING(ort_kurzbz)
|
||||||
|
WHERE aktiv AND lehre AND ort_kurzbz NOT LIKE '\\\\_%'";
|
||||||
|
if($typ) {
|
||||||
|
$params[] = $typ;
|
||||||
|
$qry.= "AND raumtyp_kurzbz = ?";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$isMitarbeiter) { // students are only allowed to get a subset defined by config
|
||||||
|
$qry.= ' AND raumtyp_kurzbz IN ?';
|
||||||
|
$params[] = $this->config->item('roomtypes_student');
|
||||||
|
$this->addMeta('config', $this->config->item('roomtypes_student'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$qry.= "AND (max_person>= ? OR max_person is null)";
|
||||||
|
$params[] = $personenanzahl;
|
||||||
|
|
||||||
|
$qry.=" AND ort_kurzbz NOT IN
|
||||||
|
(
|
||||||
|
SELECT ort_kurzbz FROM lehre.tbl_stundenplandev WHERE datum = ? AND stunde >= ? AND stunde <= ?
|
||||||
|
UNION
|
||||||
|
SELECT ort_kurzbz FROM campus.tbl_reservierung WHERE datum= ? AND stunde >= ? AND stunde <= ?
|
||||||
|
)
|
||||||
|
";
|
||||||
|
$params = array_merge($params, [$datum, $vonStunde, $bisStunde, $datum, $vonStunde, $bisStunde]);
|
||||||
|
// $this->addMeta('qry', $qry);
|
||||||
|
// $this->addMeta('params', $params);
|
||||||
|
$result = $this->OrtModel->execReadOnlyQuery($qry, $params);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTypes()
|
||||||
|
{
|
||||||
|
$this->load->model('ressource/Raumtyp_model', 'RaumtypModel');
|
||||||
|
$qry = "SELECT * FROM public.tbl_raumtyp WHERE aktiv = true";
|
||||||
|
$params = array();
|
||||||
|
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||||
|
|
||||||
|
$isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter(getAuthUID())->retval;
|
||||||
|
if(!$isMitarbeiter) { // students are only allowed to get a subset defined by config
|
||||||
|
$qry.= ' AND raumtyp_kurzbz IN ?';
|
||||||
|
$params[] = $this->config->item('roomtypes_student');
|
||||||
|
}
|
||||||
|
|
||||||
|
$qry .= " ORDER BY raumtyp_kurzbz;";
|
||||||
|
|
||||||
|
$result = $this->OrtModel->execReadOnlyQuery($qry, $params);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(getData($result));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a JSON body via HTTP POST and provides the parameters
|
* Gets a JSON body via HTTP POST and provides the parameters
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?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');
|
||||||
|
|
||||||
|
class OtherLvPlan extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object initialization
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'otherLvPlanViewData' => ['basis/other_lv_plan:r'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
|
||||||
|
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||||
|
$this->load->library('ProfilLib');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* retrieves viewData for other lv plan view
|
||||||
|
* @access public
|
||||||
|
* @param $uid the userID for which the other lv plan is being viewed
|
||||||
|
*/
|
||||||
|
public function otherLvPlanViewData($uid)
|
||||||
|
{
|
||||||
|
$isMitarbeiterResult = $this->MitarbeiterModel->isMitarbeiter($uid);
|
||||||
|
$isMitarbeiter = getData($isMitarbeiterResult);
|
||||||
|
$isStudent = !$isMitarbeiter;
|
||||||
|
|
||||||
|
$resProfileData = $this->profillib->getView($uid);
|
||||||
|
$profileData = hasData($resProfileData) ? getData($resProfileData) : null;
|
||||||
|
|
||||||
|
$viewData = [
|
||||||
|
"user_data" => [
|
||||||
|
"username" => $uid,
|
||||||
|
"is_student" => $isStudent,
|
||||||
|
"is_mitarbeiter" => $isMitarbeiter,
|
||||||
|
"foto" => $profileData->data->foto,
|
||||||
|
"vorname" => $profileData->data->vorname,
|
||||||
|
"nachname" => $profileData->data->nachname,
|
||||||
|
"titel" => $profileData->data->titel,
|
||||||
|
"postnomen" => $profileData->data->postnomen,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($viewData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Private methods
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -32,6 +32,8 @@ class Phrasen extends FHCAPI_Controller
|
|||||||
'setLanguage' => self::PERM_ANONYMOUS,
|
'setLanguage' => self::PERM_ANONYMOUS,
|
||||||
'getLanguage' => self::PERM_ANONYMOUS,
|
'getLanguage' => self::PERM_ANONYMOUS,
|
||||||
'getAllLanguages' => self::PERM_ANONYMOUS,
|
'getAllLanguages' => self::PERM_ANONYMOUS,
|
||||||
|
'getPhrases' => self::PERM_ANONYMOUS,
|
||||||
|
'getTabulatorPhrases' => self::PERM_ANONYMOUS,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->load->helper('hlp_language');
|
$this->load->helper('hlp_language');
|
||||||
@@ -73,12 +75,78 @@ class Phrasen extends FHCAPI_Controller
|
|||||||
// gets all languages that are set as active in the database
|
// gets all languages that are set as active in the database
|
||||||
public function getAllLanguages()
|
public function getAllLanguages()
|
||||||
{
|
{
|
||||||
$langs = getDBActiveLanguages();
|
$this->load->model('system/Sprache_model', 'SprachenModel');
|
||||||
|
|
||||||
|
// Add order clause by index and select the sprache,bezeichnung and index column
|
||||||
|
$this->SprachenModel->addOrder('index');
|
||||||
|
$this->SprachenModel->addSelect('sprache, bezeichnung, index');
|
||||||
|
|
||||||
|
// Retrieves from public.tbl_sprache
|
||||||
|
$langs = $this->SprachenModel->loadWhere(array('content' => true));
|
||||||
$langs = $this->getDataOrTerminateWithError($langs);
|
$langs = $this->getDataOrTerminateWithError($langs);
|
||||||
$langs = array_map(function($lang){
|
$langs = array_map(function($lang){
|
||||||
return $lang->sprache;
|
$data = new stdClass();
|
||||||
|
$data->sprache = $lang->sprache;
|
||||||
|
$data->bezeichnung = $lang->bezeichnung[($lang->index-1)];
|
||||||
|
return $data;
|
||||||
}, $langs);
|
}, $langs);
|
||||||
|
|
||||||
$this->terminateWithSuccess($langs);
|
$this->terminateWithSuccess($langs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPhrases()
|
||||||
|
{
|
||||||
|
$postParams = $this->getPostJSON();
|
||||||
|
|
||||||
|
$languages = $postParams->languages;
|
||||||
|
if (!$languages || !count($languages)) {
|
||||||
|
$this->load->model('system/Sprache_model', 'sprachenModel');
|
||||||
|
$activeLanguages = $this->sprachenModel->loadWhere(array('content' => true));
|
||||||
|
$activeLanguagesData = $this->getDataOrTerminateWithError($activeLanguages);
|
||||||
|
$languages = array_map(
|
||||||
|
function ($languageData) {
|
||||||
|
return $languageData->sprache;
|
||||||
|
},
|
||||||
|
$activeLanguagesData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->load->model('system/Phrase_model', 'phraseModel');
|
||||||
|
$phrasesGroupedByCategory = $postParams->phrasesGroupedByCategory;
|
||||||
|
$result = [];
|
||||||
|
foreach ($languages as $language) {
|
||||||
|
$phrases = $this->phraseModel->getPhrasesByCategoryAndPhrasesAndLanguage($phrasesGroupedByCategory, $language);
|
||||||
|
$result[$language] = $this->getDataOrTerminateWithError($phrases);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTabulatorPhrases()
|
||||||
|
{
|
||||||
|
$languages = json_decode($this->input->get('languages'));
|
||||||
|
if (!$languages || !count($languages)) {
|
||||||
|
$this->load->model('system/Sprache_model', 'sprachenModel');
|
||||||
|
$activeLanguages = $this->sprachenModel->loadWhere(array('content' => true));
|
||||||
|
$activeLanguagesData = $this->getDataOrTerminateWithError($activeLanguages);
|
||||||
|
$languages = array_map(
|
||||||
|
function ($languageData) {
|
||||||
|
return $languageData->sprache;
|
||||||
|
},
|
||||||
|
$activeLanguagesData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->load->model('system/Phrase_model', 'phraseModel');
|
||||||
|
$result = [];
|
||||||
|
foreach ($languages as $language) {
|
||||||
|
$tabulatorPhrases = $this->phraseModel->getPhrasesByCategoryAndLanguage(['tabulator'], $language);
|
||||||
|
$result[$language] = $this->getDataOrTerminateWithError($tabulatorPhrases);
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Pragma: private');
|
||||||
|
header('Cache-Control: private, max-age=' . (60 * 60 * 24 * 30));
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,8 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
if (!defined('BASEPATH'))
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
|
||||||
class Profil extends FHCAPI_Controller
|
class Profil extends FHCAPI_Controller
|
||||||
{
|
{
|
||||||
@@ -27,27 +28,17 @@ class Profil extends FHCAPI_Controller
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct([
|
parent::__construct([
|
||||||
'getView' => self::PERM_LOGGED,
|
'fotoSperre' => self::PERM_LOGGED,
|
||||||
'fotoSperre' => self::PERM_LOGGED,
|
|
||||||
'getGemeinden' => self::PERM_LOGGED,
|
'getGemeinden' => self::PERM_LOGGED,
|
||||||
'getAllNationen' => self::PERM_LOGGED,
|
'getAllNationen' => self::PERM_LOGGED,
|
||||||
'isMitarbeiter' => self::PERM_LOGGED,
|
'isMitarbeiter' => self::PERM_LOGGED,
|
||||||
|
'profilViewData' => self::PERM_LOGGED,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->load->library('PermissionLib');
|
$this->load->library('PermissionLib');
|
||||||
|
|
||||||
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
|
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
|
||||||
$this->load->model('crm/Student_model', 'StudentModel');
|
|
||||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
|
||||||
$this->load->model('person/Person_model', 'PersonModel');
|
$this->load->model('person/Person_model', 'PersonModel');
|
||||||
$this->load->model('person/Adresse_model', 'AdresseModel');
|
|
||||||
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
|
|
||||||
$this->load->model('person/Benutzergruppe_model', 'BenutzergruppeModel');
|
|
||||||
$this->load->model('ressource/Betriebsmittelperson_model', 'BetriebsmittelpersonModel');
|
|
||||||
$this->load->model('person/Kontakt_model', 'KontaktModel');
|
|
||||||
$this->load->model('person/Profil_update_model', 'ProfilUpdateModel');
|
|
||||||
$this->load->model('content/DmsVersion_model', 'DmsVersionModel');
|
|
||||||
|
|
||||||
|
|
||||||
//? put the uid and pid inside the controller for reusability
|
//? put the uid and pid inside the controller for reusability
|
||||||
@@ -59,68 +50,36 @@ class Profil extends FHCAPI_Controller
|
|||||||
//------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
// Public methods
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
* retrieves view data for profile view
|
||||||
* function that returns the data used for the corresponding view
|
* @access public
|
||||||
* the client side parses the @param $uid and calls this function to get the data to the correct view
|
* @param $uid the userID for which profile is being viewed, null or missing value implies one's own profile
|
||||||
* @access public
|
*/
|
||||||
* @param boolean $uid the userID used to identify which information should be retrieved for which view
|
public function profilViewData($uid = null)
|
||||||
* @return stdClass all the data corresponding to a view of a user
|
|
||||||
*/
|
|
||||||
public function getView($uid)
|
|
||||||
{
|
{
|
||||||
$res = new stdClass();
|
$authUid = getAuthUID();
|
||||||
$editAllowed = getAuthUID() == $uid || $this->permissionlib->isBerechtigt('admin');
|
$isProfilOfAuthUser = !$uid || $uid === $authUid;
|
||||||
|
|
||||||
// if parsing the URL did not found a UID then the UID of the logged in user is used
|
$this->load->library('ProfilLib');
|
||||||
if ($uid == "Profil" || $uid == $this->uid) {
|
$profileData = $this->profillib->getView($uid ?? $authUid);
|
||||||
$isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter($this->uid);
|
$profileData = hasData($profileData) ? getData($profileData) : null;
|
||||||
if (isError($isMitarbeiter)) {
|
|
||||||
show_error("error while checking if UID: " . $this->uid . " is a mitarbeiter");
|
|
||||||
}
|
|
||||||
$isMitarbeiter = getData($isMitarbeiter);
|
|
||||||
if ($isMitarbeiter) {
|
|
||||||
$res->view = "MitarbeiterProfil";
|
|
||||||
$res->data = $this->mitarbeiterProfil();
|
|
||||||
$res->data->pid = $this->pid;
|
|
||||||
} else {
|
|
||||||
$res->view = "StudentProfil";
|
|
||||||
$res->data = $this->studentProfil();
|
|
||||||
$res->data->pid = $this->pid;
|
|
||||||
}
|
|
||||||
// editing your own profil - true
|
|
||||||
$editAllowed = true;
|
|
||||||
}
|
|
||||||
// UID is availabe when accessing Profil/View/:uid
|
|
||||||
else {
|
|
||||||
$this->PersonModel->addSelect(["person_id"]);
|
|
||||||
$pid = $this->PersonModel->getByUid($uid);
|
|
||||||
if (isError($pid)) {
|
|
||||||
show_error("error while trying to update table public.tbl_person while searching for a person with UID: " . $uid);
|
|
||||||
}
|
|
||||||
$pid = hasData($pid) ? getData($pid)[0] : null;
|
|
||||||
if (!$pid) {
|
|
||||||
show_error("Person with UID: " . $uid . " does not exist");
|
|
||||||
}
|
|
||||||
$isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter($uid);
|
|
||||||
if (isError($isMitarbeiter)) {
|
|
||||||
show_error("error while checking if UID: " . $uid . " is a mitarbeiter");
|
|
||||||
}
|
|
||||||
$isMitarbeiter = getData($isMitarbeiter);
|
|
||||||
if ($isMitarbeiter) {
|
|
||||||
$res->view = "ViewMitarbeiterProfil";
|
|
||||||
$res->data = $this->viewMitarbeiterProfil($uid);
|
|
||||||
|
|
||||||
} else {
|
$viewData = [
|
||||||
$res->view = "ViewStudentProfil";
|
'editable' => $isProfilOfAuthUser,
|
||||||
$res->data = $this->viewStudentProfil($uid);
|
'profil_data' => $profileData,
|
||||||
}
|
'permissions' => [
|
||||||
|
'basis/other_lv_plan' => $this->permissionlib->isBerechtigt(('basis/other_lv_plan'))
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($isProfilOfAuthUser) {
|
||||||
|
$viewData['calendar_sync_urls'] = $this->getCalendarSyncUrlData();
|
||||||
}
|
}
|
||||||
$res->data->editAllowed = $editAllowed;
|
|
||||||
$this->terminateWithSuccess($res);
|
$this->terminateWithSuccess($viewData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update column foto_sperre in public.tbl_person
|
* update column foto_sperre in public.tbl_person
|
||||||
* @access public
|
* @access public
|
||||||
* @param boolean $value new value for the column
|
* @param boolean $value new value for the column
|
||||||
@@ -128,23 +87,20 @@ class Profil extends FHCAPI_Controller
|
|||||||
*/
|
*/
|
||||||
public function fotoSperre($value)
|
public function fotoSperre($value)
|
||||||
{
|
{
|
||||||
if(!isset($value)){
|
if (!isset($value)) {
|
||||||
$this->terminateWithError("Missing parameter", self::ERROR_TYPE_GENERAL);
|
$this->terminateWithError("Missing parameter", self::ERROR_TYPE_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = $this->PersonModel->update($this->pid, ["foto_sperre" => $value]);
|
$res = $this->PersonModel->update($this->pid, ["foto_sperre" => $value]);
|
||||||
if (isError($res)) {
|
if (isError($res)) {
|
||||||
show_error("error while trying to update table public.tbl_person");
|
$this->terminateWithError("error while trying to update table public.tbl_person");
|
||||||
}
|
}
|
||||||
$this->PersonModel->addSelect("foto_sperre");
|
$this->PersonModel->addSelect("foto_sperre");
|
||||||
$res = $this->PersonModel->load($this->pid);
|
$res = $this->PersonModel->load($this->pid);
|
||||||
if (isError($res)) {
|
|
||||||
show_error("error while trying to query table public.tbl_person");
|
|
||||||
}
|
|
||||||
|
|
||||||
$res = $this->getDataOrTerminateWithError($res);
|
$res = $this->getDataOrTerminateWithError($res);
|
||||||
|
|
||||||
$this->terminateWithSuccess(current($res));
|
$this->terminateWithSuccess(current($res));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,7 +119,7 @@ class Profil extends FHCAPI_Controller
|
|||||||
if (isError($nation_res)) {
|
if (isError($nation_res)) {
|
||||||
$this->terminateWithError("error while trying to query table codex.tbl_nation", self::ERROR_TYPE_GENERAL);
|
$this->terminateWithError("error while trying to query table codex.tbl_nation", self::ERROR_TYPE_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nation_res = $this->getDataOrTerminateWithError($nation_res);
|
$nation_res = $this->getDataOrTerminateWithError($nation_res);
|
||||||
|
|
||||||
$this->terminateWithSuccess($nation_res);
|
$this->terminateWithSuccess($nation_res);
|
||||||
@@ -171,114 +127,30 @@ class Profil extends FHCAPI_Controller
|
|||||||
|
|
||||||
public function getGemeinden($nation, $zip)
|
public function getGemeinden($nation, $zip)
|
||||||
{
|
{
|
||||||
if(!isset($nation) || !isset($zip)){
|
if (!isset($nation) || !isset($zip)) {
|
||||||
echo json_encode(error("Missing parameters"));
|
echo json_encode(error("Missing parameters"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('codex/Gemeinde_model', "GemeindeModel");
|
$this->load->model('codex/Gemeinde_model', "GemeindeModel");
|
||||||
|
|
||||||
|
|
||||||
$gemeinde_res = $this->GemeindeModel->getGemeindeByPlz($zip);
|
$gemeinde_res = $this->GemeindeModel->getGemeindeByPlz($zip);
|
||||||
|
|
||||||
if (isError($gemeinde_res)) {
|
if (isError($gemeinde_res)) {
|
||||||
$this->terminateWithError(getError($gemeinde_res),self::ERROR_TYPE_GENERAL);
|
$this->terminateWithError(getError($gemeinde_res), self::ERROR_TYPE_GENERAL);
|
||||||
}
|
}
|
||||||
$gemeinde_res = $this->getDataOrTerminateWithError($gemeinde_res);
|
$gemeinde_res = $this->getDataOrTerminateWithError($gemeinde_res);
|
||||||
|
|
||||||
/* $gemeinde_res = array_map(function ($obj) {
|
/* $gemeinde_res = array_map(function ($obj) {
|
||||||
return $obj->ortschaftsname;
|
return $obj->ortschaftsname;
|
||||||
}, $gemeinde_res); */
|
}, $gemeinde_res); */
|
||||||
|
|
||||||
$this->terminateWithSuccess($gemeinde_res);
|
$this->terminateWithSuccess($gemeinde_res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
|
||||||
// Private methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function that returns the data used for viewing another mitarbeiter profile
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID to retrieve the mitarbeiter data
|
|
||||||
* @return stdClass restricted mitarbeiter data
|
|
||||||
*/
|
|
||||||
private function viewMitarbeiterProfil($uid)
|
|
||||||
{
|
|
||||||
$mailverteiler_res = $this->getMailverteiler($uid);
|
|
||||||
$benutzer_funktion_res = $this->getBenutzerFunktion($uid);
|
|
||||||
$benutzer_res = $this->getBenutzerAlias($uid);
|
|
||||||
$person_res = $this->getPersonInfo($uid);
|
|
||||||
$mitarbeiter_res = $this->getMitarbeiterInfo($uid);
|
|
||||||
$telefon_res = $this->getTelefonInfo($uid);
|
|
||||||
|
|
||||||
$res = new stdClass();
|
|
||||||
$res->username = $uid;
|
|
||||||
|
|
||||||
//? Person Info
|
|
||||||
foreach ($person_res as $key => $val) {
|
|
||||||
$res->$key = $val;
|
|
||||||
}
|
|
||||||
|
|
||||||
//? Mitarbeiter Info
|
|
||||||
foreach ($mitarbeiter_res as $key => $val) {
|
|
||||||
$res->$key = $val;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$intern_email = array();
|
|
||||||
$intern_email["type"] = "intern";
|
|
||||||
$intern_email["email"] = $uid . "@" . DOMAIN;
|
|
||||||
$extern_email = array();
|
|
||||||
$extern_email["type"] = "alias";
|
|
||||||
$extern_email["email"] = $benutzer_res->alias . "@" . DOMAIN;
|
|
||||||
$res->emails = array($intern_email, $extern_email);
|
|
||||||
|
|
||||||
$res->funktionen = $benutzer_funktion_res;
|
|
||||||
$res->mailverteiler = $mailverteiler_res;
|
|
||||||
$res->standort_telefon = isset($telefon_res) ? $telefon_res->kontakt : null;
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function that returns the data used for viewing another student profile
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID to retrieve the student data
|
|
||||||
* @return stdClass restricted student data
|
|
||||||
*/
|
|
||||||
private function viewStudentProfil($uid)
|
|
||||||
{
|
|
||||||
$mailverteiler_res = $this->getMailverteiler($uid);
|
|
||||||
$person_res = $this->getPersonInfo($uid);
|
|
||||||
$student_res = $this->getStudentInfo($uid);
|
|
||||||
$matr_res = $this->getMatrikelNummer($uid);
|
|
||||||
|
|
||||||
$res = new stdClass();
|
|
||||||
$res->username = $uid;
|
|
||||||
|
|
||||||
//? Person Information
|
|
||||||
foreach ($person_res as $key => $value) {
|
|
||||||
$res->$key = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//? Student Information
|
|
||||||
foreach ($student_res as $key => $value) {
|
|
||||||
$res->$key = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$intern_email = array();
|
|
||||||
$intern_email["type"] = "intern";
|
|
||||||
$intern_email["email"] = $uid . "@" . DOMAIN;
|
|
||||||
|
|
||||||
$res->emails = [$intern_email];
|
|
||||||
$res->matrikelnummer = $matr_res->matr_nr;
|
|
||||||
$res->mailverteiler = $mailverteiler_res;
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks whether a specific userID is a mitarbeiter or not (foreword declaration of the function isMitarbeiter in Mitarbeiter_model.php)
|
* checks whether a specific userID is a mitarbeiter or not (foreword declaration of the function isMitarbeiter in Mitarbeiter_model.php)
|
||||||
* @access public
|
* @access public
|
||||||
@@ -288,408 +160,48 @@ class Profil extends FHCAPI_Controller
|
|||||||
public function isMitarbeiter($uid)
|
public function isMitarbeiter($uid)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!$uid) $this->terminateWithError("No uid provided", self::ERROR_TYPE_GENERAL);
|
if (!$uid)
|
||||||
|
$this->terminateWithError("No uid provided", self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
|
||||||
$result = $this->MitarbeiterModel->isMitarbeiter($uid);
|
$result = $this->MitarbeiterModel->isMitarbeiter($uid);
|
||||||
|
|
||||||
if (isError($result)) {
|
if (isError($result)) {
|
||||||
$this->terminateWithError("error when calling Mitarbeiter_model function isMitarbeiter with uid " . $uid, self::ERROR_TYPE_GENERAL);
|
$this->terminateWithError("error when calling Mitarbeiter_model function isMitarbeiter with uid " . $uid, self::ERROR_TYPE_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->getDataOrTerminateWithError($result);
|
$result = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
$this->terminateWithSuccess($result);
|
$this->terminateWithSuccess($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
* function that returns the data used for the mitarbeiter profile
|
// Private methods
|
||||||
* @access private
|
|
||||||
* @return stdClass mitarbeiter data
|
|
||||||
*/
|
|
||||||
private function mitarbeiterProfil()
|
|
||||||
{
|
|
||||||
|
|
||||||
$zutrittskarte_ausgegebenam = $this->getZutrittskarteDatum($this->uid);
|
|
||||||
$adresse_res = $this->getAdressenInfo($this->pid);
|
|
||||||
$kontakte_res = $this->getKontaktInfo($this->pid);
|
|
||||||
$mailverteiler_res = $this->getMailverteiler($this->uid);
|
|
||||||
$person_res = $this->getPersonInfo($this->uid, true);
|
|
||||||
$benutzer_funktion_res = $this->getBenutzerFunktion($this->uid);
|
|
||||||
$betriebsmittelperson_res = $this->getBetriebsmittelInfo($this->pid);
|
|
||||||
$profilUpdates = $this->getProfilUpdates($this->uid);
|
|
||||||
$telefon_res = $this->getTelefonInfo($this->uid);
|
|
||||||
$mitarbeiter_res = $this->getMitarbeiterInfo($this->uid);
|
|
||||||
|
|
||||||
$res = new stdClass();
|
|
||||||
$res->username = $this->uid;
|
|
||||||
|
|
||||||
//? Person Information
|
|
||||||
foreach ($person_res as $key => $value) {
|
|
||||||
$res->$key = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//? Mitarbeiter Information
|
|
||||||
foreach ($mitarbeiter_res as $key => $value) {
|
|
||||||
$res->$key = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$res->adressen = $adresse_res;
|
|
||||||
$res->zutrittsdatum = $zutrittskarte_ausgegebenam;
|
|
||||||
$res->kontakte = $kontakte_res;
|
|
||||||
$res->mittel = $betriebsmittelperson_res;
|
|
||||||
$res->mailverteiler = $mailverteiler_res;
|
|
||||||
|
|
||||||
$intern_email = array();
|
|
||||||
$intern_email["type"] = "intern";
|
|
||||||
$intern_email["email"] = $this->uid . "@" . DOMAIN;
|
|
||||||
$extern_email = array();
|
|
||||||
$extern_email["type"] = "alias";
|
|
||||||
$extern_email["email"] = $mitarbeiter_res->alias . "@" . DOMAIN;
|
|
||||||
$res->emails = [$intern_email, $extern_email];
|
|
||||||
|
|
||||||
$res->funktionen = $benutzer_funktion_res;
|
|
||||||
$res->standort_telefon = $telefon_res;
|
|
||||||
$res->profilUpdates = $profilUpdates;
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function that returns the data used for the student profile
|
* gets the identifier, phrase, and url for each calendar sync option
|
||||||
* @access private
|
|
||||||
* @return stdClass student data
|
|
||||||
*/
|
|
||||||
private function studentProfil()
|
|
||||||
{
|
|
||||||
$betriebsmittelperson_res = $this->getBetriebsmittelInfo($this->pid);
|
|
||||||
$kontakte_res = $this->getKontaktInfo($this->pid);
|
|
||||||
$zutrittskarte_ausgegebenam = $this->getZutrittskarteDatum($this->uid);
|
|
||||||
$adresse_res = $this->getAdressenInfo($this->pid);
|
|
||||||
$mailverteiler_res = $this->getMailverteiler($this->uid);
|
|
||||||
$person_res = $this->getPersonInfo($this->uid, true);
|
|
||||||
$zutrittsgruppe_res = $this->getZutrittsgruppen($this->uid);
|
|
||||||
$student_res = $this->getStudentInfo($this->uid);
|
|
||||||
$matr_res = $this->getMatrikelNummer($this->uid);
|
|
||||||
$profilUpdates = $this->getProfilUpdates($this->uid);
|
|
||||||
|
|
||||||
$res = new stdClass();
|
|
||||||
$res->username = $this->uid;
|
|
||||||
|
|
||||||
//? Person Information
|
|
||||||
foreach ($person_res as $key => $value) {
|
|
||||||
$res->$key = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//? Student Information
|
|
||||||
foreach ($student_res as $key => $value) {
|
|
||||||
$res->$key = trim($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
$intern_email = array();
|
|
||||||
$intern_email["type"] = "intern";
|
|
||||||
$intern_email["email"] = $this->uid . "@" . DOMAIN;
|
|
||||||
|
|
||||||
$res->emails = [$intern_email];
|
|
||||||
$res->adressen = $adresse_res;
|
|
||||||
$res->zutrittsdatum = $zutrittskarte_ausgegebenam;
|
|
||||||
$res->kontakte = $kontakte_res;
|
|
||||||
$res->mittel = $betriebsmittelperson_res;
|
|
||||||
$res->matrikelnummer = $matr_res->matr_nr;
|
|
||||||
$res->zuttritsgruppen = $zutrittsgruppe_res;
|
|
||||||
$res->mailverteiler = $mailverteiler_res;
|
|
||||||
$res->profilUpdates = $profilUpdates;
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets all the mailverteiler using the tables: tbl_benutzer, tbl_benutzergruppe, tbl_gruppe
|
|
||||||
* @access private
|
* @access private
|
||||||
* @param integer $uid the userID used to retrieve the mailverteiler
|
* @return array array of arrays, where each child array is a sync option
|
||||||
* @return array returns the mailvertailer corresponding to a userID
|
|
||||||
*/
|
*/
|
||||||
private function getMailverteiler($uid)
|
private function getCalendarSyncUrlData()
|
||||||
{
|
{
|
||||||
$this->PersonModel->addSelect('gruppe_kurzbz, beschreibung');
|
return [
|
||||||
$this->PersonModel->addJoin('tbl_benutzer', 'person_id');
|
[
|
||||||
$this->PersonModel->addJoin('tbl_benutzergruppe', 'uid');
|
"identifier" => "cal_dav",
|
||||||
$this->PersonModel->addJoin('tbl_gruppe', 'gruppe_kurzbz');
|
"labelPhrase" => "profil/calendar_sync_cal_dav",
|
||||||
|
"url" => APP_ROOT . "webdav/lvplan.php/calendars/" . $this->uid . "/LVPlan-" . $this->uid,
|
||||||
$mailverteiler_res = $this->PersonModel->loadWhere(array('mailgrp' => true, 'uid' => $uid));
|
],
|
||||||
if (isError($mailverteiler_res)) {
|
[
|
||||||
show_error("was not able to query the table public.tbl_benutzer:" . getData($mailverteiler_res));
|
"identifier" => "cal_dav_principal",
|
||||||
}
|
"labelPhrase" => "profil/calendar_sync_cal_dav_principal",
|
||||||
$mailverteiler_res = hasData($mailverteiler_res) ? getData($mailverteiler_res) : null;
|
"url" => APP_ROOT . "webdav/lvplan.php/principals/" . $this->uid,
|
||||||
$mailverteiler_res = array_map(function ($element) {
|
],
|
||||||
$element->mailto = "mailto:" . $element->gruppe_kurzbz . "@" . DOMAIN;
|
[
|
||||||
return $element;
|
"identifier" => "i_cal",
|
||||||
}, $mailverteiler_res);
|
"labelPhrase" => "profil/calendar_sync_i_cal",
|
||||||
return $mailverteiler_res;
|
"url" => APP_ROOT . "webdav/google.php?cal=" . encryptData($this->uid, LVPLAN_CYPHER_KEY) . "&" . microtime(true),
|
||||||
}
|
],
|
||||||
|
];
|
||||||
/**
|
|
||||||
* gets all the Benutzerfunktionen of a corresponding user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to retrieve the Benutzerfunktionen
|
|
||||||
* @return array returns the Benutzerfunktionen corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getBenutzerFunktion($uid)
|
|
||||||
{
|
|
||||||
$this->BenutzerfunktionModel->addSelect(["tbl_benutzerfunktion.bezeichnung as Bezeichnung", "tbl_organisationseinheit.bezeichnung as Organisationseinheit", "datum_von as Gültig_von", "datum_bis as Gültig_bis", "wochenstunden as Wochenstunden"]);
|
|
||||||
$this->BenutzerfunktionModel->addJoin("tbl_organisationseinheit", "oe_kurzbz");
|
|
||||||
|
|
||||||
$benutzer_funktion_res = $this->BenutzerfunktionModel->loadWhere(array('uid' => $uid));
|
|
||||||
if (isError($benutzer_funktion_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_benutzerfunktion:" . getData($benutzer_funktion_res));
|
|
||||||
}
|
|
||||||
$benutzer_funktion_res = hasData($benutzer_funktion_res) ? getData($benutzer_funktion_res) : null;
|
|
||||||
return $benutzer_funktion_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets all the Betriebsmittel of a corresponding user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to retrieve the Betriebsmittel
|
|
||||||
* @return array returns the Betriebsmittel corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getBetriebsmittelInfo($pid)
|
|
||||||
{
|
|
||||||
$this->BetriebsmittelpersonModel->addSelect(["CONCAT(betriebsmitteltyp, ' ' ,beschreibung) as Betriebsmittel", "nummer as Nummer", "ausgegebenam as Ausgegeben_am"]);
|
|
||||||
|
|
||||||
//? betriebsmittel are not needed in a view
|
|
||||||
$betriebsmittelperson_res = $this->BetriebsmittelpersonModel->getBetriebsmittel($pid);
|
|
||||||
if (isError($betriebsmittelperson_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_betriebsmittelperson:" . getData($betriebsmittelperson_res));
|
|
||||||
}
|
|
||||||
$betriebsmittelperson_res = hasData($betriebsmittelperson_res) ? getData($betriebsmittelperson_res) : null;
|
|
||||||
return $betriebsmittelperson_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the alias of a corresponding user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the alias
|
|
||||||
* @return string the alias of the userID
|
|
||||||
*/
|
|
||||||
private function getBenutzerAlias($uid)
|
|
||||||
{
|
|
||||||
$this->BenutzerModel->addSelect(["alias"]);
|
|
||||||
$benutzer_res = $this->BenutzerModel->load([$uid]);
|
|
||||||
if (isError($benutzer_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_benutzer:" . getData($benutzer_res));
|
|
||||||
} else {
|
|
||||||
$benutzer_res = hasData($benutzer_res) ? getData($benutzer_res)[0] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $benutzer_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the person information corresponding to a user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the person information
|
|
||||||
* @param integer $geburtsInfo flag wether to add the columns gebort, gebdatum, foto_sperre or not
|
|
||||||
* @return array all the person informaion corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getPersonInfo($uid, $geburtsInfo = null)
|
|
||||||
{
|
|
||||||
$selectClause = ["foto", "foto_sperre", "anrede", "titelpost as postnomen", "titelpre as titel", "vorname", "nachname"];
|
|
||||||
/** @param integer $geburtsInfo */
|
|
||||||
if ($geburtsInfo) {
|
|
||||||
array_push($selectClause, "gebort");
|
|
||||||
array_push($selectClause, "gebdatum");
|
|
||||||
}
|
|
||||||
$this->BenutzerModel->addSelect($selectClause);
|
|
||||||
$this->BenutzerModel->addJoin("tbl_person", "person_id");
|
|
||||||
|
|
||||||
$person_res = $this->BenutzerModel->load([$uid]);
|
|
||||||
if (isError($person_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_benutzer:" . getData($person_res));
|
|
||||||
} else {
|
|
||||||
$person_res = hasData($person_res) ? getData($person_res)[0] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ($person_res->foto === null) || (($this->uid !== $uid) && ($person_res->foto_sperre !== false)) )
|
|
||||||
{
|
|
||||||
$dummy_foto = base64_encode(file_get_contents(DOC_ROOT.'skin/images/profilbild_dummy.jpg'));
|
|
||||||
$person_res->foto = $dummy_foto;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $person_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the mitarbeiter information corresponding to a user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the mitarbeiter information
|
|
||||||
* @return array all the mitarbeiter informaion corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getMitarbeiterInfo($uid)
|
|
||||||
{
|
|
||||||
$this->MitarbeiterModel->addSelect(["kurzbz", "telefonklappe", "alias", "ort_kurzbz"]);
|
|
||||||
$this->MitarbeiterModel->addJoin("tbl_benutzer", "tbl_benutzer.uid = tbl_mitarbeiter.mitarbeiter_uid");
|
|
||||||
$mitarbeiter_res = $this->MitarbeiterModel->load($uid);
|
|
||||||
if (isError($mitarbeiter_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_mitarbeiter:" . getData($mitarbeiter_res));
|
|
||||||
} else {
|
|
||||||
$mitarbeiter_res = hasData($mitarbeiter_res) ? getData($mitarbeiter_res)[0] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $mitarbeiter_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the telefon information corresponding to a user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the telefon information
|
|
||||||
* @return array all the telefon informaion corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getTelefonInfo($uid)
|
|
||||||
{
|
|
||||||
$this->MitarbeiterModel->addSelect(["kontakt"]);
|
|
||||||
$this->MitarbeiterModel->addJoin("tbl_kontakt", "tbl_mitarbeiter.standort_id = tbl_kontakt.standort_id");
|
|
||||||
$this->MitarbeiterModel->addLimit(1);
|
|
||||||
$telefon_res = $this->MitarbeiterModel->loadWhere(["mitarbeiter_uid" => $uid, "kontakttyp" => "telefon"]);
|
|
||||||
if (isError($telefon_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_mitarbeiter:" . getData($telefon_res));
|
|
||||||
}
|
|
||||||
$telefon_res = hasData($telefon_res) ? getData($telefon_res)[0] : null;
|
|
||||||
return $telefon_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the student information corresponding to a user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the student information
|
|
||||||
* @return array all the student informaion corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getStudentInfo($uid)
|
|
||||||
{
|
|
||||||
$this->StudentModel->addSelect(['tbl_studiengang.bezeichnung as studiengang', 'tbl_student.semester', 'tbl_student.verband', 'tbl_student.gruppe', 'tbl_student.matrikelnr as personenkennzeichen']);
|
|
||||||
$this->StudentModel->addJoin('tbl_studiengang', "tbl_studiengang.studiengang_kz=tbl_student.studiengang_kz");
|
|
||||||
|
|
||||||
$student_res = $this->StudentModel->load([$uid]);
|
|
||||||
if (isError($student_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_student:" . getData($student_res));
|
|
||||||
}
|
|
||||||
$student_res = hasData($student_res) ? getData($student_res)[0] : null;
|
|
||||||
return $student_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the profil updates corresponding to a user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the profil updates
|
|
||||||
* @return array all the profil updates corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getProfilUpdates($uid)
|
|
||||||
{
|
|
||||||
$profilUpdates = $this->ProfilUpdateModel->getProfilUpdatesWhere(['uid' => $uid]);
|
|
||||||
if (isError($profilUpdates)) {
|
|
||||||
show_error("was not able to query the table public.tbl_profil_update:" . getData($profilUpdates));
|
|
||||||
}
|
|
||||||
$profilUpdates = hasData($profilUpdates) ? getData($profilUpdates) : null;
|
|
||||||
return $profilUpdates;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the Matrikelnummer corresponding to a user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the Matrikelnummer
|
|
||||||
* @return integer the Matrikelnummer corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getMatrikelNummer($uid)
|
|
||||||
{
|
|
||||||
$this->BenutzerModel->addSelect(["matr_nr"]);
|
|
||||||
$this->BenutzerModel->addJoin("tbl_person", "person_id");
|
|
||||||
|
|
||||||
$matr_res = $this->BenutzerModel->load([$uid]);
|
|
||||||
if (isError($matr_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_benutzer:" . getData($matr_res));
|
|
||||||
}
|
|
||||||
$matr_res = hasData($matr_res) ? getData($matr_res)[0] : [];
|
|
||||||
return $matr_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the Zutrittsgruppen corresponding to a user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the Zutrittsgruppen
|
|
||||||
* @return array all the Zutrittsgruppen corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getZutrittsgruppen($uid)
|
|
||||||
{
|
|
||||||
$this->BenutzergruppeModel->addSelect(['bezeichnung']);
|
|
||||||
$this->BenutzergruppeModel->addJoin('tbl_gruppe', 'gruppe_kurzbz');
|
|
||||||
|
|
||||||
$zutrittsgruppe_res = $this->BenutzergruppeModel->loadWhere(array("uid" => $uid, "zutrittssystem" => true));
|
|
||||||
if (isError($zutrittsgruppe_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_benutzergruppe:" . getData($zutrittsgruppe_res));
|
|
||||||
}
|
|
||||||
$zutrittsgruppe_res = hasData($zutrittsgruppe_res) ? getData($zutrittsgruppe_res) : null;
|
|
||||||
return $zutrittsgruppe_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the address information corresponding to a user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the address information
|
|
||||||
* @return array all the address information corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getAdressenInfo($pid)
|
|
||||||
{
|
|
||||||
$adresse_res = $this->AdresseModel->addSelect(["adresse_id", "strasse", "tbl_adressentyp.bezeichnung as typ", "plz", "ort", "zustelladresse", "gemeinde", "nation"]);
|
|
||||||
$adresse_res = $this->AdresseModel->addOrder("zustelladresse", "DESC");
|
|
||||||
$adresse_res = $this->AdresseModel->addJoin("tbl_adressentyp", "typ=adressentyp_kurzbz");
|
|
||||||
|
|
||||||
$adresse_res = $this->AdresseModel->loadWhere(["person_id" => $pid]);
|
|
||||||
if (isError($adresse_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_adresse:" . getData($adresse_res));
|
|
||||||
}
|
|
||||||
$adresse_res = hasData($adresse_res) ? getData($adresse_res) : null;
|
|
||||||
return $adresse_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the kontakt information corresponding to a user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the kontakt information
|
|
||||||
* @return array all the kontakt information corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getKontaktInfo($pid)
|
|
||||||
{
|
|
||||||
$this->KontaktModel->addSelect(['kontakttyp', 'kontakt_id', 'kontakt', 'tbl_kontakt.anmerkung', 'tbl_kontakt.zustellung']);
|
|
||||||
$this->KontaktModel->addJoin('public.tbl_standort', 'standort_id', 'LEFT');
|
|
||||||
$this->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT');
|
|
||||||
$this->KontaktModel->addOrder('kontakttyp, kontakt, tbl_kontakt.updateamum, tbl_kontakt.insertamum');
|
|
||||||
|
|
||||||
$kontakte_res = $this->KontaktModel->loadWhere(['person_id' => $pid]);
|
|
||||||
if (isError($kontakte_res)) {
|
|
||||||
show_error("was not able to query the table public.tbl_kontakt:" . getData($kontakte_res));
|
|
||||||
}
|
|
||||||
$kontakte_res = hasData($kontakte_res) ? getData($kontakte_res) : null;
|
|
||||||
return $kontakte_res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the date of issue of the FH access card corresponding to a user
|
|
||||||
* @access private
|
|
||||||
* @param integer $uid the userID used to get the date of issue of the FH access card
|
|
||||||
* @return string the date of issue of the FH access card corresponding to a userID
|
|
||||||
*/
|
|
||||||
private function getZutrittskarteDatum($uid)
|
|
||||||
{
|
|
||||||
$zutrittskarte_ausgegebenam = $this->BetriebsmittelpersonModel->getBetriebsmittelByUid($uid, "Zutrittskarte");
|
|
||||||
if (isError($zutrittskarte_ausgegebenam)) {
|
|
||||||
show_error("was not able to query the table wavi.tbl_bentriebsmittelperson:" . getData($zutrittskarte_ausgegebenam));
|
|
||||||
}
|
|
||||||
$zutrittskarte_ausgegebenam = hasData($zutrittskarte_ausgegebenam) ? getData($zutrittskarte_ausgegebenam)[0]->ausgegebenam : null;
|
|
||||||
|
|
||||||
//? formats date from 01-01-2000 to 01.01.2000
|
|
||||||
$zutrittskarte_ausgegebenam = str_replace("-", ".", $zutrittskarte_ausgegebenam);
|
|
||||||
return $zutrittskarte_ausgegebenam;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
'updateProfilRequest' => self::PERM_LOGGED,
|
'updateProfilRequest' => self::PERM_LOGGED,
|
||||||
'deleteProfilRequest' => self::PERM_LOGGED,
|
'deleteProfilRequest' => self::PERM_LOGGED,
|
||||||
'insertFile' => self::PERM_LOGGED,
|
'insertFile' => self::PERM_LOGGED,
|
||||||
|
'updateProfilbild' => self::PERM_LOGGED,
|
||||||
'show' => self::PERM_LOGGED,
|
'show' => self::PERM_LOGGED,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -478,12 +479,101 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
$this->terminateWithSuccess($res);
|
$this->terminateWithSuccess($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateProfilbild()
|
||||||
|
{
|
||||||
|
|
||||||
|
$resize = function($filename, $width, $height){
|
||||||
|
// Hoehe und Breite neu berechnen
|
||||||
|
list($width_orig, $height_orig) = getimagesize($filename);
|
||||||
|
|
||||||
|
if ($width && ($width_orig < $height_orig))
|
||||||
|
{
|
||||||
|
$width = ($height / $height_orig) * $width_orig;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$height = ($width / $width_orig) * $height_orig;
|
||||||
|
}
|
||||||
|
|
||||||
|
$image_p = imagecreatetruecolor($width, $height);
|
||||||
|
|
||||||
|
$image = imagecreatefromjpeg($filename);
|
||||||
|
|
||||||
|
//Bild nur verkleinern aber nicht vergroessern
|
||||||
|
if($width_orig>$width || $height_orig>$height)
|
||||||
|
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
|
||||||
|
else
|
||||||
|
$image_p = $image;
|
||||||
|
|
||||||
|
imagejpeg($image_p, $filename, 80);
|
||||||
|
|
||||||
|
@imagedestroy($image_p);
|
||||||
|
@imagedestroy($image);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!count($_FILES)) {
|
||||||
|
$this->terminateWithError("No file available for upload");
|
||||||
|
}
|
||||||
|
|
||||||
|
$files = $_FILES['files'];
|
||||||
|
|
||||||
|
$_FILES['files']['name'] = current($files['name']);
|
||||||
|
$_FILES['files']['type'] = current($files['type']);
|
||||||
|
$_FILES['files']['tmp_name'] = current($files['tmp_name']);
|
||||||
|
$_FILES['files']['error'] = current($files['error']);
|
||||||
|
$_FILES['files']['size'] = current($files['size']);
|
||||||
|
$_FILES['files']['tmp_name'] = current($files['tmp_name']);
|
||||||
|
|
||||||
|
$filename = $_FILES['files']['tmp_name'];
|
||||||
|
|
||||||
|
$ext = substr(current($files['name']), strrpos(current($files['name']), '.') + 1);
|
||||||
|
if($ext!='jpg' && $ext!='jpeg'){
|
||||||
|
$this->terminateWithError("Only jpg and jpeg files are allowed for profilbild upload");
|
||||||
|
}
|
||||||
|
|
||||||
|
// resize
|
||||||
|
$resize($filename, 827, 1063);
|
||||||
|
|
||||||
|
//akte
|
||||||
|
$fp = fopen($filename,'r');
|
||||||
|
//auslesen
|
||||||
|
$content = fread($fp, filesize($filename));
|
||||||
|
$base64_content = base64_encode($content);
|
||||||
|
$this->load->library('AkteLib');
|
||||||
|
$aktenInsertResult = $this->aktelib->add($this->pid,'Lichtbil',"Lichtbild_".$this->pid.".jpg","image/jpg",$fp,"Lichtbild gross");
|
||||||
|
fclose($fp);
|
||||||
|
if (isError($aktenInsertResult)) {
|
||||||
|
$this->terminateWithError(getError($aktenInsertResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
// in person abspeichern
|
||||||
|
$resize($filename, 101, 130);
|
||||||
|
$fp = fopen($filename,'r');
|
||||||
|
$content = fread($fp, filesize($filename));
|
||||||
|
fclose($fp);
|
||||||
|
$base64_content = base64_encode($content);
|
||||||
|
$this->load->model('person/Person_model','PersonModel');
|
||||||
|
$personUpdate = $this->PersonModel->update($this->pid, ["foto"=>$base64_content]);
|
||||||
|
if(isError($personUpdate)){
|
||||||
|
$this->terminateWithError(getError($personUpdate));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// update foto status
|
||||||
|
$this->load->model('person/Fotostatusperson_model','FotostatusModel');
|
||||||
|
$fotoInsert = $this->FotostatusModel->insert(["person_id"=>$this->pid,"fotostatus_kurzbz"=>"hochgeladen","datum"=>date('Y-m-d'),"insertamum"=>date('Y-m-d H:i:s'),"insertvon"=>$this->uid,"updateamum"=>date('Y-m-d H:i:s'),"updatevon"=>$this->uid]);
|
||||||
|
if(isError($fotoInsert)){
|
||||||
|
$this->terminateWithError(getError($fotoInsert));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
public function getProfilUpdateWithPermission($status = null)
|
public function getProfilUpdateWithPermission($status = null)
|
||||||
{
|
{
|
||||||
// early return if no status has been passed as argument
|
// early return if no status has been passed as argument
|
||||||
if (!isset($status)) {
|
if (!isset($status)) {
|
||||||
echo json_encode($this->ProfilUpdateModel->getProfilUpdateWithPermission());
|
$this->terminateWithSuccess($this->ProfilUpdateModel->getProfilUpdateWithPermission());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the sprache of the user
|
// get the sprache of the user
|
||||||
@@ -496,7 +586,7 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
$status = hasData($status) ? getData($status)[0]->status_kurzbz : null;
|
$status = hasData($status) ? getData($status)[0]->status_kurzbz : null;
|
||||||
$res = $this->ProfilUpdateModel->getProfilUpdateWithPermission(isset($status) ? ['status' => $status] : null);
|
$res = $this->ProfilUpdateModel->getProfilUpdateWithPermission(isset($status) ? ['status' => $status] : null);
|
||||||
|
|
||||||
echo json_encode($res);
|
$this->terminateWithSuccess($res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,9 +637,10 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
//? Send email to the Studiengangsassistentinnen
|
//? Send email to the Studiengangsassistentinnen
|
||||||
$this->StudentModel->addSelect(["public.tbl_studiengang.email"]);
|
$this->StudentModel->addSelect(["public.tbl_studiengang.email"]);
|
||||||
$this->StudentModel->addJoin("public.tbl_benutzer", "public.tbl_benutzer.uid = public.tbl_student.student_uid");
|
$this->StudentModel->addJoin("public.tbl_benutzer", "public.tbl_benutzer.uid = public.tbl_student.student_uid");
|
||||||
$this->StudentModel->addJoin("public.tbl_prestudent", "public.tbl_benutzer.person_id = public.tbl_prestudent.person_id");
|
$this->StudentModel->addJoin("public.tbl_prestudent", "public.tbl_benutzer.person_id = public.tbl_prestudent.person_id and public.tbl_student.studiengang_kz = public.tbl_prestudent.studiengang_kz");
|
||||||
$this->StudentModel->addJoin("public.tbl_prestudentstatus", "public.tbl_prestudentstatus.prestudent_id = public.tbl_prestudent.prestudent_id");
|
$this->StudentModel->addJoin("public.tbl_prestudentstatus", "public.tbl_prestudentstatus.prestudent_id = public.tbl_prestudent.prestudent_id");
|
||||||
$this->StudentModel->addJoin("public.tbl_studiengang", "public.tbl_studiengang.studiengang_kz = public.tbl_prestudent.studiengang_kz");
|
$this->StudentModel->addJoin("public.tbl_studiengang", "public.tbl_studiengang.studiengang_kz = public.tbl_prestudent.studiengang_kz");
|
||||||
|
$this->StudentModel->addGroupBy(["public.tbl_studiengang.email"]);
|
||||||
//* check if the benutzer itself is active
|
//* check if the benutzer itself is active
|
||||||
//* check if the student status is Student or Diplomand (active students)
|
//* check if the student status is Student or Diplomand (active students)
|
||||||
$this->StudentModel->db->where_in("public.tbl_prestudentstatus.status_kurzbz", ['Student', 'Diplomand']);
|
$this->StudentModel->db->where_in("public.tbl_prestudentstatus.status_kurzbz", ['Student', 'Diplomand']);
|
||||||
@@ -566,8 +657,10 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
}
|
}
|
||||||
$mail_res = [];
|
$mail_res = [];
|
||||||
//? sending email
|
//? sending email
|
||||||
foreach ($emails as $email) {
|
foreach ($emails as $email)
|
||||||
array_push($mail_res, sendSanchoMail("profil_update", ['uid' => $uid, 'topic' => $topic, 'href' => APP_ROOT . 'Cis/ProfilUpdate/id/' . $profil_update_id], $email, ("Profil Änderung von " . $uid)));
|
{
|
||||||
|
$href = $this->config->item('cis_vilesci_base_url') . $this->config->item('cis_vilesci_index_page') . '/Cis/ProfilUpdate/id/' . $profil_update_id;
|
||||||
|
array_push($mail_res, sendSanchoMail("profil_update", ['uid' => $uid, 'topic' => $topic, 'href' => $href], $email, ("Profil Änderung von " . $uid)));
|
||||||
}
|
}
|
||||||
foreach ($mail_res as $m_res) {
|
foreach ($mail_res as $m_res) {
|
||||||
if (!$m_res) {
|
if (!$m_res) {
|
||||||
@@ -590,21 +683,21 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
|
|
||||||
function languageQuery($language)
|
function languageQuery($language)
|
||||||
{
|
{
|
||||||
return "select index from public.tbl_sprache where sprache = '" + $language + "'";
|
return "select index from public.tbl_sprache where sprache = '" . $language . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->ProfilUpdateStatusModel->addSelect(["bezeichnung_mehrsprachig[(" . languageQuery('German') . ")] as status_de", "bezeichnung_mehrsprachig[(" . languageQuery('English') . ")] as status_en"]);
|
$this->ProfilUpdateStatusModel->addSelect(["bezeichnung_mehrsprachig[(" . languageQuery('German') . ")] as status_de", "bezeichnung_mehrsprachig[(" . languageQuery('English') . ")] as status_en"]);
|
||||||
|
|
||||||
$status_translation = $this->ProfilUpdateStatusModel->loadWhere(["status_kurzbz" => $status]);
|
$status_translation = $this->ProfilUpdateStatusModel->loadWhere(["status_kurzbz" => $status]);
|
||||||
|
|
||||||
if (isError($status_translation)) {
|
if (isError($status_translation)) {
|
||||||
$this->terminateWithError($this->p->t('profilUpdate', 'ProfilUpdateStatusTranslationError'));
|
$this->terminateWithError($this->p->t('profilUpdate', 'ProfilUpdateStatusTranslationError'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$status_translation = hasData($status_translation) ? getData($status_translation)[0] : null;
|
$status_translation = hasData($status_translation) ? getData($status_translation)[0] : null;
|
||||||
|
if (isset($status_translation))
|
||||||
if (isset($status_translation)) {
|
{
|
||||||
$mail_res = sendSanchoMail("profil_update_response", ['topic' => $topic, 'status_de' => $status_translation->status_de, 'status_en' => $status_translation->status_en, 'href' => APP_ROOT . 'Cis/Profil'], $email, ("Profil Änderung " . $this->p->t('profilUpdate', 'pending')));
|
$href = $this->config->item('cis_base_url') . $this->config->item('cis_index_page') . '/Cis/Profil';
|
||||||
|
$mail_res = sendSanchoMail("profil_update_response", ['topic' => $topic, 'status_de' => $status_translation->status_de, 'status_en' => $status_translation->status_en, 'href' => $href], $email, ("Profil Änderung " . $status_translation->status_de . ' / Profile Update ' . $status_translation->status_en));
|
||||||
if (!$mail_res) {
|
if (!$mail_res) {
|
||||||
$this->addError($this->p->t('profilUpdate', 'profilUpdate_email_error'));
|
$this->addError($this->p->t('profilUpdate', 'profilUpdate_email_error'));
|
||||||
}
|
}
|
||||||
@@ -613,7 +706,13 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
|
|
||||||
private function setStatusOnUpdateRequest($id, $status, $status_message)
|
private function setStatusOnUpdateRequest($id, $status, $status_message)
|
||||||
{
|
{
|
||||||
return $this->ProfilUpdateModel->update([$id], ["status" => $status, "status_timestamp" => "NOW()", "status_message" => $status_message]);
|
return $this->ProfilUpdateModel->update([$id], [
|
||||||
|
"status" => $status,
|
||||||
|
"status_timestamp" => "NOW()",
|
||||||
|
"status_message" => $status_message,
|
||||||
|
"updateamum" => "NOW()",
|
||||||
|
"updatevon" => getAuthUID()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateRequestedChange($id, $requested_change)
|
private function updateRequestedChange($id, $requested_change)
|
||||||
@@ -623,13 +722,12 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
|
|
||||||
private function deleteOldVersionFile($dms_id)
|
private function deleteOldVersionFile($dms_id)
|
||||||
{
|
{
|
||||||
|
if (!isset($dms_id)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// starting the transaction
|
// starting the transaction
|
||||||
$this->db->trans_start();
|
$this->db->trans_start();
|
||||||
|
|
||||||
|
|
||||||
if (!isset($dms_id)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//? delete the file from the profilUpdate first
|
//? delete the file from the profilUpdate first
|
||||||
$profilUpdateFileDelete = $this->ProfilUpdateModel->removeFileFromProfilUpdate($dms_id);
|
$profilUpdateFileDelete = $this->ProfilUpdateModel->removeFileFromProfilUpdate($dms_id);
|
||||||
@@ -684,13 +782,8 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
|
|
||||||
$res = $this->StudentModel->execReadOnlyQuery($query, [$student_uid]);
|
$res = $this->StudentModel->execReadOnlyQuery($query, [$student_uid]);
|
||||||
$res = $this->getDataOrTerminateWithError($res, $this->p->t('profilUpdate', 'profilUpdate_loadingOE_error'));
|
$res = $this->getDataOrTerminateWithError($res, $this->p->t('profilUpdate', 'profilUpdate_loadingOE_error'));
|
||||||
$res = array_map(
|
$oe = ($res[0])->oe_kurzbz;
|
||||||
function ($item) {
|
return $oe;
|
||||||
return $item->oe_kurzbz;
|
|
||||||
},
|
|
||||||
$res
|
|
||||||
);
|
|
||||||
return $res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function handleAdresse($requested_change, $personID)
|
private function handleAdresse($requested_change, $personID)
|
||||||
@@ -720,7 +813,7 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
$insert_adresse_id = $insertID;
|
$insert_adresse_id = $insertID;
|
||||||
$insert_adresse_id = $this->getDataOrTerminateWithError($insert_adresse_id, $this->p->t('profilUpdate', 'profilUpdate_insertAdresse_error'));
|
$insert_adresse_id = $this->getDataOrTerminateWithError($insert_adresse_id, $this->p->t('profilUpdate', 'profilUpdate_insertAdresse_error'));
|
||||||
if ($insert_adresse_id) {
|
if ($insert_adresse_id) {
|
||||||
$this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $insert_adresse_id);
|
$this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $insert_adresse_id, $personID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//! DELETE
|
//! DELETE
|
||||||
@@ -732,12 +825,33 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
}
|
}
|
||||||
//! UPDATE
|
//! UPDATE
|
||||||
else {
|
else {
|
||||||
$requested_change['updateamum'] = "NOW()";
|
$curadresse_res = $this->AdresseModel->load($adresse_id);
|
||||||
$requested_change['updatevon'] = getAuthUID();
|
$curadresse = ($this->getDataOrTerminateWithError($curadresse_res))[0];
|
||||||
$update_adresse_id = $this->AdresseModel->update($adresse_id, $requested_change);
|
|
||||||
$update_adresse_id = $this->getDataOrTerminateWithError($update_adresse_id, $this->p->t('profilUpdate', 'profilUpdate_updateAdresse_error'));
|
|
||||||
$this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $update_adresse_id);
|
|
||||||
|
|
||||||
|
if($curadresse->heimatadresse)
|
||||||
|
{
|
||||||
|
$tmpadresse = array_merge((array) $curadresse, $requested_change);
|
||||||
|
unset($tmpadresse["adresse_id"]);
|
||||||
|
$tmpadresse['insertamum'] = "NOW()";
|
||||||
|
$tmpadresse['insertvon'] = getAuthUID();
|
||||||
|
$tmpadresse['person_id'] = $personID;
|
||||||
|
unset($tmpadresse["heimatadresse"]);
|
||||||
|
unset($tmpadresse["updateamum"]);
|
||||||
|
unset($tmpadresse["updatevon"]);
|
||||||
|
|
||||||
|
$tmpadresse_res = $this->AdresseModel->insert($tmpadresse);
|
||||||
|
$tmpadresse_id = $this->getDataOrTerminateWithError($tmpadresse_res, $this->p->t('profilUpdate', 'profilUpdate_insertAdresse_error'));
|
||||||
|
$this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $tmpadresse_id, $personID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$requested_change['updateamum'] = "NOW()";
|
||||||
|
$requested_change['updatevon'] = getAuthUID();
|
||||||
|
|
||||||
|
$update_adresse_id = $this->AdresseModel->update($adresse_id, $requested_change);
|
||||||
|
$update_adresse_id = $this->getDataOrTerminateWithError($update_adresse_id, $this->p->t('profilUpdate', 'profilUpdate_updateAdresse_error'));
|
||||||
|
$this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $update_adresse_id, $personID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $insertID ?? null;
|
return $insertID ?? null;
|
||||||
}
|
}
|
||||||
@@ -759,7 +873,7 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
$insert_kontakt_id = $insertID;
|
$insert_kontakt_id = $insertID;
|
||||||
$insert_kontakt_id = $this->getDataOrTerminateWithError($insert_kontakt_id, $this->p->t('profilUpdate', 'profilUpdate_insertKontakt_error'));
|
$insert_kontakt_id = $this->getDataOrTerminateWithError($insert_kontakt_id, $this->p->t('profilUpdate', 'profilUpdate_insertKontakt_error'));
|
||||||
if ($insert_kontakt_id) {
|
if ($insert_kontakt_id) {
|
||||||
$this->handleDupplicateZustellKontakte($requested_change['zustellung'], $insert_kontakt_id);
|
$this->handleDupplicateZustellKontakte($requested_change['zustellung'], $insert_kontakt_id, $requested_change['kontakttyp'], $personID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//! DELETE
|
//! DELETE
|
||||||
@@ -776,18 +890,18 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
$update_kontakt_id = $this->KontaktModel->update($kontakt_id, $requested_change);
|
$update_kontakt_id = $this->KontaktModel->update($kontakt_id, $requested_change);
|
||||||
$update_kontakt_id = $this->getDataOrTerminateWithError($update_kontakt_id, $this->p->t('profilUpdate', 'profilUpdate_updateKontakt_error'));
|
$update_kontakt_id = $this->getDataOrTerminateWithError($update_kontakt_id, $this->p->t('profilUpdate', 'profilUpdate_updateKontakt_error'));
|
||||||
if ($update_kontakt_id) {
|
if ($update_kontakt_id) {
|
||||||
$this->handleDupplicateZustellKontakte($requested_change['zustellung'], $update_kontakt_id);
|
$this->handleDupplicateZustellKontakte($requested_change['zustellung'], $update_kontakt_id, $requested_change['kontakttyp'], $personID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isset($insertID) ? $insertID : null;
|
return isset($insertID) ? $insertID : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function handleDupplicateZustellAdressen($zustellung, $adresse_id)
|
private function handleDupplicateZustellAdressen($zustellung, $adresse_id, $person_id)
|
||||||
{
|
{
|
||||||
if ($zustellung) {
|
if ($zustellung) {
|
||||||
$this->PersonModel->addSelect("public.tbl_adresse.adresse_id");
|
$this->PersonModel->addSelect("public.tbl_adresse.adresse_id");
|
||||||
$this->PersonModel->addJoin("public.tbl_adresse", "public.tbl_adresse.person_id = public.tbl_person.person_id");
|
$this->PersonModel->addJoin("public.tbl_adresse", "public.tbl_adresse.person_id = public.tbl_person.person_id");
|
||||||
$zustellAdressenArray = $this->PersonModel->loadWhere(["public.tbl_person.person_id" => $this->pid, "zustelladresse" => TRUE]);
|
$zustellAdressenArray = $this->PersonModel->loadWhere(["public.tbl_person.person_id" => $person_id, "zustelladresse" => TRUE]);
|
||||||
if (isError($zustellAdressenArray)) {
|
if (isError($zustellAdressenArray)) {
|
||||||
$this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_loadingZustellAdressen_error'));
|
$this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_loadingZustellAdressen_error'));
|
||||||
}
|
}
|
||||||
@@ -800,6 +914,8 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
return $adresse->adresse_id != $adresse_id;
|
return $adresse->adresse_id != $adresse_id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this->addMeta('bhzustelladressen', $zustellAdressenArray);
|
||||||
|
|
||||||
// remove the zustelladresse from all other zustelladressen
|
// remove the zustelladresse from all other zustelladressen
|
||||||
foreach ($zustellAdressenArray as $adresse) {
|
foreach ($zustellAdressenArray as $adresse) {
|
||||||
$this->AdresseModel->update($adresse->adresse_id, ["zustelladresse" => FALSE]);
|
$this->AdresseModel->update($adresse->adresse_id, ["zustelladresse" => FALSE]);
|
||||||
@@ -809,12 +925,16 @@ class ProfilUpdate extends FHCAPI_Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function handleDupplicateZustellKontakte($zustellung, $kontakt_id)
|
private function handleDupplicateZustellKontakte($zustellung, $kontakt_id, $kontakttyp, $person_id)
|
||||||
{
|
{
|
||||||
if ($zustellung) {
|
if ($zustellung) {
|
||||||
$this->PersonModel->addSelect("public.tbl_kontakt.kontakt_id");
|
$this->PersonModel->addSelect("public.tbl_kontakt.kontakt_id");
|
||||||
$this->PersonModel->addJoin("public.tbl_kontakt", "public.tbl_kontakt.person_id = public.tbl_person.person_id");
|
$this->PersonModel->addJoin("public.tbl_kontakt", "public.tbl_kontakt.person_id = public.tbl_person.person_id");
|
||||||
$zustellKontakteArray = $this->PersonModel->loadWhere(["public.tbl_person.person_id" => $this->pid, "zustellung" => TRUE]);
|
$zustellKontakteArray = $this->PersonModel->loadWhere([
|
||||||
|
"public.tbl_person.person_id" => $person_id,
|
||||||
|
"zustellung" => TRUE,
|
||||||
|
"kontakttyp" => $kontakttyp
|
||||||
|
]);
|
||||||
if (!isSuccess($zustellKontakteArray)) {
|
if (!isSuccess($zustellKontakteArray)) {
|
||||||
return error($this->p->t('profilUpdate', 'profilUpdate_loadingZustellkontakte_error'));
|
return error($this->p->t('profilUpdate', 'profilUpdate_loadingZustellkontakte_error'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
class RendererLoader extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object initialization
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
parent::__construct([
|
||||||
|
'GetRenderers' => self::PERM_LOGGED,
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load->library('LogLib');
|
||||||
|
$this->loglib->setConfigs(array(
|
||||||
|
'classIndex' => 5,
|
||||||
|
'functionIndex' => 5,
|
||||||
|
'lineIndex' => 4,
|
||||||
|
'dbLogType' => 'API', // required
|
||||||
|
'dbExecuteUser' => 'RESTful API'
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetches Stundenplan and Moodle events together
|
||||||
|
* @access public
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function GetRenderers(){
|
||||||
|
$renderer_paths = [];
|
||||||
|
Events::trigger(
|
||||||
|
'loadRenderers',
|
||||||
|
function & () use (&$renderer_paths)
|
||||||
|
{
|
||||||
|
return $renderer_paths;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$this->terminateWithSuccess($renderer_paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?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');
|
||||||
|
|
||||||
|
class RouteInfo extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'info' => self::PERM_LOGGED,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load->model('system/Webservicelog_model', 'WebservicelogModel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function info()
|
||||||
|
{
|
||||||
|
$payload = json_decode($this->input->raw_input_stream);
|
||||||
|
|
||||||
|
if (isset($payload->app) && isset($payload->path) && $this->isValidApp($payload->app) && $this->isValidPath($payload->path))
|
||||||
|
{
|
||||||
|
$this->WebservicelogModel->insert(array(
|
||||||
|
'webservicetyp_kurzbz' => 'content',
|
||||||
|
'beschreibung' => $payload->app,
|
||||||
|
'request_data' => $payload->path,
|
||||||
|
'execute_user' => getAuthUID(),
|
||||||
|
'execute_time' => 'NOW()'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function isValidApp($app)
|
||||||
|
{
|
||||||
|
return preg_match("/^[A-Za-z0-9\-_]+$/", $app);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function isValidPath($path)
|
||||||
|
{
|
||||||
|
return preg_match("/^[\/A-Za-z0-9_.\-~?%=&;]+$/", $path);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,11 +35,12 @@ class Searchbar extends FHCAPI_Controller
|
|||||||
{
|
{
|
||||||
// NOTE(chris): additional permission checks will be done in SearchBarLib
|
// NOTE(chris): additional permission checks will be done in SearchBarLib
|
||||||
parent::__construct([
|
parent::__construct([
|
||||||
'search' => self::PERM_LOGGED
|
'search' => self::PERM_LOGGED,
|
||||||
|
'searchCis' => self::PERM_LOGGED,
|
||||||
|
'searchStv' => self::PERM_LOGGED
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Load the library SearchBarLib
|
$this->load->model('system/Webservicelog_model', 'WebservicelogModel');
|
||||||
$this->load->library('SearchBarLib');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -50,6 +51,7 @@ class Searchbar extends FHCAPI_Controller
|
|||||||
*/
|
*/
|
||||||
public function search()
|
public function search()
|
||||||
{
|
{
|
||||||
|
$this->load->library('SearchBarLib');
|
||||||
$this->load->library('form_validation');
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
// Checks if the searchstr and the types parameters are in the POSTed JSON
|
// Checks if the searchstr and the types parameters are in the POSTed JSON
|
||||||
@@ -63,7 +65,64 @@ class Searchbar extends FHCAPI_Controller
|
|||||||
$result = $this->searchbarlib->search($this->input->post(self::SEARCHSTR_PARAM), $this->input->post(self::TYPES_PARAM));
|
$result = $this->searchbarlib->search($this->input->post(self::SEARCHSTR_PARAM), $this->input->post(self::TYPES_PARAM));
|
||||||
if (property_exists($result, 'error'))
|
if (property_exists($result, 'error'))
|
||||||
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||||
$this->terminateWithSuccess($result);
|
|
||||||
|
$this->addMeta('mode', 'simple');
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a JSON body via HTTP POST and provides the parameters
|
||||||
|
*/
|
||||||
|
public function searchCis()
|
||||||
|
{
|
||||||
|
return $this->searchAdvanced([ 'config' => 'searchcis' ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a JSON body via HTTP POST and provides the parameters
|
||||||
|
*/
|
||||||
|
public function searchStv()
|
||||||
|
{
|
||||||
|
return $this->searchAdvanced([ 'config' => 'searchstv' ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a JSON body via HTTP POST and provides the parameters
|
||||||
|
*/
|
||||||
|
private function searchAdvanced($config)
|
||||||
|
{
|
||||||
|
$this->load->library('SearchLib', $config);
|
||||||
|
$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->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
// Convert to json the result from searchlib->search
|
||||||
|
$result = $this->searchlib->search($this->input->post(self::SEARCHSTR_PARAM), $this->input->post(self::TYPES_PARAM));
|
||||||
|
|
||||||
|
$this->WebservicelogModel->insert(array(
|
||||||
|
'webservicetyp_kurzbz' => 'content',
|
||||||
|
'beschreibung' => $config['config'],
|
||||||
|
'request_data' => json_encode(array(
|
||||||
|
self::SEARCHSTR_PARAM => $this->input->post(self::SEARCHSTR_PARAM),
|
||||||
|
self::TYPES_PARAM => $this->input->post(self::TYPES_PARAM)
|
||||||
|
)),
|
||||||
|
'execute_user' => getAuthUID(),
|
||||||
|
'execute_time' => 'NOW()'
|
||||||
|
));
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->addMeta('time', $result->meta['time']);
|
||||||
|
$this->addMeta('searchstring', $result->meta['searchstring']);
|
||||||
|
$this->addMeta('mode', 'advanced');
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?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');
|
||||||
|
|
||||||
|
class StgOrgLvPlan extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object initialization
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'stgOrgLvPlanViewData' => self::PERM_LOGGED,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetches view data for stg org lv plan
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function stgOrgLvPlanViewData()
|
||||||
|
{
|
||||||
|
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||||
|
$this->StudiengangModel->addOrder('typ');
|
||||||
|
$this->StudiengangModel->addOrder('kurzbz');
|
||||||
|
$result = $this->StudiengangModel->loadWhere([
|
||||||
|
'aktiv' => true
|
||||||
|
]);
|
||||||
|
$studiengaenge = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$viewData = array(
|
||||||
|
'studiengaenge' => $studiengaenge,
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($viewData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Private methods
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?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');
|
||||||
|
class Studgang extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object initialization
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getStudiengangInfo'=> self::PERM_LOGGED,
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||||
|
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
|
||||||
|
|
||||||
|
// Loads phrases system
|
||||||
|
$this->loadPhrases([
|
||||||
|
'global'
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
public function getStudiengangInfo(){
|
||||||
|
$isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter(getAuthUID());
|
||||||
|
$isMitarbeiter = $this->getDataOrTerminateWithError($isMitarbeiter);
|
||||||
|
if($isMitarbeiter) {
|
||||||
|
$this->terminateWithSuccess(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetches the Studiengang Information which is used next to the news
|
||||||
|
$studiengangInfo = $this->StudiengangModel->getStudiengangInfoForNews();
|
||||||
|
$studiengangInfo= $this->getDataOrTerminateWithError($studiengangInfo);
|
||||||
|
$this->terminateWithSuccess($studiengangInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Private methods
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,353 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
class Studium extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object initialization
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getStudienAllSemester'=> self::PERM_LOGGED,
|
||||||
|
'getStudiengaengeForStudienSemester'=> self::PERM_LOGGED,
|
||||||
|
'getStudienplaeneBySemester'=> self::PERM_LOGGED,
|
||||||
|
'getLvEvaluierungInfo'=> self::PERM_LOGGED,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
|
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||||
|
$this->load->model('organisation/Studienordnung_model','StudienordnungModel');
|
||||||
|
$this->load->model('organisation/Studiensemester_model',"StudiensemesterModel");
|
||||||
|
$this->load->model('organisation/Studienplan_model', 'StudienplanModel');
|
||||||
|
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
|
||||||
|
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||||
|
$this->load->model('codex/Orgform_model','OrgformModel');
|
||||||
|
$this->load->model('person/Person_model','PersonModel');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
public function getStudienAllSemester(){
|
||||||
|
|
||||||
|
$parameter_studiensemester = $this->input->get('studiensemester',true);
|
||||||
|
$parameter_studiengang = $this->input->get('studiengang',true);
|
||||||
|
$parameter_semester = $this->input->get('semester',true);
|
||||||
|
$parameter_studienplan = $this->input->get('studienplan',true);
|
||||||
|
|
||||||
|
$aktuelles_studiensemester = current($this->getDataOrTerminateWithError($this->StudiensemesterModel->getAktOrNextSemester()));
|
||||||
|
|
||||||
|
if($this->getDataOrTerminateWithError($this->StudentModel->isStudent(getAuthUID()))){
|
||||||
|
$studentLehrverband =$this->StudentlehrverbandModel->loadWhere(["student_uid" => getAuthUID(), "studiensemester_kurzbz" => $aktuelles_studiensemester->studiensemester_kurzbz]);
|
||||||
|
|
||||||
|
//TODO(Manu) check if use Fallback or just comment out all paramschecks?
|
||||||
|
//add Fallback: if no LehrverbandData of actual semester, get Data of previous one
|
||||||
|
if(!hasData($studentLehrverband))
|
||||||
|
{
|
||||||
|
$result= $this->StudiensemesterModel->getPreviousFrom($aktuelles_studiensemester->studiensemester_kurzbz);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$vorheriges_studiensemester = current($data)->studiensemester_kurzbz;
|
||||||
|
$studentLehrverband =$this->StudentlehrverbandModel->loadWhere(["student_uid" => getAuthUID(), "studiensemester_kurzbz" => $vorheriges_studiensemester]);
|
||||||
|
}
|
||||||
|
$studentLehrverband = current(getData($studentLehrverband));
|
||||||
|
|
||||||
|
$student_studienplan = $this->getStudienPlanFromPrestudentStatus(getAuthPersonId())->studienplan_id;
|
||||||
|
|
||||||
|
if(!isset($parameter_studiensemester)) {
|
||||||
|
$student_studiensemester = $studentLehrverband->studiensemester_kurzbz;
|
||||||
|
$parameter_studiensemester = $student_studiensemester;
|
||||||
|
}
|
||||||
|
if(!isset($parameter_studiengang)) {
|
||||||
|
$student_studiengang = $studentLehrverband->studiengang_kz;
|
||||||
|
$parameter_studiengang = $student_studiengang;
|
||||||
|
}
|
||||||
|
if(!isset($parameter_semester)) {
|
||||||
|
$student_semester = $studentLehrverband->semester;
|
||||||
|
$parameter_semester = $student_semester;
|
||||||
|
}
|
||||||
|
if(!isset($parameter_studienplan))
|
||||||
|
$parameter_studienplan = $student_studienplan;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($parameter_studiensemester)){
|
||||||
|
$parameter_studiensemester = current($this->getDataOrTerminateWithError($this->StudiensemesterModel->loadWhere(["studiensemester_kurzbz" => $parameter_studiensemester])));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($parameter_studiengang)){
|
||||||
|
$parameter_studiengang = current($this->getDataOrTerminateWithError($this->StudiengangModel->loadWhere(["studiengang_kz" => $parameter_studiengang])));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($parameter_studienplan)){
|
||||||
|
$this->StudienplanModel->addJoin("lehre.tbl_studienordnung", "studienordnung_id");
|
||||||
|
$this->StudienplanModel->addJoin("lehre.tbl_studienplan_semester", "studienplan_id");
|
||||||
|
$parameter_studienplan = $this->StudienplanModel->loadWhere(["studienplan_id" => $parameter_studienplan, "aktiv" => TRUE]);
|
||||||
|
$parameter_studienplan = current($this->getDataOrTerminateWithError($parameter_studienplan));
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetch studiensemester
|
||||||
|
$allStudienSemester = $this->getDataOrTerminateWithError($this->StudiensemesterModel->load());
|
||||||
|
|
||||||
|
if(isset($parameter_studiensemester) && !empty(array_filter($allStudienSemester, function($studiensemester) use($parameter_studiensemester){
|
||||||
|
return $studiensemester->studiensemester_kurzbz == $parameter_studiensemester->studiensemester_kurzbz;
|
||||||
|
}))){
|
||||||
|
$aktuelles_studiensemester = $parameter_studiensemester;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetch studiengaenge
|
||||||
|
$studiengaenge = $this->computeStudiengaenge($aktuelles_studiensemester->studiensemester_kurzbz);
|
||||||
|
$aktuelles_studiengang = current($studiengaenge);
|
||||||
|
if(!$aktuelles_studiengang){
|
||||||
|
$aktuelles_studiengang = null;
|
||||||
|
}
|
||||||
|
if(isset($parameter_studiengang) && !empty(array_filter( $studiengaenge,function($studiengang)use($parameter_studiengang){
|
||||||
|
return $studiengang->studiengang_kz == $parameter_studiengang->studiengang_kz;
|
||||||
|
}))){
|
||||||
|
$aktuelles_studiengang = $parameter_studiengang;
|
||||||
|
}
|
||||||
|
|
||||||
|
// compute semester and studienplaene
|
||||||
|
if($aktuelles_studiengang){
|
||||||
|
$studienplaene = $this->computeStudienplaene($aktuelles_studiengang->studiengang_kz, $aktuelles_studiensemester->studiensemester_kurzbz);
|
||||||
|
}else{
|
||||||
|
$studienplaene =[];
|
||||||
|
}
|
||||||
|
|
||||||
|
$semester = array_values(array_unique(array_map(function($item){
|
||||||
|
return $item->semester;
|
||||||
|
}, $studienplaene)));
|
||||||
|
$aktuelles_semester = current($semester);
|
||||||
|
if(!$aktuelles_semester){
|
||||||
|
$aktuelles_semester = null;
|
||||||
|
}
|
||||||
|
if(isset($parameter_semester) && in_array($parameter_semester, $semester)){
|
||||||
|
$aktuelles_semester = $parameter_semester;
|
||||||
|
}
|
||||||
|
|
||||||
|
$semester_studienplan = array_filter($studienplaene, function($item) use($aktuelles_semester){
|
||||||
|
return $item->semester == $aktuelles_semester;
|
||||||
|
});
|
||||||
|
|
||||||
|
// fetch current studienplan based on semester
|
||||||
|
$aktuelles_studienplan = current($semester_studienplan);
|
||||||
|
if(!$aktuelles_studienplan){
|
||||||
|
$aktuelles_studienplan = null;
|
||||||
|
}
|
||||||
|
if(isset($parameter_studienplan) && !empty(array_filter( $semester_studienplan, function($studienplan) use($parameter_studienplan){
|
||||||
|
return $studienplan->studienplan_id == $parameter_studienplan->studienplan_id;
|
||||||
|
}))){
|
||||||
|
$aktuelles_studienplan = $parameter_studienplan ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetch studienplan lehrveranstaltungen
|
||||||
|
if($aktuelles_studienplan){
|
||||||
|
$lehrveranstaltungen = $this->computeStudienplanLehrveranstaltungen($aktuelles_studienplan->studienplan_id, $aktuelles_semester);
|
||||||
|
foreach($lehrveranstaltungen as $lehrv){
|
||||||
|
// a lehrveranstaltung without a modul has no children and gets its lektoren directly
|
||||||
|
$lvs = isset($lehrv->lehrveranstaltungen) ? $lehrv->lehrveranstaltungen : [$lehrv];
|
||||||
|
foreach($lvs as $lv){
|
||||||
|
$lvLektoren =$this->computeLektorenFromLehrveranstaltung($lv->lehrveranstaltung_id,$aktuelles_semester, $aktuelles_studiengang->studiengang_kz, $aktuelles_studiensemester->studiensemester_kurzbz);
|
||||||
|
$lv->lektoren = $lvLektoren;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$aktuelles_lehrveranstaltungen = $lehrveranstaltungen;
|
||||||
|
}else{
|
||||||
|
$aktuelles_lehrveranstaltungen = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// result object
|
||||||
|
$result = new stdClass();
|
||||||
|
$result->studienSemester = [];
|
||||||
|
$result->studienSemester["all"]= $allStudienSemester;
|
||||||
|
$result->studienSemester["preselected"]=$aktuelles_studiensemester;
|
||||||
|
$result->studiengang["all"]=$studiengaenge;
|
||||||
|
$result->studiengang["preselected"]=$aktuelles_studiengang;
|
||||||
|
$result->semester["all"] =$semester;
|
||||||
|
$result->semester["preselected"] =$aktuelles_semester;
|
||||||
|
$result->studienplan["all"]=$semester_studienplan;
|
||||||
|
$result->studienplan["preselected"]=$aktuelles_studienplan;
|
||||||
|
$result->lehrveranstaltungen=$aktuelles_lehrveranstaltungen;
|
||||||
|
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLvEvaluierungInfo($studiensemester_kurzbz, $lehrveranstaltung_id){
|
||||||
|
$result = [];
|
||||||
|
Events::trigger('lvEvaluierungsInfo', function & () use (&$result) {
|
||||||
|
return $result;
|
||||||
|
},$lehrveranstaltung_id, $studiensemester_kurzbz);
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStudiengaengeForStudienSemester($studiensemester){
|
||||||
|
$studiengaenge = $this->computeStudiengaenge($studiensemester);
|
||||||
|
$this->terminateWithSuccess($studiengaenge);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStudienplaeneBySemester(){
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
$this->form_validation->set_data($this->input->get());
|
||||||
|
$this->form_validation->set_rules('studiengang', 'studiengang', 'required');
|
||||||
|
$this->form_validation->set_rules('studiensemester', 'studiensemester', 'required');
|
||||||
|
if($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
$studiengang = $this->input->get('studiengang',true);
|
||||||
|
$studiensemester = $this->input->get('studiensemester',true);
|
||||||
|
$studienplaene = $this->computeStudienplaene($studiengang, $studiensemester);
|
||||||
|
$this->terminateWithSuccess($studienplaene);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Private methods
|
||||||
|
|
||||||
|
private function computeStudienplaene($studiengang, $studiensemester){
|
||||||
|
$studienplaene = $this->StudienplanModel->getStudienplaeneBySemester($studiengang, $studiensemester);
|
||||||
|
$studienplaene = $this->getDataOrTerminateWithError($studienplaene);
|
||||||
|
$studienplaene = array_map(function($studienplan){
|
||||||
|
$orgform = current($this->getDataOrTerminateWithError($this->OrgformModel->loadWhere(["orgform_kurzbz" => $studienplan->orgform_kurzbz])));
|
||||||
|
$studienplan->orgform_bezeichnung = $orgform->bezeichnung;
|
||||||
|
// bezeichnung_mehrsprachig
|
||||||
|
$studienplan->orgform_bezeichnung_english = $orgform->bezeichnung_mehrsprachig[1];
|
||||||
|
return $studienplan;
|
||||||
|
},$studienplaene);
|
||||||
|
return $studienplaene;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function computeStudienplanLehrveranstaltungen($studienplan_id, $semester){
|
||||||
|
|
||||||
|
/*
|
||||||
|
SELECT tbl_lehrveranstaltung.*,
|
||||||
|
tbl_studienplan_lehrveranstaltung.studienplan_lehrveranstaltung_id,
|
||||||
|
tbl_studienplan_lehrveranstaltung.semester as stpllv_semester,
|
||||||
|
tbl_studienplan_lehrveranstaltung.pflicht as stpllv_pflicht,
|
||||||
|
tbl_studienplan_lehrveranstaltung.koordinator as stpllv_koordinator,
|
||||||
|
tbl_studienplan_lehrveranstaltung.studienplan_lehrveranstaltung_id_parent,
|
||||||
|
tbl_studienplan_lehrveranstaltung.sort stpllv_sort,
|
||||||
|
tbl_studienplan_lehrveranstaltung.curriculum,
|
||||||
|
tbl_studienplan_lehrveranstaltung.export,
|
||||||
|
tbl_studienplan_lehrveranstaltung.genehmigung
|
||||||
|
FROM lehre.tbl_lehrveranstaltung
|
||||||
|
JOIN lehre.tbl_studienplan_lehrveranstaltung
|
||||||
|
USING(lehrveranstaltung_id)
|
||||||
|
WHERE tbl_studienplan_lehrveranstaltung.studienplan_id=" . $this->db_add_param($studienplan_id, FHC_INTEGER);
|
||||||
|
if (defined("CIS_PROFIL_STUDIENPLAN_MODULE_AUSBLENDEN") && CIS_PROFIL_STUDIENPLAN_MODULE_AUSBLENDEN)
|
||||||
|
$qry .= " AND tbl_lehrveranstaltung.lehrtyp_kurzbz != 'modul'";
|
||||||
|
if (!is_null($semester))
|
||||||
|
{
|
||||||
|
$qry.=" AND tbl_studienplan_lehrveranstaltung.semester=" . $this->db_add_param($semester, FHC_INTEGER);
|
||||||
|
} */
|
||||||
|
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT tbl_lehrveranstaltung.*,
|
||||||
|
tbl_studienplan_lehrveranstaltung.studienplan_lehrveranstaltung_id,
|
||||||
|
tbl_studienplan_lehrveranstaltung.semester as stpllv_semester,
|
||||||
|
tbl_studienplan_lehrveranstaltung.pflicht as stpllv_pflicht,
|
||||||
|
tbl_studienplan_lehrveranstaltung.koordinator as stpllv_koordinator,
|
||||||
|
tbl_studienplan_lehrveranstaltung.studienplan_lehrveranstaltung_id_parent,
|
||||||
|
tbl_studienplan_lehrveranstaltung.sort stpllv_sort,
|
||||||
|
tbl_studienplan_lehrveranstaltung.curriculum,
|
||||||
|
tbl_studienplan_lehrveranstaltung.export,
|
||||||
|
tbl_studienplan_lehrveranstaltung.genehmigung
|
||||||
|
FROM lehre.tbl_lehrveranstaltung
|
||||||
|
JOIN lehre.tbl_studienplan_lehrveranstaltung
|
||||||
|
USING(lehrveranstaltung_id)
|
||||||
|
WHERE
|
||||||
|
tbl_lehrveranstaltung.lehre = true AND
|
||||||
|
tbl_studienplan_lehrveranstaltung.studienplan_id=? AND tbl_studienplan_lehrveranstaltung.semester=?";
|
||||||
|
|
||||||
|
if (defined("CIS_PROFIL_STUDIENPLAN_MODULE_AUSBLENDEN") && CIS_PROFIL_STUDIENPLAN_MODULE_AUSBLENDEN)
|
||||||
|
$query .= " AND tbl_lehrveranstaltung.lehrtyp_kurzbz != 'modul'";
|
||||||
|
|
||||||
|
$lehrveranstaltungen = $this->LehrveranstaltungModel->execReadOnlyQuery($query,[$studienplan_id, $semester]);
|
||||||
|
|
||||||
|
$lehrveranstaltungen = $this->getDataOrTerminateWithError($lehrveranstaltungen);
|
||||||
|
|
||||||
|
usort($lehrveranstaltungen, function($a, $b){
|
||||||
|
if($a->lehrtyp_kurzbz == "modul"){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else if($b->lehrtyp_kurzbz == "modul"){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
$lehrveranstaltungen= array_reduce($lehrveranstaltungen,function($carry, $lehrv){
|
||||||
|
if($lehrv->lehrtyp_kurzbz == "modul"){
|
||||||
|
$lehrv->lehrveranstaltungen = [];
|
||||||
|
array_push($carry, $lehrv);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$parent =array_filter($carry, function($item)use($lehrv){
|
||||||
|
return isset($item->lehrveranstaltungen)
|
||||||
|
&& $item->studienplan_lehrveranstaltung_id == $lehrv->studienplan_lehrveranstaltung_id_parent;
|
||||||
|
});
|
||||||
|
$parent = current($parent);
|
||||||
|
if($parent){
|
||||||
|
$parent->lehrveranstaltungen[] = $lehrv;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// lehrveranstaltung without a modul: keep it on the top level
|
||||||
|
array_push($carry, $lehrv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $carry;
|
||||||
|
}, []);
|
||||||
|
return $lehrveranstaltungen;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function computeStudiengaenge($studiensemester){
|
||||||
|
$studiengang_studiensemester_result = $this->StudiengangModel->getStudiengaengeByStudiensemester($studiensemester);
|
||||||
|
$studiengang_studiensemester_result = $this->getDataOrTerminateWithError($studiengang_studiensemester_result);
|
||||||
|
return $studiengang_studiensemester_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getStudienPlanFromPrestudentStatus($person_id){
|
||||||
|
$studienplan_id = current($this->getDataOrTerminateWithError($this->PrestudentstatusModel->getLastStatusPerson($person_id)))->studienplan_id;
|
||||||
|
$studienplan =current($this->getDataOrTerminateWithError($this->StudienplanModel->loadWhere(["studienplan_id"=>$studienplan_id])));
|
||||||
|
return $studienplan;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function computeLektorenFromLehrveranstaltung($lehreinheit_id, $semester, $studiengang, $studiensemester){
|
||||||
|
$this->load->library('StundenplanLib');
|
||||||
|
$lektoren = $this->stundenplanlib->getLektorenFromLehrveranstaltung($lehreinheit_id,$semester, $studiengang,$studiensemester);
|
||||||
|
$lektoren = $this->getDataOrTerminateWithError($lektoren) ?? [];
|
||||||
|
|
||||||
|
$lektoren = array_map(function($lektor){
|
||||||
|
return ["name"=>$this->getDataOrTerminateWithError($this->PersonModel->getFullName($lektor)), "email"=>$lektor."@".DOMAIN];
|
||||||
|
},$lektoren);
|
||||||
|
|
||||||
|
return $lektoren;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
<?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 TabulatorPresets extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getTabulatorPresets' => self::PERM_LOGGED,
|
||||||
|
'createTabulatorPreset' => self::PERM_LOGGED,
|
||||||
|
'updateTabulatorPreset' => self::PERM_LOGGED,
|
||||||
|
'deleteTabulatorPreset' => self::PERM_LOGGED,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load->model('tabulator/Tabulator_preset_model', 'TabulatorPresetModel');
|
||||||
|
|
||||||
|
$this->loadPhrases([
|
||||||
|
'global',
|
||||||
|
'tabulator_presets'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
|
||||||
|
public function getTabulatorPresets()
|
||||||
|
{
|
||||||
|
$tableName = $this->input->get("tableName");
|
||||||
|
if (!$tableName) {
|
||||||
|
$this->terminateWithError(error($this->p->t("tabulator_presets", "invalid_params_err_msg")));
|
||||||
|
}
|
||||||
|
|
||||||
|
$uid = getAuthUID();
|
||||||
|
$presets = $this->TabulatorPresetModel->getTabulatorPresetsByUserAndTable($uid, $tableName);
|
||||||
|
$presetsData = $this->getDataOrTerminateWithError($presets) ?? [];
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($presetsData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createTabulatorPreset()
|
||||||
|
{
|
||||||
|
$tableName = $this->input->post("tableName");
|
||||||
|
$presetName = $this->input->post("presetName");
|
||||||
|
$preset = $this->input->post("preset");
|
||||||
|
|
||||||
|
if (!$tableName || !$presetName || !$preset) {
|
||||||
|
$this->terminateWithError($this->p->t("tabulator_presets", "invalid_params_err_msg"), "general", 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$uid = getAuthUID();
|
||||||
|
|
||||||
|
$existingPresetsResult = $this->TabulatorPresetModel->getTabulatorPresetsByUserAndTable($uid, $tableName);
|
||||||
|
$existingPresets = $this->getDataOrTerminateWithError($existingPresetsResult) ?? [];
|
||||||
|
|
||||||
|
if (count($existingPresets) > 19) {
|
||||||
|
$this->terminateWithError($this->p->t("tabulator_presets", "max_presets_count_err_msg"), "general", 409);
|
||||||
|
}
|
||||||
|
|
||||||
|
$existingPresetNames = array_map(function($presetInfo) {
|
||||||
|
return $presetInfo->preset_name;
|
||||||
|
}, $existingPresets);
|
||||||
|
|
||||||
|
if (in_array($presetName, $existingPresetNames)) {
|
||||||
|
$this->terminateWithError($this->p->t("tabulator_presets", "preset_name_duplicate_err_msg"), "general", 409);
|
||||||
|
}
|
||||||
|
|
||||||
|
$presetCreationResult = $this->TabulatorPresetModel->createTabulatorPreset($uid, $tableName, $presetName, $preset);
|
||||||
|
|
||||||
|
if (isError($presetCreationResult)) {
|
||||||
|
$this->terminateWithError($presetCreationResult->retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
$newPresetData = $this->TabulatorPresetModel->getTabulatorPreset($presetCreationResult->retval);
|
||||||
|
$newPresetArray = $this->getDataOrTerminateWithError($newPresetData) ?? [null];
|
||||||
|
$newPreset = $newPresetArray[0];
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($newPreset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateTabulatorPreset()
|
||||||
|
{
|
||||||
|
$presetId = $this->input->post("presetId");
|
||||||
|
$preset = $this->input->post("preset");
|
||||||
|
|
||||||
|
if (!$presetId || !$preset) {
|
||||||
|
$this->terminateWithError($this->p->t("tabulator_presets", "invalid_params_err_msg"), "general", 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$existingPresetData = $this->TabulatorPresetModel->getTabulatorPreset($presetId);
|
||||||
|
$existingPresetArray = $this->getDataOrTerminateWithError($existingPresetData) ?? [null];
|
||||||
|
$existingPreset = $existingPresetArray[0];
|
||||||
|
if (!$existingPreset) {
|
||||||
|
$this->terminateWithError($this->p->t("tabulator_presets", "preset_not_found_err_msg"), "general", 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$uid = getAuthUID();
|
||||||
|
if ($existingPreset->benutzer_uid !== $uid) {
|
||||||
|
$this->terminateWithError($this->p->t("tabulator_presets", "preset_not_own_update_err_msg"), "general", 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$presetUpdateResult = $this->TabulatorPresetModel->updateTabulatorPreset($presetId, $preset);
|
||||||
|
if (isError($presetUpdateResult)) {
|
||||||
|
$this->terminateWithError($presetUpdateResult->retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
$updatedPresetData = $this->TabulatorPresetModel->getTabulatorPreset($presetId);
|
||||||
|
$updatedPresetArray = $this->getDataOrTerminateWithError($updatedPresetData) ?? [null];
|
||||||
|
$updatedPreset = $updatedPresetArray[0];
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($updatedPreset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteTabulatorPreset()
|
||||||
|
{
|
||||||
|
$presetId = $this->input->post("presetId");
|
||||||
|
if (!$presetId) {
|
||||||
|
$this->terminateWithError($this->p->t("tabulator_presets", "invalid_params_err_msg"), "general", 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$presetData = $this->TabulatorPresetModel->getTabulatorPreset($presetId);
|
||||||
|
$presetArray = $this->getDataOrTerminateWithError($presetData) ?? [null];
|
||||||
|
$preset = $presetArray[0];
|
||||||
|
if (!$preset) {
|
||||||
|
$this->terminateWithError($this->p->t("tabulator_presets", "preset_not_found_err_msg"), "general", 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$uid = getAuthUID();
|
||||||
|
if ($preset->benutzer_uid !== $uid) {
|
||||||
|
$this->terminateWithError($this->p->t("tabulator_presets", "preset_not_own_delete_err_msg"), "general", 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$presetDeletionResult = $this->TabulatorPresetModel->deleteTabulatorPreset($presetId);
|
||||||
|
if (isError($presetDeletionResult)) {
|
||||||
|
$this->terminateWithError($presetDeletionResult->retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2026 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 \ReflectionMethod as ReflectionMethod;
|
||||||
|
use \ReflectionFunction as ReflectionFunction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This controller operates between (interface) the JS (GUI) and the back-end
|
||||||
|
* Provides data to the ajax get calls about menues
|
||||||
|
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||||
|
*/
|
||||||
|
class Treemenu extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// Load Router
|
||||||
|
$router = load_class('Router');
|
||||||
|
|
||||||
|
// Load Config
|
||||||
|
$config = load_class('Config');
|
||||||
|
$config->load('treemenu');
|
||||||
|
|
||||||
|
// Get Treemenu name & config
|
||||||
|
$name = $router->method;
|
||||||
|
$conf = $config->item($name);
|
||||||
|
|
||||||
|
// Get Permissions from config
|
||||||
|
$permissions = $conf['permissions'] ?? self::PERM_ANONYMOUS;
|
||||||
|
|
||||||
|
// Call constructor
|
||||||
|
parent::__construct([
|
||||||
|
$name => $permissions
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load Library
|
||||||
|
$libraryName = $conf['library'] ?? null;
|
||||||
|
$this->load->library($libraryName, null, 'treemenulib');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $method
|
||||||
|
* @param array $params (optional)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function _remap($method, $params = [])
|
||||||
|
{
|
||||||
|
if (!$this->treemenulib)
|
||||||
|
show_404();
|
||||||
|
|
||||||
|
$this->addMeta('ci_method', $method);
|
||||||
|
$this->addMeta('ci_params', $params);
|
||||||
|
|
||||||
|
$params = $this->uri->uri_to_assoc(6); // 6 = start of $params
|
||||||
|
$config = $this->treemenulib->config;
|
||||||
|
|
||||||
|
foreach (array_keys($params) as $key) {
|
||||||
|
if (!isset($config[$key]) || !$config[$key])
|
||||||
|
show_404();
|
||||||
|
|
||||||
|
$config = $config[$key];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare aliases
|
||||||
|
$argumentaliases = [];
|
||||||
|
if (property_exists($this->treemenulib, 'path_to_argument'))
|
||||||
|
$argumentaliases = array_flip($this->treemenulib->path_to_argument);
|
||||||
|
$methodaliases = [];
|
||||||
|
if (property_exists($this->treemenulib, 'redirect_method'))
|
||||||
|
$methodaliases = $this->treemenulib->redirect_method;
|
||||||
|
|
||||||
|
$items = [];
|
||||||
|
foreach ($config as $uripart => $children) {
|
||||||
|
if (!is_array($children)) {
|
||||||
|
$uripart = $children;
|
||||||
|
$children = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$methodName = $uripart;
|
||||||
|
if (isset($methodaliases[$methodName])) {
|
||||||
|
$methodName = $methodaliases[$methodName];
|
||||||
|
} elseif (strpbrk($methodName, ' _-') !== false) {
|
||||||
|
$methodName = lcfirst(str_replace([' ', '_', '-'], '', ucwords($methodName, " \t\r\n\f\v_-")));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare arguments
|
||||||
|
if (is_callable($methodName, false, $name)) {
|
||||||
|
if (is_string($methodName) && is_callable([$this->treemenulib, $methodName]))
|
||||||
|
$callable = [$this->treemenulib, $methodName];
|
||||||
|
else
|
||||||
|
$callable = $methodName;
|
||||||
|
} else {
|
||||||
|
$callable = [$this->treemenulib, $methodName];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($callable))
|
||||||
|
$reflection = new ReflectionMethod($callable[0], $callable[1]);
|
||||||
|
elseif (is_string($callable) && strstr($callable, '::'))
|
||||||
|
$reflection = new ReflectionMethod($callable);
|
||||||
|
elseif ($name != 'Closure::__invoke' && strstr($name, '::__invoke'))
|
||||||
|
$reflection = new ReflectionMethod($callable, '__invoke');
|
||||||
|
else
|
||||||
|
$reflection = new ReflectionFunction($callable);
|
||||||
|
|
||||||
|
$arguments = [];
|
||||||
|
foreach ($reflection->getParameters() as $arg) {
|
||||||
|
if ($arg->name == 'path_template') {
|
||||||
|
$path = $params;
|
||||||
|
$path[$uripart] = '%s';
|
||||||
|
$arguments[] = $this->uri->assoc_to_uri($path);
|
||||||
|
} elseif ($arg->name == 'has_children') {
|
||||||
|
$arguments[] = $children;
|
||||||
|
} elseif ($arg->name == 'original_method') {
|
||||||
|
$arguments[] = $uripart;
|
||||||
|
} elseif (isset($argumentaliases[$arg->name]) && isset($params[$argumentaliases[$arg->name]])) {
|
||||||
|
$arguments[] = $params[$argumentaliases[$arg->name]];
|
||||||
|
} elseif (isset($params[$arg->name])) {
|
||||||
|
$arguments[] = $params[$arg->name];
|
||||||
|
} else {
|
||||||
|
$arguments[] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call function from lib
|
||||||
|
$items = array_merge($items, call_user_func_array($callable, $arguments));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($items);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -60,7 +60,11 @@ class BetriebsmittelP extends FHCAPI_Controller
|
|||||||
|
|
||||||
public function getAllBetriebsmittel($type_id, $id)
|
public function getAllBetriebsmittel($type_id, $id)
|
||||||
{
|
{
|
||||||
$result = $this->BetriebsmittelpersonModel->getBetriebsmittelData($id, $type_id);
|
$betriebsmitteltypes = null;
|
||||||
|
if ($this->input->get('betriebsmitteltypes') !== null && !isEmptyArray($this->input->get('betriebsmitteltypes')))
|
||||||
|
$betriebsmitteltypes = $this->input->get('betriebsmitteltypes');
|
||||||
|
|
||||||
|
$result = $this->BetriebsmittelpersonModel->getBetriebsmittelData($id, $type_id, $betriebsmitteltypes);
|
||||||
|
|
||||||
if (isError($result)) {
|
if (isError($result)) {
|
||||||
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||||
@@ -75,8 +79,9 @@ class BetriebsmittelP extends FHCAPI_Controller
|
|||||||
'required' => $this->p->t('ui', 'error_fieldRequired')
|
'required' => $this->p->t('ui', 'error_fieldRequired')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->form_validation->set_rules('kaution', 'Kaution', 'numeric|less_than_equal_to[9999.99]', [
|
$this->form_validation->set_rules('kaution', 'Kaution', 'callback_valid_number|callback_not_less_than_equal', [
|
||||||
'numeric' => $this->p->t('ui', 'error_fieldNotNumeric')
|
'valid_number' => $this->p->t('ui', 'error_fieldNoValidNumber'),
|
||||||
|
'not_less_than_equal' => $this->p->t('ui', 'error_fieldLessThan1000'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->form_validation->set_rules('ausgegebenam', 'Ausgegeben am', 'required|is_valid_date', [
|
$this->form_validation->set_rules('ausgegebenam', 'Ausgegeben am', 'required|is_valid_date', [
|
||||||
@@ -158,6 +163,7 @@ class BetriebsmittelP extends FHCAPI_Controller
|
|||||||
], [
|
], [
|
||||||
'uid_in_person' => $this->p->t('person', 'error_uidNotInPerson')
|
'uid_in_person' => $this->p->t('person', 'error_uidNotInPerson')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->validateNewOrUpdate();
|
$this->validateNewOrUpdate();
|
||||||
|
|
||||||
$betriebsmitteltyp = $this->input->post('betriebsmitteltyp');
|
$betriebsmitteltyp = $this->input->post('betriebsmitteltyp');
|
||||||
@@ -167,6 +173,7 @@ class BetriebsmittelP extends FHCAPI_Controller
|
|||||||
$betriebsmittel_id = $this->input->post('betriebsmittel_id');
|
$betriebsmittel_id = $this->input->post('betriebsmittel_id');
|
||||||
$anmerkung = $this->input->post('anmerkung');
|
$anmerkung = $this->input->post('anmerkung');
|
||||||
$kaution = $this->input->post('kaution');
|
$kaution = $this->input->post('kaution');
|
||||||
|
if($kaution) $kaution = str_replace(',', '.', $kaution);
|
||||||
$ausgegebenam = $this->input->post('ausgegebenam');
|
$ausgegebenam = $this->input->post('ausgegebenam');
|
||||||
$retouram = $this->input->post('retouram');
|
$retouram = $this->input->post('retouram');
|
||||||
$uid = $this->input->post('uid');
|
$uid = $this->input->post('uid');
|
||||||
@@ -250,8 +257,9 @@ class BetriebsmittelP extends FHCAPI_Controller
|
|||||||
$betriebsmittel_id = $this->input->post('betriebsmittel_id');
|
$betriebsmittel_id = $this->input->post('betriebsmittel_id');
|
||||||
$anmerkung = $this->input->post('anmerkung');
|
$anmerkung = $this->input->post('anmerkung');
|
||||||
$kaution = $this->input->post('kaution');
|
$kaution = $this->input->post('kaution');
|
||||||
|
if($kaution) $kaution = str_replace(',', '.', $kaution);
|
||||||
$ausgegebenam = $this->input->post('ausgegebenam');
|
$ausgegebenam = $this->input->post('ausgegebenam');
|
||||||
$retouram = $this->input->post('retouram');
|
$retouram = $this->input->post('retouram') == "" ? null : $this->input->post('retouram');
|
||||||
|
|
||||||
// NOTE(chris): transform_kartennummer
|
// NOTE(chris): transform_kartennummer
|
||||||
if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer)
|
if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer)
|
||||||
@@ -342,7 +350,7 @@ class BetriebsmittelP extends FHCAPI_Controller
|
|||||||
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'Betriebsmittelperson_id']), self::ERROR_TYPE_GENERAL);
|
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'Betriebsmittelperson_id']), self::ERROR_TYPE_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->terminateWithSuccess(current(getData($result)));
|
return $this->terminateWithSuccess(current(getData($result)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteBetriebsmittel($betriebsmittelperson_id)
|
public function deleteBetriebsmittel($betriebsmittelperson_id)
|
||||||
@@ -358,7 +366,7 @@ class BetriebsmittelP extends FHCAPI_Controller
|
|||||||
if (!hasData($result)) {
|
if (!hasData($result)) {
|
||||||
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'Betriebsmittelperson_id']), self::ERROR_TYPE_GENERAL);
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'Betriebsmittelperson_id']), self::ERROR_TYPE_GENERAL);
|
||||||
}
|
}
|
||||||
return $this->outputJsonSuccess(current(getData($result)));
|
$this->terminateWithSuccess(current(getData($result)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTypenBetriebsmittel()
|
public function getTypenBetriebsmittel()
|
||||||
@@ -366,6 +374,12 @@ class BetriebsmittelP extends FHCAPI_Controller
|
|||||||
$this->load->model('ressource/Betriebsmitteltyp_model', 'BetriebsmitteltypModel');
|
$this->load->model('ressource/Betriebsmitteltyp_model', 'BetriebsmitteltypModel');
|
||||||
|
|
||||||
$this->BetriebsmitteltypModel->addOrder('beschreibung', 'ASC');
|
$this->BetriebsmitteltypModel->addOrder('beschreibung', 'ASC');
|
||||||
|
|
||||||
|
if ($this->input->get('betriebsmitteltypes') !== null && !isEmptyArray($this->input->get('betriebsmitteltypes')))
|
||||||
|
{
|
||||||
|
$this->BetriebsmitteltypModel->db->where_in('betriebsmitteltyp', $this->input->get('betriebsmitteltypes'));
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->BetriebsmitteltypModel->load(); // load All
|
$result = $this->BetriebsmitteltypModel->load(); // load All
|
||||||
|
|
||||||
if (isError($result)) {
|
if (isError($result)) {
|
||||||
@@ -382,6 +396,26 @@ class BetriebsmittelP extends FHCAPI_Controller
|
|||||||
|
|
||||||
$this->terminateWithSuccess($data);
|
$this->terminateWithSuccess($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function valid_number($number)
|
||||||
|
{
|
||||||
|
if(is_null($number)) return true;
|
||||||
|
$number = str_replace(',', '.', $number);
|
||||||
|
if (!is_numeric($number))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function not_less_than_equal($number)
|
||||||
|
{
|
||||||
|
$number = str_replace(',', '.', $number);
|
||||||
|
if ($number < 1000)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2026 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 Board extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'list' => 'dashboard/admin:r',
|
||||||
|
'create' => 'dashboard/admin:rw',
|
||||||
|
'update' => 'dashboard/admin:rw',
|
||||||
|
'delete' => 'dashboard/admin:rw'
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Models
|
||||||
|
$this->load->model('dashboard/Dashboard_model', 'DashboardModel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function list()
|
||||||
|
{
|
||||||
|
$this->DashboardModel->addSelect('dashboard_id');
|
||||||
|
$this->DashboardModel->addSelect('dashboard_kurzbz');
|
||||||
|
$this->DashboardModel->addSelect('tbl_dashboard.beschreibung');
|
||||||
|
$this->DashboardModel->addSelect("(
|
||||||
|
SELECT json_agg(w.*)
|
||||||
|
FROM dashboard.tbl_widget w
|
||||||
|
JOIN dashboard.tbl_dashboard_widget dw
|
||||||
|
USING(widget_id)
|
||||||
|
WHERE dw.dashboard_id=tbl_dashboard.dashboard_id
|
||||||
|
) AS \"widgetSetup\"");
|
||||||
|
|
||||||
|
$result = $this->DashboardModel->load();
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$data = array_map(function ($dashboard) {
|
||||||
|
$tmpSetups = json_decode($dashboard->widgetSetup);
|
||||||
|
$tmpSetups = array_map(function ($widget) {
|
||||||
|
$widget->setup->file = absoluteJsImportUrl($widget->setup->file);
|
||||||
|
return $widget;
|
||||||
|
}, $tmpSetups);
|
||||||
|
$dashboard->widgetSetup = $tmpSetups;
|
||||||
|
return $dashboard;
|
||||||
|
}, $data);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$dashboard_kurzbz = $this->input->post('dashboard_kurzbz');
|
||||||
|
|
||||||
|
$result = $this->DashboardModel->insert([
|
||||||
|
'dashboard_kurzbz' => $dashboard_kurzbz
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('dashboard_id', 'Dashboard ID', 'required');
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
$dashboard_id = $this->input->post('dashboard_id');
|
||||||
|
$dashboard_kurzbz = $this->input->post('dashboard_kurzbz');
|
||||||
|
$beschreibung = $this->input->post('beschreibung');
|
||||||
|
|
||||||
|
$result = $this->DashboardModel->update([
|
||||||
|
'dashboard_id' => $dashboard_id
|
||||||
|
], [
|
||||||
|
'dashboard_kurzbz' => $dashboard_kurzbz,
|
||||||
|
'beschreibung' => $beschreibung
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('dashboard_id', 'Dashboard ID', 'required');
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
$dashboard_id = $this->input->post('dashboard_id');
|
||||||
|
|
||||||
|
//delete all presets
|
||||||
|
$this->load->model('dashboard/Dashboard_Preset_model', 'DashboardPresetModel');
|
||||||
|
|
||||||
|
$result = $this->DashboardPresetModel->delete([
|
||||||
|
'dashboard_id' => $dashboard_id
|
||||||
|
]);
|
||||||
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
//delete all widgets
|
||||||
|
$this->load->model('dashboard/Dashboard_Widget_model', 'DashboardWidgetModel');
|
||||||
|
|
||||||
|
$result = $this->DashboardWidgetModel->delete([
|
||||||
|
'dashboard_id' => $dashboard_id
|
||||||
|
]);
|
||||||
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$result = $this->DashboardModel->delete($dashboard_id);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,199 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2026 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 Preset extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'list' => 'dashboard/admin:r',
|
||||||
|
'getBatch' => 'dashboard/admin:r',
|
||||||
|
'addWidget' => 'dashboard/admin:rw',
|
||||||
|
'removeWidget' => 'dashboard/admin:rw'
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load language phrases
|
||||||
|
$this->loadPhrases([
|
||||||
|
'ui'
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Libraries
|
||||||
|
$this->load->library('dashboard/DashboardLib');
|
||||||
|
|
||||||
|
// Models
|
||||||
|
$this->load->model('ressource/Funktion_model', 'FunktionModel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function list($dashboard_kurzbz)
|
||||||
|
{
|
||||||
|
$sql = "
|
||||||
|
WITH
|
||||||
|
dashboard_presets AS (
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
dashboard.tbl_dashboard_preset dp
|
||||||
|
JOIN
|
||||||
|
dashboard.tbl_dashboard d ON d.dashboard_id = dp.dashboard_id
|
||||||
|
WHERE
|
||||||
|
d.dashboard_kurzbz = {$this->db->escape($dashboard_kurzbz)}
|
||||||
|
),
|
||||||
|
general AS (
|
||||||
|
SELECT
|
||||||
|
'general' AS funktion_kurzbz,
|
||||||
|
'Allgemein' AS beschreibung
|
||||||
|
)
|
||||||
|
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
f.funktion_kurzbz,
|
||||||
|
f.beschreibung,
|
||||||
|
COUNT(p.preset_id) AS has_preset
|
||||||
|
FROM
|
||||||
|
general f
|
||||||
|
LEFT JOIN
|
||||||
|
dashboard_presets p ON p.funktion_kurzbz IS NULL
|
||||||
|
GROUP BY
|
||||||
|
f.funktion_kurzbz, f.beschreibung
|
||||||
|
)
|
||||||
|
UNION ALL
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
f.funktion_kurzbz,
|
||||||
|
f.beschreibung,
|
||||||
|
COUNT(p.preset_id) AS has_preset
|
||||||
|
FROM
|
||||||
|
public.tbl_funktion f
|
||||||
|
LEFT JOIN
|
||||||
|
dashboard_presets p ON p.funktion_kurzbz = f.funktion_kurzbz
|
||||||
|
GROUP BY
|
||||||
|
f.funktion_kurzbz, f.beschreibung
|
||||||
|
ORDER BY
|
||||||
|
f.beschreibung ASC
|
||||||
|
)
|
||||||
|
";
|
||||||
|
|
||||||
|
$result = $this->FunktionModel->execReadOnlyQuery($sql);
|
||||||
|
|
||||||
|
$funktionen = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($funktionen);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBatch()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('db', 'Dashboard', 'required');
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
$db = $this->input->post('db');
|
||||||
|
$funktionen = $this->input->post('funktionen') ?: [];
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($funktionen as $funktion) {
|
||||||
|
$conf = $this->dashboardlib->getPreset($db, $funktion);
|
||||||
|
if ($conf) {
|
||||||
|
$preset = json_decode($conf->preset, true);
|
||||||
|
$result[$funktion] = $preset;
|
||||||
|
} else {
|
||||||
|
$result[$funktion] = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addWidget()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('dashboard', 'Dashboard', 'required');
|
||||||
|
$this->form_validation->set_rules('funktion_kurzbz', 'Funktion', 'required');
|
||||||
|
$this->form_validation->set_rules('widget[widget]', 'Widget', 'required');
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
$dashboard_kurzbz = $this->input->post('dashboard');
|
||||||
|
$funktion_kurzbz = $this->input->post('funktion_kurzbz');
|
||||||
|
$widget = $this->input->post('widget');
|
||||||
|
|
||||||
|
if (!isset($widget['widgetid']))
|
||||||
|
$widget['widgetid'] = $this->dashboardlib->generateWidgetId($dashboard_kurzbz);
|
||||||
|
|
||||||
|
$preset = $this->dashboardlib->getPresetOrCreateEmptyPreset($dashboard_kurzbz, $funktion_kurzbz);
|
||||||
|
|
||||||
|
$preset_decoded = json_decode($preset->preset, true);
|
||||||
|
|
||||||
|
$preset_decoded[$widget['widgetid']] = $widget;
|
||||||
|
|
||||||
|
$preset->preset = json_encode($preset_decoded);
|
||||||
|
|
||||||
|
$result = $this->dashboardlib->insertOrUpdatePreset($preset);
|
||||||
|
|
||||||
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($widget['widgetid']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeWidget()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('db', 'Dashboard', 'required');
|
||||||
|
$this->form_validation->set_rules('funktion_kurzbz', 'Funktion', 'required');
|
||||||
|
$this->form_validation->set_rules('widgetid', 'Widget', 'required');
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
$dashboard_kurzbz = $this->input->post('db');
|
||||||
|
$funktion_kurzbz = $this->input->post('funktion_kurzbz');
|
||||||
|
$widgetid = $this->input->post('widgetid');
|
||||||
|
|
||||||
|
$preset = $this->dashboardlib->getPreset($dashboard_kurzbz, $funktion_kurzbz);
|
||||||
|
if (!$preset)
|
||||||
|
show_404();
|
||||||
|
|
||||||
|
$preset_decoded = json_decode($preset->preset, true);
|
||||||
|
|
||||||
|
if (!isset($preset_decoded[$widgetid]))
|
||||||
|
show_404();
|
||||||
|
|
||||||
|
unset($preset_decoded[$widgetid]);
|
||||||
|
|
||||||
|
$preset->preset = json_encode($preset_decoded);
|
||||||
|
|
||||||
|
$result = $this->dashboardlib->insertOrUpdatePreset($preset);
|
||||||
|
|
||||||
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(array('msg' => $this->p->t('dashboard', 'success_savePreset')));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2026 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 users dashboard
|
||||||
|
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||||
|
*/
|
||||||
|
class User extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'get' => 'dashboard/benutzer:r',
|
||||||
|
'addWidget' => 'dashboard/benutzer:rw',
|
||||||
|
'removeWidget' => 'dashboard/benutzer:rw'
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Libraries
|
||||||
|
$this->load->library('dashboard/DashboardLib');
|
||||||
|
|
||||||
|
// Models
|
||||||
|
$this->load->model('ressource/Funktion_model', 'FunktionModel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($dashboard_kurzbz)
|
||||||
|
{
|
||||||
|
$dashboard = $this->dashboardlib->getDashboardByKurzbz($dashboard_kurzbz);
|
||||||
|
if (!$dashboard)
|
||||||
|
show_404();
|
||||||
|
|
||||||
|
$uid = $this->authlib->getAuthObj()->username;
|
||||||
|
|
||||||
|
$mergedconfig = $this->dashboardlib->getMergedUserConfig($dashboard->dashboard_id, $uid);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($mergedconfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addWidget()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('dashboard', 'Dashboard', 'required');
|
||||||
|
$this->form_validation->set_rules('widget[widget]', 'Widget', 'required');
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
$widget = $this->input->post('widget');
|
||||||
|
$dashboard_kurzbz = $this->input->post('dashboard');
|
||||||
|
$uid = $this->authlib->getAuthObj()->username;
|
||||||
|
|
||||||
|
if (!isset($widget['widgetid']))
|
||||||
|
$widget['widgetid'] = $this->dashboardlib->generateWidgetId($dashboard_kurzbz);
|
||||||
|
|
||||||
|
if (isset($widget['source']))
|
||||||
|
unset($widget['source']);
|
||||||
|
|
||||||
|
$override = $this->dashboardlib->getOverrideOrCreateEmptyOverride($dashboard_kurzbz, $uid);
|
||||||
|
|
||||||
|
$override_decoded = json_decode($override->override, true);
|
||||||
|
|
||||||
|
$override_decoded[$widget['widgetid']] = $widget;
|
||||||
|
|
||||||
|
$override->override = json_encode($override_decoded);
|
||||||
|
|
||||||
|
$result = $this->dashboardlib->insertOrUpdateOverride($override);
|
||||||
|
|
||||||
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($widget['widgetid']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeWidget()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('dashboard', 'Dashboard', 'required');
|
||||||
|
$this->form_validation->set_rules('widget', 'Widget', 'required');
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
$widget_id = $this->input->post('widget');
|
||||||
|
$dashboard_kurzbz = $this->input->post('dashboard');
|
||||||
|
$uid = $this->authlib->getAuthObj()->username;
|
||||||
|
|
||||||
|
$override = $this->dashboardlib->getOverride($dashboard_kurzbz, $uid);
|
||||||
|
if (!$override)
|
||||||
|
show_404();
|
||||||
|
|
||||||
|
$override_decoded = json_decode($override->override, true);
|
||||||
|
|
||||||
|
if (!isset($override_decoded[$widget_id]))
|
||||||
|
show_404();
|
||||||
|
|
||||||
|
unset($override_decoded[$widget_id]);
|
||||||
|
|
||||||
|
$override->override = json_encode($override_decoded);
|
||||||
|
|
||||||
|
$result = $this->dashboardlib->insertOrUpdateOverride($override);
|
||||||
|
|
||||||
|
$this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2026 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 users dashboard
|
||||||
|
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||||
|
*/
|
||||||
|
class Widget extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'get' => ['dashboard/benutzer:r', 'dashboard/admin:r'],
|
||||||
|
'list' => 'dashboard/admin:r',
|
||||||
|
'listAllowed' => ['dashboard/benutzer:rw', 'dashboard/admin:r'],
|
||||||
|
'setAllowed' => 'dashboard/admin:rw'
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Libraries
|
||||||
|
$this->load->library('dashboard/DashboardLib');
|
||||||
|
|
||||||
|
// Models
|
||||||
|
$this->load->model('dashboard/Widget_model', 'WidgetModel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($id)
|
||||||
|
{
|
||||||
|
$result = $this->WidgetModel->load($id);
|
||||||
|
|
||||||
|
$widget = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
if (!$widget)
|
||||||
|
return $this->terminateWithSuccess([
|
||||||
|
"widget_id" => 0,
|
||||||
|
"widget_kurzbz" => "notfound",
|
||||||
|
"arguments" => [
|
||||||
|
"className" => 'alert-danger',
|
||||||
|
"title" => 'Widget Not Found',
|
||||||
|
"msg" => 'The widget with the id ' . $id . ' could not be found'
|
||||||
|
],
|
||||||
|
"setup" => [
|
||||||
|
"name" => 'Widget Not Found',
|
||||||
|
"file" => absoluteJsImportUrl('public/js/components/DashboardWidget/Default.js'),
|
||||||
|
"width" => 1,
|
||||||
|
"height" => 1
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
$widget = current($widget);
|
||||||
|
$widget->arguments = json_decode($widget->arguments);
|
||||||
|
$tmpsetup = json_decode($widget->setup);
|
||||||
|
$tmpsetup->file = absoluteJsImportUrl($tmpsetup->file);
|
||||||
|
$widget->setup = $tmpsetup;
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function list($dashboard)
|
||||||
|
{
|
||||||
|
$result = $this->WidgetModel->getWithAllowedForDashboard($dashboard);
|
||||||
|
|
||||||
|
$widgets = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$widgets = array_map(function ($widget) {
|
||||||
|
$widget->arguments = json_decode($widget->arguments);
|
||||||
|
$tmpsetup = json_decode($widget->setup);
|
||||||
|
$tmpsetup->file = absoluteJsImportUrl($tmpsetup->file);
|
||||||
|
$widget->setup = $tmpsetup;
|
||||||
|
return $widget;
|
||||||
|
}, $widgets);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($widgets);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listAllowed($dashboard)
|
||||||
|
{
|
||||||
|
$result = $this->WidgetModel->getForDashboard($dashboard);
|
||||||
|
|
||||||
|
$widgets = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$widgets = array_map(function ($widget) {
|
||||||
|
$widget->arguments = json_decode($widget->arguments);
|
||||||
|
$tmpsetup = json_decode($widget->setup);
|
||||||
|
$tmpsetup->file = absoluteJsImportUrl($tmpsetup->file);
|
||||||
|
$widget->setup = $tmpsetup;
|
||||||
|
return $widget;
|
||||||
|
}, $widgets);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($widgets);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAllowed()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('dashboard_id', 'Dashboard', 'required');
|
||||||
|
$this->form_validation->set_rules('widget_id', 'Widget', 'required');
|
||||||
|
$this->form_validation->set_rules('allowed', 'Allowed', 'is_bool');
|
||||||
|
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'dashboard_id' => $this->input->post('dashboard_id'),
|
||||||
|
'widget_id' => $this->input->post('widget_id')
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->load->model('dashboard/Dashboard_Widget_model', 'DashboardWidgetModel');
|
||||||
|
|
||||||
|
if ($this->input->post('allowed'))
|
||||||
|
$result = $this->DashboardWidgetModel->insert($data);
|
||||||
|
else
|
||||||
|
$result = $this->DashboardWidgetModel->delete($data);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
|
||||||
|
class Detailheader extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getHeader' => ['vertrag/mitarbeiter:r', 'basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
|
||||||
|
'getPersonAbteilung' => ['vertrag/mitarbeiter:r', 'basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
|
||||||
|
'getLeitungOrg' => ['vertrag/mitarbeiter:r', 'basis/mitarbeiter:r', 'admin:r', 'assistenz:r'],
|
||||||
|
'getSemesterStati' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeader($person_id)
|
||||||
|
{
|
||||||
|
$this->load->model('ressource/Mitarbeiter_model', 'Mitarbeitermodel');
|
||||||
|
|
||||||
|
$result = $this->Mitarbeitermodel->getHeader($person_id);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(current($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonAbteilung($mitarbeiter_uid)
|
||||||
|
{
|
||||||
|
$this->load->model('ressource/Mitarbeiter_model', 'Mitarbeitermodel');
|
||||||
|
|
||||||
|
$result = $this->Mitarbeitermodel->getPersonAbteilung($mitarbeiter_uid);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(current($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLeitungOrg($oekurzbz)
|
||||||
|
{
|
||||||
|
$this->load->model('ressource/Mitarbeiter_model', 'Mitarbeitermodel');
|
||||||
|
|
||||||
|
$result = $this->Mitarbeitermodel->getLeitungOrg($oekurzbz);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(current($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSemesterStati($prestudent_id)
|
||||||
|
{
|
||||||
|
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||||
|
|
||||||
|
$result = $this->PrestudentstatusModel->getAllPrestudentstatiWithStudiensemester($prestudent_id);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,237 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
|
||||||
|
class Foto extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'uploadFoto' => ['admin:r', 'assistenz:r'],
|
||||||
|
'deleteFoto' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
//Load Models and Libraries
|
||||||
|
$this->load->model('person/Person_model', 'PersonModel');
|
||||||
|
$this->load->model("crm/Akte_model", "AkteModel");
|
||||||
|
$this->load->model('person/Fotostatusperson_model', 'FotostatusPersonModel');
|
||||||
|
|
||||||
|
$this->loadPhrases([
|
||||||
|
'ui',
|
||||||
|
'header'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uploadFoto($person_id)
|
||||||
|
{
|
||||||
|
if(!$person_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Person_id']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
if (!empty($data['image']))
|
||||||
|
{
|
||||||
|
$base64 = $data['image'];
|
||||||
|
$resizedImage1 = $this->_resize($base64, 827, 1063);
|
||||||
|
|
||||||
|
if (is_null($resizedImage1))
|
||||||
|
return $this->terminateWithError($this->p->t('header', 'error_fotoupload'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$akte = $this->AkteModel->loadWhere(array('person_id' => $person_id, 'dokument_kurzbz' => 'Lichtbil'));
|
||||||
|
|
||||||
|
$akteUpdateData = array(
|
||||||
|
'dokument_kurzbz' => 'Lichtbil',
|
||||||
|
'person_id' => $person_id,
|
||||||
|
'inhalt' => $resizedImage1,
|
||||||
|
'mimetype' => 'image/jpg',
|
||||||
|
'erstelltam' => date('c'),
|
||||||
|
'gedruckt' => false,
|
||||||
|
'titel' => 'Lichtbild_' . $person_id . '.jpg',
|
||||||
|
'bezeichnung' => 'Lichtbild gross',
|
||||||
|
'insertamum' => date('c'),
|
||||||
|
'insertvon' => getAuthUID(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (hasData($akte)) {
|
||||||
|
$akte_id = getData($akte)[0]->akte_id;
|
||||||
|
|
||||||
|
$akteUpdateData['updateamum'] = date('c');
|
||||||
|
$akteUpdateData['updatevon'] = getAuthUID();
|
||||||
|
$akteResult = $this->AkteModel->update(array('akte_id' => $akte_id), $akteUpdateData);
|
||||||
|
} else {
|
||||||
|
$akteResult = $this->AkteModel->insert($akteUpdateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isError($akteResult)) {
|
||||||
|
return $this->terminateWithError(getError($akteResult), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$resizedImage2 = $this->_resize($base64, 101, 130);
|
||||||
|
|
||||||
|
if (is_null($resizedImage2))
|
||||||
|
return $this->terminateWithError($this->p->t('header', 'error_fotoupload'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$result = $this->_updateFoto($person_id, $resizedImage2);
|
||||||
|
|
||||||
|
if (!isError($result)) {
|
||||||
|
$this->FotostatusPersonModel->insert(array(
|
||||||
|
'person_id' => $person_id,
|
||||||
|
'fotostatus_kurzbz' => 'hochgeladen',
|
||||||
|
'datum' => date('Y-m-d'),
|
||||||
|
'updateamum' => date('c'),
|
||||||
|
'updatevon' => getAuthUID(),
|
||||||
|
'insertamum' => date('c'),
|
||||||
|
'insertvon' => getAuthUID(),
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->terminateWithSuccess($base64);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('header', 'error_noPhoto'), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteFoto($person_id)
|
||||||
|
{
|
||||||
|
if(!$person_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Person_id']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->_deleteFoto($person_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
{
|
||||||
|
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
return $this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _resize($imageData, $maxwidth, $maxheight, $quality = 90)
|
||||||
|
{
|
||||||
|
$meta = getimagesize($imageData);
|
||||||
|
if (!$meta)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$src_width = $meta[0];
|
||||||
|
$src_height = $meta[1];
|
||||||
|
$mime = $meta['mime'];
|
||||||
|
|
||||||
|
switch ($mime) {
|
||||||
|
case 'image/jpeg':
|
||||||
|
case 'image/jpg':
|
||||||
|
$imagecreated = imagecreatefromjpeg($imageData);
|
||||||
|
break;
|
||||||
|
case 'image/png':
|
||||||
|
$imagecreated = imagecreatefrompng($imageData);
|
||||||
|
break;
|
||||||
|
case 'image/gif':
|
||||||
|
$imagecreated = imagecreatefromgif($imageData);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!$imagecreated)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$src_aspect_ratio = $src_width / $src_height;
|
||||||
|
$thu_aspect_ratio = $maxwidth / $maxheight;
|
||||||
|
|
||||||
|
if ($src_width <= $maxwidth && $src_height <= $maxheight)
|
||||||
|
{
|
||||||
|
$thu_width = $src_width;
|
||||||
|
$thu_height = $src_height;
|
||||||
|
}
|
||||||
|
elseif ($thu_aspect_ratio > $src_aspect_ratio)
|
||||||
|
{
|
||||||
|
$thu_width = (int) ($maxheight * $src_aspect_ratio);
|
||||||
|
$thu_height = $maxheight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$thu_width = $maxwidth;
|
||||||
|
$thu_height = (int) ($maxwidth / $src_aspect_ratio);
|
||||||
|
}
|
||||||
|
|
||||||
|
$imageScaled = imagecreatetruecolor($thu_width, $thu_height);
|
||||||
|
|
||||||
|
if ($mime === 'image/png')
|
||||||
|
{
|
||||||
|
$background = imagecolorallocate($imageScaled , 0, 0, 0);
|
||||||
|
imagecolortransparent($imageScaled, $background);
|
||||||
|
imagealphablending($imageScaled, false);
|
||||||
|
imagesavealpha($imageScaled, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
imagecopyresampled($imageScaled, $imagecreated, 0, 0, 0, 0, $thu_width, $thu_height, $src_width, $src_height);
|
||||||
|
|
||||||
|
if ($mime === "image/gif")
|
||||||
|
{
|
||||||
|
$background = imagecolorallocate($imageScaled, 0, 0, 0);
|
||||||
|
imagecolortransparent($imageScaled, $background);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($imageScaled))
|
||||||
|
{
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
if ($mime == 'image/png')
|
||||||
|
imagepng($imageScaled, NULL);
|
||||||
|
else if ($mime === 'image/gif')
|
||||||
|
imagegif($imageScaled, NULL);
|
||||||
|
else
|
||||||
|
imagejpeg($imageScaled, NULL, $quality);
|
||||||
|
|
||||||
|
$resizedImageData = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
@imagedestroy($imagecreated);
|
||||||
|
@imagedestroy($imageScaled);
|
||||||
|
|
||||||
|
|
||||||
|
if (!empty($resizedImageData))
|
||||||
|
{
|
||||||
|
return base64_encode($resizedImageData);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _updateFoto($person_id, $foto)
|
||||||
|
{
|
||||||
|
$personJson['foto'] = $foto;
|
||||||
|
$result = $this->PersonModel->update($person_id, $personJson);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
{
|
||||||
|
return error($result->msg, EXIT_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _deleteFoto($person_id)
|
||||||
|
{
|
||||||
|
$personJson['foto'] = null;
|
||||||
|
$result = $this->PersonModel->update($person_id, $personJson);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
{
|
||||||
|
return error($result->msg, EXIT_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,332 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
|
||||||
|
class Funktionen extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//TODO(Manu) check permissions
|
||||||
|
parent::__construct(array(
|
||||||
|
'getAllFunctions' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getAllUserFunctions' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getOrgHeads' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getOrgetsForCompany' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getAllOrgUnits' => ['admin:r', 'assistenz:r'],
|
||||||
|
'loadFunction' => ['admin:r', 'assistenz:r'],
|
||||||
|
'insertFunction' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'updateFunction' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'deleteFunction' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Load Libraries
|
||||||
|
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
// Load language phrases
|
||||||
|
$this->loadPhrases([
|
||||||
|
'ui',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load models
|
||||||
|
$this->load->model('extensions/FHC-Core-Personalverwaltung/Api_model', 'ApiModel');
|
||||||
|
$this->load->model('ressource/Funktion_model', 'FunktionModel');
|
||||||
|
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
|
||||||
|
|
||||||
|
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllFunctions()
|
||||||
|
{
|
||||||
|
$this->FunktionModel->addSelect("funktion_kurzbz");
|
||||||
|
$this->FunktionModel->addSelect("beschreibung");
|
||||||
|
$this->FunktionModel->addSelect("aktiv");
|
||||||
|
$this->FunktionModel->addSelect("beschreibung AS label");
|
||||||
|
$this->FunktionModel->addOrder("beschreibung");
|
||||||
|
$result = $this->FunktionModel->load();
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOrgHeads()
|
||||||
|
{
|
||||||
|
$result = $this->OrganisationseinheitModel->getHeads();
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllUserFunctions($uid)
|
||||||
|
{
|
||||||
|
if(!$uid)
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'UID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
dv.dienstverhaeltnis_id,
|
||||||
|
un.bezeichnung || ' (' || TO_CHAR(dv.von, 'DD.MM.YYYY') || CASE WHEN dv.bis IS NOT NULL THEN ' - '
|
||||||
|
|| TO_CHAR(dv.bis, 'DD.MM.YYYY') ELSE '' END || ')' AS dienstverhaeltnis_unternehmen ,
|
||||||
|
'[' || oet.bezeichnung || '] ' || oe.bezeichnung AS funktion_oebezeichnung,
|
||||||
|
f.beschreibung AS funktion_beschreibung,
|
||||||
|
bf.*,
|
||||||
|
fb.bezeichnung AS fachbereich_bezeichnung,
|
||||||
|
CASE
|
||||||
|
WHEN
|
||||||
|
bf.datum_bis IS NOT NULL AND bf.datum_bis::date < now()::date
|
||||||
|
THEN
|
||||||
|
false
|
||||||
|
ELSE
|
||||||
|
true
|
||||||
|
END aktiv
|
||||||
|
FROM
|
||||||
|
public.tbl_benutzerfunktion bf
|
||||||
|
JOIN
|
||||||
|
public.tbl_organisationseinheit oe ON oe.oe_kurzbz = bf.oe_kurzbz
|
||||||
|
JOIN
|
||||||
|
public.tbl_organisationseinheittyp oet ON oe.organisationseinheittyp_kurzbz = oet.organisationseinheittyp_kurzbz
|
||||||
|
JOIN
|
||||||
|
public.tbl_funktion f ON f.funktion_kurzbz = bf.funktion_kurzbz
|
||||||
|
LEFT JOIN
|
||||||
|
hr.tbl_vertragsbestandteil_funktion vf ON vf.benutzerfunktion_id = bf.benutzerfunktion_id
|
||||||
|
LEFT JOIN
|
||||||
|
hr.tbl_vertragsbestandteil v ON vf.vertragsbestandteil_id = v.vertragsbestandteil_id
|
||||||
|
LEFT JOIN
|
||||||
|
hr.tbl_dienstverhaeltnis dv ON v.dienstverhaeltnis_id = dv.dienstverhaeltnis_id
|
||||||
|
LEFT JOIN
|
||||||
|
public.tbl_organisationseinheit un ON dv.oe_kurzbz = un.oe_kurzbz
|
||||||
|
LEFT JOIN
|
||||||
|
public.tbl_fachbereich fb ON fb.fachbereich_kurzbz = bf.fachbereich_kurzbz
|
||||||
|
WHERE
|
||||||
|
bf.uid = ?
|
||||||
|
ORDER BY
|
||||||
|
bf.datum_von, bf.datum_von ASC";
|
||||||
|
|
||||||
|
$benutzerfunktionen = $this->BenutzerfunktionModel->execReadOnlyQuery($sql, array($uid));
|
||||||
|
$data = $this->getDataOrTerminateWithError($benutzerfunktionen);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* returns list of all organisation units
|
||||||
|
* as key value list to be used in select or autocomplete
|
||||||
|
*/
|
||||||
|
public function getAllOrgUnits()
|
||||||
|
{
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
oe.oe_kurzbz, oe.aktiv,
|
||||||
|
'[' || COALESCE(oet.bezeichnung, oet.organisationseinheittyp_kurzbz) ||
|
||||||
|
'] ' || COALESCE(oe.bezeichnung, oe.oe_kurzbz) AS label
|
||||||
|
FROM public.tbl_organisationseinheit oe
|
||||||
|
JOIN public.tbl_organisationseinheittyp oet ON oe.organisationseinheittyp_kurzbz = oet.organisationseinheittyp_kurzbz
|
||||||
|
ORDER BY oet.bezeichnung ASC, oe.bezeichnung ASC";
|
||||||
|
|
||||||
|
$result = $this->OrganisationseinheitModel->execReadOnlyQuery($sql);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return list of child orgets for a given company orget_kurzbz
|
||||||
|
* as key value list to be used in select or autocomplete
|
||||||
|
*/
|
||||||
|
public function getOrgetsForCompany($companyOrgetkurzbz = null)
|
||||||
|
{
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
oe.oe_kurzbz, oe.aktiv,
|
||||||
|
'[' || COALESCE(oet.bezeichnung, oet.organisationseinheittyp_kurzbz) ||
|
||||||
|
'] ' || COALESCE(oe.bezeichnung, oe.oe_kurzbz) AS label
|
||||||
|
FROM (
|
||||||
|
WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
|
||||||
|
(
|
||||||
|
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
|
||||||
|
WHERE oe_kurzbz=?
|
||||||
|
UNION ALL
|
||||||
|
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
|
||||||
|
WHERE o.oe_parent_kurzbz=oes.oe_kurzbz
|
||||||
|
)
|
||||||
|
SELECT oe_kurzbz
|
||||||
|
FROM oes
|
||||||
|
GROUP BY oe_kurzbz
|
||||||
|
) c
|
||||||
|
JOIN public.tbl_organisationseinheit oe ON oe.oe_kurzbz = c.oe_kurzbz
|
||||||
|
JOIN public.tbl_organisationseinheittyp oet ON oe.organisationseinheittyp_kurzbz = oet.organisationseinheittyp_kurzbz
|
||||||
|
ORDER BY oet.bezeichnung ASC, oe.bezeichnung ASC";
|
||||||
|
|
||||||
|
$childorgets = $this->OrganisationseinheitModel->execReadOnlyQuery($sql, array($companyOrgetkurzbz));
|
||||||
|
$data = $this->getDataOrTerminateWithError($childorgets);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadFunction($benutzerfunktion_id)
|
||||||
|
{
|
||||||
|
$this->BenutzerfunktionModel->addSelect("*");
|
||||||
|
$result = $this->BenutzerfunktionModel->loadWhere(
|
||||||
|
array('benutzerfunktion_id' => $benutzerfunktion_id)
|
||||||
|
);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(current($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insertFunction()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
$authUID = getAuthUID();
|
||||||
|
|
||||||
|
$uid = $this->input->post('uid');
|
||||||
|
|
||||||
|
if(!$uid)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'UID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$formData = $this->input->post('formData');
|
||||||
|
|
||||||
|
$datum_von = $formData['datum_von'] ?? null;
|
||||||
|
$datum_bis = $formData['datum_bis'] ?? null;
|
||||||
|
$formData['oe_kurzbz'] = is_array($formData['oe_kurzbz']) ? $formData['oe_kurzbz']['oe_kurzbz'] : $formData['oe_kurzbz'];
|
||||||
|
$formData['funktion_kurzbz'] = is_array($formData['funktion_kurzbz'])
|
||||||
|
? $formData['funktion_kurzbz']['funktion_kurzbz']
|
||||||
|
: $formData['funktion_kurzbz'];
|
||||||
|
$bezeichnung = $formData['bezeichnung'] ?? null;
|
||||||
|
$wochenstunden = $formData['wochenstunden'] ?? null;
|
||||||
|
|
||||||
|
$this->form_validation->set_data($formData);
|
||||||
|
$this->form_validation->set_rules('datum_von', 'VonDatum', 'required|is_valid_date', [
|
||||||
|
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'VonDatum']),
|
||||||
|
'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VonDatum'])
|
||||||
|
]);
|
||||||
|
$this->form_validation->set_rules('datum_bis', 'BisDatum', 'is_valid_date', [
|
||||||
|
'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'BisDatum'])
|
||||||
|
]);
|
||||||
|
$this->form_validation->set_rules('oe_kurzbz', 'Organisationseinheit', 'required', [
|
||||||
|
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Organisationseinheit'])
|
||||||
|
]);
|
||||||
|
$this->form_validation->set_rules('funktion_kurzbz', 'Funktion', 'required', [
|
||||||
|
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Funktion'])
|
||||||
|
]);
|
||||||
|
$this->form_validation->set_rules('wochenstunden', 'Wochenstunden', 'numeric', [
|
||||||
|
'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Wochenstunden'])
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->form_validation->run() == false)
|
||||||
|
{
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->BenutzerfunktionModel->insert([
|
||||||
|
'uid' => $uid,
|
||||||
|
'datum_von' => $datum_von,
|
||||||
|
'datum_bis' => $datum_bis ,
|
||||||
|
'oe_kurzbz' => $formData['oe_kurzbz'],
|
||||||
|
'funktion_kurzbz' => $formData['funktion_kurzbz'],
|
||||||
|
'bezeichnung' => $bezeichnung,
|
||||||
|
'wochenstunden' => $wochenstunden,
|
||||||
|
'insertamum' => date('c'),
|
||||||
|
'insertvon' => $authUID,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateFunction()
|
||||||
|
{
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
$authUID = getAuthUID();
|
||||||
|
|
||||||
|
$uid = $this->input->post('uid');
|
||||||
|
|
||||||
|
if(!$uid)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'UID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$benutzerfunktion_id = $this->input->post('benutzerfunktion_id');
|
||||||
|
|
||||||
|
if(!$benutzerfunktion_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Benutzerfunktion ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$formData = $this->input->post('formData');
|
||||||
|
|
||||||
|
$datum_von = $formData['datum_von'] ?? null;
|
||||||
|
$datum_bis = $formData['datum_bis'] ?? null;
|
||||||
|
$formData['oe_kurzbz'] = is_array($formData['oe_kurzbz']) ? $formData['oe_kurzbz']['oe_kurzbz'] : $formData['oe_kurzbz'];
|
||||||
|
$formData['funktion_kurzbz'] = is_array($formData['funktion_kurzbz'])
|
||||||
|
? $formData['funktion_kurzbz']['funktion_kurzbz']
|
||||||
|
: $formData['funktion_kurzbz'];
|
||||||
|
$bezeichnung = $formData['bezeichnung'] ?? null;
|
||||||
|
$wochenstunden = $formData['wochenstunden'] ?? null;
|
||||||
|
|
||||||
|
$this->form_validation->set_data($formData);
|
||||||
|
$this->form_validation->set_rules('datum_von', 'VonDatum', 'required|is_valid_date', [
|
||||||
|
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'VonDatum']),
|
||||||
|
'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VonDatum'])
|
||||||
|
]);
|
||||||
|
$this->form_validation->set_rules('datum_bis', 'BisDatum', 'is_valid_date', [
|
||||||
|
'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'BisDatum'])
|
||||||
|
]);
|
||||||
|
$this->form_validation->set_rules('oe_kurzbz', 'Organisationseinheit', 'required', [
|
||||||
|
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Organisationseinheit'])
|
||||||
|
]);
|
||||||
|
$this->form_validation->set_rules('funktion_kurzbz', 'Funktion', 'required', [
|
||||||
|
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Funktion'])
|
||||||
|
]);
|
||||||
|
$this->form_validation->set_rules('wochenstunden', 'Wochenstunden', 'numeric', [
|
||||||
|
'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Wochenstunden'])
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->form_validation->run() == false)
|
||||||
|
{
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
}
|
||||||
|
if($datum_von == '')
|
||||||
|
$datum_von = null;
|
||||||
|
if($datum_bis == '')
|
||||||
|
$datum_bis = null;
|
||||||
|
|
||||||
|
$result = $this->BenutzerfunktionModel->update(
|
||||||
|
[
|
||||||
|
'benutzerfunktion_id' => $benutzerfunktion_id,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => $uid,
|
||||||
|
'datum_von' => $datum_von,
|
||||||
|
'datum_bis' => $datum_bis ,
|
||||||
|
'oe_kurzbz' => $formData['oe_kurzbz'],
|
||||||
|
'funktion_kurzbz' => $formData['funktion_kurzbz'],
|
||||||
|
'bezeichnung' => $bezeichnung,
|
||||||
|
'wochenstunden' => $wochenstunden,
|
||||||
|
'updateamum' => date('c'),
|
||||||
|
'updatevon' => $authUID,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteFunction($benutzerfunktion_id)
|
||||||
|
{
|
||||||
|
$result = $this->BenutzerfunktionModel->delete(
|
||||||
|
array('benutzerfunktion_id' => $benutzerfunktion_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('BASEPATH'))
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Config extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
private $_ci;
|
||||||
|
private $_uid;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'get' => ['admin:r', 'assistenz:r'],
|
||||||
|
'set' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->_ci = &get_instance();
|
||||||
|
$this->_setAuthUID();
|
||||||
|
|
||||||
|
$this->loadPhrases([
|
||||||
|
'lehre'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->_ci->load->library('VariableLib', ['uid' => $this->_uid]);
|
||||||
|
$this->_ci->load->library('PermissionLib');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function get()
|
||||||
|
{
|
||||||
|
if (!($this->permissionlib->isBerechtigt('basis/tempus')) && !($this->permissionlib->isBerechtigt('lv-plan')))
|
||||||
|
$this->terminateWithSuccess([]);
|
||||||
|
|
||||||
|
$ignore_kollision = $this->_ci->variablelib->getVar('ignore_kollision');
|
||||||
|
$ignore_zeitsperre = $this->_ci->variablelib->getVar('ignore_zeitsperre');
|
||||||
|
$ignore_reservierung = $this->_ci->variablelib->getVar('ignore_reservierung');
|
||||||
|
|
||||||
|
$config['ignore_kollision'] = [
|
||||||
|
"type" => "checkbox",
|
||||||
|
"label" => 'ignore_kollision',
|
||||||
|
"value" => $ignore_kollision,
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['ignore_zeitsperre'] = [
|
||||||
|
"type" => "checkbox",
|
||||||
|
"label" => 'ignore_zeitsperre',
|
||||||
|
"value" => $ignore_zeitsperre,
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['ignore_reservierung'] = [
|
||||||
|
"type" => "checkbox",
|
||||||
|
"label" => 'ignore_reservierung',
|
||||||
|
"value" => $ignore_reservierung,
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($config);
|
||||||
|
}
|
||||||
|
public function set()
|
||||||
|
{
|
||||||
|
if (!($this->permissionlib->isBerechtigt('basis/tempus')) && !($this->permissionlib->isBerechtigt('lv-plan')))
|
||||||
|
$this->terminateWithSuccess([]);
|
||||||
|
|
||||||
|
$this->load->model('system/Variable_model', 'VariableModel');
|
||||||
|
|
||||||
|
foreach (['ignore_kollision','ignore_zeitsperre','ignore_reservierung'] as $variable)
|
||||||
|
{
|
||||||
|
if ($this->_ci->input->post($variable) !== null)
|
||||||
|
{
|
||||||
|
$this->VariableModel->update(array('uid' => $this->_uid, 'name' => $variable), array('wert' => $this->input->post($variable)));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _setAuthUID()
|
||||||
|
{
|
||||||
|
$this->_uid = getAuthUID();
|
||||||
|
|
||||||
|
if (!$this->_uid)
|
||||||
|
show_error('User authentification failed');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2025 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');
|
||||||
|
|
||||||
|
class DirektGruppe extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
private $_ci;
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'add' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'delete' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'getByLehreinheit' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->_ci = &get_instance();
|
||||||
|
|
||||||
|
$this->loadPhrases([
|
||||||
|
'ui'
|
||||||
|
]);
|
||||||
|
$this->_ci->load->model('education/Lehreinheitgruppe_model', 'LehreinheitgruppeModel');
|
||||||
|
$this->_ci->load->model('education/lehreinheit_model', 'LehreinheitModel');
|
||||||
|
$this->_ci->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$uid = $this->input->post('uid');
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
|
||||||
|
$this->checkPermission($lehreinheit_id, $uid);
|
||||||
|
|
||||||
|
$result = $this->_ci->LehreinheitgruppeModel->direktUserAdd($uid, $lehreinheit_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result));
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete()
|
||||||
|
{
|
||||||
|
$uid = $this->input->post('uid');
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
|
||||||
|
$this->checkPermission($lehreinheit_id, $uid);
|
||||||
|
|
||||||
|
$result = $this->_ci->LehreinheitgruppeModel->direktUserDelete($uid, $lehreinheit_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result));
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getByLehreinheit($lehreinheit_id = null)
|
||||||
|
{
|
||||||
|
$this->checkPermission($lehreinheit_id);
|
||||||
|
$gruppen = $this->_ci->LehreinheitgruppeModel->getDirectGroup($lehreinheit_id);
|
||||||
|
$this->terminateWithSuccess(hasData($gruppen) ? getData($gruppen) : array());
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkPermission($lehreinheit_id, $uid = false)
|
||||||
|
{
|
||||||
|
if (is_null($lehreinheit_id) || !ctype_digit((string)$lehreinheit_id))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$lehreinheit_result = $this->_ci->LehreinheitModel->load($lehreinheit_id);
|
||||||
|
|
||||||
|
if (!hasData($lehreinheit_result) || isError($lehreinheit_result))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
if ($uid)
|
||||||
|
{
|
||||||
|
$benuzuer_result = $this->_ci->BenutzerModel->load(array($uid));
|
||||||
|
if (!hasData($benuzuer_result) || isError($benuzuer_result))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->_ci->LehreinheitModel->getOes($lehreinheit_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$oe_array = [];
|
||||||
|
if (hasData($result))
|
||||||
|
$oe_array = getData($result);
|
||||||
|
|
||||||
|
if (!$this->_ci->permissionlib->isBerechtigtMultipleOe('admin', $oe_array, 'suid') &&
|
||||||
|
!$this->_ci->permissionlib->isBerechtigtMultipleOe('assistenz', $oe_array, 'suid'))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_fieldWriteAccess'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,316 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('BASEPATH'))
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Gruppe extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
private $_uid;
|
||||||
|
private $_ci;
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'add' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'delete' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'deleteFromLVPlan' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'getBenutzerSearch' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getAllSearch' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getByLehreinheit' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getGruppe' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->_ci = &get_instance();
|
||||||
|
$this->_setAuthUID();
|
||||||
|
$this->_ci->load->library('PhrasesLib');
|
||||||
|
$this->loadPhrases(
|
||||||
|
array(
|
||||||
|
'ui',
|
||||||
|
'lehre'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_ci->load->model('organisation/Gruppe_model', 'GruppeModel');
|
||||||
|
$this->_ci->load->model('organisation/Lehrverband_model', 'LehrverbandModel');
|
||||||
|
$this->_ci->load->model('education/Lehreinheitgruppe_model', 'LehreinheitgruppeModel');
|
||||||
|
$this->_ci->load->model('person/Person_model', 'PersonModel');
|
||||||
|
$this->_ci->load->model('ressource/stundenplandev_model', 'StundenplandevModel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete()
|
||||||
|
{
|
||||||
|
$lehreinheitgruppe_id = $this->input->post('lehreinheitgruppe_id');
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
|
||||||
|
if (is_null($lehreinheit_id) || !ctype_digit((string)$lehreinheit_id) || is_null($lehreinheitgruppe_id) || !ctype_digit((string)$lehreinheitgruppe_id))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$lehreinheitgruppe_result = $this->_ci->LehreinheitgruppeModel->loadWhere(array('lehreinheitgruppe_id' => $lehreinheitgruppe_id));
|
||||||
|
if (!hasData($lehreinheitgruppe_result) || isError($lehreinheitgruppe_result))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$this->checkPermission($lehreinheit_id);
|
||||||
|
|
||||||
|
$result = $this->_ci->LehreinheitgruppeModel->deleteGroup($lehreinheit_id, $lehreinheitgruppe_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result));
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
$gid = $this->input->post('gid');
|
||||||
|
$lehrverband = $this->input->post('lehrverband');
|
||||||
|
|
||||||
|
if (is_null($lehreinheit_id) || !ctype_digit((string)$lehreinheit_id) || is_null($gid) || !ctype_digit((string)$gid) || is_null($lehrverband))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$this->checkPermission($lehreinheit_id);
|
||||||
|
|
||||||
|
$result = $this->_ci->LehreinheitgruppeModel->addGroup($lehreinheit_id, $gid, $lehrverband === true || $lehrverband === 'true');
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result));
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGruppe()
|
||||||
|
{
|
||||||
|
$lehrverband = $this->input->post('lehrverband');
|
||||||
|
|
||||||
|
$gruppen_result = array();
|
||||||
|
|
||||||
|
if ($lehrverband === false)
|
||||||
|
{
|
||||||
|
$gruppen_result = $this->_ci->GruppeModel->loadWhere(array(
|
||||||
|
'studiengang_kz' => $this->input->post('stg_kz'),
|
||||||
|
'gruppe_kurzbz' => $this->input->post('gruppe_kurzbz'),
|
||||||
|
'aktiv' => true
|
||||||
|
));
|
||||||
|
}
|
||||||
|
else if ($lehrverband === true)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!isEmptyString($this->input->post('verband')))
|
||||||
|
{
|
||||||
|
$this->LehrverbandModel->db->where('verband', $this->input->post('verband'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->LehrverbandModel->db->group_start();
|
||||||
|
$this->LehrverbandModel->db->where("trim(verband) = ''");
|
||||||
|
$this->LehrverbandModel->db->or_where("verband IS NULL");
|
||||||
|
$this->LehrverbandModel->db->group_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isEmptyString($this->input->post('gruppe')))
|
||||||
|
{
|
||||||
|
$this->LehrverbandModel->db->where('gruppe', $this->input->post('gruppe'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->LehrverbandModel->db->group_start();
|
||||||
|
$this->LehrverbandModel->db->where("trim(gruppe) = ''");
|
||||||
|
$this->LehrverbandModel->db->or_where("gruppe IS NULL");
|
||||||
|
$this->LehrverbandModel->db->group_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isEmptyString((string)$this->input->post('semester')))
|
||||||
|
{
|
||||||
|
$this->LehrverbandModel->db->where('semester', $this->input->post('semester'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->LehrverbandModel->db->group_start();
|
||||||
|
$this->LehrverbandModel->db->where("semester = ''");
|
||||||
|
$this->LehrverbandModel->db->or_where("semester IS NULL");
|
||||||
|
$this->LehrverbandModel->db->group_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
$gruppen_result = $this->LehrverbandModel->loadWhere(array('studiengang_kz' => $this->input->post('stg_kz'), 'aktiv' => true));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasData($gruppen_result))
|
||||||
|
return $this->terminateWithError('No group found');
|
||||||
|
|
||||||
|
$gruppen_array = getData($gruppen_result)[0];
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($gruppen_array->gid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getByLehreinheit($lehreinheit_id = null)
|
||||||
|
{
|
||||||
|
if (is_null($lehreinheit_id) || !ctype_digit((string)$lehreinheit_id))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$this->checkPermission($lehreinheit_id);
|
||||||
|
|
||||||
|
$gruppen = $this->_ci->LehreinheitgruppeModel->getByLehreinheit($lehreinheit_id);
|
||||||
|
$this->terminateWithSuccess(hasData($gruppen) ? getData($gruppen) : array());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteFromLVPlan()
|
||||||
|
{
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
$lehreinheitgruppe_id = $this->input->post('lehreinheitgruppe_id');
|
||||||
|
|
||||||
|
if (is_null($lehreinheit_id) || !ctype_digit((string)$lehreinheit_id) || is_null($lehreinheitgruppe_id) || !ctype_digit((string)$lehreinheitgruppe_id))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$lehreinheitgruppe_result = $this->_ci->LehreinheitgruppeModel->loadWhere(array('lehreinheitgruppe_id' => $lehreinheitgruppe_id));
|
||||||
|
if (!hasData($lehreinheitgruppe_result) || isError($lehreinheitgruppe_result))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$this->checkPermission($lehreinheit_id);
|
||||||
|
|
||||||
|
$result = $this->_ci->StundenplandevModel->deleteGroupPlanning($lehreinheit_id, $lehreinheitgruppe_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result));
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getAllSearch()
|
||||||
|
{
|
||||||
|
$query = $this->input->get('query');
|
||||||
|
|
||||||
|
if (is_null($query))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$query_words = explode(' ', $query);
|
||||||
|
|
||||||
|
$this->_ci->GruppeModel->addSelect('gruppe_kurzbz,
|
||||||
|
studiengang_kz,
|
||||||
|
semester,
|
||||||
|
bezeichnung,
|
||||||
|
gid,
|
||||||
|
\'false\' as lehrverband');
|
||||||
|
$this->_ci->GruppeModel->db->where(array('sichtbar' => true, 'aktiv' => true, 'lehre' => true, 'direktinskription' => false, 'semester IS NOT NULL' => null));
|
||||||
|
$this->_ci->GruppeModel->db->group_start();
|
||||||
|
foreach ($query_words as $word)
|
||||||
|
{
|
||||||
|
$this->_ci->GruppeModel->db->group_start();
|
||||||
|
$this->_ci->GruppeModel->db->where('gruppe_kurzbz ILIKE', "%" . $word . "%");
|
||||||
|
$this->_ci->GruppeModel->db->or_where('bezeichnung ILIKE', "%" . $word . "%");
|
||||||
|
$this->_ci->GruppeModel->db->group_end();
|
||||||
|
}
|
||||||
|
$this->_ci->GruppeModel->db->group_end();
|
||||||
|
|
||||||
|
$gruppen_result = $this->_ci->GruppeModel->load();
|
||||||
|
|
||||||
|
$gruppen_array = array();
|
||||||
|
|
||||||
|
if (isError($gruppen_result))
|
||||||
|
$this->terminateWithError(getError($gruppen_result), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
if (hasData($gruppen_result))
|
||||||
|
$gruppen_array = getData($gruppen_result);
|
||||||
|
|
||||||
|
$this->_ci->LehrverbandModel->addSelect('CONCAT(UPPER(CONCAT(typ, kurzbz)), \'\', semester, verband, COALESCE(gruppe,\'\')) as gruppe_kurzbz,
|
||||||
|
studiengang_kz,
|
||||||
|
semester,
|
||||||
|
tbl_lehrverband.bezeichnung,
|
||||||
|
gid,
|
||||||
|
\'true\' as lehrverband');
|
||||||
|
$this->_ci->LehrverbandModel->addJoin('public.tbl_studiengang', 'studiengang_kz');
|
||||||
|
$this->_ci->LehrverbandModel->addOrder('verband');
|
||||||
|
$this->_ci->LehrverbandModel->addOrder('gruppe');
|
||||||
|
$this->_ci->LehrverbandModel->db->where(array('tbl_lehrverband.aktiv' => true));
|
||||||
|
|
||||||
|
$this->_ci->LehrverbandModel->db->group_start();
|
||||||
|
foreach ($query_words as $word)
|
||||||
|
{
|
||||||
|
$this->_ci->LehrverbandModel->db->group_start();
|
||||||
|
$this->_ci->LehrverbandModel->db->where('CONCAT(CONCAT(typ, kurzbz), \'\', semester, verband, COALESCE(gruppe,\'\')) ILIKE', "%" . $word . "%");
|
||||||
|
$this->_ci->LehrverbandModel->db->or_where('tbl_lehrverband.bezeichnung ILIKE', "%" . $word . "%");
|
||||||
|
$this->_ci->LehrverbandModel->db->group_end();
|
||||||
|
}
|
||||||
|
$this->_ci->LehrverbandModel->db->group_end();
|
||||||
|
$lehrverband_result = $this->_ci->LehrverbandModel->load();
|
||||||
|
|
||||||
|
$lehrverband_array = array();
|
||||||
|
|
||||||
|
if (isError($lehrverband_result))
|
||||||
|
$this->terminateWithError(getError($lehrverband_result), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
if (hasData($lehrverband_result))
|
||||||
|
$lehrverband_array = getData($lehrverband_result);
|
||||||
|
|
||||||
|
$all_gruppen = array_merge($gruppen_array, $lehrverband_array);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($all_gruppen);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBenutzerSearch()
|
||||||
|
{
|
||||||
|
$query = $this->input->get('query');
|
||||||
|
|
||||||
|
if (is_null($query))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$query_words = explode(' ', $query);
|
||||||
|
|
||||||
|
$this->_ci->PersonModel->addSelect('vorname, nachname, uid, semester, UPPER(CONCAT(tbl_studiengang.typ, tbl_studiengang.kurzbz)) as studiengang');
|
||||||
|
$this->_ci->PersonModel->addJoin('public.tbl_benutzer', 'person_id');
|
||||||
|
$this->_ci->PersonModel->addJoin('public.tbl_mitarbeiter', 'uid = mitarbeiter_uid', 'LEFT');
|
||||||
|
$this->_ci->PersonModel->addJoin('public.tbl_student', 'uid = student_uid', 'LEFT');
|
||||||
|
$this->_ci->PersonModel->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT');
|
||||||
|
|
||||||
|
$this->_ci->PersonModel->db->where(array('tbl_benutzer.aktiv' => true));
|
||||||
|
|
||||||
|
$this->_ci->PersonModel->db->group_start();
|
||||||
|
foreach ($query_words as $word)
|
||||||
|
{
|
||||||
|
$this->_ci->PersonModel->db->group_start();
|
||||||
|
$this->_ci->PersonModel->db->where('tbl_person.vorname ILIKE', "%" . $word . "%");
|
||||||
|
$this->_ci->PersonModel->db->or_where('tbl_person.nachname ILIKE', "%" . $word . "%");
|
||||||
|
$this->_ci->PersonModel->db->or_where('uid ILIKE', "%" . $word . "%");
|
||||||
|
$this->_ci->PersonModel->db->or_where('CONCAT(tbl_studiengang.typ, tbl_studiengang.kurzbz) ILIKE', "%" . $word . "%");
|
||||||
|
|
||||||
|
if (is_numeric($word))
|
||||||
|
{
|
||||||
|
$this->_ci->PersonModel->db->or_where('semester', $word);
|
||||||
|
}
|
||||||
|
$this->_ci->PersonModel->db->group_end();
|
||||||
|
}
|
||||||
|
$this->_ci->PersonModel->db->group_end();
|
||||||
|
$personen = $this->_ci->PersonModel->load();
|
||||||
|
$this->terminateWithSuccess(hasData($personen) ? getData($personen) : array());
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _setAuthUID()
|
||||||
|
{
|
||||||
|
$this->_uid = getAuthUID();
|
||||||
|
|
||||||
|
if (!$this->_uid)
|
||||||
|
show_error('User authentification failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkPermission($lehreinheit_id)
|
||||||
|
{
|
||||||
|
$lehreinheit_result = $this->_ci->LehreinheitModel->load($lehreinheit_id);
|
||||||
|
|
||||||
|
if (!hasData($lehreinheit_result) || isError($lehreinheit_result))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$result = $this->_ci->LehreinheitModel->getOes($lehreinheit_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$oe_array = [];
|
||||||
|
if (hasData($result))
|
||||||
|
$oe_array = getData($result);
|
||||||
|
|
||||||
|
if (!$this->_ci->permissionlib->isBerechtigtMultipleOe('admin', $oe_array, 'suid') &&
|
||||||
|
!$this->_ci->permissionlib->isBerechtigtMultipleOe('assistenz', $oe_array, 'suid') &&
|
||||||
|
!$this->_ci->permissionlib->isBerechtigtMultipleOe('lv-plan', $oe_array, 'suid'))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_fieldWriteAccess'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,478 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('BASEPATH'))
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Lehreinheit extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
private $_uid;
|
||||||
|
private $_ci;
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'add' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'copy' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'delete' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'update' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
|
||||||
|
'get' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getStudiensemester' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getLehrfach' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getSprache' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getRaumtyp' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getLehrform' => ['admin:r', 'assistenz:r']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->_ci = &get_instance();
|
||||||
|
$this->_setAuthUID();
|
||||||
|
$this->_ci->load->library('VariableLib', ['uid' => $this->_uid]);
|
||||||
|
$this->_ci->load->library('PhrasesLib');
|
||||||
|
$this->loadPhrases(
|
||||||
|
array(
|
||||||
|
'global',
|
||||||
|
'ui'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_ci->load->model('education/Lehreinheit_model', 'LehreinheitModel');
|
||||||
|
$this->_ci->load->model('education/Lehreinheitgruppe_model', 'LehreinheitgruppeModel');
|
||||||
|
$this->_ci->load->model('education/Lehreinheitmitarbeiter_model', 'LehreinheitmitarbeiterModel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($lehreinheit_id)
|
||||||
|
{
|
||||||
|
$lehreinheit = $this->checkLehreinheit($lehreinheit_id);
|
||||||
|
$lehreinheit->lehrfaecher = $this->getLehrfaecher($lehreinheit);
|
||||||
|
$this->terminateWithSuccess($lehreinheit);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getLehrfaecher($lehreinheit)
|
||||||
|
{
|
||||||
|
$lehrfacher_array = array($lehreinheit->lehrfach_id);
|
||||||
|
$this->_ci->LehreinheitModel->addSelect('lehrveranstaltung_id_kompatibel');
|
||||||
|
$this->_ci->LehreinheitModel->addJoin('lehre.tbl_lehrveranstaltung_kompatibel', 'lehrveranstaltung_id');
|
||||||
|
$lehrfaecher = $this->_ci->LehreinheitModel->loadWhere(array('lehrveranstaltung_id' => $lehreinheit->lehrveranstaltung_id));
|
||||||
|
|
||||||
|
|
||||||
|
if (hasData($lehrfaecher))
|
||||||
|
$lehrfaecher_array = array_merge($lehrfacher_array, array_column(getData($lehrfaecher), 'lehrveranstaltung_id_kompatibel'));
|
||||||
|
|
||||||
|
$lehrfaecher_array[] = $lehreinheit->lehrveranstaltung_id;
|
||||||
|
|
||||||
|
$this->_ci->LehrveranstaltungModel->addDistinct('lehrfach_id');
|
||||||
|
$this->_ci->LehrveranstaltungModel->addSelect("tbl_lehrveranstaltung.lehrveranstaltung_id, CONCAT(tbl_lehrveranstaltung.bezeichnung || '(' || tbl_lehrveranstaltung.oe_kurzbz || ')') as lehrfach");
|
||||||
|
$this->_ci->LehrveranstaltungModel->db->where_in('tbl_lehrveranstaltung.lehrveranstaltung_id', $lehrfaecher_array);
|
||||||
|
$lehrfaecher_result = $this->_ci->LehrveranstaltungModel->load();
|
||||||
|
|
||||||
|
return hasData($lehrfaecher_result) ? getData($lehrfaecher_result) : array();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$lehrveranstaltung_id = $this->input->post('lehrveranstaltung_id');
|
||||||
|
|
||||||
|
if (is_null($lehrveranstaltung_id) || !ctype_digit((string)$lehrveranstaltung_id))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$lehrveranstaltung_result = $this->_ci->LehrveranstaltungModel->loadWhere(array('lehrveranstaltung_id' => $lehrveranstaltung_id));
|
||||||
|
|
||||||
|
if (!hasData($lehrveranstaltung_result) || isError($lehrveranstaltung_result))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$lehrveranstaltung = getData($lehrveranstaltung_result)[0];
|
||||||
|
|
||||||
|
$oe_result = $this->_ci->LehrveranstaltungModel->getAllOe($lehrveranstaltung->lehrveranstaltung_id);
|
||||||
|
$oe_array = hasData($oe_result) ? array_column(getData($oe_result), 'oe_kurzbz') : array();
|
||||||
|
|
||||||
|
if (!$this->_ci->permissionlib->isBerechtigtMultipleOe('admin', $oe_array, 'suid') &&
|
||||||
|
!$this->_ci->permissionlib->isBerechtigtMultipleOe('assistenz', $oe_array, 'suid') &&
|
||||||
|
!$this->_ci->permissionlib->isBerechtigtMultipleOe('lv-plan', $oe_array, 'suid'))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_fieldWriteAccess'));
|
||||||
|
|
||||||
|
$this->_ci->load->library('form_validation');
|
||||||
|
|
||||||
|
$updatableFields = array(
|
||||||
|
'lehrveranstaltung_id',
|
||||||
|
'studiensemester_kurzbz',
|
||||||
|
'lehrfach_id',
|
||||||
|
'lehrform_kurzbz',
|
||||||
|
'stundenblockung',
|
||||||
|
'wochenrythmus',
|
||||||
|
'gewicht',
|
||||||
|
'start_kw',
|
||||||
|
'raumtyp',
|
||||||
|
'raumtypalternativ',
|
||||||
|
'sprache',
|
||||||
|
'lehre',
|
||||||
|
'anmerkung',
|
||||||
|
'lvnr',
|
||||||
|
'unr',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($updatableFields as $field)
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case 'lehrveranstaltung_id':
|
||||||
|
$this->form_validation->set_rules($field, 'Lehrveranstaltung ID', 'required|integer');
|
||||||
|
break;
|
||||||
|
case 'studiensemester_kurzbz':
|
||||||
|
$this->form_validation->set_rules($field, 'Studiensemester', 'required|max_length[16]');
|
||||||
|
break;
|
||||||
|
case 'lehrfach_id':
|
||||||
|
$this->form_validation->set_rules($field, 'Lehrfach ID', 'required|integer');
|
||||||
|
break;
|
||||||
|
case 'lehrform_kurzbz':
|
||||||
|
$this->form_validation->set_rules($field, 'Lehrform', 'required|max_length[8]');
|
||||||
|
break;
|
||||||
|
case 'stundenblockung':
|
||||||
|
$this->form_validation->set_rules($field, 'Stundenblockung', 'required|integer|greater_than_equal_to[0]');
|
||||||
|
break;
|
||||||
|
case 'wochenrythmus':
|
||||||
|
$this->form_validation->set_rules($field, 'Wochenrhytmus', 'required|integer|greater_than_equal_to[0]');
|
||||||
|
break;
|
||||||
|
case 'start_kw':
|
||||||
|
$this->form_validation->set_rules($field, 'Start KW', 'integer|greater_than[0]|less_than_equal_to[53]');
|
||||||
|
break;
|
||||||
|
case 'gewicht':
|
||||||
|
$this->form_validation->set_rules($field, 'Gewicht', 'numeric');
|
||||||
|
break;
|
||||||
|
case 'raumtyp':
|
||||||
|
$this->form_validation->set_rules($field, 'Raumtyp', 'required|max_length[16]');
|
||||||
|
break;
|
||||||
|
case 'raumtypalternativ':
|
||||||
|
$this->form_validation->set_rules($field, 'Raumtyp Alternativ', 'required|max_length[16]');
|
||||||
|
break;
|
||||||
|
case 'sprache':
|
||||||
|
$this->form_validation->set_rules($field, 'Sprache', 'required|max_length[16]');
|
||||||
|
break;
|
||||||
|
case 'lvnr':
|
||||||
|
$this->form_validation->set_rules($field, 'LVNR', 'integer');
|
||||||
|
break;
|
||||||
|
case 'unr':
|
||||||
|
$this->form_validation->set_rules($field, 'UNR', 'integer');
|
||||||
|
break;
|
||||||
|
case 'lehre':
|
||||||
|
$this->form_validation->set_rules($field, 'Lehre', 'trim');
|
||||||
|
break;
|
||||||
|
case 'anmerkung':
|
||||||
|
$this->form_validation->set_rules($field, 'Anmerkung', 'trim');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->form_validation->run() === false)
|
||||||
|
{
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
}
|
||||||
|
|
||||||
|
$updateData = array();
|
||||||
|
foreach ($updatableFields as $field)
|
||||||
|
{
|
||||||
|
$value = $this->input->post($field);
|
||||||
|
|
||||||
|
if ($field === 'lehre')
|
||||||
|
{
|
||||||
|
$value = (bool)$value;
|
||||||
|
}
|
||||||
|
if ($value !== null)
|
||||||
|
{
|
||||||
|
$updateData[$field] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$updateData['insertvon'] = $this->_uid;
|
||||||
|
$updateData['insertamum'] = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
$result = $this->_ci->LehreinheitModel->insert(
|
||||||
|
$updateData
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!isset($updateData['unr']))
|
||||||
|
{
|
||||||
|
$unr = getData($result);
|
||||||
|
$this->_ci->LehreinheitModel->update($unr, array('unr' => $unr));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function copy()
|
||||||
|
{
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
$art = $this->input->post('art');
|
||||||
|
|
||||||
|
$lehreinheit_old = $this->checkLehreinheit($lehreinheit_id);
|
||||||
|
$this->checkPermission($lehreinheit_old->lehreinheit_id);
|
||||||
|
|
||||||
|
$lehreinheit_new = $lehreinheit_old;
|
||||||
|
|
||||||
|
$lehreinheit_new->unr = null;
|
||||||
|
unset($lehreinheit_new->lehreinheit_id);
|
||||||
|
$lehreinheit_new->updateamum = date('Y-m-d H:i:s');
|
||||||
|
$lehreinheit_new->updatevon = $this->_uid;
|
||||||
|
$lehreinheit_new->insertamum = date('Y-m-d H:i:s');
|
||||||
|
$lehreinheit_new->insertvon = $this->_uid;
|
||||||
|
|
||||||
|
$insert_result = $this->_ci->LehreinheitModel->insert($lehreinheit_new);
|
||||||
|
|
||||||
|
if (isError($insert_result))
|
||||||
|
$this->terminateWithError(getError($insert_result), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$lehreinheit_id_new = getData($insert_result);
|
||||||
|
|
||||||
|
$this->_ci->LehreinheitModel->update(array('lehreinheit_id' => $lehreinheit_id_new), array('unr' => $lehreinheit_id_new));
|
||||||
|
if (in_array($art, array('gruppen', 'alle')))
|
||||||
|
{
|
||||||
|
$gruppen_result = $this->_ci->LehreinheitgruppeModel->loadWhere(array('lehreinheit_id' => $lehreinheit_id));
|
||||||
|
|
||||||
|
if (isError($gruppen_result))
|
||||||
|
$this->terminateWithError(getError($gruppen_result), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
if (hasData($gruppen_result))
|
||||||
|
{
|
||||||
|
$gruppen = getData($gruppen_result);
|
||||||
|
|
||||||
|
foreach ($gruppen as $gruppe)
|
||||||
|
{
|
||||||
|
$gruppe_new = $gruppe;
|
||||||
|
unset($gruppe_new->lehreinheitgruppe_id);
|
||||||
|
$gruppe_new->lehreinheit_id = $lehreinheit_id_new;
|
||||||
|
$gruppe_new->insertamum = date('Y-m-d H:i:s');
|
||||||
|
$gruppe_new->insertvon = $this->_uid;
|
||||||
|
$gruppe_new->updateamum = date('Y-m-d H:i:s');
|
||||||
|
$gruppe_new->updatevon = $this->_uid;
|
||||||
|
|
||||||
|
$gruppe_new_result = $this->_ci->LehreinheitgruppeModel->insert($gruppe_new);
|
||||||
|
|
||||||
|
if (isError($gruppe_new_result))
|
||||||
|
$this->terminateWithError(getError($gruppe_new_result), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($art, array('lektoren', 'alle')))
|
||||||
|
{
|
||||||
|
$lektoren_result = $this->_ci->LehreinheitmitarbeiterModel->loadWhere(array('lehreinheit_id' => $lehreinheit_id));
|
||||||
|
|
||||||
|
if (isError($lektoren_result))
|
||||||
|
$this->terminateWithError(getError($lektoren_result), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
if (hasData($lektoren_result))
|
||||||
|
{
|
||||||
|
$lektoren = getData($lektoren_result);
|
||||||
|
|
||||||
|
foreach ($lektoren as $lektor)
|
||||||
|
{
|
||||||
|
|
||||||
|
$lektor_new = $lektor;
|
||||||
|
$lektor_new->lehreinheit_id = $lehreinheit_id_new;
|
||||||
|
$lektor_new->insertamum = date('Y-m-d H:i:s');
|
||||||
|
$lektor_new->insertvon = $this->_uid;
|
||||||
|
$lektor_new->updateamum = date('Y-m-d H:i:s');
|
||||||
|
$lektor_new->updatevon = $this->_uid;
|
||||||
|
unset($lektor_new->vertrag_id);
|
||||||
|
|
||||||
|
$lektor_new_result = $this->_ci->LehreinheitmitarbeiterModel->insert((array)$lektor_new);
|
||||||
|
|
||||||
|
if (isError($lektor_new_result))
|
||||||
|
$this->terminateWithError(getError($lektor_new_result), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess("Erfolgeich gespeichert");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete()
|
||||||
|
{
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
|
||||||
|
$errors = array();
|
||||||
|
if (is_array($lehreinheit_id))
|
||||||
|
{
|
||||||
|
foreach ($lehreinheit_id as $le_id)
|
||||||
|
{
|
||||||
|
$lehreinheit = $this->checkLehreinheit($le_id);
|
||||||
|
$this->checkPermission($lehreinheit->lehreinheit_id);
|
||||||
|
|
||||||
|
$result = $this->_ci->LehreinheitModel->deleteLehreinheit($lehreinheit->lehreinheit_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
{
|
||||||
|
$errors[] = getError($result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$lehreinheit = $this->checkLehreinheit($lehreinheit_id);
|
||||||
|
$this->checkPermission($lehreinheit->lehreinheit_id);
|
||||||
|
|
||||||
|
$result = $this->_ci->LehreinheitModel->deleteLehreinheit($lehreinheit->lehreinheit_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isEmptyArray($errors))
|
||||||
|
{
|
||||||
|
if (count($errors) !== count($lehreinheit_id))
|
||||||
|
$this->terminateWithSuccess(array('errors' => $errors));
|
||||||
|
else
|
||||||
|
$this->terminateWithError($errors);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->terminateWithSuccess('Erfolgreich geloescht');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update()
|
||||||
|
{
|
||||||
|
$lehreinheit = $this->checkLehreinheit($this->input->post('lehreinheit_id'));
|
||||||
|
|
||||||
|
$this->checkPermission($lehreinheit->lehreinheit_id);
|
||||||
|
|
||||||
|
$this->_ci->load->library('form_validation');
|
||||||
|
|
||||||
|
$formData = $this->input->post('formData');
|
||||||
|
|
||||||
|
$updatableFields = array(
|
||||||
|
'lehrveranstaltung_id',
|
||||||
|
'studiensemester_kurzbz',
|
||||||
|
'lehrfach_id',
|
||||||
|
'lehrform_kurzbz',
|
||||||
|
'stundenblockung',
|
||||||
|
'wochenrythmus',
|
||||||
|
'gewicht',
|
||||||
|
'start_kw',
|
||||||
|
'raumtyp',
|
||||||
|
'raumtypalternativ',
|
||||||
|
'sprache',
|
||||||
|
'lehre',
|
||||||
|
'anmerkung',
|
||||||
|
'lvnr',
|
||||||
|
'unr',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->form_validation->set_data($formData);
|
||||||
|
|
||||||
|
foreach ($updatableFields as $field)
|
||||||
|
{
|
||||||
|
if (array_key_exists($field, $formData))
|
||||||
|
{
|
||||||
|
switch ($field)
|
||||||
|
{
|
||||||
|
case 'lehrveranstaltung_id':
|
||||||
|
$this->form_validation->set_rules($field, 'Lehrveranstaltung ID', 'required|integer');
|
||||||
|
break;
|
||||||
|
case 'studiensemester_kurzbz':
|
||||||
|
$this->form_validation->set_rules($field, 'Studiensemester', 'required|max_length[16]');
|
||||||
|
break;
|
||||||
|
case 'lehrfach_id':
|
||||||
|
$this->form_validation->set_rules($field, 'Lehrfach ID', 'required|integer');
|
||||||
|
break;
|
||||||
|
case 'lehrform_kurzbz':
|
||||||
|
$this->form_validation->set_rules($field, 'Lehrform', 'required|max_length[8]');
|
||||||
|
break;
|
||||||
|
case 'stundenblockung':
|
||||||
|
$this->form_validation->set_rules($field, 'Stundenblockung', 'required|integer|greater_than_equal_to[0]');
|
||||||
|
break;
|
||||||
|
case 'wochenrythmus':
|
||||||
|
$this->form_validation->set_rules($field, 'Wochenrhytmus', 'required|integer|greater_than_equal_to[0]');
|
||||||
|
break;
|
||||||
|
case 'start_kw':
|
||||||
|
$this->form_validation->set_rules($field, 'Start KW', 'integer|greater_than[0]|less_than_equal_to[53]');
|
||||||
|
break;
|
||||||
|
case 'gewicht':
|
||||||
|
$this->form_validation->set_rules($field, 'Gewicht', 'numeric|greater_than_equal_to[0]');
|
||||||
|
break;
|
||||||
|
case 'raumtyp':
|
||||||
|
$this->form_validation->set_rules($field, 'Raumtyp', 'required|max_length[16]');
|
||||||
|
break;
|
||||||
|
case 'raumtypalternativ':
|
||||||
|
$this->form_validation->set_rules($field, 'Raumtyp Alternativ', 'required|max_length[16]');
|
||||||
|
break;
|
||||||
|
case 'sprache':
|
||||||
|
$this->form_validation->set_rules($field, 'Sprache', 'required|max_length[16]');
|
||||||
|
break;
|
||||||
|
case 'lvnr':
|
||||||
|
$this->form_validation->set_rules($field, 'LVNR', 'integer');
|
||||||
|
break;
|
||||||
|
case 'unr':
|
||||||
|
$this->form_validation->set_rules($field, 'UNR', 'integer|greater_than_equal_to[0]');
|
||||||
|
break;
|
||||||
|
case 'lehre':
|
||||||
|
$this->form_validation->set_rules($field, 'Lehre', 'trim');
|
||||||
|
break;
|
||||||
|
case 'anmerkung':
|
||||||
|
$this->form_validation->set_rules($field, 'Anmerkung', 'trim');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->form_validation->run() === false)
|
||||||
|
{
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
}
|
||||||
|
|
||||||
|
$updateData = [];
|
||||||
|
foreach ($updatableFields as $field)
|
||||||
|
{
|
||||||
|
if (array_key_exists($field, $formData))
|
||||||
|
{
|
||||||
|
$updateData[$field] = $formData[$field];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$updateData['updatevon'] = $this->_uid;
|
||||||
|
$updateData['updateamum'] = date('Y-m-d H:i:s');
|
||||||
|
$result = $this->_ci->LehreinheitModel->update(
|
||||||
|
[
|
||||||
|
'lehreinheit_id' => $this->input->post('lehreinheit_id'),
|
||||||
|
],
|
||||||
|
$updateData
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||||
|
$this->terminateWithSuccess($this->p->t('global', 'gespeichert'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function checkPermission($lehreinheit_id)
|
||||||
|
{
|
||||||
|
$result = $this->_ci->LehreinheitModel->getOes($lehreinheit_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$oe_array = [];
|
||||||
|
if (hasData($result))
|
||||||
|
$oe_array = getData($result);
|
||||||
|
|
||||||
|
if (!$this->_ci->permissionlib->isBerechtigtMultipleOe('admin', $oe_array, 'suid') &&
|
||||||
|
!$this->_ci->permissionlib->isBerechtigtMultipleOe('assistenz', $oe_array, 'suid') &&
|
||||||
|
!$this->_ci->permissionlib->isBerechtigtMultipleOe('lv-plan', $oe_array, 'suid'))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_fieldWriteAccess'));
|
||||||
|
}
|
||||||
|
private function checkLehreinheit($lehreinheit_id)
|
||||||
|
{
|
||||||
|
if (is_null($lehreinheit_id) || !ctype_digit((string)$lehreinheit_id))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$lehreinheit_result = $this->_ci->LehreinheitModel->load($lehreinheit_id);
|
||||||
|
|
||||||
|
if (!hasData($lehreinheit_result) || isError($lehreinheit_result))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
return getData($lehreinheit_result)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _setAuthUID()
|
||||||
|
{
|
||||||
|
$this->_uid = getAuthUID();
|
||||||
|
|
||||||
|
if (!$this->_uid)
|
||||||
|
show_error('User authentification failed');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,440 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('BASEPATH'))
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Lektor extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
private $_uid;
|
||||||
|
private $_ci;
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'add' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'update' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'cancelVertrag' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'deleteLVPlan' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'deletePerson' => ['admin:rw', 'assistenz:rw'],
|
||||||
|
'getLehrfunktionen' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getLektorenSearch' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getLektorenByLE' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getLektorDaten' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getLektorVertrag' => ['admin:r', 'assistenz:r'],
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->_ci = &get_instance();
|
||||||
|
$this->_setAuthUID();
|
||||||
|
$this->_ci->load->library('VariableLib', ['uid' => $this->_uid]);
|
||||||
|
$this->_ci->load->library('PermissionLib');
|
||||||
|
$this->_ci->load->library('LektorLib');
|
||||||
|
$this->_ci->load->library('form_validation');
|
||||||
|
$this->loadPhrases([
|
||||||
|
'ui'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->_ci->load->model('accounting/Vertrag_model', 'VertragModel');
|
||||||
|
$this->_ci->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||||
|
$this->_ci->load->model('education/lehreinheit_model', 'LehreinheitModel');
|
||||||
|
$this->_ci->load->model('education/Lehreinheitmitarbeiter_model', 'LehreinheitmitarbeiterModel');
|
||||||
|
$this->_ci->load->model('ressource/stundenplandev_model', 'StundenplandevModel');
|
||||||
|
$this->_ci->load->model('ressource/Stundensatz_model', 'StundensatzModel');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkMitarbeiter($mitarbeiter_uid)
|
||||||
|
{
|
||||||
|
if (is_null($mitarbeiter_uid))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$mitarbeiter_result = $this->_ci->MitarbeiterModel->load($mitarbeiter_uid);
|
||||||
|
|
||||||
|
if (!hasData($mitarbeiter_result) || isError($mitarbeiter_result))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
$mitarbeiter_uid = $this->input->post('mitarbeiter_uid');
|
||||||
|
|
||||||
|
$this->checkLehreinheit($lehreinheit_id);
|
||||||
|
$this->checkMitarbeiter($mitarbeiter_uid);
|
||||||
|
$lehrfach_permission = $this->checkLehrfachPermission($lehreinheit_id, array('assistenz', 'admin'));
|
||||||
|
$lehreinheit_permission = $this->checkPermission($lehreinheit_id, array('admin', 'assistenz', 'lv-plan'));
|
||||||
|
|
||||||
|
if (!$lehrfach_permission && !$lehreinheit_permission)
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_fieldWriteAccess'));
|
||||||
|
|
||||||
|
$result = $this->_ci->lektorlib->addLektorToLehreinheit($lehreinheit_id, $mitarbeiter_uid);
|
||||||
|
|
||||||
|
if (isError($result)) $this->terminateWithError(getError($result));
|
||||||
|
|
||||||
|
$this->terminateWithSuccess("Erfolgreich gespeichert");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update()
|
||||||
|
{
|
||||||
|
$formData = $this->input->post('formData');
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
$mitarbeiter_uid = $this->input->post('mitarbeiter_uid');
|
||||||
|
|
||||||
|
$this->checkLehreinheit($lehreinheit_id);
|
||||||
|
$this->checkMitarbeiter($mitarbeiter_uid);
|
||||||
|
|
||||||
|
$updatableFields = array(
|
||||||
|
'lehrfunktion_kurzbz',
|
||||||
|
'planstunden',
|
||||||
|
'stundensatz',
|
||||||
|
'faktor',
|
||||||
|
'anmerkung',
|
||||||
|
'bismelden',
|
||||||
|
'semesterstunden',
|
||||||
|
'mitarbeiter_uid'
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->form_validation->set_data($formData);
|
||||||
|
|
||||||
|
foreach ($updatableFields as $field)
|
||||||
|
{
|
||||||
|
if (array_key_exists($field, $formData))
|
||||||
|
{
|
||||||
|
switch ($field)
|
||||||
|
{
|
||||||
|
case 'lehrfunktion_kurzbz':
|
||||||
|
$this->form_validation->set_rules($field, 'Lehrfunktion', 'required|max_length[16]');
|
||||||
|
break;
|
||||||
|
case 'planstunden':
|
||||||
|
$this->form_validation->set_rules($field, 'Planstunden', 'integer|greater_than_equal_to[0]');
|
||||||
|
break;
|
||||||
|
case 'stundensatz':
|
||||||
|
$formData['stundensatz'] = str_replace(',', '.', $formData['stundensatz']);
|
||||||
|
$this->form_validation->set_rules($field, 'Stundensatz', 'callback__check_stundensatz');
|
||||||
|
break;
|
||||||
|
case 'faktor':
|
||||||
|
$this->form_validation->set_rules($field, 'Faktor', 'numeric|greater_than_equal_to[0]');
|
||||||
|
break;
|
||||||
|
case 'anmerkung':
|
||||||
|
$this->form_validation->set_rules($field, 'Anmerkung', 'max_length[256]');
|
||||||
|
break;
|
||||||
|
case 'bismelden':
|
||||||
|
$this->form_validation->set_rules($field, 'Bis Melden', 'trim');
|
||||||
|
break;
|
||||||
|
case 'semesterstunden':
|
||||||
|
$formData['semesterstunden'] = str_replace(',', '.', $formData['semesterstunden']);
|
||||||
|
$this->form_validation->set_rules($field, 'Semesterstunden', 'callback__check_semesterstunden');
|
||||||
|
break;
|
||||||
|
case 'mitarbeiter_uid':
|
||||||
|
$this->form_validation->set_rules($field, 'Semesterstunden', 'required|max_length[32]');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$this->form_validation->run())
|
||||||
|
{
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
}
|
||||||
|
|
||||||
|
$nullable_fields = array('semesterstunden', 'stundensatz', 'planstunden');
|
||||||
|
|
||||||
|
foreach ($nullable_fields as $nullable_field)
|
||||||
|
{
|
||||||
|
if (isset($formData[$nullable_field]) && (!is_numeric($formData[$nullable_field]) || $formData[$nullable_field] === ''))
|
||||||
|
{
|
||||||
|
$formData[$nullable_field] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$lehreinheit_permission = $this->checkPermission($lehreinheit_id, array('admin', 'assistenz', 'lv-plan'));
|
||||||
|
|
||||||
|
if (!$lehreinheit_permission)
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_fieldWriteAccess'));
|
||||||
|
|
||||||
|
if (!is_null($this->getLektorVertrag($lehreinheit_id, $mitarbeiter_uid)) && (array_key_exists('mitarbeiter_uid', $formData) && $mitarbeiter_uid !== $formData['mitarbeiter_uid']))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_fieldWriteAccess'));
|
||||||
|
|
||||||
|
$result = $this->_ci->lektorlib->updateLektorFromLehreinheit($lehreinheit_id, $mitarbeiter_uid, $formData);
|
||||||
|
|
||||||
|
if (isError($result)) $this->terminateWithError(getError($result));
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function _check_stundensatz($value)
|
||||||
|
{
|
||||||
|
$value = str_replace(',', '.', $value);
|
||||||
|
|
||||||
|
if (!is_numeric($value) && $value !== "")
|
||||||
|
{
|
||||||
|
$this->form_validation->set_message('_check_decimal', 'Das Feld {field} muss eine Zahl sein.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($value < 0 || $value >= 10000) {
|
||||||
|
$this->form_validation->set_message('_check_decimal', 'Das Feld {field} muss zwischen 0 und 10000 liegen.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public function _check_semesterstunden($value)
|
||||||
|
{
|
||||||
|
if ($value === null || $value === '') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_numeric($value))
|
||||||
|
{
|
||||||
|
$this->form_validation->set_message(
|
||||||
|
'_check_semesterstunden',
|
||||||
|
'Das Feld {field} muss eine Zahl sein.'
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($value < 0)
|
||||||
|
{
|
||||||
|
$this->form_validation->set_message(
|
||||||
|
'_check_semesterstunden',
|
||||||
|
'Das Feld {field} muss eine Zahl größer oder gleich 0 sein.'
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($value > 999.99)
|
||||||
|
{
|
||||||
|
$this->form_validation->set_message(
|
||||||
|
'_check_semesterstunden',
|
||||||
|
'Das Feld {field} darf maximal 999,99 betragen.'
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public function getLehrfunktionen()
|
||||||
|
{
|
||||||
|
$this->_ci->load->model('education/Lehrfunktion_model', 'LehrfunktionModel');
|
||||||
|
$this->_ci->LehrfunktionModel->addOrder('lehrfunktion_kurzbz');
|
||||||
|
$this->terminateWithSuccess(getData($this->_ci->LehrfunktionModel->load()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLektorenSearch()
|
||||||
|
{
|
||||||
|
$query = $this->input->get('query');
|
||||||
|
|
||||||
|
if (is_null($query))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$query_words = explode(' ', $query);
|
||||||
|
|
||||||
|
$this->_ci->MitarbeiterModel->addSelect('uid, person_id, vorname, nachname');
|
||||||
|
$this->_ci->MitarbeiterModel->addJoin('public.tbl_benutzer', 'uid = mitarbeiter_uid');
|
||||||
|
$this->_ci->MitarbeiterModel->addJoin('public.tbl_person', 'person_id');
|
||||||
|
|
||||||
|
$this->_ci->MitarbeiterModel->db->where('public.tbl_benutzer.aktiv', true);
|
||||||
|
|
||||||
|
$this->_ci->MitarbeiterModel->db->group_start();
|
||||||
|
foreach ($query_words as $word)
|
||||||
|
{
|
||||||
|
$this->_ci->MitarbeiterModel->db->group_start();
|
||||||
|
$this->_ci->MitarbeiterModel->db->where('tbl_person.vorname ILIKE', "%" . $word . "%");
|
||||||
|
$this->_ci->MitarbeiterModel->db->or_where('tbl_person.nachname ILIKE', "%" . $word . "%");
|
||||||
|
$this->_ci->MitarbeiterModel->db->or_where('uid ILIKE', "%" . $word . "%");
|
||||||
|
$this->_ci->MitarbeiterModel->db->group_end();
|
||||||
|
}
|
||||||
|
$this->_ci->MitarbeiterModel->db->group_end();
|
||||||
|
$this->_ci->MitarbeiterModel->addOrder('nachname');
|
||||||
|
$this->_ci->MitarbeiterModel->addOrder('vorname');
|
||||||
|
$result = $this->_ci->MitarbeiterModel->load();
|
||||||
|
$this->terminateWithSuccess(hasData($result) ? getData($result) : array());
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkLehreinheit($lehreinheit_id)
|
||||||
|
{
|
||||||
|
if (is_null($lehreinheit_id) || !ctype_digit((string)$lehreinheit_id))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$lehreinheit_result = $this->_ci->LehreinheitModel->load($lehreinheit_id);
|
||||||
|
|
||||||
|
if (!hasData($lehreinheit_result) || isError($lehreinheit_result))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
return getData($lehreinheit_result)[0];
|
||||||
|
|
||||||
|
}
|
||||||
|
public function getLektorenByLE($lehreinheit_id = null)
|
||||||
|
{
|
||||||
|
$this->checkLehreinheit($lehreinheit_id);
|
||||||
|
$le_mitarbeiter_data = $this->_ci->LehreinheitmitarbeiterModel->getLektorenByLe($lehreinheit_id);
|
||||||
|
$this->terminateWithSuccess(hasData($le_mitarbeiter_data) ? getData($le_mitarbeiter_data) : array());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLektorDaten($lehreinheit_id = null, $mitarbeiter_uid = null)
|
||||||
|
{
|
||||||
|
$lehreinheit = $this->checkLehreinheit($lehreinheit_id);
|
||||||
|
|
||||||
|
if (is_null($mitarbeiter_uid))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$mitarbeiter_result = $this->_ci->MitarbeiterModel->load($mitarbeiter_uid);
|
||||||
|
|
||||||
|
if (!hasData($mitarbeiter_result) || isError($mitarbeiter_result))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$this->load->model('organisation/Studiensemester_model','StudiensemesterModel');
|
||||||
|
$studiensemester_result = $this->_ci->StudiensemesterModel->loadWhere(array('studiensemester_kurzbz' => $lehreinheit->studiensemester_kurzbz));
|
||||||
|
$studiensemester = getData($studiensemester_result)[0];
|
||||||
|
|
||||||
|
$defaultStundensatz = $this->_ci->StundensatzModel->getDefaultStundensatz($mitarbeiter_uid, $studiensemester->start, $studiensemester->ende, 'lehre');
|
||||||
|
|
||||||
|
$le_mitarbeiter_result = $this->_ci->LehreinheitmitarbeiterModel->getByLeLektor($lehreinheit_id, $mitarbeiter_uid);
|
||||||
|
|
||||||
|
$le_mitarbeiter_data = array();
|
||||||
|
if (hasData($le_mitarbeiter_result))
|
||||||
|
{
|
||||||
|
$le_mitarbeiter_data = getData($le_mitarbeiter_result)[0];
|
||||||
|
$le_mitarbeiter_data->default_stundensatz = $defaultStundensatz;
|
||||||
|
}
|
||||||
|
$vertrag = $this->getLektorVertrag($lehreinheit_id, $mitarbeiter_uid);
|
||||||
|
$le_mitarbeiter_data->vertrag = $vertrag;
|
||||||
|
$this->terminateWithSuccess($le_mitarbeiter_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getLektorVertrag($lehreinheit_id = null, $mitarbeiter_uid = null)
|
||||||
|
{
|
||||||
|
$this->_ci->load->model('accounting/Vertrag_model', 'VertragModel');
|
||||||
|
$vertrag = $this->_ci->VertragModel->getVertrag($mitarbeiter_uid, $lehreinheit_id);
|
||||||
|
return hasData($vertrag) ? getData($vertrag)[0] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkLehrfachPermission($lehreinheit_id, $permissions)
|
||||||
|
{
|
||||||
|
$lehrfach_oe_kurzbz = $this->_ci->LehreinheitModel->getLehrfachOe($lehreinheit_id);
|
||||||
|
|
||||||
|
if (isError($lehrfach_oe_kurzbz))
|
||||||
|
$this->terminateWithError(getError($lehrfach_oe_kurzbz), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$lehrfach_oe_kurzbz = array('');
|
||||||
|
if (hasData($lehrfach_oe_kurzbz))
|
||||||
|
$lehrfach_oe_kurzbz = array_column(getData($lehrfach_oe_kurzbz), 'oe_kurzbz');
|
||||||
|
|
||||||
|
|
||||||
|
return $this->checkPermissionGenerel($permissions, $lehrfach_oe_kurzbz);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkPermissionGenerel($permissions, $oe_array)
|
||||||
|
{
|
||||||
|
$hasPermission = false;
|
||||||
|
foreach ($permissions as $permission)
|
||||||
|
{
|
||||||
|
if ($this->_ci->permissionlib->isBerechtigtMultipleOe($permission, $oe_array, 'suid'))
|
||||||
|
{
|
||||||
|
$hasPermission = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $hasPermission;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkPermission($lehreinheit_id, $permissions)
|
||||||
|
{
|
||||||
|
$result = $this->_ci->LehreinheitModel->getOes($lehreinheit_id);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$oe_array = [];
|
||||||
|
if (hasData($result))
|
||||||
|
$oe_array = getData($result);
|
||||||
|
|
||||||
|
return $this->checkPermissionGenerel($permissions, $oe_array);
|
||||||
|
}
|
||||||
|
public function cancelVertrag()
|
||||||
|
{
|
||||||
|
$vertrag_id = $this->input->post('vertrag_id');
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
$mitarbeiter_uid = $this->input->post('mitarbeiter_uid');
|
||||||
|
|
||||||
|
$this->checkLehreinheit($lehreinheit_id);
|
||||||
|
$this->checkPermission($lehreinheit_id, array('admin', 'lehre/lehrauftrag_bestellen'));
|
||||||
|
|
||||||
|
if (is_null($vertrag_id) || !ctype_digit((string)$vertrag_id))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$vertrag_result = $this->_ci->VertragModel->load($vertrag_id);
|
||||||
|
|
||||||
|
if (!hasData($vertrag_result) || isError($vertrag_result))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
if (is_null($mitarbeiter_uid))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$mitarbeiter_result = $this->_ci->MitarbeiterModel->load($mitarbeiter_uid);
|
||||||
|
|
||||||
|
if (!hasData($mitarbeiter_result) || isError($mitarbeiter_result))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$result = $this->_ci->VertragModel->cancelVertrag($vertrag_id, $mitarbeiter_uid);
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
$this->terminateWithError(getError($result));
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deletePerson()
|
||||||
|
{
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
$mitarbeiter_uid = $this->input->post('mitarbeiter_uid');
|
||||||
|
|
||||||
|
$this->checkLehreinheit($lehreinheit_id);
|
||||||
|
$this->checkPermission($lehreinheit_id, array('admin', 'assistenz', 'lv-plan'));
|
||||||
|
|
||||||
|
if (is_null($mitarbeiter_uid))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$mitarbeiter_result = $this->_ci->MitarbeiterModel->load($mitarbeiter_uid);
|
||||||
|
|
||||||
|
if (!hasData($mitarbeiter_result) || isError($mitarbeiter_result))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$delete_result =$this->_ci->LehreinheitmitarbeiterModel->deleteLektorFromLe($lehreinheit_id, $mitarbeiter_uid);
|
||||||
|
|
||||||
|
if (isError($delete_result))
|
||||||
|
$this->terminateWithError(getError($delete_result));
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($delete_result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteLVPlan()
|
||||||
|
{
|
||||||
|
$lehreinheit_id = $this->input->post('lehreinheit_id');
|
||||||
|
$mitarbeiter_uid = $this->input->post('mitarbeiter_uid');
|
||||||
|
|
||||||
|
$this->checkLehreinheit($lehreinheit_id);
|
||||||
|
$this->checkPermission($lehreinheit_id, array('lv-plan/lektorentfernen'));
|
||||||
|
|
||||||
|
if (is_null($mitarbeiter_uid))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$mitarbeiter_result = $this->_ci->MitarbeiterModel->load($mitarbeiter_uid);
|
||||||
|
|
||||||
|
if (!hasData($mitarbeiter_result) || isError($mitarbeiter_result))
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
|
||||||
|
$delete_result = $this->_ci->StundenplandevModel->deleteLektorPlanning($lehreinheit_id, $mitarbeiter_uid);
|
||||||
|
|
||||||
|
if (isError($delete_result))
|
||||||
|
$this->terminateWithError(getError($delete_result));
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($delete_result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _setAuthUID()
|
||||||
|
{
|
||||||
|
$this->_uid = getAuthUID();
|
||||||
|
|
||||||
|
if (!$this->_uid)
|
||||||
|
show_error('User authentification failed');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Noten extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getCertificate' => 'student/noten:r',
|
||||||
|
'getTeacherProposal' => 'student/noten:r',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Load Libraries
|
||||||
|
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||||
|
|
||||||
|
// Load Phrases
|
||||||
|
$this->loadPhrases([
|
||||||
|
'stv',
|
||||||
|
'person',
|
||||||
|
'lehre'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCertificate($lv_id, $studiensemester_kurzbz = null)
|
||||||
|
{
|
||||||
|
if (is_null($lv_id) || !ctype_digit((string)$lv_id))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$this->load->model('education/lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
$this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel');
|
||||||
|
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||||
|
|
||||||
|
$result = $this->LehrveranstaltungModel->loadWhere([
|
||||||
|
'lehrveranstaltung_id' => $lv_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
$lehrveranstaltung = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
if (!$lehrveranstaltung)
|
||||||
|
$this->terminateWithSuccess([]);
|
||||||
|
|
||||||
|
if ($studiensemester_kurzbz !== null && !$this->StudiensemesterModel->isValidStudiensemester($studiensemester_kurzbz))
|
||||||
|
{
|
||||||
|
$this->terminateWithError($studiensemester_kurzbz . ' - ' . $this->p->t('lehre', 'error_noStudiensemester'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->ZeugnisnoteModel->getZeugnisnoten(null, $studiensemester_kurzbz, $lehrveranstaltung[0]->lehrveranstaltung_id);
|
||||||
|
|
||||||
|
$grades = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($grades);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTeacherProposal($lv_id, $studiensemester_kurzbz = null)
|
||||||
|
{
|
||||||
|
if (is_null($lv_id) || !ctype_digit((string)$lv_id))
|
||||||
|
$this->terminateWithError( $this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$this->load->model('education/lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
$this->load->model('education/Lvgesamtnote_model', 'LvgesamtnoteModel');
|
||||||
|
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||||
|
|
||||||
|
$result = $this->LehrveranstaltungModel->loadWhere([
|
||||||
|
'lehrveranstaltung_id' => $lv_id
|
||||||
|
]);
|
||||||
|
|
||||||
|
$lehrveranstaltung = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
if (!$lehrveranstaltung)
|
||||||
|
$this->terminateWithSuccess([]);
|
||||||
|
|
||||||
|
if ($studiensemester_kurzbz !== null && !$this->StudiensemesterModel->isValidStudiensemester($studiensemester_kurzbz))
|
||||||
|
{
|
||||||
|
$this->terminateWithError($studiensemester_kurzbz . ' - ' . $this->p->t('lehre', 'error_noStudiensemester'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->LvgesamtnoteModel->getLvGesamtNoten($lv_id, null, $studiensemester_kurzbz);
|
||||||
|
|
||||||
|
$grades = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($grades);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2025 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;
|
||||||
|
|
||||||
|
class Setup extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
private $_ci;
|
||||||
|
private $_uid;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getLETabs' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getLVTabs' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getStudiensemester' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getSprache' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getRaumtyp' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getLehrform' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->_ci = &get_instance();
|
||||||
|
$this->_setAuthUID();
|
||||||
|
|
||||||
|
$this->_ci->load->model('education/Lehreinheit_model', 'LehreinheitModel');
|
||||||
|
$this->_ci->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||||
|
|
||||||
|
$this->_ci->load->library('VariableLib', ['uid' => $this->_uid]);
|
||||||
|
$this->_ci->load->helper('hlp_document');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLETabs()
|
||||||
|
{
|
||||||
|
$tabs['details'] = array (
|
||||||
|
'title' => 'Details',
|
||||||
|
'component' => absoluteJsImportUrl('public/js/components/LVVerwaltung/Tabs/Details.js'),
|
||||||
|
'config' => []
|
||||||
|
);
|
||||||
|
$tabs['gruppen'] = array (
|
||||||
|
'title' => 'Gruppen',
|
||||||
|
'component' => absoluteJsImportUrl('public/js/components/LVVerwaltung/Tabs/Gruppen.js'),
|
||||||
|
'config' => []
|
||||||
|
);
|
||||||
|
$tabs['lektor'] = array (
|
||||||
|
'title' => 'LektorInnenzuteilung',
|
||||||
|
'component' => absoluteJsImportUrl('public/js/components/LVVerwaltung/Tabs/Lektor.js'),
|
||||||
|
'config' => []
|
||||||
|
);
|
||||||
|
$tabs['termine'] = array (
|
||||||
|
'title' => 'Termine',
|
||||||
|
'component' => absoluteJsImportUrl('public/js/components/LVVerwaltung/Tabs/Termine.js'),
|
||||||
|
'config' => []
|
||||||
|
);
|
||||||
|
$tabs['notiz'] = array (
|
||||||
|
'title' => 'Notizen',
|
||||||
|
'component' => absoluteJsImportUrl('public/js/components/LVVerwaltung/Tabs/Notiz.js'),
|
||||||
|
'config' => []
|
||||||
|
);
|
||||||
|
|
||||||
|
Events::trigger('lvv_conf_tabs', function & () use (&$tabs) {
|
||||||
|
return $tabs;
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($tabs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLVTabs()
|
||||||
|
{
|
||||||
|
$tabs['termine'] = array (
|
||||||
|
'title' => 'Termine',
|
||||||
|
'component' => absoluteJsImportUrl('public/js/components/LVVerwaltung/Tabs/LVTermine.js'),
|
||||||
|
'config' => []
|
||||||
|
);
|
||||||
|
$tabs['noten'] = array (
|
||||||
|
'title' => 'Noten',
|
||||||
|
'component' => absoluteJsImportUrl('public/js/components/LVVerwaltung/Tabs/Noten.js'),
|
||||||
|
'config' => [
|
||||||
|
'usePoints' => defined('CIS_GESAMTNOTE_PUNKTE') && CIS_GESAMTNOTE_PUNKTE,
|
||||||
|
'edit' => 'both', // Possible values: both|header|inline
|
||||||
|
'delete' => 'inline', // Possible values: both|header|inline
|
||||||
|
'documents' => 'inline', // Possible values: both|header|inline
|
||||||
|
'documentslist' => gradesDocumentsList(),
|
||||||
|
'semesterSelect' => false
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$this->terminateWithSuccess($tabs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStudiensemester()
|
||||||
|
{
|
||||||
|
$this->_ci->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||||
|
$this->_ci->StudiensemesterModel->addOrder('start', 'DESC');
|
||||||
|
$this->terminateWithSuccess(getData($this->_ci->StudiensemesterModel->load()));
|
||||||
|
}
|
||||||
|
public function getSprache()
|
||||||
|
{
|
||||||
|
$this->_ci->load->model('system/Sprache_model', 'SpracheModel');
|
||||||
|
$this->terminateWithSuccess(getData($this->_ci->SpracheModel->load()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRaumtyp()
|
||||||
|
{
|
||||||
|
$this->_ci->load->model('ressource/Raumtyp_model', 'RaumtypModel');
|
||||||
|
$this->_ci->RaumtypModel->addOrder('raumtyp_kurzbz');
|
||||||
|
$this->terminateWithSuccess(getData($this->_ci->RaumtypModel->loadWhere(array('aktiv' => true))));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLehrform()
|
||||||
|
{
|
||||||
|
$language = $this->_getLanguageIndex();
|
||||||
|
|
||||||
|
$this->_ci->load->model('codex/lehrform_model', 'LehrformModel');
|
||||||
|
|
||||||
|
$this->_ci->LehrformModel->addSelect(
|
||||||
|
'*,
|
||||||
|
bezeichnung_kurz[('.$language.')] as bez_kurz,
|
||||||
|
bezeichnung_lang[('.$language.')] as bez
|
||||||
|
'
|
||||||
|
);
|
||||||
|
$this->terminateWithSuccess(getData($this->_ci->LehrformModel->load()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _getLanguageIndex()
|
||||||
|
{
|
||||||
|
$this->_ci->load->model('system/Sprache_model', 'SpracheModel');
|
||||||
|
$this->_ci->SpracheModel->addSelect('index');
|
||||||
|
$result = $this->_ci->SpracheModel->loadWhere(array('sprache' => getUserLanguage()));
|
||||||
|
|
||||||
|
return hasData($result) ? getData($result)[0]->index : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _setAuthUID()
|
||||||
|
{
|
||||||
|
$this->_uid = getAuthUID();
|
||||||
|
|
||||||
|
if (!$this->_uid)
|
||||||
|
show_error('User authentification failed');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('BASEPATH'))
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Tags extends Tag_Controller
|
||||||
|
{
|
||||||
|
const BERECHTIGUNG_KURZBZ = ['admin:rw', 'assistenz:r'];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getTag' => self::BERECHTIGUNG_KURZBZ,
|
||||||
|
'getTags' => self::BERECHTIGUNG_KURZBZ,
|
||||||
|
'addTag' => self::BERECHTIGUNG_KURZBZ,
|
||||||
|
'updateTag' => self::BERECHTIGUNG_KURZBZ,
|
||||||
|
'doneTag' => self::BERECHTIGUNG_KURZBZ,
|
||||||
|
'deleteTag' => self::BERECHTIGUNG_KURZBZ,
|
||||||
|
'updateLehre' => self::BERECHTIGUNG_KURZBZ,
|
||||||
|
'doneLehre' => self::BERECHTIGUNG_KURZBZ,
|
||||||
|
'deleteLehre' => self::BERECHTIGUNG_KURZBZ,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->config->load('lvverwaltung');
|
||||||
|
}
|
||||||
|
public function getTag($readonly_tags = null)
|
||||||
|
{
|
||||||
|
parent::getTag($this->config->item('lvverwaltung_tags'));
|
||||||
|
}
|
||||||
|
public function getTags($tags = null)
|
||||||
|
{
|
||||||
|
parent::getTags($this->config->item('lvverwaltung_tags'));
|
||||||
|
}
|
||||||
|
public function addTag($withZuordnung = true, $updatable_tags = null)
|
||||||
|
{
|
||||||
|
parent::addTag(true, $this->config->item('lvverwaltung_tags'));
|
||||||
|
}
|
||||||
|
public function updateTag($updatable_tags = null)
|
||||||
|
{
|
||||||
|
parent::updateTag($this->config->item('lvverwaltung_tags'));
|
||||||
|
}
|
||||||
|
public function deleteTag($withZuordnung = true, $updatable_tags = null)
|
||||||
|
{
|
||||||
|
parent::deleteTag(true, $this->config->item('lvverwaltung_tags'));
|
||||||
|
}
|
||||||
|
public function doneTag($updatable_tags = null)
|
||||||
|
{
|
||||||
|
parent::doneTag($this->config->item('lvverwaltung_tags'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,564 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Messages extends FHCAPI_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'getMessages' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getVorlagen' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getMessageVarsPerson' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getMsgVarsPrestudent' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getMsgVarsLoggedInUser' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getNameOfDefaultRecipient' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getNameOfDefaultRecipients' => ['admin:r', 'assistenz:r'],
|
||||||
|
'sendMessage' => ['admin:r', 'assistenz:r'],
|
||||||
|
'deleteMessage' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getDataVorlage' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getPreviewText' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getReplyData' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getPersonId' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getUid' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getUids' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
//Load Models
|
||||||
|
$this->load->model('system/Message_model', 'MessageModel');
|
||||||
|
$this->load->model('CL/Messages_model', 'MessagesModel');
|
||||||
|
|
||||||
|
// Additional Permission Checks
|
||||||
|
//TODO(manu) check permissions
|
||||||
|
|
||||||
|
// Load Libraries
|
||||||
|
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
$this->load->library('MessageLib');
|
||||||
|
|
||||||
|
// Load language phrases
|
||||||
|
$this->loadPhrases([
|
||||||
|
'ui', 'messages'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMessages($id, $type_id, $size=null, $page=null)
|
||||||
|
{
|
||||||
|
if($type_id != 'person_id'){
|
||||||
|
$id = $this->_getPersonId($id, $type_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(is_null($size) && is_null($page)))
|
||||||
|
{
|
||||||
|
$offset = $size * ($page - 1);
|
||||||
|
$limit = $size;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$offset = null;
|
||||||
|
$limit = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->MessageModel->getMessagesForTable($id, $offset, $limit);
|
||||||
|
|
||||||
|
if (hasData($result))
|
||||||
|
{
|
||||||
|
$data = getData($result);
|
||||||
|
$this->addMeta('count', $data['count']);
|
||||||
|
$this->terminateWithSuccess($data['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(array());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVorlagen()
|
||||||
|
{
|
||||||
|
//get oe of user
|
||||||
|
$uid = getAuthUID();
|
||||||
|
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
|
||||||
|
$result = $this->BenutzerfunktionModel->getBenutzerfunktionByUid($uid, 'oezuordnung');
|
||||||
|
|
||||||
|
if (hasData($result))
|
||||||
|
{
|
||||||
|
$this->load->model('system/Vorlage_model', 'VorlageModel');
|
||||||
|
|
||||||
|
$data = getData($result);
|
||||||
|
|
||||||
|
$oe_kurzbz = array_column($data, 'oe_kurzbz');
|
||||||
|
$result = $this->VorlageModel->getAllVorlagenByOe($oe_kurzbz);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(hasData($result) ? getData($result) : array());
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess(array());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDataVorlage($vorlage_kurzbz)
|
||||||
|
{
|
||||||
|
$studiengang_kz = 0;
|
||||||
|
$this->load->model('system/Vorlagestudiengang_model', 'VorlagestudiengangModel');
|
||||||
|
$this->VorlagestudiengangModel->addOrder('version', 'DESC');
|
||||||
|
|
||||||
|
$result = $this->VorlagestudiengangModel->loadWhere(
|
||||||
|
[
|
||||||
|
'vorlage_kurzbz' =>$vorlage_kurzbz,
|
||||||
|
'studiengang_kz' => $studiengang_kz
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$vorlage = current($data);
|
||||||
|
$this->terminateWithSuccess($vorlage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMessageVarsPerson($typeId)
|
||||||
|
{
|
||||||
|
$ids = $this->input->post('ids');
|
||||||
|
$messageVarsPerson = [];
|
||||||
|
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$person_id = ($typeId == 'mitarbeiter_uid') ? $this->_getPersonId($id, $typeId) : $id;
|
||||||
|
$result = $this->MessageModel->getMsgVarsDataByPersonId($person_id);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$messageVarsPerson[] = current($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($messageVarsPerson);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMsgVarsPrestudent($typeId)
|
||||||
|
{
|
||||||
|
$ids = $this->input->post('ids');
|
||||||
|
if(!is_array($ids)) {
|
||||||
|
$ids = array($ids);
|
||||||
|
}
|
||||||
|
$messageVarsPrestudent = [];
|
||||||
|
|
||||||
|
if($typeId == 'uid')
|
||||||
|
{
|
||||||
|
$prestudent_ids = [];
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$prestudent_ids[] = $this->_getPrestudentIdFromUid($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$prestudent_ids = $ids;
|
||||||
|
|
||||||
|
foreach ($prestudent_ids as $prestudent_id)
|
||||||
|
{
|
||||||
|
$result = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$messageVarsPrestudent[] = current($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($messageVarsPrestudent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMsgVarsLoggedInUser()
|
||||||
|
{
|
||||||
|
$result = $this->MessageModel->getMsgVarsLoggedInUser();
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNameOfDefaultRecipients($type_id)
|
||||||
|
{
|
||||||
|
$ids = $this->input->post('ids');
|
||||||
|
if(!is_array($ids)) {
|
||||||
|
$ids = array($ids);
|
||||||
|
}
|
||||||
|
$recipients = [];
|
||||||
|
|
||||||
|
if (empty($ids)) {
|
||||||
|
|
||||||
|
throw new InvalidArgumentException($this->p->t('ui', 'errorMissingOrInvalidParameters', ['parameter'=> 'Id(s)']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->load->model('person/Person_model', 'PersonModel');
|
||||||
|
if($type_id != 'person_id'){
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$person_id = $this->_getPersonId($id, $type_id);
|
||||||
|
$result = $this->PersonModel->load($person_id);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$name = current($data);
|
||||||
|
$recipients[$id] = $name->vorname . " " . $name->nachname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
$result = $this->PersonModel->load($id);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$name = current($data);
|
||||||
|
$recipients[$id] = $name->vorname . " " . $name->nachname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($recipients);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendMessage($typeId)
|
||||||
|
{
|
||||||
|
$resultReturn = [];
|
||||||
|
$uid = getAuthUID();
|
||||||
|
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||||
|
$result = $this->BenutzerModel->loadWhere(
|
||||||
|
['uid' => $uid]
|
||||||
|
);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$benutzer = current($data);
|
||||||
|
|
||||||
|
if (isset($_POST['data']))
|
||||||
|
{
|
||||||
|
$data = json_decode($_POST['data']);
|
||||||
|
unset($_POST['data']);
|
||||||
|
foreach ($data as $k => $v) {
|
||||||
|
$_POST[$k] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('subject', 'Betreff', 'required', [
|
||||||
|
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Betreff'])
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('body', 'Text', 'required', [
|
||||||
|
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Text'])
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->form_validation->run() == false)
|
||||||
|
{
|
||||||
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
}
|
||||||
|
|
||||||
|
$subject = $this->input->post('subject');
|
||||||
|
$body = $this->input->post('body');
|
||||||
|
$relationmessage_id = $this->input->post('relationmessage_id');
|
||||||
|
|
||||||
|
if (isset($_POST['ids']))
|
||||||
|
{
|
||||||
|
$ids = json_decode($_POST['ids']);
|
||||||
|
unset($_POST['ids']);
|
||||||
|
foreach ($data as $k => $v) {
|
||||||
|
$_POST[$k] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_array($ids)) {
|
||||||
|
$ids = [$ids];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$receiversPersonId = $typeId == "person_id" ? $id : $this->_getPersonId($id, $typeId);
|
||||||
|
|
||||||
|
if($typeId == 'uid')
|
||||||
|
{
|
||||||
|
$prestudent_id = $this-> _getPrestudentIdFromUid($id);
|
||||||
|
|
||||||
|
$result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $body);
|
||||||
|
$bodyParsed = $this->getDataOrTerminateWithError($result);
|
||||||
|
}
|
||||||
|
if($typeId == 'mitarbeiter_uid')
|
||||||
|
{
|
||||||
|
$person_id = $this->_getPersonId($id, $typeId);
|
||||||
|
|
||||||
|
$result = $this->MessagesModel->parseMessageTextPerson($person_id, $body);
|
||||||
|
$bodyParsed = $this->getDataOrTerminateWithError($result);
|
||||||
|
}
|
||||||
|
elseif($typeId == 'person_id')
|
||||||
|
{
|
||||||
|
$result = $this->MessagesModel->parseMessageTextPerson($id, $body);
|
||||||
|
$bodyParsed = $this->getDataOrTerminateWithError($result);
|
||||||
|
}
|
||||||
|
elseif($typeId == 'prestudent_id')
|
||||||
|
{
|
||||||
|
$result = $this->MessagesModel->parseMessageTextPrestudent($id, $body);
|
||||||
|
$bodyParsed = $this->getDataOrTerminateWithError($result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('messages', 'error_missingLogic', ['type'=> $typeId]), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result =$this->messagelib->sendMessageUser($receiversPersonId, $subject, $bodyParsed, $benutzer->person_id, null, $relationmessage_id);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$resultReturn[] = current($data);
|
||||||
|
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess($resultReturn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreviewText($type_id)
|
||||||
|
{
|
||||||
|
if (isset($_POST['data']))
|
||||||
|
{
|
||||||
|
$data = json_decode($_POST['data']);
|
||||||
|
unset($_POST['data']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->terminateWithError($this->p->t('messages', 'errorMissingOrInvalidParameters', ['parameter'=> "Textbody"]), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
if (isset($_POST['ids']))
|
||||||
|
{
|
||||||
|
$ids = json_decode($_POST['ids']);
|
||||||
|
if(!is_array($ids))
|
||||||
|
{
|
||||||
|
$ids = array($ids);
|
||||||
|
}
|
||||||
|
unset($_POST['ids']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'errorMissingOrInvalidParameters', ['parameter'=> 'Id(s)']), self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
$bodyParsed = [];
|
||||||
|
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
switch($type_id)
|
||||||
|
{
|
||||||
|
case 'uid':
|
||||||
|
$prestudent_id = $this->_getPrestudentIdFromUid($id);
|
||||||
|
$result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $data);
|
||||||
|
$bodyParsed[$id] = $this->getDataOrTerminateWithError($result);
|
||||||
|
break;
|
||||||
|
case 'prestudent_id':
|
||||||
|
$result = $this->MessagesModel->parseMessageTextPrestudent($id, $data);
|
||||||
|
$bodyParsed[$id] = $this->getDataOrTerminateWithError($result);
|
||||||
|
break;
|
||||||
|
case 'person_id':
|
||||||
|
$result = $this->MessagesModel->parseMessageTextPerson($id, $data);
|
||||||
|
$bodyParsed[$id] = $this->getDataOrTerminateWithError($result);
|
||||||
|
break;
|
||||||
|
case 'mitarbeiter_uid':
|
||||||
|
{
|
||||||
|
$person_id = $this->_getPersonId($id, $type_id);
|
||||||
|
$result = $this->MessagesModel->parseMessageTextPerson($person_id, $data);
|
||||||
|
$bodyParsed[$id] = $this->getDataOrTerminateWithError($result);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->terminateWithError($this->p->t('messages', 'error_missingLogic', ['type'=> $type_id]), self::ERROR_TYPE_GENERAL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($bodyParsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getReplyData($messageId)
|
||||||
|
{
|
||||||
|
if (!is_numeric($messageId)) {
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_valueNotNumeric', ['value'=> 'Message ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->MessageModel->addSelect('public.tbl_msg_message.*');
|
||||||
|
$this->MessageModel->addSelect('r.*');
|
||||||
|
$this->MessageModel->addSelect('p.nachname');
|
||||||
|
$this->MessageModel->addSelect('p.vorname');
|
||||||
|
$this->MessageModel->addJoin('public.tbl_msg_recipient r', 'ON (r.message_id = public.tbl_msg_message.message_id)');
|
||||||
|
$this->MessageModel->addJoin('public.tbl_person p', 'ON (p.person_id = public.tbl_msg_message.person_id)');
|
||||||
|
|
||||||
|
$result = $this->MessageModel->loadWhere(
|
||||||
|
array('r.message_id' => $messageId)
|
||||||
|
);
|
||||||
|
|
||||||
|
$dataMessage = $this->getDataOrTerminateWithError($result);
|
||||||
|
$prefix = "Re: "; // reply subject prefix
|
||||||
|
|
||||||
|
$subject = $dataMessage[0]->subject;
|
||||||
|
$body = $dataMessage[0]->body;
|
||||||
|
|
||||||
|
|
||||||
|
$replyBody = $this->_getReplyBody($body, $dataMessage[0]->nachname, $dataMessage[0]->vorname, $dataMessage[0]->insertamum);
|
||||||
|
|
||||||
|
$dataMessage[0]->replyBody = $replyBody;
|
||||||
|
$dataMessage[0]->replySubject = $prefix . $subject;
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($dataMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteMessage($messageId)
|
||||||
|
{
|
||||||
|
// Start DB transaction
|
||||||
|
$this->db->trans_begin();
|
||||||
|
|
||||||
|
$result = $this->MessageModel->deleteMessageRecipient($messageId);
|
||||||
|
if (isError($result)) {
|
||||||
|
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->MessageModel->deleteMessageStatus($messageId);
|
||||||
|
if (isError($result)) {
|
||||||
|
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->MessageModel->deleteMessage($messageId);
|
||||||
|
if (isError($result)) {
|
||||||
|
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_commit();
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonId($id, $typeId)
|
||||||
|
{
|
||||||
|
if ($typeId == 'uid' || $typeId == 'mitarbeiter_uid')
|
||||||
|
{
|
||||||
|
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||||
|
$result = $this->BenutzerModel->loadWhere(
|
||||||
|
['uid' => $id]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif($typeId == 'prestudent_id')
|
||||||
|
{
|
||||||
|
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||||
|
$result = $this->PrestudentModel->loadWhere(
|
||||||
|
['prestudent_id' => $id]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('messages', 'error_missingLogic', ['type'=> $typeId]), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$person = current($data);
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($person->person_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUids($typeId)
|
||||||
|
{
|
||||||
|
$ids = $this->input->post('ids');
|
||||||
|
$benutzerIds = [];
|
||||||
|
|
||||||
|
if (!$typeId)
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Type ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
elseif ($typeId == 'person_id')
|
||||||
|
{
|
||||||
|
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$result = $this->BenutzerModel->loadWhere(
|
||||||
|
['person_id' => $id]
|
||||||
|
);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$benutzer = current($data);
|
||||||
|
|
||||||
|
$benutzerIds[$id] = $benutzer->uid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($typeId == 'prestudent_id')
|
||||||
|
{
|
||||||
|
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$result = $this->PrestudentModel->loadWhere(
|
||||||
|
['prestudent_id' => $id]
|
||||||
|
);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$person = current($data);
|
||||||
|
$person_id = $person->person_id;
|
||||||
|
|
||||||
|
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||||
|
$result = $this->BenutzerModel->loadWhere(
|
||||||
|
['person_id' => $person_id]
|
||||||
|
);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$benutzer = current($data);
|
||||||
|
|
||||||
|
$benutzerIds[$id] = $benutzer->uid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($typeId == 'uid' || $typeId == 'mitarbeiter_uid')
|
||||||
|
{
|
||||||
|
$this->terminateWithSuccess($ids);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('messages', 'error_missingLogic', ['type'=> $typeId]), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithSuccess($benutzerIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _getPersonId($id, $typeId)
|
||||||
|
{
|
||||||
|
if ($typeId == 'uid' || $typeId == 'mitarbeiter_uid')
|
||||||
|
{
|
||||||
|
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||||
|
$result = $this->BenutzerModel->loadWhere(
|
||||||
|
['uid' => $id]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
elseif($typeId == 'prestudent_id')
|
||||||
|
{
|
||||||
|
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||||
|
$result = $this->PrestudentModel->loadWhere(
|
||||||
|
['prestudent_id' => $id]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('messages', 'error_missingLogic', ['type'=> $typeId]), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
if (count($data) < 1)
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$person = current($data);
|
||||||
|
|
||||||
|
return $person->person_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _getPrestudentIdFromUid($uid)
|
||||||
|
{
|
||||||
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
|
$result = $this->StudentModel->loadWhere(
|
||||||
|
['student_uid' => $uid]
|
||||||
|
);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
if (count($data) < 1)
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Prestudent ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$student = current($data);
|
||||||
|
|
||||||
|
return $student->prestudent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _getReplyBody($body, $receiverName, $receiverSurname, $sentDate)
|
||||||
|
{
|
||||||
|
// To quote a reply body message
|
||||||
|
$bodyFormat = "<br>
|
||||||
|
<br>
|
||||||
|
<blockquote>
|
||||||
|
<i>
|
||||||
|
On %s %s %s wrote:
|
||||||
|
</i>
|
||||||
|
</blockquote>
|
||||||
|
<blockquote style='border-left:2px solid; padding-left: 8px'>
|
||||||
|
%s
|
||||||
|
</blockquote>";
|
||||||
|
return sprintf(
|
||||||
|
$bodyFormat,
|
||||||
|
date_format(date_create($sentDate), 'd.m.Y H:i'), $receiverName, $receiverSurname, $body
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
|
||||||
|
class NotizAnrechnung extends Notiz_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'isBerechtigt' => ['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 isBerechtigt($id, $typeId)
|
||||||
|
{
|
||||||
|
if($typeId != "anrechnung_id")
|
||||||
|
{
|
||||||
|
$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');
|
||||||
|
|
||||||
|
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess("berechtigt in überschreibender Funktion");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
|
||||||
|
class NotizBestellung extends Notiz_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'isBerechtigt' => ['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 isBerechtigt($id, $typeId)
|
||||||
|
{
|
||||||
|
if($typeId != "bestellung_id")
|
||||||
|
{
|
||||||
|
$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');
|
||||||
|
|
||||||
|
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess("berechtigt in überschreibender Funktion");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class NotizLehreinheit 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'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
//Load Models
|
||||||
|
$this->load->model('person/Notiz_model', 'NotizModel');
|
||||||
|
$this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel');
|
||||||
|
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
|
||||||
|
|
||||||
|
// Load Libraries
|
||||||
|
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||||
|
|
||||||
|
//Permission checks for allowed Oes
|
||||||
|
$allowedOes = $this->permissionlib->getOE_isEntitledFor('assistenz') ?: [];
|
||||||
|
|
||||||
|
if ($this->router->method == 'addNewNotiz')
|
||||||
|
{
|
||||||
|
$json = $this->input->post('data');
|
||||||
|
$post_data = json_decode($json, true);
|
||||||
|
$lehreinheit_id = $post_data['id'];
|
||||||
|
|
||||||
|
if(!$lehreinheit_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Lehreinheit ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->_checkAllowedOesFromLehreinheit($lehreinheit_id, $allowedOes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->router->method == 'updateNotiz')
|
||||||
|
{
|
||||||
|
$json = $this->input->post('data');
|
||||||
|
$post_data = json_decode($json, true);
|
||||||
|
$notiz_id = $post_data['notiz_id'];
|
||||||
|
|
||||||
|
if(!$notiz_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Notiz ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
//get lehreinheit_id
|
||||||
|
$result = $this->NotizzuordnungModel->loadWhere(['notiz_id' => $notiz_id]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$lehreinheit_id = current($data)->lehreinheit_id;
|
||||||
|
|
||||||
|
if(!$lehreinheit_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Lehreinheit ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->_checkAllowedOesFromLehreinheit($lehreinheit_id, $allowedOes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->router->method == 'deleteNotiz')
|
||||||
|
{
|
||||||
|
$notiz_id = $this->input->post('notiz_id');
|
||||||
|
$lehreinheit_id = $this->input->post('id');
|
||||||
|
|
||||||
|
if(!$notiz_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Notiz ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$lehreinheit_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Lehreinheit ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->_checkAllowedOesFromLehreinheit($lehreinheit_id, $allowedOes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load language phrases
|
||||||
|
$this->loadPhrases([
|
||||||
|
'ui'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _checkAllowedOesFromLehreinheit($lehreinheit_id, $allowedOes)
|
||||||
|
{
|
||||||
|
//get oe from lehreinheit
|
||||||
|
$result = $this->LehreinheitModel->getOes($lehreinheit_id);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$oes = current($data);
|
||||||
|
|
||||||
|
if (!in_array($oes, $allowedOes))
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_keineBerechtigungStg') . " " . $oes, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isBerechtigt($id, $typeId)
|
||||||
|
{
|
||||||
|
if($typeId != "lehreinheit_id")
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid'))
|
||||||
|
{
|
||||||
|
$result = $this->p->t('lehre','error_keineSchreibrechte');
|
||||||
|
|
||||||
|
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess("berechtigt in überschreibender Funktion");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
|
||||||
|
class NotizMitarbeiter extends Notiz_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'isBerechtigt' => ['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 isBerechtigt($id, $typeId)
|
||||||
|
{
|
||||||
|
if($typeId != "mitarbeiter_uid")
|
||||||
|
{
|
||||||
|
$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');
|
||||||
|
|
||||||
|
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess("berechtigt in überschreibender Funktion");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,34 +18,102 @@ class NotizPerson extends Notiz_Controller
|
|||||||
'loadDokumente' => ['admin:r', 'assistenz:r'],
|
'loadDokumente' => ['admin:r', 'assistenz:r'],
|
||||||
'getMitarbeiter' => ['admin:r', 'assistenz:r'],
|
'getMitarbeiter' => ['admin:r', 'assistenz:r'],
|
||||||
'isBerechtigt' => ['admin:r', 'assistenz:r'],
|
'isBerechtigt' => ['admin:r', 'assistenz:r'],
|
||||||
|
'getCountNotes' => ['admin:r', 'assistenz:r'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
//Load Models
|
||||||
|
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||||
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
|
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||||
|
|
||||||
|
//Permission checks for allowed Oes
|
||||||
|
if ($this->router->method == 'addNewNotiz')
|
||||||
|
{
|
||||||
|
$json = $this->input->post('data');
|
||||||
|
$post_data = json_decode($json, true);
|
||||||
|
$person_id = $post_data['id'];
|
||||||
|
|
||||||
|
$allowedStgs = $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: [];
|
||||||
|
|
||||||
|
if(!$person_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->_checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->router->method == 'updateNotiz')
|
||||||
|
{
|
||||||
|
$json = $this->input->post('data');
|
||||||
|
$post_data = json_decode($json, true);
|
||||||
|
$notiz_id = $post_data['notiz_id'];
|
||||||
|
|
||||||
|
if(!$notiz_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Notiz ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
//get person_id
|
||||||
|
$result = $this->NotizzuordnungModel->loadWhere(['notiz_id' => $notiz_id]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$person_id = current($data)->person_id;
|
||||||
|
|
||||||
|
$allowedStgs = $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: [];
|
||||||
|
$this->_checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->router->method == 'deleteNotiz' )
|
||||||
|
{
|
||||||
|
$notiz_id = $this->input->post('notiz_id');
|
||||||
|
$person_id = $this->input->post('id');
|
||||||
|
|
||||||
|
if(!$notiz_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Notiz ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$person_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'person ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$allowedStgs = $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: [];
|
||||||
|
$this->_checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isBerechtigt($id, $typeId)
|
public function isBerechtigt($id, $typeId)
|
||||||
{
|
{
|
||||||
if($typeId != "person_id")
|
if($typeId != "person_id")
|
||||||
{
|
{
|
||||||
return $this->terminateWithError($this->p->t('ui', 'error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL);
|
$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'))
|
if (!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid'))
|
||||||
{
|
{
|
||||||
$result = $this->p->t('lehre', 'error_keineSchreibrechte');
|
$result = $this->p->t('lehre', 'error_keineSchreibrechte');
|
||||||
|
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->outputJsonSuccess(true);
|
$this->terminateWithSuccess("berechtigt in überschreibender Funktion");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadDokumente()
|
//stv: if person has permission of one studiengang of person -> permission to add/update/delete Note
|
||||||
|
private function _checkIfBerechtigungForOnePrestudentExists($person_id, $allowedStgs)
|
||||||
{
|
{
|
||||||
$notiz_id = $this->input->post('notiz_id');
|
$result = $this->PrestudentModel->loadWhere(['person_id' => $person_id]);
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
// TODO(chris): make CI variant of endpoint
|
$checkarray = [];
|
||||||
$this->NotizModel->addSelect($this->NotizModel->escape(base_url('content/notizdokdownload.php?id=')) . ' || campus.tbl_dms_version.dms_id AS preview');
|
foreach ($data as $item)
|
||||||
|
{
|
||||||
return parent::loadDokumente();
|
if(in_array($item->studiengang_kz, $allowedStgs))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->terminateWithError($this->p->t('ui', 'error_keineBerechtigungStg'), self::ERROR_TYPE_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
|
||||||
|
class NotizPrestudent extends Notiz_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'isBerechtigt' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
//Load Models
|
||||||
|
$this->load->model('person/Notiz_model', 'NotizModel');
|
||||||
|
$this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel');
|
||||||
|
$this->load->model('crm/Student_model', 'StudentModel');
|
||||||
|
|
||||||
|
// Load Libraries
|
||||||
|
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||||
|
|
||||||
|
// Load language phrases
|
||||||
|
$this->loadPhrases([
|
||||||
|
'ui'
|
||||||
|
]);
|
||||||
|
|
||||||
|
//Permission checks for Studiengangsarray
|
||||||
|
$allowedStgs = $this->permissionlib->getSTG_isEntitledFor('assistenz') ?: [];
|
||||||
|
|
||||||
|
if ($this->router->method == 'addNewNotiz')
|
||||||
|
{
|
||||||
|
$json = $this->input->post('data');
|
||||||
|
$post_data = json_decode($json, true);
|
||||||
|
$prestudent_id = $post_data['id'];
|
||||||
|
|
||||||
|
if(!$prestudent_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Lehreinheit ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->_checkAllowedOesFromPrestudent($prestudent_id, $allowedStgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->router->method == 'updateNotiz')
|
||||||
|
{
|
||||||
|
$json = $this->input->post('data');
|
||||||
|
$post_data = json_decode($json, true);
|
||||||
|
$notiz_id = $post_data['notiz_id'];
|
||||||
|
|
||||||
|
if(!$notiz_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Notiz ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
//get prestudent_id
|
||||||
|
$result = $this->NotizzuordnungModel->loadWhere(['notiz_id' => $notiz_id]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$prestudent_id = current($data)->prestudent_id;
|
||||||
|
|
||||||
|
if(!$prestudent_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Prestudent ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->_checkAllowedOesFromPrestudent($prestudent_id, $allowedStgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->router->method == 'deleteNotiz')
|
||||||
|
{
|
||||||
|
$notiz_id = $this->input->post('notiz_id');
|
||||||
|
$prestudent_id = $this->input->post('id');
|
||||||
|
|
||||||
|
if(!$notiz_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Notiz ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$prestudent_id)
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Prestudent ID']), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->_checkAllowedOesFromPrestudent($prestudent_id, $allowedStgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isBerechtigt($id, $typeId)
|
||||||
|
{
|
||||||
|
if($typeId != "prestudent_id")
|
||||||
|
{
|
||||||
|
$this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid'))
|
||||||
|
{
|
||||||
|
$result = $this->p->t('lehre','error_keineSchreibrechte');
|
||||||
|
|
||||||
|
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess("berechtigt in überschreibender Funktion");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _checkAllowedOesFromPrestudent($prestudent_id, $allowedStgs)
|
||||||
|
{
|
||||||
|
$student_uid = $this->StudentModel->getUID($prestudent_id);
|
||||||
|
|
||||||
|
$result = $this->StudentModel->loadWhere(['student_uid' => $student_uid]);
|
||||||
|
|
||||||
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
$studiengang_kz = current($data)->studiengang_kz;
|
||||||
|
|
||||||
|
if (!in_array($studiengang_kz, $allowedStgs))
|
||||||
|
{
|
||||||
|
return $this->terminateWithError($this->p->t('ui', 'error_keineBerechtigungStg'), self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
|
||||||
|
class NotizProjekt extends Notiz_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'isBerechtigt' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isBerechtigt($id, $typeId)
|
||||||
|
{
|
||||||
|
if($typeId != "projekt_kurzbz")
|
||||||
|
{
|
||||||
|
$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');
|
||||||
|
|
||||||
|
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess("berechtigt in überschreibender Funktion");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use \DateTime as DateTime;
|
||||||
|
|
||||||
|
class NotizProjektphase extends Notiz_Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct([
|
||||||
|
'isBerechtigt' => ['admin:r', 'assistenz:r'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isBerechtigt($id, $typeId)
|
||||||
|
{
|
||||||
|
if($typeId != "projektphase_id")
|
||||||
|
{
|
||||||
|
$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');
|
||||||
|
|
||||||
|
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||||
|
}
|
||||||
|
$this->terminateWithSuccess("berechtigt in überschreibender Funktion");
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user