mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 15:04:04 +00:00
Compare commits
39
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10492dea0c | ||
|
|
2e39da7d12 | ||
|
|
24b4981079 | ||
|
|
b0d933a13f | ||
|
|
2076752f40 | ||
|
|
0c002b3969 | ||
|
|
2307565696 | ||
|
|
ace2057166 | ||
|
|
2428589bca | ||
|
|
953a04f24a | ||
|
|
82d640b1f4 | ||
|
|
5b4e632526 | ||
|
|
5c2038fb79 | ||
|
|
1b400f7d42 | ||
|
|
43811d5724 | ||
|
|
4c03668082 | ||
|
|
10d52caa98 | ||
|
|
2de6278603 | ||
|
|
85db467cff | ||
|
|
1c65d6e076 | ||
|
|
f72ea1a655 | ||
|
|
413ccba64b | ||
|
|
9ccbb7b9e2 | ||
|
|
d6803a3947 | ||
|
|
545e2b0445 | ||
|
|
131ec86dee | ||
|
|
cd03264ab4 | ||
|
|
c6232f7959 | ||
|
|
cf2cc796b3 | ||
|
|
475888d4ac | ||
|
|
4b8b3c90fb | ||
|
|
b168ebb5f6 | ||
|
|
a259db2e7b | ||
|
|
3e77d80d26 | ||
|
|
2d71a436f6 | ||
|
|
026bd6e247 | ||
|
|
9c37215e62 | ||
|
|
733a6a8c15 | ||
|
|
a24483188b |
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
// Preferred organisational unit for a new content.
|
||||
// If the user is entitled for this unit, it wins.
|
||||
// If not, the first entitled unit wins.
|
||||
$config['default_oe_kurzbz'] = 'etw';
|
||||
|
||||
// Lifetime of an edit lock in hours, counted from tbl_contentlog.start. Must be > 0.
|
||||
$config['lock_ttl_hours'] = 24;
|
||||
|
||||
// Switches the click statistics off completely. With false the admin tab stays hidden and
|
||||
// the endpoint refuses every request, whatever the rights of the caller are.
|
||||
$config['clickstats_enabled'] = true;
|
||||
|
||||
// Default period of the click statistics in months, when the caller sends none.
|
||||
$config['clickstats_months'] = 12;
|
||||
|
||||
// Length of the ranking in the click statistics tab.
|
||||
$config['clickstats_limit'] = 100;
|
||||
@@ -0,0 +1,448 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
$config['fehler'] = array(
|
||||
array(
|
||||
'fehlercode' => 'CORE_ZGV_0001',
|
||||
'fehler_kurzbz' => 'zgvDatumInZukunft',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'ZGV Datum in Zukunft',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => array('core'),
|
||||
'producerLibName' => 'ZgvDatumInZukunft',
|
||||
'resolverLibName' => 'CORE_ZGV_0001',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_ZGV_0002',
|
||||
'fehler_kurzbz' => 'zgvDatumVorGeburtsdatum',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'ZGV Datum vor Geburtsdatum',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'ZgvDatumVorGeburtsdatum',
|
||||
'resolverLibName' => 'CORE_ZGV_0002',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_ZGV_0003',
|
||||
'fehler_kurzbz' => 'zgvMasterDatumInZukunft',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'ZGV Masterdatum in Zukunft',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'ZgvMasterDatumInZukunft',
|
||||
'resolverLibName' => 'CORE_ZGV_0003',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_ZGV_0004',
|
||||
'fehler_kurzbz' => 'zgvMasterDatumVorZgvdatum',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'ZGV Masterdatum vor Zgvdatum',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'ZgvMasterDatumVorZgvdatum',
|
||||
'resolverLibName' => 'CORE_ZGV_0004',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_ZGV_0005',
|
||||
'fehler_kurzbz' => 'zgvMasterDatumVorGeburtsdatum',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'ZGV Masterdatum vor Geburtsdatum',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'ZgvMasterDatumVorGeburtsdatum',
|
||||
'resolverLibName' => 'CORE_ZGV_0005',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_INOUT_0001',
|
||||
'fehler_kurzbz' => 'keinAufenthaltszweckPlausi',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Kein Aufenthaltszweck gefunden',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'KeinAufenthaltszweckPlausi',
|
||||
'resolverLibName' => 'CORE_INOUT_0001',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_INOUT_0002',
|
||||
'fehler_kurzbz' => 'zuVieleZweckeIncomingPlausi',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Es sind %s Aufenthaltszwecke eingetragen (max. 1 Zweck für Incomings)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'ZuVieleZweckeIncomingPlausi',
|
||||
'resolverLibName' => 'CORE_INOUT_0002',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_INOUT_0003',
|
||||
'fehler_kurzbz' => 'falscherIncomingZweckPlausi',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Aufenthaltszweckcode ist %s (für Incomings ist nur Zweck 1, 2, 3 erlaubt)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'FalscherIncomingZweckPlausi',
|
||||
'resolverLibName' => 'CORE_INOUT_0003',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_INOUT_0004',
|
||||
'fehler_kurzbz' => 'outgoingAufenthaltfoerderungfehltPlausi',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Keine Aufenthaltsfoerderung angegeben (bei Outgoings >= 29 Tage Monat im Ausland muss mind. 1 gemeldet werden)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'OutgoingAufenthaltfoerderungfehltPlausi',
|
||||
'resolverLibName' => 'CORE_INOUT_0004',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_INOUT_0005',
|
||||
'fehler_kurzbz' => 'outgoingAngerechneteEctsFehlenPlausi',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Angerechnete ECTS fehlen (Meldepflicht bei Outgoings >= 29 Tage Monat im Ausland)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'OutgoingAngerechneteEctsFehlenPlausi',
|
||||
'resolverLibName' => 'CORE_INOUT_0005',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_INOUT_0006',
|
||||
'fehler_kurzbz' => 'outgoingErworbeneEctsFehlenPlausi',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Erworbene ECTS fehlen (Meldepflicht bei Outgoings >= 29 Tage Monat im Ausland)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'OutgoingErworbeneEctsFehlenPlausi',
|
||||
'resolverLibName' => 'CORE_INOUT_0006',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
|
||||
/** Plausichecks **/
|
||||
array(
|
||||
'fehlercode' => 'CORE_INOUT_0007',
|
||||
'fehler_kurzbz' => 'IncomingHeimatNationOesterreich',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Heimatnation bei Incoming Österreich',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'IncomingHeimatNationOesterreich',
|
||||
'resolverLibName' => 'CORE_INOUT_0007',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_INOUT_0008',
|
||||
'fehler_kurzbz' => 'IncomingOhneIoDatensatz',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Incoming hat keinen IO Datensatz (prestudent_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'IncomingOhneIoDatensatz',
|
||||
'resolverLibName' => 'CORE_INOUT_0008',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_INOUT_0009',
|
||||
'fehler_kurzbz' => 'IncomingOrGsFoerderrelevant',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Incoming oder gemeinsames Studium ist nicht als nicht förderrelevant markiert. (prestudent_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'IncomingOrGsFoerderrelevant',
|
||||
'resolverLibName' => 'CORE_INOUT_0009',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STG_0001',
|
||||
'fehler_kurzbz' => 'StgPrestudentUngleichStgStudent',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Studiengang des Prestudenten ist ungleich dem Studiengang des Studenten. (prestudent_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'StgPrestudentUngleichStgStudent',
|
||||
'resolverLibName' => 'CORE_STG_0001',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STG_0002',
|
||||
'fehler_kurzbz' => 'OrgformStgUngleichOrgformPrestudent',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Es ist kein Studienplan mit Studiengang (%s) und Organisationsform (%s) des Studenten zugewiesen. (prestudent_id %s, Studiensemester %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'OrgformStgUngleichOrgformPrestudent',
|
||||
'resolverLibName' => 'CORE_STG_0002',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STG_0003',
|
||||
'fehler_kurzbz' => 'PrestudentMischformOhneOrgform',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Organisationsform ist für Studierenden/BewerberIn in Mischformstudiengang nicht eingetragen. (prestudent_id %s, Studiensemester %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'PrestudentMischformOhneOrgform',
|
||||
'resolverLibName' => 'CORE_STG_0003',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STG_0004',
|
||||
'fehler_kurzbz' => 'StgPrestudentUngleichStgStudienplan',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Studiengang des Prestudenten passt nicht zu Studiengang des Studienplans. (prestudent_id %s, Studienplan %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'StgPrestudentUngleichStgStudienplan',
|
||||
'resolverLibName' => 'CORE_STG_0004',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0001',
|
||||
'fehler_kurzbz' => 'AbbrecherAktiv',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'AbbrecherIn hat aktiven Benutzer. (prestudent_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'AbbrecherAktiv',
|
||||
'resolverLibName' => null,
|
||||
'producerIsResolver' => true
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0002',
|
||||
'fehler_kurzbz' => 'StudentstatusNachAbbrecher',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Aktiver Status nach Abbrecher Status. (prestudent_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'StudentstatusNachAbbrecher',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0002',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0003',
|
||||
'fehler_kurzbz' => 'AusbildungssemPrestudentUngleichAusbildungssemStatus',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Ausbildungssemester %s des aktuellen Status stimmt nicht mit Ausbildungssemester %s bei StudentIn (Lehrverband) überein. (student_uid %s, prestudent_id %s, Studiensemester %s)',
|
||||
'fehlertyp_kurzbz' => 'warning',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'AusbildungssemPrestudentUngleichAusbildungssemStatus',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0003',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0004',
|
||||
'fehler_kurzbz' => 'InaktiverStudentAktiverStatus',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Inaktiver Benutzer hat aktiven Status. (prestudent_id %s)',
|
||||
'fehlertyp_kurzbz' => 'warning',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'InaktiverStudentAktiverStatus',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0004',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0005',
|
||||
'fehler_kurzbz' => 'InskriptionVorLetzerBismeldung',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Datum der Inskription liegt vor dem Datum der letzten BIS-Meldung %s. (prestudent_id %s, Studiensemester %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'InskriptionVorLetzerBismeldung',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0005',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0006',
|
||||
'fehler_kurzbz' => 'DatumStudiensemesterFalscheReihenfolge',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Datum und Studiensemester sind bei den Status in falscher Reihenfolge. (prestudent_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'DatumStudiensemesterFalscheReihenfolge',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0006',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0007',
|
||||
'fehler_kurzbz' => 'AktiverStudentOhneStatus',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Aktive/r StudentIn ohne aktuellen Status (prestudent_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'AktiverStudentOhneStatus',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0007',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
//~ array(
|
||||
//~ 'fehlercode' => 'CORE_STUDENTSTATUS_0008',
|
||||
//~ 'fehler_kurzbz' => 'StudienplanUngueltig',
|
||||
//~ 'fehlercode_extern' => null,
|
||||
//~ 'fehlertext' => 'Studienplan %s ist im Ausbildungssemester %s nicht gültig (prestudent_id %s)',
|
||||
//~ 'fehlertyp_kurzbz' => 'error',
|
||||
//~ 'app' => 'core',
|
||||
//~ 'producerLibName' => 'StudienplanUngueltig',
|
||||
//~ 'resolverLibName' => 'CORE_STUDENTSTATUS_0008',
|
||||
//~ 'producerIsResolver' => false
|
||||
//~ ),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0009',
|
||||
'fehler_kurzbz' => 'FalscheAnzahlAbschlusspruefungen',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Mehrere oder keine bestandenen Abschlussprüfungen (prestudent_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'FalscheAnzahlAbschlusspruefungen',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0009',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0010',
|
||||
'fehler_kurzbz' => 'DatumAbschlusspruefungFehlt',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Kein Abschlussprüfung Datum (prestudent_id %s, abschlusspruefung_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'DatumAbschlusspruefungFehlt',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0010',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0011',
|
||||
'fehler_kurzbz' => 'DatumSponsionFehlt',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Kein Sponsionsdatum (prestudent_id %s, abschlusspruefung_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'DatumSponsionFehlt',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0011',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
//~ array(
|
||||
//~ 'fehlercode' => 'CORE_STUDENTSTATUS_0012',
|
||||
//~ 'fehler_kurzbz' => 'BewerberNichtZumRtAngetreten',
|
||||
//~ 'fehlercode_extern' => null,
|
||||
//~ 'fehlertext' => 'Bewerber nicht zum Reihungstest angetreten (prestudent_id %s)',
|
||||
//~ 'fehlertyp_kurzbz' => 'warning',
|
||||
//~ 'app' => 'core',
|
||||
//~ 'producerLibName' => 'BewerberNichtZumRtAngetreten',
|
||||
//~ 'resolverLibName' => 'CORE_STUDENTSTATUS_0012',
|
||||
//~ 'producerIsResolver' => false
|
||||
//~ ),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0013',
|
||||
'fehler_kurzbz' => 'AktSemesterNull',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Aktuelles Ausbildungssemester ist 0 (prestudent_id %s, Studiensemester %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'AktSemesterNull',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0013',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0014',
|
||||
'fehler_kurzbz' => 'AbschlussstatusFehlt',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Kein Abschlussstatus (prestudent_id %s)',
|
||||
'fehlertyp_kurzbz' => 'warning',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'AbschlussstatusFehlt',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0014',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0015',
|
||||
'fehler_kurzbz' => 'AktiverStudentstatusOhneKontobuchung',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Keine Kontobuchung bei aktivem Studentstatus (prestudent_id %s, Studiensemester %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'AktiverStudentstatusOhneKontobuchung',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0015',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0016',
|
||||
'fehler_kurzbz' => 'DualesStudiumOhneMarkierung',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'StudentIn in dualem Studiengang nicht als dual markiert (prestudent_id %s, Studienplan %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'DualesStudiumOhneMarkierung',
|
||||
'resolverLibName' => 'CORE_STUDENTSTATUS_0016',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_PERSON_0001',
|
||||
'fehler_kurzbz' => 'GbDatumWeitZurueck',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Geburtsdatum vor dem 01.01.1920',
|
||||
'fehlertyp_kurzbz' => 'warning',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'GbDatumWeitZurueck',
|
||||
'resolverLibName' => 'CORE_PERSON_0001',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_PERSON_0002',
|
||||
'fehler_kurzbz' => 'NationNichtOesterreichAberGemeinde',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Nation der Adresse ist ungleich Österreich, es ist aber eine österreichische Gemeinde (%s) angegeben (adresse_id %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'NationNichtOesterreichAberGemeinde',
|
||||
'resolverLibName' => 'CORE_PERSON_0002',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_PERSON_0003',
|
||||
'fehler_kurzbz' => 'FalscheAnzahlHeimatadressen',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Es sind mehrere oder keine Heimatadressen eingetragen',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'FalscheAnzahlHeimatadressen',
|
||||
'resolverLibName' => 'CORE_PERSON_0003',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_PERSON_0004',
|
||||
'fehler_kurzbz' => 'FalscheAnzahlZustelladressen',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Es sind mehrere oder keine Zustelladressen eingetragen',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'FalscheAnzahlZustelladressen',
|
||||
'resolverLibName' => 'CORE_PERSON_0004',
|
||||
'producerIsResolver' => false
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_PERSON_0005',
|
||||
'fehler_kurzbz' => 'geburtsnationFehlt',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Geburtsnation nicht vorhanden',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'GeburtsnationFehlt',
|
||||
'resolverLibName' => null,
|
||||
'producerIsResolver' => true
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_PERSON_0006',
|
||||
'fehler_kurzbz' => 'uhstatPersonkennungFehltCore',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Personkennung fehlt (vBpk AS, vBpk BF oder Ersatzkennzeichen fehlt)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core',
|
||||
'producerLibName' => 'UhstatPersonkennungFehltCore',
|
||||
'resolverLibName' => 'CORE_PERSON_0006',
|
||||
'producerIsResolver' => false
|
||||
)
|
||||
);
|
||||
@@ -3,4 +3,3 @@
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
$config['infocenter_studiengang_kz'] = '10021, 10027, 10002';
|
||||
$config['infocenter_qualifikationskurs_kz'] = '10002';
|
||||
|
||||
@@ -75,10 +75,6 @@ $route['Abgabetool/Student'] = 'Cis/Abgabetool/Student';
|
||||
$route['Abgabetool/Student/(:any)'] = 'Cis/Abgabetool/Student/$1';
|
||||
$route['Abgabetool/Deadlines'] = 'Cis/Abgabetool/Deadlines';
|
||||
|
||||
// CMS Admin App Routes
|
||||
$route['cms'] = 'cms/index';
|
||||
$route['cms/.*'] = 'cms/index';
|
||||
|
||||
// Studierendenverwaltung App Routes
|
||||
$route['studvw'] = 'studentenverwaltung/index';
|
||||
$route['studvw/.*'] = 'studentenverwaltung/index';
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
class Compat extends Auth_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct([
|
||||
'ci' => ['basis/cis:r'],
|
||||
'legacy' => ['basis/cis:r'],
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ci()
|
||||
{
|
||||
$this->load->view('CisRouterView/CisRouterView.php',['route' => 'Compat']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function legacy()
|
||||
{
|
||||
$this->load->view('CisRouterView/CisRouterView.php',['route' => 'Compat']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,22 +44,19 @@ class Cms extends Auth_Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function content($content_id = null, $version = null, $sprache = null, $sichtbar = true)
|
||||
public function content($content_id, $version = null, $sprache = null, $sichtbar = true)
|
||||
{
|
||||
if (!is_numeric($content_id))
|
||||
show_404();
|
||||
// return early if the content_id for the content is missing
|
||||
if (!isset($content_id))
|
||||
$this->terminateWithError("content_id is missing");
|
||||
|
||||
$content = $this->ContentModel->load($content_id);
|
||||
if (isError($content))
|
||||
{
|
||||
show_error('The content could not be loaded');
|
||||
}
|
||||
$this->terminateWithError(getError($content));
|
||||
|
||||
$content = getData($content);
|
||||
|
||||
if (NULL === $content) {
|
||||
show_404();
|
||||
}
|
||||
if (NULL === $content)
|
||||
$this->terminateWithError("Content not found");
|
||||
|
||||
$content = current($content);
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Cms extends Auth_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(['index' => 'basis/cms:r']);
|
||||
$this->load->library('PermissionLib');
|
||||
$this->config->load('cms');
|
||||
$this->loadPhrases(['global', 'ui', 'cms']);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
// decide whether the click statistics tab is shown at all.
|
||||
$this->load->view('Cms.php', [
|
||||
'clickstats' => $this->config->item('clickstats_enabled')
|
||||
&& $this->permissionlib->isBerechtigt('admin')
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -67,11 +67,8 @@ class CisMenu extends FHCAPI_Controller
|
||||
|
||||
private function generateUrlForMenuItem($menuItem)
|
||||
{
|
||||
if(!isset($menuItem->url))
|
||||
{
|
||||
$menuItem->url = $this->menuItemUrlHelper($menuItem);
|
||||
unset($menuItem->content);
|
||||
}
|
||||
$menuItem->url = $this->menuItemUrlHelper($menuItem);
|
||||
unset($menuItem->content);
|
||||
|
||||
if ($menuItem->childs && count($menuItem->childs)) {
|
||||
$menuItem->childs = $this->generateUrlsForMenuItems($menuItem->childs);
|
||||
@@ -86,7 +83,7 @@ class CisMenu extends FHCAPI_Controller
|
||||
return site_url("/CisVue/Cms/content/" . $menuItem->content_id);
|
||||
}
|
||||
|
||||
if (!isset($menuItem->content) || !$menuItem->content || !mb_strlen($menuItem->content)) {
|
||||
if (!$menuItem->content || !mb_strlen($menuItem->content)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -94,8 +91,6 @@ class CisMenu extends FHCAPI_Controller
|
||||
$doc->loadXML($menuItem->content);
|
||||
$urlElem = $doc->getElementsByTagName('url')->item(0);
|
||||
|
||||
$this->menuItemUrlTargetHelper($menuItem, $doc);
|
||||
|
||||
if (!$urlElem) {
|
||||
return '';
|
||||
}
|
||||
@@ -127,18 +122,5 @@ class CisMenu extends FHCAPI_Controller
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,6 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
*/
|
||||
class Cms extends FHCAPI_Controller
|
||||
{
|
||||
// Upper bound for the tiefe of oe-personen and dms-liste. A hierarchy this deep does
|
||||
// not occur, and the cap keeps one marker from walking a whole tree.
|
||||
const MAX_TIEFE = 10;
|
||||
|
||||
|
||||
/**
|
||||
* Object initialization
|
||||
@@ -43,11 +39,6 @@ class Cms extends FHCAPI_Controller
|
||||
'news' => self::PERM_LOGGED,
|
||||
'getNewsRowCount' => self::PERM_LOGGED,
|
||||
'getNews' => self::PERM_LOGGED,
|
||||
'getOePersonen' => self::PERM_LOGGED,
|
||||
'getDmsKategorie' => self::PERM_LOGGED,
|
||||
'getContentChilds' => self::PERM_LOGGED,
|
||||
'getPerson' => self::PERM_LOGGED,
|
||||
'getDmsDokumente' => self::PERM_LOGGED,
|
||||
|
||||
]);
|
||||
|
||||
@@ -64,7 +55,11 @@ class Cms extends FHCAPI_Controller
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
@@ -85,10 +80,7 @@ class Cms extends FHCAPI_Controller
|
||||
$sprache = $this->input->get("sprache",TRUE);
|
||||
$sichtbar = $this->input->get("sichtbar",TRUE);
|
||||
|
||||
// cms admin preview renders a content without counting a view
|
||||
$preview = $this->input->get("preview",TRUE);
|
||||
|
||||
$content = $this->cmslib->getContent($content_id, $version, $sprache, $sichtbar, !$preview);
|
||||
$content = $this->cmslib->getContent($content_id, $version, $sprache, $sichtbar);
|
||||
$content = $this->getDataOrTerminateWithError($content);
|
||||
|
||||
$this->terminateWithSuccess($content);
|
||||
@@ -211,331 +203,5 @@ class Cms extends FHCAPI_Controller
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Lists the people assigned to an organisation unit.
|
||||
* Used by the CMS content component "oe-personen".
|
||||
*/
|
||||
public function getOePersonen()
|
||||
{
|
||||
// form validation
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('oe_kurzbz', 'Organisationseinheit', 'required');
|
||||
if ($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
|
||||
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
|
||||
|
||||
$oe_kurzbz = $this->input->get('oe_kurzbz', TRUE);
|
||||
$mitFoto = $this->input->get('foto', TRUE) ? true : false;
|
||||
|
||||
// tiefe 0 asks about the one unit. Deeper takes the sub units with it.
|
||||
$oeResult = $this->OrganisationseinheitModel->getMitUntereinheiten(
|
||||
$oe_kurzbz, $this->_tiefe()
|
||||
);
|
||||
$oeRows = $this->getDataOrTerminateWithError($oeResult) ?: array();
|
||||
|
||||
$uids = array();
|
||||
$funktionen = array();
|
||||
|
||||
foreach ($oeRows as $oe)
|
||||
{
|
||||
// 'oezuordnung' is the function that assigns an employee to an organisation
|
||||
// unit. The model already filters datum_von and datum_bis.
|
||||
$rows = $this->BenutzerfunktionModel->getBenutzerFunktionenDetailed(
|
||||
'oezuordnung', $oe->oe_kurzbz
|
||||
);
|
||||
$rows = $this->getDataOrTerminateWithError($rows) ?: array();
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
// The model returns the aktiv flag but does not filter on it.
|
||||
if (!$row->aktiv)
|
||||
continue;
|
||||
|
||||
// One person can hold the assignment in several units of the walk. The
|
||||
// first one wins, so the list keeps one block per person.
|
||||
if (isset($funktionen[$row->uid]))
|
||||
continue;
|
||||
|
||||
$uids[] = $row->uid;
|
||||
// tbl_benutzerfunktion.bezeichnung is the free label of one assignment,
|
||||
// for example "Bibliothekarin". tbl_funktion.beschreibung is the generic
|
||||
// name.
|
||||
$funktionen[$row->uid] = $row->bezeichnung ?: $row->beschreibung;
|
||||
}
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($this->_cmsPersonen($uids, $funktionen, $mitFoto));
|
||||
}
|
||||
|
||||
/**
|
||||
* Contact data of one person.
|
||||
* Used by the CMS content component "person-block".
|
||||
*/
|
||||
public function getPerson()
|
||||
{
|
||||
// form validation
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('uid', 'UID', 'required');
|
||||
if ($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$uid = $this->input->get('uid', TRUE);
|
||||
$mitFoto = $this->input->get('foto', TRUE) ? true : false;
|
||||
|
||||
// The function label comes from the marker, not from the database. The component
|
||||
// passes it through as a property.
|
||||
$personen = $this->_cmsPersonen(array($uid), array(), $mitFoto);
|
||||
|
||||
$this->terminateWithSuccess($personen ? current($personen) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists the published documents of one DMS category.
|
||||
* Used by the CMS content component "dms-liste".
|
||||
*/
|
||||
public function getDmsKategorie()
|
||||
{
|
||||
// form validation
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('kategorie_kurzbz', 'DMS-Kategorie', 'required');
|
||||
if ($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$kategorie_kurzbz = $this->input->get('kategorie_kurzbz', TRUE);
|
||||
|
||||
$erlaubt = $this->_dmsKategorieErlaubt($kategorie_kurzbz);
|
||||
|
||||
if ($erlaubt === null)
|
||||
$this->terminateWithError('DMS category not found', self::ERROR_TYPE_404);
|
||||
|
||||
// a missing entitlement answers with success and an empty list, not with
|
||||
// an error. The component sits inside a public content page. An error would raise a
|
||||
// toast for every reader who is simply not in the group.
|
||||
$dokumente = array();
|
||||
if ($erlaubt)
|
||||
{
|
||||
// tiefe 0 asks about the one category. Deeper takes the sub categories with it.
|
||||
$katResult = $this->DmsModel->getMitUnterkategorien(
|
||||
$kategorie_kurzbz, $this->_tiefe()
|
||||
);
|
||||
$kategorien = $this->getDataOrTerminateWithError($katResult) ?: array();
|
||||
|
||||
foreach ($kategorien as $kat)
|
||||
{
|
||||
// Every category carries its own group rule, so a sub category can be
|
||||
// closed while the parent is open. Ask for each one instead of letting the
|
||||
// entitlement of the root stand for the whole walk. The root is already
|
||||
// answered above.
|
||||
if ($kat->kategorie_kurzbz !== $kategorie_kurzbz
|
||||
&& $this->_dmsKategorieErlaubt($kat->kategorie_kurzbz) !== true)
|
||||
continue;
|
||||
|
||||
$rows = $this->DmsModel->getKategorieDokumente($kat->kategorie_kurzbz);
|
||||
$rows = $this->getDataOrTerminateWithError($rows) ?: array();
|
||||
|
||||
foreach ($rows as $row)
|
||||
$dokumente[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess(array(
|
||||
'zugriff' => $erlaubt,
|
||||
'dokumente' => $dokumente
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists named documents, in the order the caller asked for them.
|
||||
* Used by the CMS content component "dms-dokumente".
|
||||
*/
|
||||
public function getDmsDokumente()
|
||||
{
|
||||
// form validation
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('dms_ids', 'DMS-IDs', 'required');
|
||||
if ($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$this->load->model('content/Dms_model', 'DmsModel');
|
||||
|
||||
$ids = array();
|
||||
foreach (explode(',', $this->input->get('dms_ids', TRUE)) as $teil)
|
||||
{
|
||||
$teil = trim($teil);
|
||||
if (is_numeric($teil))
|
||||
$ids[] = (int) $teil;
|
||||
}
|
||||
|
||||
// An unbounded list would let one marker fetch the whole DMS.
|
||||
$ids = array_slice(array_unique($ids), 0, 50);
|
||||
|
||||
$dokumente = $this->DmsModel->getDokumenteByIds($ids);
|
||||
$dokumente = $this->getDataOrTerminateWithError($dokumente) ?: array();
|
||||
|
||||
// A hand picked list holds few categories, so deciding per category is cheap and
|
||||
// reuses the rule of getDmsKategorie().
|
||||
$erlaubte = array();
|
||||
$nachId = array();
|
||||
foreach ($dokumente as $dokument)
|
||||
{
|
||||
if (!array_key_exists($dokument->kategorie_kurzbz, $erlaubte))
|
||||
$erlaubte[$dokument->kategorie_kurzbz] = $this->_dmsKategorieErlaubt($dokument->kategorie_kurzbz);
|
||||
|
||||
if ($erlaubte[$dokument->kategorie_kurzbz] === true)
|
||||
$nachId[$dokument->dms_id] = $dokument;
|
||||
}
|
||||
|
||||
// The editor chose the order. Keep it.
|
||||
$sortiert = array();
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
if (isset($nachId[$id]))
|
||||
$sortiert[] = $nachId[$id];
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($sortiert);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists the child pages of a content, as a reader may see them.
|
||||
* Used by the CMS content component "contentchild-menu".
|
||||
*/
|
||||
public function getContentChilds()
|
||||
{
|
||||
// form validation
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural_no_zero');
|
||||
if ($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$this->load->model('content/Contentchild_model', 'ContentchildModel');
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
$sprache = $this->input->get('sprache', TRUE);
|
||||
if (!$sprache)
|
||||
$sprache = getUserLanguage();
|
||||
|
||||
$childs = $this->ContentchildModel->getChildsForReader($content_id, $sprache, getAuthUID());
|
||||
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($childs) ?: array());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Builds the shape both person content components render.
|
||||
*
|
||||
* The assembly follows Cis/Cms/News/Xml/Address/Detailed.php, so a person reads the
|
||||
* same in the news extras and on a content page.
|
||||
*
|
||||
* @param array $uids in the order the result should keep
|
||||
* @param array $funktionen uid => function label, may be empty
|
||||
* @param boolean $mitFoto
|
||||
* @return array
|
||||
*/
|
||||
private function _cmsPersonen($uids, $funktionen, $mitFoto)
|
||||
{
|
||||
if (empty($uids))
|
||||
return array();
|
||||
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
$kontakt = $this->PersonModel->getCmsKontakt($uids, $mitFoto);
|
||||
$kontakt = $this->getDataOrTerminateWithError($kontakt) ?: array();
|
||||
|
||||
$nachUid = array();
|
||||
foreach ($kontakt as $row)
|
||||
$nachUid[$row->uid] = $row;
|
||||
|
||||
$personen = array();
|
||||
|
||||
// Loops over $uids, not over the result, so the caller keeps its order.
|
||||
foreach ($uids as $uid)
|
||||
{
|
||||
if (!isset($nachUid[$uid]))
|
||||
continue;
|
||||
|
||||
$row = $nachUid[$uid];
|
||||
|
||||
$name = trim(implode(' ', array_filter(array(
|
||||
$row->titelpre, $row->vorname, $row->nachname, $row->titelpost
|
||||
))));
|
||||
|
||||
$telefon = '';
|
||||
if ($row->telefonklappe)
|
||||
$telefon = trim(($row->kontakt ?: '') . ' - ' . $row->telefonklappe);
|
||||
|
||||
$email = '';
|
||||
if (defined('DOMAIN'))
|
||||
$email = ($row->alias ?: $row->uid) . '@' . DOMAIN;
|
||||
|
||||
$personen[] = array(
|
||||
'uid' => $row->uid,
|
||||
'name' => $name,
|
||||
'funktion' => isset($funktionen[$uid]) ? $funktionen[$uid] : '',
|
||||
'telefon' => $telefon,
|
||||
'email' => $email,
|
||||
'ort' => $row->planbezeichnung,
|
||||
'foto' => $row->foto
|
||||
);
|
||||
}
|
||||
|
||||
return $personen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decides whether the current user may see a DMS category.
|
||||
*
|
||||
* Same rule as cms/dms.php: an unlocked category is open to everyone. A locked one
|
||||
* needs a granted group, or the category permission together with basis/dms.
|
||||
*
|
||||
* @param string $kategorie_kurzbz
|
||||
* @return boolean|null null when the category does not exist
|
||||
*/
|
||||
/**
|
||||
* Reads the tiefe parameter of a content component. 0 keeps the component to the unit
|
||||
* or category it names, which is what a marker without the attribute means.
|
||||
* Capped, because the depth drives a recursive walk and one query per level found.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function _tiefe()
|
||||
{
|
||||
$tiefe = (int) $this->input->get('tiefe', TRUE);
|
||||
|
||||
if ($tiefe < 0)
|
||||
return 0;
|
||||
|
||||
return min($tiefe, self::MAX_TIEFE);
|
||||
}
|
||||
|
||||
private function _dmsKategorieErlaubt($kategorie_kurzbz)
|
||||
{
|
||||
$this->load->library('PermissionLib');
|
||||
$this->load->model('content/Dms_model', 'DmsModel');
|
||||
|
||||
$zugriff = $this->DmsModel->getKategorieZugriff($kategorie_kurzbz, getAuthUID());
|
||||
$zugriff = $this->getDataOrTerminateWithError($zugriff);
|
||||
|
||||
if (empty($zugriff))
|
||||
return null;
|
||||
|
||||
$kategorie = current($zugriff);
|
||||
|
||||
if (!$kategorie->gesperrt || $kategorie->in_gruppe)
|
||||
return true;
|
||||
|
||||
$erlaubt = $this->permissionlib->isBerechtigt('basis/dms');
|
||||
|
||||
if ($erlaubt && $kategorie->berechtigung_kurzbz != '')
|
||||
$erlaubt = $this->permissionlib->isBerechtigt($kategorie->berechtigung_kurzbz);
|
||||
|
||||
return $erlaubt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,760 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class CmsAdmin extends FHCAPI_Controller
|
||||
{
|
||||
const MAX_TREE_DEPTH = 50;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct([
|
||||
'getTree' => ['basis/cms:r'],
|
||||
'getSubtree' => ['basis/cms:r'],
|
||||
'getContent' => ['basis/cms:r'],
|
||||
'getContentsprache' => ['basis/cms:r'],
|
||||
'getTemplates' => ['basis/cms:r'],
|
||||
'getOrganisationseinheiten' => ['basis/cms:r'],
|
||||
'getSprachen' => ['basis/cms:r'],
|
||||
'getDmsKategorien' => ['basis/cms:r'],
|
||||
'getMitarbeiter' => ['basis/cms:r'],
|
||||
'getDmsKategorieDokumente' => ['basis/cms:r'],
|
||||
'getUsage' => ['basis/cms:r'],
|
||||
'getTreeMeta' => ['basis/cms:r'],
|
||||
'getAncestors' => ['basis/cms:r'],
|
||||
'getClickCount' => ['basis/cms:r'],
|
||||
'getClickRanking' => ['basis/cms:r'],
|
||||
'postContent' => ['basis/cms:rw'],
|
||||
'postTranslation' => ['basis/cms:rw'],
|
||||
'postVersion' => ['basis/cms:rw'],
|
||||
'putProperties' => ['basis/cms:rw'],
|
||||
'deleteContent' => ['basis/cms:rw'],
|
||||
'deleteContentsprache' => ['basis/cms:rw']
|
||||
]);
|
||||
|
||||
$this->load->library('CmsAdminLib');
|
||||
$this->load->library('PermissionLib');
|
||||
$this->load->model('content/Content_model', 'ContentModel');
|
||||
$this->load->model('content/Contentsprache_model', 'ContentspracheModel');
|
||||
$this->load->model('content/Contentchild_model', 'ContentchildModel');
|
||||
$this->load->model('content/Contentgruppe_model', 'ContentgruppeModel');
|
||||
$this->load->model('content/Template_model', 'TemplateModel');
|
||||
|
||||
$this->loadPhrases(['global', 'cms']);
|
||||
}
|
||||
|
||||
public function getTree()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('menu', 'Menu', 'required|in_list[content,news]');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$menu = $this->input->get('menu', TRUE);
|
||||
$filter = $this->input->get('filter', TRUE);
|
||||
|
||||
$entitledResult = $this->cmsadminlib->getEntitledOe();
|
||||
$entitledOe = isError($entitledResult) ? [] : getData($entitledResult) ?? [];
|
||||
|
||||
$nodes = [];
|
||||
|
||||
if ($menu === 'news')
|
||||
{
|
||||
$newsResult = $this->ContentModel->getNewsContent();
|
||||
if (!isError($newsResult) && getData($newsResult))
|
||||
{
|
||||
foreach (getData($newsResult) as $row)
|
||||
{
|
||||
$titel = '';
|
||||
$csResult = $this->ContentspracheModel->getOne(
|
||||
(int) $row->content_id, DEFAULT_LANGUAGE
|
||||
);
|
||||
if (!isError($csResult))
|
||||
$titel = getData($csResult)->titel;
|
||||
|
||||
$node = new stdClass();
|
||||
$node->content_id = (int) $row->content_id;
|
||||
$node->titel = mb_substr($titel, 0, 15) . ' '
|
||||
. date('d.m.Y', strtotime($row->insertamum));
|
||||
$node->template_kurzbz = $row->template_kurzbz;
|
||||
$node->oe_kurzbz = $row->oe_kurzbz;
|
||||
$node->aktiv = ($row->aktiv === 't' || $row->aktiv === true);
|
||||
$node->entitled = false;
|
||||
$node->groups = [];
|
||||
$node->children = [];
|
||||
$nodes[] = $node;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($filter))
|
||||
{
|
||||
$clean = str_replace(['!', '.', '?', ','], '', $filter);
|
||||
$searchItems = preg_split('/\s+/', $clean, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$rootsResult = $this->ContentModel->searchCms($searchItems);
|
||||
}
|
||||
else
|
||||
{
|
||||
$rootsResult = $this->ContentModel->getRootContent();
|
||||
}
|
||||
|
||||
if (!isError($rootsResult) && getData($rootsResult))
|
||||
{
|
||||
$visited = [];
|
||||
foreach (getData($rootsResult) as $row)
|
||||
{
|
||||
$node = $this->buildTreeNode(
|
||||
(int) $row->content_id, 0, $visited
|
||||
);
|
||||
if ($node !== null)
|
||||
$nodes[] = $node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$allIds = [];
|
||||
$this->collectContentIds($nodes, $allIds);
|
||||
|
||||
$groupMap = [];
|
||||
if (!empty($allIds))
|
||||
{
|
||||
$gResult = $this->ContentgruppeModel->getGruppenForContents($allIds);
|
||||
if (!isError($gResult))
|
||||
$groupMap = getData($gResult);
|
||||
}
|
||||
|
||||
$this->applyMeta($nodes, $entitledOe, $groupMap);
|
||||
|
||||
$result = [];
|
||||
foreach ($nodes as $node)
|
||||
{
|
||||
$pruned = $this->pruneUnentitled($node);
|
||||
if ($pruned !== null)
|
||||
$result[] = $pruned;
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($result);
|
||||
}
|
||||
|
||||
// One subtree in the shape of a getTree root node. Lets the client replace a branch
|
||||
// instead of rebuilding the whole tree after a change.
|
||||
// The visited map starts empty here, so a node with several parents can show up twice
|
||||
// until the next full reload. Rebuilding the whole tree on every change costs more.
|
||||
public function getSubtree()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = (int) $this->input->get('content_id', TRUE);
|
||||
|
||||
$entitledResult = $this->cmsadminlib->getEntitledOe();
|
||||
$entitledOe = isError($entitledResult) ? [] : getData($entitledResult);
|
||||
|
||||
$visited = [];
|
||||
$node = $this->buildTreeNode($content_id, 0, $visited);
|
||||
|
||||
// Deleted meanwhile. The client drops the branch.
|
||||
if ($node === null)
|
||||
$this->terminateWithSuccess(null);
|
||||
|
||||
$nodes = [$node];
|
||||
|
||||
$allIds = [];
|
||||
$this->collectContentIds($nodes, $allIds);
|
||||
|
||||
$groupMap = [];
|
||||
if (!empty($allIds))
|
||||
{
|
||||
$gResult = $this->ContentgruppeModel->getGruppenForContents($allIds);
|
||||
if (!isError($gResult))
|
||||
$groupMap = getData($gResult);
|
||||
}
|
||||
|
||||
$this->applyMeta($nodes, $entitledOe, $groupMap);
|
||||
|
||||
$this->terminateWithSuccess($this->pruneUnentitled($node));
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
|
||||
$entitledResult = $this->cmsadminlib->isEntitledForContent($content_id);
|
||||
$entitled = $this->getDataOrTerminateWithError($entitledResult);
|
||||
|
||||
if (!$entitled)
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigungFuerDiesenEintrag'));
|
||||
|
||||
$this->ContentModel->resetQuery();
|
||||
$contentResult = $this->ContentModel->load($content_id);
|
||||
$contentData = $this->getDataOrTerminateWithError($contentResult);
|
||||
if (empty($contentData))
|
||||
$this->terminateWithError($this->p->t('cms', 'contentNichtGefunden'));
|
||||
$content = $contentData[0];
|
||||
|
||||
$langResult = $this->ContentspracheModel->getLanguages($content_id);
|
||||
$languages = $this->getDataOrTerminateWithError($langResult);
|
||||
|
||||
$versions = new stdClass();
|
||||
foreach ($languages as $sprache)
|
||||
{
|
||||
$vResult = $this->ContentspracheModel->getVersions($content_id, $sprache);
|
||||
if (!isError($vResult) && getData($vResult))
|
||||
{
|
||||
$versions->$sprache = array_map(function ($v) {
|
||||
return (int) $v->version;
|
||||
}, getData($vResult));
|
||||
}
|
||||
}
|
||||
|
||||
$result = new stdClass();
|
||||
$result->content_id = (int) $content->content_id;
|
||||
$result->template_kurzbz = $content->template_kurzbz;
|
||||
$result->oe_kurzbz = $content->oe_kurzbz;
|
||||
$result->aktiv = ($content->aktiv === 't' || $content->aktiv === true);
|
||||
$result->menu_open = ($content->menu_open === 't' || $content->menu_open === true);
|
||||
$result->beschreibung = $content->beschreibung ?: '';
|
||||
$result->entitled = true;
|
||||
$result->languages = $languages;
|
||||
$result->versions = $versions;
|
||||
|
||||
// Tells the CIS4 preview whether this template renders there at all.
|
||||
$cis4Result = $this->TemplateModel->hasCis4Stylesheet($content->template_kurzbz);
|
||||
$result->has_cis4_stylesheet = !isError($cis4Result) && getData($cis4Result);
|
||||
|
||||
$this->terminateWithSuccess($result);
|
||||
}
|
||||
|
||||
public function getContentsprache()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('sprache', 'Sprache', 'required');
|
||||
$this->form_validation->set_rules('version', 'Version', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
$sprache = $this->input->get('sprache', TRUE);
|
||||
$version = $this->input->get('version', TRUE);
|
||||
|
||||
$result = $this->ContentspracheModel->getOne($content_id, $sprache, $version);
|
||||
if (isError($result))
|
||||
$this->terminateWithError($this->p->t('cms', 'versionNichtGefunden'));
|
||||
|
||||
$data = getData($result);
|
||||
$data->sichtbar = ($data->sichtbar === 't' || $data->sichtbar === true);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
// The tree lists a search hit out of its place, so a generic title carries no context.
|
||||
// This answers where each one sits. One walk for the whole list, not one per node.
|
||||
const MAX_ANCESTOR_TIEFE = 12;
|
||||
|
||||
/**
|
||||
* Ancestors of the given contents, keyed by content_id and ordered from the top down.
|
||||
*/
|
||||
public function getAncestors()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_ids', 'Content IDs', 'required');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$ids = [];
|
||||
foreach (explode(',', $this->input->get('content_ids', TRUE)) as $teil)
|
||||
{
|
||||
$teil = trim($teil);
|
||||
if (is_numeric($teil))
|
||||
$ids[] = (int) $teil;
|
||||
}
|
||||
$ids = array_values(array_unique($ids));
|
||||
|
||||
if (empty($ids))
|
||||
$this->terminateWithSuccess(new stdClass());
|
||||
|
||||
$result = $this->ContentchildModel->getAncestors(
|
||||
$ids, self::MAX_ANCESTOR_TIEFE, DEFAULT_LANGUAGE
|
||||
);
|
||||
$rows = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
// Same rule as the tree: an entry of an organisational unit the editor is not
|
||||
// entitled for stays readable but cannot be opened.
|
||||
$entitledResult = $this->cmsadminlib->getEntitledOe();
|
||||
$entitledOe = isError($entitledResult) ? [] : getData($entitledResult) ?? [];
|
||||
|
||||
// The query orders by the distance, farthest first, so appending keeps the path
|
||||
// reading from the top down.
|
||||
$pfade = [];
|
||||
foreach ((array) $rows as $row)
|
||||
{
|
||||
$start = (int) $row->start_id;
|
||||
|
||||
if (!isset($pfade[$start]))
|
||||
$pfade[$start] = [];
|
||||
|
||||
$pfade[$start][] = [
|
||||
'content_id' => (int) $row->content_id,
|
||||
'titel' => $row->titel,
|
||||
'tiefe' => (int) $row->tiefe,
|
||||
'entitled' => in_array($row->oe_kurzbz, $entitledOe)
|
||||
];
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($pfade ?: new stdClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Per content metadata for the tree filter, keyed by content_id.
|
||||
* One query for the whole tree, so the client filters and sorts without a round trip.
|
||||
*/
|
||||
public function getTreeMeta()
|
||||
{
|
||||
$result = $this->ContentModel->getTreeMeta(getAuthUID(), DEFAULT_LANGUAGE);
|
||||
$rows = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$meta = [];
|
||||
foreach ((array) $rows as $row)
|
||||
{
|
||||
$meta[(int) $row->content_id] = [
|
||||
'childcount' => (int) $row->childcount,
|
||||
'insertamum' => $row->insertamum,
|
||||
'updateamum' => $row->updateamum,
|
||||
'mine' => ($row->mine === 't' || $row->mine === true),
|
||||
'contentlength' => (int) $row->contentlength
|
||||
];
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($meta);
|
||||
}
|
||||
|
||||
/**
|
||||
* Two gates guard every click statistics request: the config flag switches the feature
|
||||
* off for everybody, the admin right decides who may read the numbers.
|
||||
*/
|
||||
private function checkClickstatsAccess()
|
||||
{
|
||||
$this->config->load('cms');
|
||||
|
||||
if (!$this->config->item('clickstats_enabled'))
|
||||
$this->terminateWithError($this->p->t('cms', 'klickstatistikDeaktiviert'));
|
||||
|
||||
if (!$this->permissionlib->isBerechtigt('admin'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Period of a click statistics request. 0 counts the whole log.
|
||||
* Call it after checkClickstatsAccess, which loads the config.
|
||||
* @return array months and the start date, null for the whole log
|
||||
*/
|
||||
private function clickstatsPeriod()
|
||||
{
|
||||
$months = $this->input->get('months');
|
||||
if ($months === null || $months === '')
|
||||
$months = $this->config->item('clickstats_months');
|
||||
$months = (int) $months;
|
||||
|
||||
$since = ($months > 0)
|
||||
? date('Y-m-d H:i:s', strtotime('-' . $months . ' months'))
|
||||
: null;
|
||||
|
||||
return [$months, $since];
|
||||
}
|
||||
|
||||
/**
|
||||
* Views of one content. One counting query, so the tab loads it right away.
|
||||
* Empty if LOG_CONTENT is off.
|
||||
*/
|
||||
public function getClickCount()
|
||||
{
|
||||
$this->checkClickstatsAccess();
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('months', 'Monate', 'is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$this->load->model('system/Webservicelog_model', 'WebservicelogModel');
|
||||
|
||||
list($months, $since) = $this->clickstatsPeriod();
|
||||
|
||||
$result = $this->WebservicelogModel->getContentClickCount(
|
||||
(int) $this->input->get('content_id', TRUE), $since
|
||||
);
|
||||
|
||||
$this->terminateWithSuccess([
|
||||
'since' => $since,
|
||||
'months' => $months,
|
||||
'own' => $this->getDataOrTerminateWithError($result)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The ranking of the most viewed contents. It groups the whole log and resolves a
|
||||
* title per row, which takes seconds, so the tab fetches it only on request.
|
||||
* Empty if LOG_CONTENT is off.
|
||||
*/
|
||||
public function getClickRanking()
|
||||
{
|
||||
$this->checkClickstatsAccess();
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('months', 'Monate', 'is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$this->load->model('system/Webservicelog_model', 'WebservicelogModel');
|
||||
|
||||
list($months, $since) = $this->clickstatsPeriod();
|
||||
|
||||
$sprache = $this->input->get('sprache', TRUE);
|
||||
if (empty($sprache))
|
||||
$sprache = DEFAULT_LANGUAGE;
|
||||
|
||||
$result = $this->WebservicelogModel->getContentClickCounts(
|
||||
$since, $sprache, (int) $this->config->item('clickstats_limit')
|
||||
);
|
||||
$rows = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$ranked = [];
|
||||
foreach ((array) $rows as $row)
|
||||
{
|
||||
$ranked[] = [
|
||||
'content_id' => (int) $row->content_id,
|
||||
'titel' => $row->titel,
|
||||
'hits' => (int) $row->hits
|
||||
];
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess([
|
||||
'since' => $since,
|
||||
'months' => $months,
|
||||
'ranked' => $ranked
|
||||
]);
|
||||
}
|
||||
|
||||
public function getTemplates()
|
||||
{
|
||||
$this->TemplateModel->addSelect('template_kurzbz, bezeichnung');
|
||||
$this->TemplateModel->addOrder('bezeichnung');
|
||||
$result = $this->TemplateModel->loadWhere([]);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function getOrganisationseinheiten()
|
||||
{
|
||||
$this->load->model(
|
||||
'organisation/Organisationseinheit_model', 'OrganisationseinheitModel'
|
||||
);
|
||||
$this->OrganisationseinheitModel->addSelect(
|
||||
'oe_kurzbz, bezeichnung, organisationseinheittyp_kurzbz, aktiv'
|
||||
);
|
||||
$this->OrganisationseinheitModel->addOrder('bezeichnung');
|
||||
$result = $this->OrganisationseinheitModel->loadWhere([]);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function getSprachen()
|
||||
{
|
||||
$this->load->model('system/Sprache_model', 'SpracheModel');
|
||||
$this->SpracheModel->addSelect('sprache, bezeichnung');
|
||||
|
||||
$result = $this->SpracheModel->loadWhere(['content' => true]);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function getUsage()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
$result = $this->ContentModel->getUsage($content_id);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function postContent()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'i'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('parent_content_id', 'Parent', 'is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$parent = $this->input->post('parent_content_id');
|
||||
if (empty($parent))
|
||||
$parent = null;
|
||||
|
||||
$result = $this->cmsadminlib->createContent($parent);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function postTranslation()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'i'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('sprache', 'Sprache', 'required');
|
||||
$this->form_validation->set_rules('version', 'Version', 'required|is_natural');
|
||||
$this->form_validation->set_rules('target_sprache', 'Target Sprache', 'required');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$result = $this->cmsadminlib->createTranslation(
|
||||
$this->input->post('content_id'),
|
||||
$this->input->post('sprache'),
|
||||
$this->input->post('version'),
|
||||
$this->input->post('target_sprache')
|
||||
);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function postVersion()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'i'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('sprache', 'Sprache', 'required');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$result = $this->cmsadminlib->createVersion(
|
||||
$this->input->post('content_id'),
|
||||
$this->input->post('sprache')
|
||||
);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function putProperties()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'u'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('sprache', 'Sprache', 'required');
|
||||
$this->form_validation->set_rules('version', 'Version', 'required|is_natural');
|
||||
$this->form_validation->set_rules('template_kurzbz', 'Template', 'required');
|
||||
$this->form_validation->set_rules('oe_kurzbz', 'OE', 'required');
|
||||
$this->form_validation->set_rules('titel', 'Titel', 'required|max_length[256]');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$daten = [
|
||||
'content_id' => $this->input->post('content_id'),
|
||||
'sprache' => $this->input->post('sprache'),
|
||||
'version' => $this->input->post('version'),
|
||||
'template_kurzbz' => $this->input->post('template_kurzbz'),
|
||||
'oe_kurzbz' => $this->input->post('oe_kurzbz'),
|
||||
'titel' => $this->input->post('titel'),
|
||||
'beschreibung' => $this->input->post('beschreibung') ?: '',
|
||||
'aktiv' => filter_var($this->input->post('aktiv'), FILTER_VALIDATE_BOOLEAN),
|
||||
'menu_open' => filter_var($this->input->post('menu_open'), FILTER_VALIDATE_BOOLEAN),
|
||||
'sichtbar' => filter_var($this->input->post('sichtbar'), FILTER_VALIDATE_BOOLEAN)
|
||||
];
|
||||
|
||||
$result = $this->cmsadminlib->saveProperties($daten);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function deleteContent()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'd'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$result = $this->cmsadminlib->deleteContent($this->input->post('content_id'));
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function deleteContentsprache()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'd'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->validateContentSpracheVersion();
|
||||
|
||||
$result = $this->cmsadminlib->deleteVersion(
|
||||
$this->input->post('content_id'),
|
||||
$this->input->post('sprache'),
|
||||
$this->input->post('version')
|
||||
);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
// --- Private helpers ---
|
||||
|
||||
private function validateContentSpracheVersion()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('sprache', 'Sprache', 'required');
|
||||
$this->form_validation->set_rules('version', 'Version', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
}
|
||||
|
||||
private function buildTreeNode($content_id, $depth, &$visited)
|
||||
{
|
||||
if ($depth > self::MAX_TREE_DEPTH || isset($visited[$content_id]))
|
||||
return null;
|
||||
|
||||
$visited[$content_id] = true;
|
||||
|
||||
$this->ContentModel->resetQuery();
|
||||
$contentResult = $this->ContentModel->load($content_id);
|
||||
if (isError($contentResult) || empty(getData($contentResult)))
|
||||
return null;
|
||||
$content = getData($contentResult)[0];
|
||||
|
||||
$titel = '';
|
||||
$csResult = $this->ContentspracheModel->getOne($content_id, DEFAULT_LANGUAGE);
|
||||
if (!isError($csResult))
|
||||
$titel = getData($csResult)->titel;
|
||||
|
||||
$childrenResult = $this->ContentchildModel->getChilds($content_id, DEFAULT_LANGUAGE);
|
||||
$children = [];
|
||||
if (!isError($childrenResult) && getData($childrenResult))
|
||||
{
|
||||
foreach (getData($childrenResult) as $child)
|
||||
{
|
||||
$childNode = $this->buildTreeNode(
|
||||
(int) $child->child_content_id, $depth + 1, $visited
|
||||
);
|
||||
if ($childNode !== null)
|
||||
$children[] = $childNode;
|
||||
}
|
||||
}
|
||||
|
||||
$node = new stdClass();
|
||||
$node->content_id = (int) $content_id;
|
||||
$node->titel = $titel;
|
||||
$node->template_kurzbz = $content->template_kurzbz;
|
||||
$node->oe_kurzbz = $content->oe_kurzbz;
|
||||
$node->aktiv = ($content->aktiv === 't' || $content->aktiv === true);
|
||||
$node->entitled = false;
|
||||
$node->groups = [];
|
||||
$node->children = $children;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
private function collectContentIds($nodes, &$ids)
|
||||
{
|
||||
foreach ($nodes as $node)
|
||||
{
|
||||
$ids[] = $node->content_id;
|
||||
if (!empty($node->children))
|
||||
$this->collectContentIds($node->children, $ids);
|
||||
}
|
||||
}
|
||||
|
||||
private function applyMeta(&$nodes, $entitledOe, $groupMap)
|
||||
{
|
||||
foreach ($nodes as $node)
|
||||
{
|
||||
$node->entitled = in_array($node->oe_kurzbz, $entitledOe);
|
||||
$node->groups = isset($groupMap[$node->content_id])
|
||||
? $groupMap[$node->content_id]
|
||||
: [];
|
||||
if (!empty($node->children))
|
||||
$this->applyMeta($node->children, $entitledOe, $groupMap);
|
||||
}
|
||||
}
|
||||
|
||||
private function pruneUnentitled($node)
|
||||
{
|
||||
$kept = [];
|
||||
foreach ($node->children as $child)
|
||||
{
|
||||
$pruned = $this->pruneUnentitled($child);
|
||||
if ($pruned !== null)
|
||||
$kept[] = $pruned;
|
||||
}
|
||||
$node->children = $kept;
|
||||
|
||||
if ($node->entitled || !empty($node->children))
|
||||
return $node;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists the DMS categories for the contentcomponent insert dialog.
|
||||
*/
|
||||
public function getDmsKategorien()
|
||||
{
|
||||
$this->load->model('content/Dms_model', 'DmsModel');
|
||||
|
||||
$result = $this->DmsModel->getKategorien();
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lists active staff for the contentcomponent insert dialog.
|
||||
* Names only. See Mitarbeiter_model::getAktivesPersonalNamen().
|
||||
*/
|
||||
public function getMitarbeiter()
|
||||
{
|
||||
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||
|
||||
$result = $this->MitarbeiterModel->getAktivesPersonalNamen();
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lists the documents of one DMS category for the contentcomponent insert dialog.
|
||||
*/
|
||||
public function getDmsKategorieDokumente()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('kategorie_kurzbz', 'DMS-Kategorie', 'required');
|
||||
if ($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$this->load->model('content/Dms_model', 'DmsModel');
|
||||
|
||||
$result = $this->DmsModel->getKategorieDokumenteAlle($this->input->get('kategorie_kurzbz', TRUE));
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result) ?: array());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class CmsAdminInhalt extends FHCAPI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct([
|
||||
'getFormSchema' => ['basis/cms:r'],
|
||||
'getFormData' => ['basis/cms:r'],
|
||||
'getLock' => ['basis/cms:r'],
|
||||
'getVersions' => ['basis/cms:r'],
|
||||
'putFormData' => ['basis/cms:rw'],
|
||||
'postLock' => ['basis/cms:rw'],
|
||||
'deleteLock' => ['basis/cms:rw'],
|
||||
'deleteLockForced' => ['basis/cms:rw']
|
||||
]);
|
||||
|
||||
$this->load->library('CmsAdminLib');
|
||||
$this->load->library('XsdSchemaLib');
|
||||
$this->load->library('PermissionLib');
|
||||
$this->load->model('content/Contentsprache_model', 'ContentspracheModel');
|
||||
$this->load->model('content/Template_model', 'TemplateModel');
|
||||
|
||||
$this->loadPhrases(['global', 'cms']);
|
||||
}
|
||||
|
||||
public function getFormSchema()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('template_kurzbz', 'Template', 'required');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$template_kurzbz = $this->input->get('template_kurzbz', TRUE);
|
||||
|
||||
$this->TemplateModel->resetQuery();
|
||||
$templateResult = $this->TemplateModel->load($template_kurzbz);
|
||||
$templateData = $this->getDataOrTerminateWithError($templateResult);
|
||||
if (empty($templateData))
|
||||
$this->terminateWithError($this->p->t('cms', 'vorlageNichtGefunden'));
|
||||
|
||||
$schemaResult = $this->xsdschemalib->parseSchema(
|
||||
$templateData[0]->xsd, $template_kurzbz
|
||||
);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($schemaResult));
|
||||
}
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('sprache', 'Sprache', 'required');
|
||||
$this->form_validation->set_rules('version', 'Version', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
$sprache = $this->input->get('sprache', TRUE);
|
||||
$version = $this->input->get('version', TRUE);
|
||||
|
||||
$versionResult = $this->ContentspracheModel->getOne($content_id, $sprache, $version);
|
||||
$row = $this->getDataOrTerminateWithError($versionResult);
|
||||
|
||||
$this->load->model('content/Content_model', 'ContentModel');
|
||||
$this->ContentModel->resetQuery();
|
||||
$contentResult = $this->ContentModel->load($content_id);
|
||||
$contentData = $this->getDataOrTerminateWithError($contentResult);
|
||||
if (empty($contentData))
|
||||
$this->terminateWithError($this->p->t('cms', 'contentNichtGefunden'));
|
||||
|
||||
$this->TemplateModel->resetQuery();
|
||||
$templateResult = $this->TemplateModel->load($contentData[0]->template_kurzbz);
|
||||
$templateData = $this->getDataOrTerminateWithError($templateResult);
|
||||
if (empty($templateData))
|
||||
$this->terminateWithError($this->p->t('cms', 'vorlageNichtGefunden'));
|
||||
|
||||
$schemaResult = $this->xsdschemalib->parseSchema(
|
||||
$templateData[0]->xsd, $contentData[0]->template_kurzbz
|
||||
);
|
||||
$schema = $this->getDataOrTerminateWithError($schemaResult);
|
||||
|
||||
$valuesResult = $this->xsdschemalib->extractValues($row->content, $schema);
|
||||
$values = $this->getDataOrTerminateWithError($valuesResult);
|
||||
|
||||
$lockResult = $this->cmsadminlib->getLockState($content_id, $sprache, $version);
|
||||
$lock = $this->getDataOrTerminateWithError($lockResult);
|
||||
|
||||
$this->terminateWithSuccess([
|
||||
'schema' => $schema,
|
||||
'values' => $values,
|
||||
'sperre' => $lock
|
||||
]);
|
||||
}
|
||||
|
||||
public function getLock()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('sprache', 'Sprache', 'required');
|
||||
$this->form_validation->set_rules('version', 'Version', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
$sprache = $this->input->get('sprache', TRUE);
|
||||
$version = $this->input->get('version', TRUE);
|
||||
|
||||
$result = $this->cmsadminlib->getLockState($content_id, $sprache, $version);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function getVersions()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('sprache', 'Sprache', 'required');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
$sprache = $this->input->get('sprache', TRUE);
|
||||
|
||||
$result = $this->ContentspracheModel->getVersions($content_id, $sprache);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function putFormData()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('sprache', 'Sprache', 'required');
|
||||
$this->form_validation->set_rules('version', 'Version', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->post('content_id');
|
||||
$sprache = $this->input->post('sprache');
|
||||
$version = $this->input->post('version');
|
||||
$values = $this->input->post('values');
|
||||
|
||||
if (is_string($values))
|
||||
$values = json_decode($values, true);
|
||||
|
||||
if (!is_array($values))
|
||||
$values = [];
|
||||
|
||||
$lockResult = $this->cmsadminlib->getLockState($content_id, $sprache, $version);
|
||||
$lock = $this->getDataOrTerminateWithError($lockResult);
|
||||
if (!$lock['own'])
|
||||
$this->terminateWithError($this->p->t('cms', 'speichernNurMitSperre'));
|
||||
|
||||
$result = $this->cmsadminlib->saveContentXml($content_id, $sprache, $version, $values);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function postLock()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'u'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigungFuerDieseAktion'));
|
||||
|
||||
$contentsprache_id = $this->input->post('contentsprache_id');
|
||||
|
||||
$result = $this->cmsadminlib->lock($contentsprache_id);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function deleteLock()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'u'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigungFuerDieseAktion'));
|
||||
|
||||
$contentsprache_id = $this->input->post('contentsprache_id');
|
||||
|
||||
$result = $this->cmsadminlib->releaseOwnLock($contentsprache_id);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function deleteLockForced()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms_sperrfreigabe', 'su'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigungFuerDieseAktion'));
|
||||
|
||||
$contentsprache_id = $this->input->post('contentsprache_id');
|
||||
|
||||
$result = $this->cmsadminlib->forceRelease($contentsprache_id);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
}
|
||||
@@ -1,265 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class CmsAdminStruktur extends FHCAPI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct([
|
||||
'getGruppen' => ['basis/cms:r'],
|
||||
'getAllGruppen' => ['basis/cms:r'],
|
||||
'getChilds' => ['basis/cms:r'],
|
||||
'getParents' => ['basis/cms:r'],
|
||||
'getPossibleChilds' => ['basis/cms:r'],
|
||||
'postGruppe' => ['basis/cms:rw'],
|
||||
'deleteGruppe' => ['basis/cms:rw'],
|
||||
'postChild' => ['basis/cms:rw'],
|
||||
'deleteChild' => ['basis/cms:rw'],
|
||||
'putChildSort' => ['basis/cms:rw'],
|
||||
'putChildOrder' => ['basis/cms:rw']
|
||||
]);
|
||||
|
||||
$this->load->library('PermissionLib');
|
||||
$this->load->model('content/Content_model', 'ContentModel');
|
||||
$this->load->model('content/Contentchild_model', 'ContentchildModel');
|
||||
$this->load->model('content/Contentgruppe_model', 'ContentgruppeModel');
|
||||
|
||||
$this->loadPhrases(['global', 'cms']);
|
||||
}
|
||||
|
||||
public function getGruppen()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
|
||||
$result = $this->ContentgruppeModel->getGruppen($content_id);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function getAllGruppen()
|
||||
{
|
||||
$result = $this->ContentgruppeModel->getAllGruppen();
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function getChilds()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
$sprache = $this->input->get('sprache', TRUE);
|
||||
|
||||
if (empty($sprache))
|
||||
$sprache = DEFAULT_LANGUAGE;
|
||||
|
||||
$result = $this->ContentchildModel->getChilds($content_id, $sprache);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function getParents()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
$sprache = $this->input->get('sprache', TRUE);
|
||||
|
||||
if (empty($sprache))
|
||||
$sprache = DEFAULT_LANGUAGE;
|
||||
|
||||
$result = $this->ContentchildModel->getParents($content_id, $sprache);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function getPossibleChilds()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_GET);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->get('content_id', TRUE);
|
||||
$sprache = $this->input->get('sprache', TRUE);
|
||||
|
||||
if (empty($sprache))
|
||||
$sprache = DEFAULT_LANGUAGE;
|
||||
|
||||
$result = $this->ContentModel->getPossibleChilds($content_id, $sprache);
|
||||
$this->terminateWithSuccess($this->getDataOrTerminateWithError($result));
|
||||
}
|
||||
|
||||
public function postGruppe()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'u'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('gruppe_kurzbz', 'Gruppe', 'required');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$result = $this->ContentgruppeModel->insert([
|
||||
'content_id' => $this->input->post('content_id'),
|
||||
'gruppe_kurzbz' => $this->input->post('gruppe_kurzbz'),
|
||||
'insertamum' => date('Y-m-d H:i:s'),
|
||||
'insertvon' => getAuthUID()
|
||||
]);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
$this->terminateWithError($this->p->t('cms', 'gruppeBereitsZugeordnet'));
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess(true);
|
||||
}
|
||||
|
||||
public function deleteGruppe()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'u'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('gruppe_kurzbz', 'Gruppe', 'required');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$result = $this->ContentgruppeModel->delete([
|
||||
$this->input->post('gruppe_kurzbz'),
|
||||
$this->input->post('content_id')
|
||||
]);
|
||||
$this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess(true);
|
||||
}
|
||||
|
||||
public function postChild()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'u'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('child_content_id', 'Child Content ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$content_id = $this->input->post('content_id');
|
||||
|
||||
$sortResult = $this->ContentchildModel->getMaxSort($content_id);
|
||||
$sort = $this->getDataOrTerminateWithError($sortResult) + 1;
|
||||
|
||||
$result = $this->ContentchildModel->insert([
|
||||
'content_id' => $content_id,
|
||||
'child_content_id' => $this->input->post('child_content_id'),
|
||||
'sort' => $sort,
|
||||
'insertamum' => date('Y-m-d H:i:s'),
|
||||
'insertvon' => getAuthUID()
|
||||
]);
|
||||
$this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess(true);
|
||||
}
|
||||
|
||||
public function deleteChild()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'u'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('contentchild_id', 'Contentchild ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$result = $this->ContentchildModel->delete($this->input->post('contentchild_id'));
|
||||
$this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess(true);
|
||||
}
|
||||
|
||||
public function putChildSort()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'u'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('contentchild_id', 'Contentchild ID', 'required|is_natural');
|
||||
$this->form_validation->set_rules('direction', 'Direction', 'required|in_list[up,down]');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$direction = $this->input->post('direction');
|
||||
|
||||
$result = $this->ContentchildModel->swapSort(
|
||||
$this->input->post('contentchild_id'),
|
||||
$direction
|
||||
);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
// The child already sits at the end it was moved towards. That is a normal
|
||||
// answer, not a failure, and the direction decides the wording.
|
||||
if (getError($result) === Contentchild_model::NO_NEIGHBOUR)
|
||||
{
|
||||
$this->terminateWithError($this->p->t('cms',
|
||||
$direction === 'up' ? 'bereitsGanzOben' : 'bereitsGanzUnten'));
|
||||
}
|
||||
|
||||
$this->terminateWithError($this->p->t('cms', 'sortierungFehlgeschlagen'));
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess(true);
|
||||
}
|
||||
|
||||
// Writes the whole order at once. The drag and drop moves a child over any distance,
|
||||
// and putChildSort would need one request per position.
|
||||
public function putChildOrder()
|
||||
{
|
||||
if (!$this->permissionlib->isBerechtigt('basis/cms', 'u'))
|
||||
$this->terminateWithError($this->p->t('cms', 'keineBerechtigung'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_data($_POST);
|
||||
$this->form_validation->set_rules('content_id', 'Content ID', 'required|is_natural');
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$ids = $this->input->post('contentchild_ids');
|
||||
|
||||
if (is_string($ids))
|
||||
$ids = json_decode($ids, true);
|
||||
|
||||
if (!is_array($ids) || empty($ids))
|
||||
$this->terminateWithError($this->p->t('cms', 'sortierungFehlgeschlagen'));
|
||||
|
||||
$result = $this->ContentchildModel->setSortOrder(
|
||||
$this->input->post('content_id'),
|
||||
$ids
|
||||
);
|
||||
|
||||
if (isError($result))
|
||||
$this->terminateWithError($this->p->t('cms', 'sortierungFehlgeschlagen'));
|
||||
|
||||
$this->terminateWithSuccess(true);
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ class Lehrveranstaltung extends FHCAPI_Controller
|
||||
{
|
||||
$studiengang_kz = $this->getStudiengangKz($stg_kz);
|
||||
|
||||
if (is_null($studiengang_kz) || !preg_match("/^(-?[1-9][0-9]*|0)$/", (string)$studiengang_kz))
|
||||
if (is_null($studiengang_kz) || !preg_match("/^-?[1-9][0-9]*$/", (string)$studiengang_kz))
|
||||
$this->terminateWithError($this->p->t('ui', 'ungueltigeParameter'), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$verband = null;
|
||||
|
||||
@@ -114,7 +114,6 @@ class LvPlan extends FHCAPI_Controller
|
||||
|
||||
// fetching lvplan events
|
||||
$result = $this->stundenplanlib->getEventsUser($start_date, $end_date, $uid);
|
||||
|
||||
$lvplanEvents = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
// fetching moodle events
|
||||
|
||||
@@ -167,9 +167,7 @@ class Studium extends FHCAPI_Controller
|
||||
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){
|
||||
foreach($lehrv->lehrveranstaltungen as $lv){
|
||||
$lvLektoren =$this->computeLektorenFromLehrveranstaltung($lv->lehrveranstaltung_id,$aktuelles_semester, $aktuelles_studiengang->studiengang_kz, $aktuelles_studiensemester->studiensemester_kurzbz);
|
||||
$lv->lektoren = $lvLektoren;
|
||||
}
|
||||
@@ -288,7 +286,6 @@ SELECT tbl_lehrveranstaltung.*,
|
||||
$lehrveranstaltungen = $this->LehrveranstaltungModel->execReadOnlyQuery($query,[$studienplan_id, $semester]);
|
||||
|
||||
$lehrveranstaltungen = $this->getDataOrTerminateWithError($lehrveranstaltungen);
|
||||
|
||||
usort($lehrveranstaltungen, function($a, $b){
|
||||
if($a->lehrtyp_kurzbz == "modul"){
|
||||
return -1;
|
||||
@@ -305,17 +302,12 @@ SELECT tbl_lehrveranstaltung.*,
|
||||
}
|
||||
else{
|
||||
$parent =array_filter($carry, function($item)use($lehrv){
|
||||
return isset($item->lehrveranstaltungen)
|
||||
&& $item->studienplan_lehrveranstaltung_id == $lehrv->studienplan_lehrveranstaltung_id_parent;
|
||||
return $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;
|
||||
}, []);
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
class IssueChecker extends FHCAPI_Controller
|
||||
{
|
||||
const DEFAULT_PERMISSION = 'system/issues_verwalten:r';
|
||||
|
||||
protected $person_id;
|
||||
protected $_extensionName = null;
|
||||
protected $_fehlercodes = [];
|
||||
protected $_apps = [];
|
||||
|
||||
protected $errors = [];
|
||||
protected $infos = [];
|
||||
|
||||
public function __construct($permissions = [])
|
||||
{
|
||||
$default_permissions = [
|
||||
'checkPerson' => self::DEFAULT_PERMISSION,
|
||||
'countPersonOpenIssues' => self::DEFAULT_PERMISSION
|
||||
];
|
||||
|
||||
if(!is_array($permissions))
|
||||
{
|
||||
$this->terminateWithError("Issue Checker: permissions must be an array");
|
||||
}
|
||||
|
||||
$merged_permissions = array_merge($default_permissions, $permissions);
|
||||
|
||||
parent::__construct($merged_permissions);
|
||||
|
||||
$this->load->model('system/Issue_model', 'IssueModel');
|
||||
$this->load->model('system/Fehler_model', 'FehlerModel');
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
$producerArgs = [];
|
||||
$resolverArgs = [];
|
||||
|
||||
// get fehler kurzbz from fehlercodes, if fehlercodes provided
|
||||
if (!isEmptyArray($this->_fehlercodes))
|
||||
{
|
||||
$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz');
|
||||
$this->FehlerModel->db->where_in('tbl_fehler.fehlercode', $this->_fehlercodes);
|
||||
$fehlerKurzbzRes = $this->FehlerModel->load();
|
||||
|
||||
if (isError($fehlerKurzbzRes)) $this->terminateWithError(getError($fehlerKurzbzRes), self::ERROR_TYPE_GENERAL);
|
||||
if (hasData($fehlerKurzbzRes))
|
||||
{
|
||||
$producerArgs['fehlerKurzbz'] = array_column(getData($fehlerKurzbzRes), 'fehler_kurzbz');
|
||||
$resolverArgs['fehlercode'] = array_column(getData($fehlerKurzbzRes), 'fehlercode');
|
||||
}
|
||||
}
|
||||
elseif (!isEmptyArray($this->_apps)) // if apps are provided
|
||||
{
|
||||
// get fehlercodes for the apps
|
||||
$fehlerRes = $this->FehlerModel->getByApps($this->_apps);
|
||||
if (hasData($fehlerRes)) $this->_fehlercodes = array_column(getData($fehlerRes), 'fehlercode');
|
||||
|
||||
$producerArgs['apps'] = $this->_apps;
|
||||
$resolverArgs['apps'] = $this->_apps;
|
||||
}
|
||||
|
||||
// load producer and checker libraries with fehler kurbz and fehlercode list
|
||||
$this->load->library(
|
||||
'issues/PlausicheckProducerLib',
|
||||
$producerArgs,
|
||||
'PlausicheckProducerLib'
|
||||
);
|
||||
|
||||
$this->load->library(
|
||||
'issues/PlausicheckResolverLib',
|
||||
$resolverArgs,
|
||||
'PlausicheckResolverLib'
|
||||
);
|
||||
|
||||
$this->load->library('PhrasesLib');
|
||||
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'ui'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function checkPerson()
|
||||
{
|
||||
$person_id = $this->input->post('person_id', true);
|
||||
$hauptzustaendig = filter_var($this->input->post('hauptzustaendig', true), FILTER_VALIDATE_BOOLEAN);
|
||||
|
||||
if (!is_numeric($person_id)) $this->terminateWithError($this->p->t('ui', 'error_invalidId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$this->person_id = intval($person_id);
|
||||
$this->hauptzustaendig = $hauptzustaendig;
|
||||
|
||||
$persRes = $this->PersonModel->load($this->person_id);
|
||||
if (!hasData($persRes)) $this->terminateWithError('Person with id ' . $this->person_id . ' not found.', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$this->_produceIssues();
|
||||
$this->_resolveIssues();
|
||||
$this->_produceIssues();
|
||||
|
||||
$openIssueCountRes = $this->_countOpenIssues();
|
||||
if (isError($openIssueCountRes)) $this->terminateWithError(getError($openIssueCountRes), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$data = array(
|
||||
'person_id' => $this->person_id,
|
||||
'openissues' => hasData($openIssueCountRes) ? getData($openIssueCountRes) : 0
|
||||
);
|
||||
|
||||
$this->addMeta('errors', $this->errors);
|
||||
$this->addMeta('infos', $this->infos);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
public function countPersonOpenIssues()
|
||||
{
|
||||
$person_id = $this->input->get('person_id', true);
|
||||
$hauptzustaendig = filter_var($this->input->get('hauptzustaendig', true), FILTER_VALIDATE_BOOLEAN);
|
||||
|
||||
if (!is_numeric($person_id)) $this->terminateWithError($this->p->t('ui', 'error_invalidId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$this->person_id = intval($person_id);
|
||||
$this->hauptzustaendig = $hauptzustaendig;
|
||||
|
||||
$persRes = $this->PersonModel->load($this->person_id);
|
||||
|
||||
if (!hasData($persRes)) $this->terminateWithError('Person with id ' . $this->person_id . ' not found.', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$openIssueCountRes = $this->_countOpenIssues();
|
||||
if (isError($openIssueCountRes)) $this->terminateWithError(getError($openIssueCountRes), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$data = array(
|
||||
'person_id' => $this->person_id,
|
||||
'openissues' => hasData($openIssueCountRes) ? getData($openIssueCountRes) : 0
|
||||
);
|
||||
|
||||
$this->addMeta('errors', $this->errors);
|
||||
$this->addMeta('infos', $this->infos);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
protected function _countOpenIssues()
|
||||
{
|
||||
if (isEmptyArray($this->_fehlercodes)) return success([]);
|
||||
|
||||
// load open issues with given errorcodes
|
||||
$openIssuesRes = $this->IssueModel->getOpenIssues(
|
||||
$this->_fehlercodes,
|
||||
$this->person_id,
|
||||
$oe_kurzbz = null,
|
||||
$fehlercode_extern = null,
|
||||
$this->hauptzustaendig
|
||||
);
|
||||
|
||||
// log error if occured
|
||||
if (isError($openIssuesRes)) return $openIssuesRes;
|
||||
|
||||
$issues = hasData($openIssuesRes) ? getData($openIssuesRes) : [];
|
||||
$issuescount = is_array($issues) || $issues instanceof Countable ? count($issues) : 0;
|
||||
|
||||
return success($issuescount);
|
||||
}
|
||||
|
||||
protected function _produceIssues()
|
||||
{
|
||||
$result = $this->PlausicheckProducerLib->producePlausicheckIssues(
|
||||
array('person_id' => $this->person_id)
|
||||
);
|
||||
|
||||
// log if error, or log info if inserted new issue
|
||||
if (isset($result->errors))
|
||||
$this->errors = array_merge($this->errors, $result->errors);
|
||||
if (isset($result->infos))
|
||||
$this->infos = array_merge($this->infos, $result->infos);
|
||||
}
|
||||
|
||||
protected function _resolveIssues()
|
||||
{
|
||||
// load open issues with given errorcodes
|
||||
$openIssuesRes = $this->IssueModel->getOpenIssues(
|
||||
$this->_fehlercodes,
|
||||
$this->person_id
|
||||
);
|
||||
|
||||
if (hasData($openIssuesRes))
|
||||
{
|
||||
$openIssues = getData($openIssuesRes);
|
||||
|
||||
$result = $this->PlausicheckResolverLib->resolvePlausicheckIssues($openIssues);
|
||||
|
||||
// log if error, or log info if inserted new issue
|
||||
if (isset($result->errors))
|
||||
$this->errors = array_merge($this->errors, $result->errors);
|
||||
if (isset($result->infos))
|
||||
$this->infos = array_merge($this->infos, $result->infos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
|
||||
class Issues extends FHCAPI_Controller
|
||||
{
|
||||
const DEFAULT_PERMISSION = 'system/issues_verwalten:r';
|
||||
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
'getOpenIssuesByProperties' => Self::DEFAULT_PERMISSION,
|
||||
'getPersonenMitOffenenIssues' => Self::DEFAULT_PERMISSION
|
||||
)
|
||||
);
|
||||
|
||||
// Loads authentication library and starts authenticationfetc
|
||||
$this->load->library('AuthLib');
|
||||
|
||||
$this->load->model('extensions/FHC-Core-Personalverwaltung/Api_model','ApiModel');
|
||||
$this->load->model('person/Person_model','PersonModel');
|
||||
$this->load->model('system/Fehler_model','FehlerModel');
|
||||
$this->load->model('system/Issue_model', 'IssueModel');
|
||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
}
|
||||
|
||||
public function getOpenIssuesByProperties()
|
||||
{
|
||||
$person_id = $this->input->get('person_id', true);
|
||||
$oe_kurzbz = $this->input->get('oe_kurzbz', true);
|
||||
$fehlertyp_kurzbz = $this->input->get('fehlertyp_kurzbz', true);
|
||||
$apps = $this->input->get('apps', true);
|
||||
$behebung_parameter = $this->input->get('behebung_parameter', true);
|
||||
$hauptzustaendig = filter_var($this->input->get('hauptzustaendig', true), FILTER_VALIDATE_BOOLEAN);
|
||||
|
||||
if (isset($person_id) && !is_numeric($person_id))
|
||||
$this->terminateWithError('person id is not numeric!');
|
||||
|
||||
if (isset($behebung_parameter) && !is_array($behebung_parameter))
|
||||
$this->terminateWithError('Behebung parameter invalid');
|
||||
|
||||
$issueRes = $this->IssueModel->getOpenIssuesByProperties(
|
||||
$person_id,
|
||||
$oe_kurzbz,
|
||||
$fehlertyp_kurzbz,
|
||||
$apps,
|
||||
$behebung_parameter,
|
||||
$hauptzustaendig
|
||||
);
|
||||
|
||||
if (isError($issueRes))
|
||||
{
|
||||
$this->terminateWithError(getError($issueRes));
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess(hasData($issueRes) ? getData($issueRes) : []);
|
||||
}
|
||||
|
||||
public function getPersonenMitOffenenIssues()
|
||||
{
|
||||
|
||||
$sql = <<<EOSQL
|
||||
SELECT
|
||||
|
||||
person_id, uid, vorname, nachname, count(*) AS openissues ,
|
||||
(select count(*) anz_aktiv
|
||||
from hr.tbl_dienstverhaeltnis dv
|
||||
where dv.mitarbeiter_uid=uid and dv.von<=now() and
|
||||
(dv.bis is null OR dv.bis>=now())
|
||||
) aktiv
|
||||
FROM
|
||||
system.tbl_issue
|
||||
JOIN
|
||||
system.tbl_fehler USING (fehlercode)
|
||||
JOIN
|
||||
public.tbl_person USING (person_id)
|
||||
JOIN
|
||||
public.tbl_benutzer USING (person_id)
|
||||
JOIN
|
||||
public.tbl_mitarbeiter ON uid = mitarbeiter_uid
|
||||
WHERE
|
||||
app = 'personalverwaltung' AND verarbeitetamum IS NULL
|
||||
GROUP BY
|
||||
person_id, uid, vorname, nachname
|
||||
HAVING
|
||||
count(*) > 0
|
||||
ORDER BY
|
||||
count(*) DESC;
|
||||
|
||||
EOSQL;
|
||||
|
||||
$personenmitissues = $this->IssueModel->execReadOnlyQuery($sql);
|
||||
if( hasData($personenmitissues) )
|
||||
{
|
||||
$this->terminateWithSuccess(getData($personenmitissues));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->terminateWithSuccess(array());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
require_once APPPATH.'/controllers/api/frontend/v1/issues/IssueChecker.php';
|
||||
|
||||
class StudentIssueChecker extends IssueChecker
|
||||
{
|
||||
protected $_apps = array(
|
||||
'core',
|
||||
'dvuh',
|
||||
'bis'
|
||||
);
|
||||
|
||||
//protected $_fehlercodes = array(
|
||||
//~ 'CORE_AA_0001'
|
||||
//);
|
||||
}
|
||||
@@ -370,7 +370,6 @@ class LvTermine extends FHCAPI_Controller
|
||||
$result->semester = $item->semester;
|
||||
$result->verband = $item->verband;
|
||||
$result->gruppe = $item->gruppe;
|
||||
$result->studiensemester_kurzbz = $item->studiensemester_kurzbz;
|
||||
return $result;
|
||||
},
|
||||
$lehrverband_query_result));
|
||||
|
||||
@@ -42,8 +42,6 @@ class Projektarbeit extends FHCAPI_Controller
|
||||
$this->load->model('education/Note_model', 'NoteModel');
|
||||
$this->load->model('education/Projektbetreuer_model', 'BetreuerModel');
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
|
||||
// load libraries
|
||||
$this->load->library('PermissionLib');
|
||||
@@ -102,16 +100,16 @@ class Projektarbeit extends FHCAPI_Controller
|
||||
private function fetchProjektarbeitById($projektarbeit_id) {
|
||||
$this->ProjektarbeitModel->resetQuery();
|
||||
$this->ProjektarbeitModel->addSelect(
|
||||
'lehre.tbl_projektarbeit.projektarbeit_id, titel, titel_english, themenbereich, projekttyp_kurzbz, lehrveranstaltung_id, lehreinheit_id,
|
||||
tbl_projektarbeit.studiensemester_kurzbz, firma_id, beginn, ende, gesperrtbis, note, final, freigegeben, tbl_projektarbeit.anmerkung, fa.name AS firma_name'
|
||||
'lehre.tbl_projektarbeit.projektarbeit_id, titel, titel_english, themenbereich, projekttyp_kurzbz, lehrveranstaltung_id, lehreinheit_id,
|
||||
firma_id, beginn, ende, gesperrtbis, note, final, freigegeben, tbl_projektarbeit.anmerkung, fa.name AS firma_name'
|
||||
);
|
||||
$this->ProjektarbeitModel->addJoin('lehre.tbl_lehreinheit le', 'lehreinheit_id');
|
||||
$this->ProjektarbeitModel->addJoin('lehre.tbl_lehrveranstaltung lv', 'lehrveranstaltung_id');
|
||||
$this->ProjektarbeitModel->addJoin('public.tbl_firma fa', 'firma_id', 'LEFT');
|
||||
|
||||
|
||||
return $this->ProjektarbeitModel->loadWhere(
|
||||
array('projektarbeit_id' => $projektarbeit_id)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,38 +246,14 @@ class Projektarbeit extends FHCAPI_Controller
|
||||
$additional_lehrveranstaltung_id = $this->input->get('additional_lehrveranstaltung_id');
|
||||
|
||||
if (!isset($student_uid)) $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Student UID']), self::ERROR_TYPE_GENERAL);
|
||||
if (!isset($studiensemester_kurzbz)) $this->terminateWithError('Studiensemester missing', self::ERROR_TYPE_GENERAL);
|
||||
if (!isset($studiensemester_kurzbz)) $this->terminateWithError('Studiensemster missing', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
// get prestudent_id from student model
|
||||
$studentRes = $this->StudentModel->load(['student_uid' => $student_uid]);
|
||||
if(hasData($studentRes)) {
|
||||
$student = getData($studentRes);
|
||||
} else {
|
||||
$this->terminateWithError($studentRes, self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
// to get prestudent_status history
|
||||
$historyRes = $this->PrestudentstatusModel->getHistoryPrestudent($student[0]->prestudent_id);
|
||||
if(hasData($historyRes)) {
|
||||
$history = getData($historyRes);
|
||||
} else {
|
||||
$this->terminateWithError($historyRes, self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
// query for every lva of a studiengang that has projektarbeit flag true
|
||||
// get Lvs
|
||||
$lvsResult = $this->LehrveranstaltungModel->getLvsForProjektarbeit($student_uid, $studiengang_kz, $additional_lehrveranstaltung_id);
|
||||
|
||||
if (isError($lvsResult)) return $this->terminateWithError($lvsResult, self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$lvs = hasData($lvsResult) ? getData($lvsResult) : [];
|
||||
|
||||
$lvsIDs = array_column($lvs, 'lehrveranstaltung_id');
|
||||
|
||||
// get current studienplan_id from status history to find out which lva options are actually assigned to the students studienplan
|
||||
// important so the projektarbeit has the correct lva assigned to be able to find and print the thesis title on the degree documents!
|
||||
$currentStatus = $history[0];
|
||||
$lvByStudienPlanRes = $this->LehrveranstaltungModel->getLvsByStudienplanByLvaIDs($currentStatus->studienplan_id, $lvsIDs);
|
||||
if(hasData($lvByStudienPlanRes)) {
|
||||
$lvs = getData($lvByStudienPlanRes);
|
||||
}
|
||||
|
||||
foreach ($lvs as $lv)
|
||||
{
|
||||
@@ -346,18 +320,11 @@ class Projektarbeit extends FHCAPI_Controller
|
||||
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Projekttyp'])
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('lehreinheit_id', 'Lehreinheit', 'is_natural', [
|
||||
$this->form_validation->set_rules('lehreinheit_id', 'Lehreinheit', 'required|is_natural', [
|
||||
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Lehreinheit']),
|
||||
'is_natural' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Lehreinheit'])
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('lehrveranstaltung_id', 'Lehrveranstaltung', 'required', [
|
||||
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Lehrveranstaltung'])
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'required', [
|
||||
'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Studiensemester'])
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('beginn', 'Beginn', 'is_valid_date', [
|
||||
'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'Beginn'])
|
||||
]);
|
||||
@@ -387,8 +354,6 @@ class Projektarbeit extends FHCAPI_Controller
|
||||
'projekttyp_kurzbz' => $formData['projekttyp_kurzbz'],
|
||||
'firma_id' => $formData['firma_id'] ?? null,
|
||||
'lehreinheit_id' => $formData['lehreinheit_id'],
|
||||
'lehrveranstaltung_id' => $formData['lehrveranstaltung_id'],
|
||||
'studiensemester_kurzbz' => $formData['studiensemester_kurzbz'],
|
||||
'beginn' => isset($formData['beginn']) && !isEmptyString($formData['beginn']) ? $formData['beginn'] : null,
|
||||
'ende' => isset($formData['ende']) && !isEmptyString($formData['ende']) ? $formData['ende'] : null,
|
||||
'note' => $formData['note'] ?? null,
|
||||
|
||||
@@ -108,7 +108,6 @@ class Students extends FHCAPI_Controller
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
]);
|
||||
|
||||
$studiensemester_kurzbz = $this->getStudiensemesterKurzbz($studiensemester_kurzbz);
|
||||
|
||||
$this->studentlistlib->addJoin(
|
||||
"(
|
||||
@@ -154,8 +153,7 @@ class Students extends FHCAPI_Controller
|
||||
$this->addMeta('ci_params', [
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
]);
|
||||
|
||||
$studiensemester_kurzbz = $this->getStudiensemesterKurzbz($studiensemester_kurzbz);
|
||||
|
||||
|
||||
$this->studentlistlib->addJoin(
|
||||
"(
|
||||
@@ -215,7 +213,6 @@ class Students extends FHCAPI_Controller
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
]);
|
||||
|
||||
$studiensemester_kurzbz = $this->getStudiensemesterKurzbz($studiensemester_kurzbz);
|
||||
|
||||
$this->studentlistlib->addJoin(
|
||||
"(
|
||||
|
||||
@@ -5,58 +5,46 @@
|
||||
*/
|
||||
class IssueResolver extends IssueResolver_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// set fehler codes which can be resolved by the job, with own resolver defined
|
||||
// structure: fehlercode => class (library) name for resolving in "resolvers" folder
|
||||
$this->_codeLibMappings = array(
|
||||
'CORE_ZGV_0001' => 'CORE_ZGV_0001',
|
||||
'CORE_ZGV_0002' => 'CORE_ZGV_0002',
|
||||
'CORE_ZGV_0003' => 'CORE_ZGV_0003',
|
||||
'CORE_ZGV_0004' => 'CORE_ZGV_0004',
|
||||
'CORE_ZGV_0005' => 'CORE_ZGV_0005',
|
||||
'CORE_INOUT_0001' => 'CORE_INOUT_0001',
|
||||
'CORE_INOUT_0002' => 'CORE_INOUT_0002',
|
||||
'CORE_INOUT_0003' => 'CORE_INOUT_0003',
|
||||
'CORE_INOUT_0004' => 'CORE_INOUT_0004',
|
||||
'CORE_INOUT_0005' => 'CORE_INOUT_0005',
|
||||
'CORE_INOUT_0006' => 'CORE_INOUT_0006',
|
||||
'CORE_INOUT_0007' => 'CORE_INOUT_0007',
|
||||
'CORE_INOUT_0008' => 'CORE_INOUT_0008',
|
||||
'CORE_INOUT_0009' => 'CORE_INOUT_0009',
|
||||
'CORE_STG_0001' => 'CORE_STG_0001',
|
||||
'CORE_STG_0002' => 'CORE_STG_0002',
|
||||
'CORE_STG_0003' => 'CORE_STG_0003',
|
||||
'CORE_STG_0004' => 'CORE_STG_0004',
|
||||
'CORE_STUDENTSTATUS_0002' => 'CORE_STUDENTSTATUS_0002',
|
||||
'CORE_STUDENTSTATUS_0003' => 'CORE_STUDENTSTATUS_0003',
|
||||
'CORE_STUDENTSTATUS_0004' => 'CORE_STUDENTSTATUS_0004',
|
||||
'CORE_STUDENTSTATUS_0005' => 'CORE_STUDENTSTATUS_0005',
|
||||
'CORE_STUDENTSTATUS_0006' => 'CORE_STUDENTSTATUS_0006',
|
||||
'CORE_STUDENTSTATUS_0007' => 'CORE_STUDENTSTATUS_0007',
|
||||
'CORE_STUDENTSTATUS_0008' => 'CORE_STUDENTSTATUS_0008',
|
||||
'CORE_STUDENTSTATUS_0009' => 'CORE_STUDENTSTATUS_0009',
|
||||
'CORE_STUDENTSTATUS_0010' => 'CORE_STUDENTSTATUS_0010',
|
||||
'CORE_STUDENTSTATUS_0011' => 'CORE_STUDENTSTATUS_0011',
|
||||
'CORE_STUDENTSTATUS_0012' => 'CORE_STUDENTSTATUS_0012',
|
||||
'CORE_STUDENTSTATUS_0013' => 'CORE_STUDENTSTATUS_0013',
|
||||
'CORE_STUDENTSTATUS_0014' => 'CORE_STUDENTSTATUS_0014',
|
||||
'CORE_STUDENTSTATUS_0015' => 'CORE_STUDENTSTATUS_0015',
|
||||
'CORE_STUDENTSTATUS_0016' => 'CORE_STUDENTSTATUS_0016',
|
||||
'CORE_PERSON_0001' => 'CORE_PERSON_0001',
|
||||
'CORE_PERSON_0002' => 'CORE_PERSON_0002',
|
||||
'CORE_PERSON_0003' => 'CORE_PERSON_0003',
|
||||
'CORE_PERSON_0004' => 'CORE_PERSON_0004',
|
||||
'CORE_PERSON_0005' => 'CORE_PERSON_0005',
|
||||
'CORE_PERSON_0006' => 'CORE_PERSON_0006'
|
||||
);
|
||||
|
||||
// fehler which are resolved by the job the same way as they are produced
|
||||
// structure: fehlercode => class (library) name for resolving in "plausichecks" folder
|
||||
$this->_codeProducerLibMappings = array(
|
||||
'CORE_STUDENTSTATUS_0001' => 'AbbrecherAktiv',
|
||||
);
|
||||
}
|
||||
protected $_fehlercodes = array(
|
||||
'CORE_ZGV_0001',
|
||||
'CORE_ZGV_0002',
|
||||
'CORE_ZGV_0003',
|
||||
'CORE_ZGV_0004',
|
||||
'CORE_ZGV_0005',
|
||||
'CORE_INOUT_0001',
|
||||
'CORE_INOUT_0002',
|
||||
'CORE_INOUT_0003',
|
||||
'CORE_INOUT_0004',
|
||||
'CORE_INOUT_0005',
|
||||
'CORE_INOUT_0006',
|
||||
'CORE_INOUT_0007',
|
||||
'CORE_INOUT_0008',
|
||||
'CORE_INOUT_0009',
|
||||
'CORE_STG_0001',
|
||||
'CORE_STG_0002',
|
||||
'CORE_STG_0003',
|
||||
'CORE_STG_0004',
|
||||
'CORE_STUDENTSTATUS_0001',
|
||||
'CORE_STUDENTSTATUS_0002',
|
||||
'CORE_STUDENTSTATUS_0003',
|
||||
'CORE_STUDENTSTATUS_0004',
|
||||
'CORE_STUDENTSTATUS_0005',
|
||||
'CORE_STUDENTSTATUS_0006',
|
||||
'CORE_STUDENTSTATUS_0007',
|
||||
'CORE_STUDENTSTATUS_0008',
|
||||
'CORE_STUDENTSTATUS_0009',
|
||||
'CORE_STUDENTSTATUS_0010',
|
||||
'CORE_STUDENTSTATUS_0011',
|
||||
'CORE_STUDENTSTATUS_0012',
|
||||
'CORE_STUDENTSTATUS_0013',
|
||||
'CORE_STUDENTSTATUS_0014',
|
||||
'CORE_STUDENTSTATUS_0015',
|
||||
'CORE_STUDENTSTATUS_0016',
|
||||
'CORE_PERSON_0001',
|
||||
'CORE_PERSON_0002',
|
||||
'CORE_PERSON_0003',
|
||||
'CORE_PERSON_0004',
|
||||
'CORE_PERSON_0005',
|
||||
'CORE_PERSON_0006'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
class PlausiIssueProducer extends PlausiIssueProducer_Controller
|
||||
{
|
||||
private $_currentStudiensemester;
|
||||
protected $_app = 'core';
|
||||
protected $_apps = 'core';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -18,12 +18,12 @@ class PlausiIssueProducer extends PlausiIssueProducer_Controller
|
||||
$this->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
|
||||
|
||||
// get current Studiensemester
|
||||
$studiensemesterRes = $this->StudiensemesterModel->getAkt();
|
||||
$studiensemesterRes = $this->StudiensemesterModel->getAktOrNextSemester(62);
|
||||
if (hasData($studiensemesterRes)) $this->_currentStudiensemester = getData($studiensemesterRes)[0]->studiensemester_kurzbz;
|
||||
|
||||
// set fehler which can be produced by the job
|
||||
// structure: fehler_kurzbz => class (library) name for resolving
|
||||
$this->_fehlerLibMappings = $this->plausicheckdefinitionlib->getFehlerLibMappings();
|
||||
$this->_fehlerKurzbz = $this->plausicheckdefinitionlib->getFehlerKurzbz();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -803,7 +803,7 @@ class ReihungstestJob extends JOB_Controller
|
||||
{
|
||||
if (!isset($studiensemester) || isEmptyString($studiensemester))
|
||||
{
|
||||
$this->logError("Studiensemester not passed as parameter");
|
||||
$this->logError("Studiensemster not passed as parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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 CLI_Manager extends CLI_Controller
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('FehlerUpdateLib');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installAll()
|
||||
{
|
||||
$this->fehlerupdatelib->installAll();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installFromCore()
|
||||
{
|
||||
$this->fehlerupdatelib->installFromCore();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installFrom($extensionName)
|
||||
{
|
||||
$this->fehlerupdatelib->installFrom(urldecode($extensionName));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Manager extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'installAll' => 'admin:rw',
|
||||
'installFromCore' => 'admin:rw'
|
||||
)
|
||||
);
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('FehlerUpdateLib');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installAll()
|
||||
{
|
||||
$this->fehlerupdatelib->installAll();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installFromCore()
|
||||
{
|
||||
$this->fehlerupdatelib->installFromCore();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installFrom($fehlerConfigDirectory)
|
||||
{
|
||||
$this->fehlerupdatelib->installFrom($fehlerConfigDirectory);
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,6 @@ class InfoCenter extends Auth_Controller
|
||||
const PREV_FILTER_ID = 'prev_filter_id';
|
||||
const KEEP_TABLESORTER_FILTER = 'keepTsFilter';
|
||||
|
||||
const ONBOARDING_INSERTVON = 'onboarding';
|
||||
const ONBOARDING_KENNZEICHENTYP = 'eobRegistrierungsId';
|
||||
|
||||
private $_uid; // contains the UID of the logged user
|
||||
|
||||
// Used to log with PersonLogLib
|
||||
@@ -178,7 +175,6 @@ class InfoCenter extends Auth_Controller
|
||||
$this->load->model('person/Kontakt_model', 'KontaktModel');
|
||||
$this->load->model('person/Geschlecht_model', 'GeschlechtModel');
|
||||
$this->load->model('person/adresse_model', 'AdresseModel');
|
||||
$this->load->model('person/Kennzeichen_model', 'KennzeichenModel');
|
||||
|
||||
// Loads libraries
|
||||
$this->load->library('PersonLogLib');
|
||||
@@ -1456,100 +1452,6 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
$this->outputJsonSuccess("Done!");
|
||||
}
|
||||
|
||||
public function getAbsageData()
|
||||
{
|
||||
$stg_typ = $this->getStudienArtBerechtigung(['b', 'm']);
|
||||
|
||||
if (!is_null($stg_typ))
|
||||
{
|
||||
$statusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
|
||||
$studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
|
||||
$studiengaenge = $this->StudiengangModel->getStudiengaengeWithOrgForm(array_column($stg_typ, 'typ'), $studienSemester);
|
||||
|
||||
$data = array (
|
||||
'statusgruende' => $statusgruende,
|
||||
'studiengaenge' => $studiengaenge->retval
|
||||
);
|
||||
|
||||
$this->outputJsonSuccess($data);
|
||||
}
|
||||
else
|
||||
$this->outputJsonSuccess(null);
|
||||
}
|
||||
|
||||
public function getStudienArtBerechtigung($typ = null)
|
||||
{
|
||||
$studiengang_kz_all = $this->permissionlib->getSTG_isEntitledFor('infocenter');
|
||||
$stg_typ = $this->StudiengangModel->getStudiengangTyp($studiengang_kz_all, $typ);
|
||||
return getData($stg_typ);
|
||||
}
|
||||
|
||||
public function getStudienartData()
|
||||
{
|
||||
$this->outputJsonSuccess($this->getStudienArtBerechtigung(['b', 'm', 'l']));
|
||||
}
|
||||
|
||||
public function saveAbsageForAll()
|
||||
{
|
||||
$statusgrund = $this->input->post('statusgrund');
|
||||
$studiengang = $this->input->post('studiengang');
|
||||
$abgeschickt = $this->input->post('abgeschickt');
|
||||
$personen = $this->input->post('personen');
|
||||
$studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
|
||||
|
||||
if ($statusgrund === 'null' || $studiengang === 'null' || $abgeschickt === 'null' || empty($personen))
|
||||
$this->terminateWithJsonError("Bitte füllen Sie alle Felder aus");
|
||||
|
||||
if ($studiengang === 'all' && $abgeschickt === 'all')
|
||||
{
|
||||
foreach($personen as $person)
|
||||
{
|
||||
$prestudenten = $this->PrestudentModel->getByPersonWithoutLehrgang($person, $studienSemester);
|
||||
|
||||
if (!hasData($prestudenten))
|
||||
continue;
|
||||
|
||||
$prestudentenData = getData($prestudenten);
|
||||
|
||||
foreach ($prestudentenData as $prestudent)
|
||||
{
|
||||
$this->saveAbsage($prestudent->prestudent_id, $statusgrund);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('organisation/Studienplan_model', 'StudienplanModel');
|
||||
|
||||
$this->StudienplanModel->addSelect('1');
|
||||
$this->StudienplanModel->addJoin('lehre.tbl_studienordnung so', 'studienordnung_id');
|
||||
$escaped = $this->StudienplanModel->db->escape(strtoupper($studiengang));
|
||||
$this->StudienplanModel->db->where("UPPER(so.studiengangkurzbzlang || ':' || tbl_studienplan.orgform_kurzbz) = $escaped");
|
||||
$this->StudienplanModel->addLimit(1);
|
||||
$studiengangResult = $this->StudienplanModel->load();
|
||||
|
||||
if (hasData($studiengangResult))
|
||||
{
|
||||
foreach($personen as $person)
|
||||
{
|
||||
$prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt, $abgeschickt === 'all');
|
||||
|
||||
if (!hasData($prestudent))
|
||||
continue;
|
||||
|
||||
$prestudentData = getData($prestudent);
|
||||
$this->saveAbsage($prestudentData[0]->prestudent_id, $statusgrund);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->terminateWithJsonError("Falschen Studiengang übergeben!");
|
||||
|
||||
}
|
||||
|
||||
$this->outputJsonSuccess("Success");
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
@@ -2044,17 +1946,6 @@ class InfoCenter extends Auth_Controller
|
||||
show_error(getError($user_person));
|
||||
}
|
||||
|
||||
// add info about first electronig onboarding login
|
||||
$this->KennzeichenModel->addSelect('insertamum');
|
||||
$onboarding_first_login = $this->KennzeichenModel->loadWhere(
|
||||
array('person_id' => $person_id, 'kennzeichentyp_kurzbz' => self::ONBOARDING_KENNZEICHENTYP)
|
||||
);
|
||||
|
||||
if (isError($onboarding_first_login))
|
||||
{
|
||||
show_error(getError($onboarding_first_login));
|
||||
}
|
||||
|
||||
$data = array (
|
||||
'lockedby' => $lockedby,
|
||||
'lockedbyother' => $lockedbyother,
|
||||
@@ -2064,9 +1955,7 @@ class InfoCenter extends Auth_Controller
|
||||
'messages' => $messages->retval,
|
||||
'logs' => $logs,
|
||||
'notizen' => $notizen->retval,
|
||||
'notizenbewerbung' => $notizen_bewerbung->retval,
|
||||
'created_by_onboarding' => $stammdaten->retval->insertvon == self::ONBOARDING_INSERTVON,
|
||||
'onboarding_first_login' => hasData($onboarding_first_login) ? getData($onboarding_first_login)[0]->insertamum : null
|
||||
'notizenbewerbung' => $notizen_bewerbung->retval
|
||||
);
|
||||
|
||||
return $data;
|
||||
@@ -2486,4 +2375,97 @@ class InfoCenter extends Auth_Controller
|
||||
$this->loglib->logError('Studiengang has no mail for sending Freigabe mail');
|
||||
}
|
||||
}
|
||||
|
||||
public function getAbsageData()
|
||||
{
|
||||
$stg_typ = $this->getStudienArtBerechtigung(['b', 'm']);
|
||||
|
||||
if (!is_null($stg_typ))
|
||||
{
|
||||
$statusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
|
||||
$studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
|
||||
$studiengaenge = $this->StudiengangModel->getStudiengaengeWithOrgForm(array_column($stg_typ, 'typ'), $studienSemester);
|
||||
|
||||
$data = array (
|
||||
'statusgruende' => $statusgruende,
|
||||
'studiengaenge' => $studiengaenge->retval
|
||||
);
|
||||
|
||||
$this->outputJsonSuccess($data);
|
||||
}
|
||||
else
|
||||
$this->outputJsonSuccess(null);
|
||||
}
|
||||
|
||||
public function getStudienArtBerechtigung($typ = null)
|
||||
{
|
||||
$studiengang_kz_all = $this->permissionlib->getSTG_isEntitledFor('infocenter');
|
||||
$stg_typ = $this->StudiengangModel->getStudiengangTyp($studiengang_kz_all, $typ);
|
||||
return getData($stg_typ);
|
||||
}
|
||||
|
||||
public function getStudienartData()
|
||||
{
|
||||
$this->outputJsonSuccess($this->getStudienArtBerechtigung(['b', 'm', 'l']));
|
||||
}
|
||||
|
||||
public function saveAbsageForAll()
|
||||
{
|
||||
$statusgrund = $this->input->post('statusgrund');
|
||||
$studiengang = $this->input->post('studiengang');
|
||||
$abgeschickt = $this->input->post('abgeschickt');
|
||||
$personen = $this->input->post('personen');
|
||||
$studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
|
||||
|
||||
if ($statusgrund === 'null' || $studiengang === 'null' || $abgeschickt === 'null' || empty($personen))
|
||||
$this->terminateWithJsonError("Bitte füllen Sie alle Felder aus");
|
||||
|
||||
if ($studiengang === 'all' && $abgeschickt === 'all')
|
||||
{
|
||||
foreach($personen as $person)
|
||||
{
|
||||
$prestudenten = $this->PrestudentModel->getByPersonWithoutLehrgang($person, $studienSemester);
|
||||
|
||||
if (!hasData($prestudenten))
|
||||
continue;
|
||||
|
||||
$prestudentenData = getData($prestudenten);
|
||||
|
||||
foreach ($prestudentenData as $prestudent)
|
||||
{
|
||||
$this->saveAbsage($prestudent->prestudent_id, $statusgrund);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('organisation/Studienplan_model', 'StudienplanModel');
|
||||
|
||||
$this->StudienplanModel->addSelect('1');
|
||||
$this->StudienplanModel->addJoin('lehre.tbl_studienordnung so', 'studienordnung_id');
|
||||
$escaped = $this->StudienplanModel->db->escape(strtoupper($studiengang));
|
||||
$this->StudienplanModel->db->where("UPPER(so.studiengangkurzbzlang || ':' || tbl_studienplan.orgform_kurzbz) = $escaped");
|
||||
$this->StudienplanModel->addLimit(1);
|
||||
$studiengangResult = $this->StudienplanModel->load();
|
||||
|
||||
if (hasData($studiengangResult))
|
||||
{
|
||||
foreach($personen as $person)
|
||||
{
|
||||
$prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt, $abgeschickt === 'all');
|
||||
|
||||
if (!hasData($prestudent))
|
||||
continue;
|
||||
|
||||
$prestudentData = getData($prestudent);
|
||||
$this->saveAbsage($prestudentData[0]->prestudent_id, $statusgrund);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->terminateWithJsonError("Falschen Studiengang übergeben!");
|
||||
|
||||
}
|
||||
|
||||
$this->outputJsonSuccess("Success");
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,6 @@ class Rueckstellung extends Auth_Controller
|
||||
private $_ci; // Code igniter instance
|
||||
private $_uid;
|
||||
|
||||
const ZGV_UEBERPRUEFUNG_MAIL_VORLAGE = 'ZGVUEP';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
@@ -25,7 +23,6 @@ class Rueckstellung extends Auth_Controller
|
||||
$this->load->model('crm/RueckstellungStatus_model', 'RueckstellungStatusModel');
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
$this->load->library('PersonLogLib');
|
||||
$this->load->library('MessageLib');
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
|
||||
@@ -81,8 +78,6 @@ class Rueckstellung extends Auth_Controller
|
||||
|
||||
$this->_log($person_id, $status_kurzbz);
|
||||
|
||||
if ($status_kurzbz === 'onhold_zgv')
|
||||
$this->sendRueckstellungMessage($person_id);
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
@@ -109,10 +104,6 @@ class Rueckstellung extends Auth_Controller
|
||||
if (isError($result))
|
||||
$this->terminateWithJsonError(getError($result));
|
||||
$this->_log($person, $status_kurzbz);
|
||||
|
||||
if ($status_kurzbz === 'onhold_zgv')
|
||||
$this->sendRueckstellungMessage($person);
|
||||
|
||||
}
|
||||
$this->outputJsonSuccess("Erfolgreich gespeichert!");
|
||||
}
|
||||
@@ -169,26 +160,4 @@ class Rueckstellung extends Auth_Controller
|
||||
$this->_uid
|
||||
);
|
||||
}
|
||||
|
||||
private function sendRueckstellungMessage($person_id)
|
||||
{
|
||||
$person = $this->_ci->PersonModel->load($person_id);
|
||||
|
||||
if (hasData($person))
|
||||
{
|
||||
$person = getData($person)[0];
|
||||
|
||||
return $this->messagelib->sendMessageUserTemplate(
|
||||
$person_id,
|
||||
self::ZGV_UEBERPRUEFUNG_MAIL_VORLAGE,
|
||||
array(
|
||||
'anrede' => $person->anrede,
|
||||
'nachname' => $person->nachname
|
||||
),
|
||||
null,
|
||||
getAuthPersonId(),
|
||||
'infocenter'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,9 +88,11 @@ class IssuesKonfiguration extends Auth_Controller
|
||||
|
||||
// get all Fehler, optionally filtered by app
|
||||
$params = array('fehlercode_extern' => null);
|
||||
$this->FehlerModel->addDistinct();
|
||||
$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz, fehlertyp_kurzbz, fehlertext');
|
||||
$this->FehlerModel->addJoin('system.tbl_fehler_app', 'fehlercode');
|
||||
$this->FehlerModel->addOrder('fehlercode');
|
||||
if (!isEmptyString($app)) $params['app'] = $app;
|
||||
if (!isEmptyString($app)) $params['tbl_fehler_app.app'] = $app;
|
||||
$fehlerRes = $this->FehlerModel->loadWhere($params);
|
||||
|
||||
if (isError($fehlerRes)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlerFehlerLaden'));
|
||||
|
||||
@@ -69,10 +69,7 @@ class IssuesZustaendigkeiten extends Auth_Controller
|
||||
{
|
||||
$app = $this->input->get('app');
|
||||
|
||||
$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz, fehlertext, fehlertyp_kurzbz, app');
|
||||
$this->FehlerModel->addOrder('fehlercode');
|
||||
|
||||
$fehlerRes = isset($app) ? $this->FehlerModel->loadWhere(array('app' => $app)) : $this->FehlerModel->load();
|
||||
$fehlerRes = $this->FehlerModel->getByApps($app);
|
||||
|
||||
$this->outputJson($fehlerRes);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Plausichecks extends Auth_Controller
|
||||
{
|
||||
const GENERIC_ISSUE_OCCURED_TEXT = 'Issue aufgetreten';
|
||||
const APPS = ['core', 'dvuh', 'bis'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -16,8 +17,7 @@ class Plausichecks extends Auth_Controller
|
||||
);
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('issues/PlausicheckProducerLib', array('app' => 'core'));
|
||||
$this->load->library('issues/PlausicheckDefinitionLib');
|
||||
$this->load->library('issues/PlausicheckProducerLib', array('apps' => self::APPS));
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
// Load models
|
||||
@@ -46,37 +46,31 @@ class Plausichecks extends Auth_Controller
|
||||
|
||||
// issues array for passing issue texts
|
||||
$allIssues = array();
|
||||
// all fehler kurzbz which are going to be checked
|
||||
$fehlerKurzbz = !isEmptyString($fehler_kurzbz) ? array($fehler_kurzbz) : $this->plausicheckdefinitionlib->getFehlerKurzbz();
|
||||
$fehlerLibMappings = $this->plausicheckdefinitionlib->getFehlerLibMappings();
|
||||
|
||||
$fehler_kurzbz_arr = isEmptyString($fehler_kurzbz) ? array_keys($this->plausicheckproducerlib->getFehlerMappings()) : [$fehler_kurzbz];
|
||||
|
||||
$this->FehlerModel->addOrder('fehler_kurzbz, fehlercode');
|
||||
$this->FehlerModel->db->where_in('fehler_kurzbz', $fehler_kurzbz_arr);
|
||||
$fehlerRes = $this->FehlerModel->load();
|
||||
|
||||
if (isError($fehlerRes)) $this->terminateWithJsonError(getError($fehlerRes));
|
||||
if (!hasData($fehlerRes)) return $this->outputJsonSuccess([]);
|
||||
|
||||
// all fehler which are going to be checked
|
||||
$fehlerArr = getData($fehlerRes);
|
||||
|
||||
// set Studiengang to null if not passed
|
||||
if (isEmptyString($studiengang_kz)) $studiengang_kz = null;
|
||||
|
||||
// get the data returned by Plausicheck
|
||||
foreach ($fehlerKurzbz as $fehler_kurzbz)
|
||||
foreach ($fehlerArr as $fehler)
|
||||
{
|
||||
// get Text and fehlercode of the Fehler
|
||||
$this->FehlerModel->addSelect('fehlercode, fehlertext, fehlertyp_kurzbz');
|
||||
$fehlerRes = $this->FehlerModel->loadWhere(array('fehler_kurzbz' => $fehler_kurzbz));
|
||||
|
||||
if (isError($fehlerRes)) $this->terminateWithJsonError(getError($fehlerRes));
|
||||
|
||||
// do not check error if no data
|
||||
if (!hasData($fehlerRes)) continue;
|
||||
|
||||
// get the error data
|
||||
$fehler = getData($fehlerRes)[0];
|
||||
|
||||
// initialize issue array
|
||||
$allIssues[$fehler_kurzbz] = array('fehlercode' => $fehler->fehlercode, 'data' => array());
|
||||
|
||||
// get library name for producing issue
|
||||
$libName = $fehlerLibMappings[$fehler_kurzbz];
|
||||
$allIssues[$fehler->fehler_kurzbz] = array('fehlercode' => $fehler->fehlercode, 'data' => array());
|
||||
|
||||
// execute the check
|
||||
$plausicheckRes = $this->plausicheckproducerlib->producePlausicheckIssue(
|
||||
$libName,
|
||||
$fehler_kurzbz,
|
||||
$fehler->fehler_kurzbz,
|
||||
array(
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'studiengang_kz' => $studiengang_kz
|
||||
@@ -107,7 +101,7 @@ class Plausichecks extends Auth_Controller
|
||||
{
|
||||
// replace placeholder with params, if present
|
||||
if (count($fehlertext_params) != substr_count($fehlerText, '%s'))
|
||||
$this->terminateWithJsonError('Wrong number of parameters for Fehlertext, fehler_kurzbz ' . $fehler_kurzbz);
|
||||
$this->terminateWithJsonError('Wrong number of parameters for Fehlertext, fehler_kurzbz ' . $fehler->fehler_kurzbz);
|
||||
|
||||
$fehlerText = vsprintf($fehlerText, $fehlertext_params);
|
||||
}
|
||||
@@ -118,7 +112,7 @@ class Plausichecks extends Auth_Controller
|
||||
$issueObj = new StdClass();
|
||||
$issueObj->fehlertext = $fehlerText;
|
||||
$issueObj->type = $fehlerTyp;
|
||||
$allIssues[$fehler_kurzbz]['data'][] = $issueObj;
|
||||
$allIssues[$fehler->fehler_kurzbz]['data'][] = $issueObj;
|
||||
}
|
||||
else // if no issue text found, use generic text
|
||||
{
|
||||
@@ -149,6 +143,12 @@ class Plausichecks extends Auth_Controller
|
||||
|
||||
if (isError($currSemRes)) show_error(getError($currSemRes));
|
||||
|
||||
if (!hasData($currSemRes))
|
||||
{
|
||||
$currSemRes = $this->StudiensemesterModel->getNext();
|
||||
if (isError($currSemRes)) show_error(getError($currSemRes));
|
||||
}
|
||||
|
||||
$this->StudiengangModel->addSelect('studiengang_kz, tbl_studiengang.bezeichnung, tbl_studiengang.typ,
|
||||
tbl_studiengangstyp.bezeichnung AS typbezeichnung, UPPER(tbl_studiengang.typ::varchar(1) || tbl_studiengang.kurzbz) as kuerzel');
|
||||
$this->StudiengangModel->addJoin('public.tbl_studiengangstyp', 'typ');
|
||||
@@ -157,7 +157,7 @@ class Plausichecks extends Auth_Controller
|
||||
|
||||
if (isError($studiengaengeRes)) show_error(getError($studiengaengeRes));
|
||||
|
||||
$fehlerKurzbz = $this->plausicheckdefinitionlib->getFehlerKurzbz();
|
||||
$fehlerKurzbz = array_keys($this->plausicheckproducerlib->getFehlerMappings());
|
||||
|
||||
$db = new DB_Model();
|
||||
|
||||
@@ -168,7 +168,9 @@ class Plausichecks extends Auth_Controller
|
||||
FROM
|
||||
system.tbl_fehler
|
||||
WHERE
|
||||
fehler_kurzbz IN ?',
|
||||
fehler_kurzbz IN ?
|
||||
ORDER BY
|
||||
fehler_kurzbz, fehlercode',
|
||||
array($fehlerKurzbz)
|
||||
);
|
||||
|
||||
@@ -188,7 +190,8 @@ class Plausichecks extends Auth_Controller
|
||||
'semester' => hasData($studiensemesterRes) ? getData($studiensemesterRes) : array(),
|
||||
'currsemester' => hasData($currSemRes) ? getData($currSemRes) : array(),
|
||||
'studiengaenge' => hasData($studiengaengeRes) ? getData($studiengaengeRes) : array(),
|
||||
'fehlerKurzbzCodeMappings' => $fehlerKurzbzCodeMappings
|
||||
'fehlerKurzbzCodeMappings' => $fehlerKurzbzCodeMappings,
|
||||
'studiengang_kz' => $this->input->get('studiengang_kz') ?? ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,8 @@
|
||||
*/
|
||||
abstract class IssueResolver_Controller extends JOB_Controller
|
||||
{
|
||||
// mappings in form fehlercode -> resolverlibrary name, fehler which have explicit resolver class defined
|
||||
protected $_codeLibMappings = [];
|
||||
|
||||
// mappings in form fehlercode -> producer library name, fehler which are resolved the same way they are produced
|
||||
protected $_codeProducerLibMappings = [];
|
||||
// codes of fehler to be resolved
|
||||
protected $_fehlercodes = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -24,25 +21,18 @@ abstract class IssueResolver_Controller extends JOB_Controller
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// initialize librariy with provided fehlercodes
|
||||
$this->load->library(
|
||||
'issues/PlausicheckResolverLib',
|
||||
[
|
||||
'extensionName' => $this->_extensionName ?? null,
|
||||
'codeLibMappings' => $this->_codeLibMappings,
|
||||
'codeProducerLibMappings' => $this->_codeProducerLibMappings
|
||||
'fehlercodes' => $this->_fehlercodes
|
||||
]
|
||||
);
|
||||
|
||||
$this->logInfo("Issue resolve job started");
|
||||
|
||||
// load open issues with given errorcodes
|
||||
$openIssuesRes = $this->IssueModel->getOpenIssues(
|
||||
array_merge(array_keys($this->_codeLibMappings), array_keys($this->_codeProducerLibMappings))
|
||||
);
|
||||
|
||||
$openIssues = hasData($openIssuesRes) ? getData($openIssuesRes) : [];
|
||||
|
||||
$result = $this->plausicheckresolverlib->resolvePlausicheckIssues($openIssues);
|
||||
// resolve the issues
|
||||
$result = $this->plausicheckresolverlib->resolvePlausicheckIssues();
|
||||
|
||||
// log if error, or log info if inserted new issue
|
||||
foreach ($result->errors as $error) $this->logError($error);
|
||||
|
||||
@@ -5,14 +5,23 @@
|
||||
*/
|
||||
abstract class PlausiIssueProducer_Controller extends JOB_Controller
|
||||
{
|
||||
protected $_fehlerLibMappings = [];
|
||||
protected $_app;
|
||||
protected $_fehlerKurzbz = [];
|
||||
protected $_apps = [];
|
||||
|
||||
/**
|
||||
* Runs issue production job.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// producing issues
|
||||
$this->producePlausicheckIssues(array());
|
||||
}
|
||||
|
||||
protected function producePlausicheckIssues($params)
|
||||
{
|
||||
$this->load->library(
|
||||
'issues/PlausicheckProducerLib',
|
||||
['extensionName' => $this->_extensionName ?? null, 'app' => $this->_app, 'fehlerLibMappings' => $this->_fehlerLibMappings]
|
||||
['apps' => $this->_apps, 'fehlerKurzbz' => $this->_fehlerKurzbz]
|
||||
);
|
||||
|
||||
$this->logInfo("Plausicheck issue producer job started");
|
||||
|
||||
@@ -741,7 +741,7 @@ class AnrechnungLib
|
||||
$fullname = hasData($result) ? $result->retval[0]->vorname. $result->retval[0]->nachname : '';
|
||||
|
||||
// Return filename
|
||||
return 'Anrechnungsantrag'. $orgform_kurzbz .'_LV-'. $lehrveranstaltung_id. '_'. $fullname . '.pdf';
|
||||
return 'Anrechnungsantrag'. $orgform_kurzbz .'_LV-'. $lehrveranstaltung_id. '_'. $fullname;
|
||||
}
|
||||
|
||||
public function LVhasLector($anrechnung_id)
|
||||
|
||||
@@ -1,563 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
class CmsAdminLib
|
||||
{
|
||||
private $ci;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->ci->load->model('content/Content_model', 'ContentModel');
|
||||
$this->ci->load->model('content/Contentsprache_model', 'ContentspracheModel');
|
||||
$this->ci->load->model('content/Contentchild_model', 'ContentchildModel');
|
||||
$this->ci->load->model('content/Contentgruppe_model', 'ContentgruppeModel');
|
||||
$this->ci->load->model('content/Contentlog_model', 'ContentlogModel');
|
||||
$this->ci->load->model('content/Template_model', 'TemplateModel');
|
||||
|
||||
$this->ci->load->library('XsdSchemaLib');
|
||||
$this->ci->load->library('PermissionLib');
|
||||
$this->ci->config->load('cms');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object success(array) entitled oe_kurzbz values
|
||||
*/
|
||||
public function getEntitledOe()
|
||||
{
|
||||
$oe = $this->ci->permissionlib->getOE_isEntitledFor('basis/cms');
|
||||
|
||||
if ($oe === false || !is_array($oe))
|
||||
return success([]);
|
||||
|
||||
return success($oe);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @return object success(bool)
|
||||
*/
|
||||
public function isEntitledForContent($content_id)
|
||||
{
|
||||
$oeResult = $this->ci->ContentModel->getOeKurzbz($content_id);
|
||||
if (isError($oeResult))
|
||||
return $oeResult;
|
||||
|
||||
$entitledResult = $this->getEntitledOe();
|
||||
if (isError($entitledResult))
|
||||
return $entitledResult;
|
||||
|
||||
return success(in_array(getData($oeResult), getData($entitledResult)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object success(string) or error
|
||||
*/
|
||||
public function getDefaultOe()
|
||||
{
|
||||
$default = $this->ci->config->item('default_oe_kurzbz');
|
||||
|
||||
$entitledResult = $this->getEntitledOe();
|
||||
if (isError($entitledResult))
|
||||
return $entitledResult;
|
||||
$entitled = getData($entitledResult);
|
||||
|
||||
if (empty($entitled))
|
||||
return error($this->ci->p->t('cms', 'keineBerechtigteOe'));
|
||||
|
||||
if (in_array($default, $entitled))
|
||||
return success($default);
|
||||
|
||||
return success($entitled[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $parent_content_id
|
||||
* @return object success(array) with content_id, sprache, version
|
||||
*/
|
||||
public function createContent($parent_content_id = null)
|
||||
{
|
||||
$templatesResult = $this->ci->TemplateModel->loadWhere([]);
|
||||
if (isError($templatesResult))
|
||||
return $templatesResult;
|
||||
$templates = getData($templatesResult);
|
||||
if (empty($templates))
|
||||
return error($this->ci->p->t('cms', 'keineVorlageVorhanden'));
|
||||
$template = $templates[0];
|
||||
|
||||
$oeResult = $this->getDefaultOe();
|
||||
if (isError($oeResult))
|
||||
return $oeResult;
|
||||
$oe = getData($oeResult);
|
||||
|
||||
$titel = $this->ci->p->t('cms', 'neuerEintrag');
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$uid = getAuthUID();
|
||||
|
||||
$this->ci->db->trans_start();
|
||||
|
||||
$contentResult = $this->ci->ContentModel->insert([
|
||||
'template_kurzbz' => $template->template_kurzbz,
|
||||
'oe_kurzbz' => $oe,
|
||||
'aktiv' => true,
|
||||
'menu_open' => false,
|
||||
'beschreibung' => '',
|
||||
'insertamum' => $now,
|
||||
'insertvon' => $uid
|
||||
]);
|
||||
if (isError($contentResult))
|
||||
return $contentResult;
|
||||
$content_id = getData($contentResult);
|
||||
|
||||
$spracheResult = $this->ci->ContentspracheModel->insert([
|
||||
'content_id' => $content_id,
|
||||
'sprache' => DEFAULT_LANGUAGE,
|
||||
'version' => 1,
|
||||
'sichtbar' => true,
|
||||
'titel' => $titel,
|
||||
'content' => '<?xml version="1.0" encoding="UTF-8" ?><content></content>',
|
||||
'insertamum' => $now,
|
||||
'insertvon' => $uid
|
||||
]);
|
||||
if (isError($spracheResult))
|
||||
return $spracheResult;
|
||||
|
||||
if ($parent_content_id !== null)
|
||||
{
|
||||
$maxSortResult = $this->ci->ContentchildModel->getMaxSort($parent_content_id);
|
||||
if (isError($maxSortResult))
|
||||
return $maxSortResult;
|
||||
|
||||
$childResult = $this->ci->ContentchildModel->insert([
|
||||
'content_id' => $parent_content_id,
|
||||
'child_content_id' => $content_id,
|
||||
'sort' => getData($maxSortResult) + 1,
|
||||
'insertamum' => $now,
|
||||
'insertvon' => $uid
|
||||
]);
|
||||
if (isError($childResult))
|
||||
return $childResult;
|
||||
}
|
||||
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
return error($this->ci->p->t('cms', 'speichernFehlgeschlagen'));
|
||||
|
||||
return success([
|
||||
'content_id' => $content_id,
|
||||
'sprache' => DEFAULT_LANGUAGE,
|
||||
'version' => 1
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @param string $sprache source language
|
||||
* @param int $version source version
|
||||
* @param string $neueSprache target language
|
||||
* @return object success(array) with contentsprache_id
|
||||
*/
|
||||
public function createTranslation($content_id, $sprache, $version, $neueSprache)
|
||||
{
|
||||
$existsResult = $this->ci->ContentspracheModel->exists($content_id, $neueSprache);
|
||||
if (isError($existsResult))
|
||||
return $existsResult;
|
||||
if (getData($existsResult))
|
||||
return error($this->ci->p->t('cms', 'uebersetzungExistiert'));
|
||||
|
||||
$sourceResult = $this->ci->ContentspracheModel->getOne($content_id, $sprache, $version);
|
||||
if (isError($sourceResult))
|
||||
return $sourceResult;
|
||||
$source = getData($sourceResult);
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$uid = getAuthUID();
|
||||
|
||||
$insertResult = $this->ci->ContentspracheModel->insert([
|
||||
'content_id' => $content_id,
|
||||
'sprache' => $neueSprache,
|
||||
'version' => $source->version,
|
||||
'sichtbar' => true,
|
||||
'titel' => $source->titel,
|
||||
'content' => $source->content,
|
||||
// The review feature is gone from this admin, but the columns stay
|
||||
'reviewvon' => null,
|
||||
'reviewamum' => null,
|
||||
'gesperrt_uid' => null,
|
||||
'insertamum' => $now,
|
||||
'insertvon' => $uid,
|
||||
'updateamum' => $now,
|
||||
'updatevon' => $uid
|
||||
]);
|
||||
if (isError($insertResult))
|
||||
return $insertResult;
|
||||
|
||||
return success(['contentsprache_id' => getData($insertResult)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @return object success(array) with version
|
||||
*/
|
||||
public function createVersion($content_id, $sprache)
|
||||
{
|
||||
$sourceResult = $this->ci->ContentspracheModel->getOne($content_id, $sprache, null);
|
||||
if (isError($sourceResult))
|
||||
return $sourceResult;
|
||||
$source = getData($sourceResult);
|
||||
|
||||
$maxResult = $this->ci->ContentspracheModel->getMaxVersion($content_id, $sprache);
|
||||
if (isError($maxResult))
|
||||
return $maxResult;
|
||||
$newVersion = getData($maxResult) + 1;
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$uid = getAuthUID();
|
||||
|
||||
$insertResult = $this->ci->ContentspracheModel->insert([
|
||||
'content_id' => $content_id,
|
||||
'sprache' => $sprache,
|
||||
'version' => $newVersion,
|
||||
'sichtbar' => false,
|
||||
'titel' => $source->titel,
|
||||
'content' => $source->content,
|
||||
// The review feature is gone from this admin, but the columns stay
|
||||
'reviewvon' => null,
|
||||
'reviewamum' => null,
|
||||
'gesperrt_uid' => null,
|
||||
'insertamum' => $now,
|
||||
'insertvon' => $uid,
|
||||
'updateamum' => $now,
|
||||
'updatevon' => $uid
|
||||
]);
|
||||
if (isError($insertResult))
|
||||
return $insertResult;
|
||||
|
||||
return success(['version' => $newVersion]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the properties of one content version.
|
||||
* @param array $daten content_id, sprache, version, template_kurzbz, oe_kurzbz,
|
||||
* aktiv, menu_open, beschreibung, titel, sichtbar
|
||||
* @return object success(true) or error
|
||||
*/
|
||||
public function saveProperties($daten)
|
||||
{
|
||||
$versionResult = $this->ci->ContentspracheModel->getOne(
|
||||
$daten['content_id'], $daten['sprache'], $daten['version']
|
||||
);
|
||||
if (isError($versionResult))
|
||||
return $versionResult;
|
||||
$row = getData($versionResult);
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$uid = getAuthUID();
|
||||
|
||||
$this->ci->db->trans_start();
|
||||
|
||||
$this->ci->ContentModel->update($daten['content_id'], [
|
||||
'template_kurzbz' => $daten['template_kurzbz'],
|
||||
'oe_kurzbz' => $daten['oe_kurzbz'],
|
||||
'aktiv' => $daten['aktiv'],
|
||||
'menu_open' => $daten['menu_open'],
|
||||
'beschreibung' => $daten['beschreibung'],
|
||||
'updateamum' => $now,
|
||||
'updatevon' => $uid
|
||||
]);
|
||||
|
||||
$this->ci->ContentspracheModel->update($row->contentsprache_id, [
|
||||
'titel' => $daten['titel'],
|
||||
'sichtbar' => $daten['sichtbar'],
|
||||
'updateamum' => $now,
|
||||
'updatevon' => $uid
|
||||
]);
|
||||
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
return error($this->ci->p->t('cms', 'speichernFehlgeschlagen'));
|
||||
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// legacy cms checks neither the permission
|
||||
// type nor the lock. The form appears only when the user holds the lock, but the POST
|
||||
// itself is unprotected.
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @param int $version
|
||||
* @param array $values field name => value
|
||||
* @return object success(true) or error
|
||||
*/
|
||||
public function saveContentXml($content_id, $sprache, $version, $values)
|
||||
{
|
||||
$versionResult = $this->ci->ContentspracheModel->getOne($content_id, $sprache, $version);
|
||||
if (isError($versionResult))
|
||||
return $versionResult;
|
||||
$row = getData($versionResult);
|
||||
|
||||
$contentResult = $this->ci->ContentModel->load($content_id);
|
||||
if (isError($contentResult))
|
||||
return $contentResult;
|
||||
$content = getData($contentResult);
|
||||
if (empty($content))
|
||||
return error($this->ci->p->t('cms', 'contentNichtGefunden'));
|
||||
|
||||
$templateResult = $this->ci->TemplateModel->load($content[0]->template_kurzbz);
|
||||
if (isError($templateResult))
|
||||
return $templateResult;
|
||||
$template = getData($templateResult);
|
||||
if (empty($template))
|
||||
return error($this->ci->p->t('cms', 'keineVorlageVorhanden'));
|
||||
|
||||
$schemaResult = $this->ci->xsdschemalib->parseSchema(
|
||||
$template[0]->xsd, $content[0]->template_kurzbz
|
||||
);
|
||||
if (isError($schemaResult))
|
||||
return $schemaResult;
|
||||
|
||||
$xmlResult = $this->ci->xsdschemalib->buildXml(getData($schemaResult), $values);
|
||||
if (isError($xmlResult))
|
||||
return $xmlResult;
|
||||
|
||||
$updateResult = $this->ci->ContentspracheModel->update(
|
||||
$row->contentsprache_id,
|
||||
['content' => getData($xmlResult)]
|
||||
);
|
||||
if (isError($updateResult))
|
||||
return $updateResult;
|
||||
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Locks a version for the current user, or takes over an expired lock.
|
||||
* @param int $contentsprache_id
|
||||
* @return object success(true) or error
|
||||
*/
|
||||
public function lock($contentsprache_id)
|
||||
{
|
||||
$uid = getAuthUID();
|
||||
|
||||
$rowResult = $this->ci->ContentspracheModel->load($contentsprache_id);
|
||||
if (isError($rowResult))
|
||||
return $rowResult;
|
||||
$rowData = getData($rowResult);
|
||||
if (empty($rowData))
|
||||
return error($this->ci->p->t('cms', 'versionNichtGefunden'));
|
||||
|
||||
$holder = ($rowData[0]->gesperrt_uid === '') ? null : $rowData[0]->gesperrt_uid;
|
||||
|
||||
if ($holder !== null && $holder !== $uid)
|
||||
{
|
||||
$openResult = $this->ci->ContentlogModel->getOpenLock($contentsprache_id, $holder);
|
||||
$openEntry = (!isError($openResult)) ? getData($openResult) : null;
|
||||
|
||||
if (!$this->isLockExpired($holder, $openEntry))
|
||||
return error($this->ci->p->t('cms', 'bereitsGesperrt'));
|
||||
}
|
||||
|
||||
$this->ci->db->trans_start();
|
||||
|
||||
$this->ci->ContentlogModel->closeOpenEntries($contentsprache_id);
|
||||
|
||||
$logResult = $this->ci->ContentlogModel->insert([
|
||||
'uid' => $uid,
|
||||
'contentsprache_id' => $contentsprache_id,
|
||||
'start' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
if (isError($logResult))
|
||||
return $logResult;
|
||||
|
||||
$updateResult = $this->ci->ContentspracheModel->update($contentsprache_id, [
|
||||
'gesperrt_uid' => $uid
|
||||
]);
|
||||
if (isError($updateResult))
|
||||
return $updateResult;
|
||||
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
return error($this->ci->p->t('cms', 'speichernFehlgeschlagen'));
|
||||
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// legacy released ALL locks of the user. Releasing now ends one lock.
|
||||
// The uid predicate stops a user releasing a lock of somebody else.
|
||||
/**
|
||||
* Releases the lock of the current user on one version.
|
||||
* @param int $contentsprache_id
|
||||
* @return object success(true)
|
||||
*/
|
||||
public function releaseOwnLock($contentsprache_id)
|
||||
{
|
||||
$uid = getAuthUID();
|
||||
|
||||
$this->ci->db->trans_start();
|
||||
|
||||
$this->ci->ContentlogModel->closeOpenEntries($contentsprache_id, $uid);
|
||||
$this->ci->ContentspracheModel->releaseLock($contentsprache_id, $uid);
|
||||
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
return error($this->ci->p->t('cms', 'speichernFehlgeschlagen'));
|
||||
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $contentsprache_id
|
||||
* @return object success(true)
|
||||
*/
|
||||
public function forceRelease($contentsprache_id)
|
||||
{
|
||||
$this->ci->db->trans_start();
|
||||
|
||||
$this->ci->ContentlogModel->closeOpenEntries($contentsprache_id);
|
||||
$this->ci->ContentspracheModel->releaseLock($contentsprache_id);
|
||||
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
return error($this->ci->p->t('cms', 'speichernFehlgeschlagen'));
|
||||
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @param int $version
|
||||
* @return object success(array) gesperrt_uid, start, expires, own, expired, may_force
|
||||
*/
|
||||
public function getLockState($content_id, $sprache, $version)
|
||||
{
|
||||
$versionResult = $this->ci->ContentspracheModel->getOne($content_id, $sprache, $version);
|
||||
if (isError($versionResult))
|
||||
return $versionResult;
|
||||
$row = getData($versionResult);
|
||||
|
||||
// legacy admin.php inserts an empty string, releasing writes NULL.
|
||||
// this code reports NULL.
|
||||
$gesperrt_uid = ($row->gesperrt_uid === '') ? null : $row->gesperrt_uid;
|
||||
|
||||
$logEntry = null;
|
||||
if ($gesperrt_uid !== null)
|
||||
{
|
||||
$lockResult = $this->ci->ContentlogModel->getOpenLock(
|
||||
$row->contentsprache_id, $gesperrt_uid
|
||||
);
|
||||
$logEntry = (!isError($lockResult)) ? getData($lockResult) : null;
|
||||
}
|
||||
|
||||
return success([
|
||||
'contentsprache_id' => (int) $row->contentsprache_id,
|
||||
'gesperrt_uid' => $gesperrt_uid,
|
||||
'start' => $logEntry ? $logEntry->start : null,
|
||||
'own' => ($gesperrt_uid !== null && $gesperrt_uid === getAuthUID()),
|
||||
'expired' => $this->isLockExpired($gesperrt_uid, $logEntry),
|
||||
'expires' => $this->lockExpiryDate($logEntry),
|
||||
'may_force' => $this->ci->permissionlib->isBerechtigt('basis/cms_sperrfreigabe', 'su')
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* End of the lock window, null if the entry carries no start.
|
||||
* @param stdClass|null $logEntry
|
||||
* @return string|null
|
||||
*/
|
||||
private function lockExpiryDate($logEntry)
|
||||
{
|
||||
if ($logEntry === null || empty($logEntry->start))
|
||||
return null;
|
||||
|
||||
$ttlHours = (int) $this->ci->config->item('lock_ttl_hours');
|
||||
|
||||
// lock() writes start with PHP time, so stay on PHP time.
|
||||
return date('Y-m-d H:i:s', strtotime($logEntry->start) + $ttlHours * 3600);
|
||||
}
|
||||
|
||||
// Locks now age out after lock_ttl_hours.
|
||||
/**
|
||||
* A lock without a log entry has no age and counts as expired.
|
||||
* @param string|null $gesperrt_uid
|
||||
* @param stdClass|null $logEntry
|
||||
* @return bool
|
||||
*/
|
||||
private function isLockExpired($gesperrt_uid, $logEntry)
|
||||
{
|
||||
if ($gesperrt_uid === null)
|
||||
return false;
|
||||
|
||||
$expires = $this->lockExpiryDate($logEntry);
|
||||
|
||||
return $expires === null || strtotime($expires) < time();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @return object success(true) or error
|
||||
*/
|
||||
public function deleteContent($content_id)
|
||||
{
|
||||
$this->ci->db->trans_start();
|
||||
|
||||
$this->ci->ContentchildModel->deleteByContent($content_id);
|
||||
$this->ci->ContentlogModel->deleteByContent($content_id);
|
||||
$this->ci->ContentspracheModel->deleteByContent($content_id);
|
||||
$this->ci->ContentgruppeModel->deleteByContent($content_id);
|
||||
$this->ci->ContentModel->delete($content_id);
|
||||
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
return error($this->ci->p->t('cms', 'loeschenNichtMoeglichReferenzen'));
|
||||
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @param int $version
|
||||
* @return object success(true) or error
|
||||
*/
|
||||
public function deleteVersion($content_id, $sprache, $version)
|
||||
{
|
||||
if ($sprache === DEFAULT_LANGUAGE)
|
||||
{
|
||||
$countResult = $this->ci->ContentspracheModel->getNumberOfVersions($content_id, $sprache);
|
||||
if (isError($countResult))
|
||||
return $countResult;
|
||||
if (getData($countResult) === 1)
|
||||
return error($this->ci->p->t('cms', 'letzteVersionNichtLoeschbar'));
|
||||
}
|
||||
|
||||
$versionResult = $this->ci->ContentspracheModel->getOne($content_id, $sprache, $version);
|
||||
if (isError($versionResult))
|
||||
return $versionResult;
|
||||
$row = getData($versionResult);
|
||||
|
||||
$this->ci->db->trans_start();
|
||||
|
||||
$this->ci->ContentlogModel->deleteByContentsprache($row->contentsprache_id);
|
||||
$this->ci->ContentspracheModel->deleteVersion($content_id, $sprache, $version);
|
||||
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
return error($this->ci->p->t('cms', 'loeschenFehlgeschlagen'));
|
||||
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
@@ -42,12 +42,10 @@ class CmsLib
|
||||
* @param int $version
|
||||
* @param string $sprache
|
||||
* @param boolean $sichtbar
|
||||
* @param boolean $log false suppresses the click log entry. The CMS admin
|
||||
* preview renders a content without counting a view.
|
||||
*
|
||||
* @return stdClass
|
||||
*/
|
||||
public function getContent($content_id, $version = null, $sprache = null, $sichtbar = true, $log = true)
|
||||
public function getContent($content_id, $version = null, $sprache = null, $sichtbar = true)
|
||||
{
|
||||
if (!is_numeric($content_id))
|
||||
return error('ContentID ist ungueltig');
|
||||
@@ -74,7 +72,7 @@ class CmsLib
|
||||
return $content;
|
||||
|
||||
// Legt einen Logeintrag für die Klickstatistik an
|
||||
if ($log && defined('LOG_CONTENT') && LOG_CONTENT) {
|
||||
if (defined('LOG_CONTENT') && LOG_CONTENT) {
|
||||
// Nur eingeloggte User werden geloggt, das sonst auch alle Infoscreenaufrufe und dgl. mitgeloggt werden
|
||||
if (isLogged()) {
|
||||
$request_data = 'content_id=' . $content_id;
|
||||
|
||||
@@ -0,0 +1,384 @@
|
||||
<?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 FehlerUpdateLib
|
||||
{
|
||||
// Who adds phrases into the database
|
||||
const UPSERT_BY = 'FehlerUpdate';
|
||||
|
||||
const CONFIG_DIRECTORY = 'config';
|
||||
const CONFIG_FEHLER_NAME = 'fehler';
|
||||
const CONFIG_FEHLER_INDEX = 'fehler';
|
||||
|
||||
const TYPE_STRING = 'string';
|
||||
const TYPE_ARRAY = 'array';
|
||||
|
||||
//~ // Array elements names
|
||||
const FEHLERCODE = 'fehlercode';
|
||||
const FEHLER_KURZBZ = 'fehler_kurzbz';
|
||||
const FEHLERTEXT = 'fehlertext';
|
||||
const FEHLERTYP_KURZBZ = 'fehlertyp_kurzbz';
|
||||
const APP = 'app';
|
||||
const FEHLERCODE_EXTERN = 'fehlercode_extern';
|
||||
|
||||
// structure of a fehler
|
||||
// type default: string
|
||||
const FEHLER_ATTRIBUTES = [
|
||||
self::FEHLERCODE => ['required' => true],
|
||||
self::FEHLER_KURZBZ => ['required' => false],
|
||||
self::FEHLERTEXT => ['required' => true, 'updateable' => false],
|
||||
self::FEHLERTYP_KURZBZ => ['required' => false, 'updateable' => true],
|
||||
self::APP => ['required' => true, 'types' => [self::TYPE_STRING, self::TYPE_ARRAY]],
|
||||
self::FEHLERCODE_EXTERN => ['required' => false]
|
||||
];
|
||||
|
||||
private $_ci; // Code igniter instance
|
||||
private $_updateHistory = [];
|
||||
|
||||
/**
|
||||
* Loads parser library
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_ci =& get_instance();
|
||||
|
||||
// Loads EPrintfLib
|
||||
$this->_ci->load->library('EPrintfLib');
|
||||
|
||||
// Loads the Models
|
||||
$this->_ci->load->model('system/Fehler_model', 'FehlerModel');
|
||||
$this->_ci->load->model('system/App_model', 'AppModel');
|
||||
|
||||
// Loads extensions lib
|
||||
$this->_ci->load->library('ExtensionsLib');
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
|
||||
/**
|
||||
* Install all possible fehler, from core and extensions
|
||||
*/
|
||||
public function installAll()
|
||||
{
|
||||
$this->installFromCore();
|
||||
|
||||
// load fehler entries of extensions
|
||||
$extensions = $this->_ci->extensionslib->getInstalledExtensions();
|
||||
|
||||
if (hasData($extensions))
|
||||
{
|
||||
$extensionArray = array();
|
||||
|
||||
$extensionsData = getData($extensions);
|
||||
|
||||
foreach ($extensionsData as $ext)
|
||||
{
|
||||
$this->installFrom($ext->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install fehler from the core
|
||||
*/
|
||||
public function installFromCore()
|
||||
{
|
||||
$this->_installFehler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Install fehler from the given path
|
||||
*/
|
||||
public function installFrom($extensionName)
|
||||
{
|
||||
if (!isset($extensionName))
|
||||
{
|
||||
$this->_ci->eprintflib->printError('Extension name missing!');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_installFehler(ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName.'/'.FehlerUpdateLib::CONFIG_FEHLER_NAME);
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Install fehler from the given directory
|
||||
*/
|
||||
private function _installFehler($fehlerConfigDirectory = null)
|
||||
{
|
||||
// check that fehler config file exists
|
||||
$configDir = isset($fehlerConfigDirectory) ? $fehlerConfigDirectory : self::CONFIG_FEHLER_NAME;
|
||||
|
||||
$configFilename = APPPATH.self::CONFIG_DIRECTORY.'/'.$configDir.'.php';
|
||||
|
||||
if (!file_exists($configFilename))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Load Fehler Entries
|
||||
$this->_ci->load->config($configDir);
|
||||
$configArray = $this->_ci->config->item(self::CONFIG_FEHLER_INDEX);
|
||||
|
||||
if (!isset($configArray) || !is_array($configArray)) // check if fehler config entries could be loaded
|
||||
{
|
||||
$this->_ci->eprintflib->printError(
|
||||
'Fehler config array could not be loaded, directory '.$configDir.' index '.self::CONFIG_FEHLER_INDEX
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_ci->eprintflib->printInfo('------------------------------------------------------------------------------------------');
|
||||
$this->_ci->eprintflib->printInfo('Fehler installation started, directory '.$configDir);
|
||||
|
||||
foreach ($configArray as $idx => $configEntry)
|
||||
{
|
||||
// create fehler from config entry
|
||||
$createFehlerResult = $this->_createFehlerFromEntry($configEntry);
|
||||
|
||||
// write error if creation failed
|
||||
if (isError($createFehlerResult))
|
||||
{
|
||||
$this->_ci->eprintflib->printError(
|
||||
getError($createFehlerResult).', directory '.$configDir.', index '.$idx
|
||||
);
|
||||
}
|
||||
elseif (hasData($createFehlerResult))
|
||||
{
|
||||
// add fehler to db
|
||||
$addFehlerResult = $this->_updateFehler(getData($createFehlerResult));
|
||||
|
||||
if (isError($addFehlerResult))
|
||||
{
|
||||
$this->_ci->eprintflib->printError(
|
||||
getError($addFehlerResult).', directory'.$configDir.', index '.$idx
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->_ci->eprintflib->printInfo('Fehler installation ended');
|
||||
$this->_ci->eprintflib->printInfo('------------------------------------------------------------------------------------------');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new fehler to the database
|
||||
*/
|
||||
private function _updateFehler($fehler)
|
||||
{
|
||||
$fehlerReferences = $fehler['references'];
|
||||
$fehler = $fehler['fehler'];
|
||||
|
||||
// Checks if the fehler already exists in the database
|
||||
$this->_ci->FehlerModel->db->where(self::FEHLERCODE.' = ', $fehler[self::FEHLERCODE]);
|
||||
if (isset($fehler[self::FEHLER_KURZBZ]) && !isEmptyString($fehler[self::FEHLER_KURZBZ]))
|
||||
$this->_ci->FehlerModel->db->or_where(self::FEHLER_KURZBZ.' = ', $fehler[self::FEHLER_KURZBZ]);
|
||||
$fehlerResult = $this->_ci->FehlerModel->load();
|
||||
|
||||
// If an error occurred then return the error itself
|
||||
if (isError($fehlerResult)) return $fehlerResult;
|
||||
|
||||
$updateRes = null;
|
||||
|
||||
// if fehler has been found
|
||||
if (hasData($fehlerResult))
|
||||
{
|
||||
$foundFehler = getData($fehlerResult)[0];
|
||||
|
||||
// check if fehlercode - fehler kurzbz combination is correct
|
||||
if ($foundFehler->{self::FEHLERCODE} != $fehler[self::FEHLERCODE]
|
||||
|| $foundFehler->{self::FEHLER_KURZBZ} != ($fehler[self::FEHLER_KURZBZ] ?? null)
|
||||
) {
|
||||
return error("Wrong fehlercode - fehler kurzbz combination: ".$fehler[self::FEHLERCODE].", ".$fehler[self::FEHLER_KURZBZ]);
|
||||
}
|
||||
|
||||
$this->_ci->eprintflib->printMessage(
|
||||
"Fehler ".$fehler[self::FEHLERCODE]
|
||||
.(isset($fehler[self::FEHLER_KURZBZ]) ? " (".$fehler[self::FEHLER_KURZBZ].")" : "")
|
||||
." already exists in database"
|
||||
);
|
||||
|
||||
$updateArr = [];
|
||||
|
||||
// update fehler, if needed
|
||||
foreach (self::FEHLER_ATTRIBUTES as $attributeName => $attributeInfo)
|
||||
{
|
||||
if (!array_key_exists($attributeName, $fehler)) continue;
|
||||
|
||||
// set attributes to be updated
|
||||
if (isset($attributeInfo['updateable']) && $attributeInfo['updateable'] && $foundFehler->{$attributeName} != $fehler[$attributeName])
|
||||
{
|
||||
$updateArr[$attributeName] = $fehler[$attributeName];
|
||||
|
||||
if (isset($this->_updateHistory[$foundFehler->{self::FEHLERCODE}][$attributeName])
|
||||
&& $this->_updateHistory[$foundFehler->{self::FEHLERCODE}][$attributeName] != $fehler[$attributeName]
|
||||
) {
|
||||
return error("Conflicting update values for attribute ".$attributeName.", fehler ".$foundFehler->{self::FEHLERCODE});
|
||||
}
|
||||
$this->_updateHistory[$foundFehler->{self::FEHLERCODE}][$attributeName] = $fehler[$attributeName];
|
||||
}
|
||||
}
|
||||
|
||||
if (!isEmptyArray($updateArr))
|
||||
{
|
||||
$updateRes = $this->_ci->FehlerModel->update(
|
||||
[self::FEHLERCODE => $foundFehler->{self::FEHLERCODE}],
|
||||
array_merge($updateArr, ['updateamum' => 'NOW()', 'updatevon' => self::UPSERT_BY])
|
||||
);
|
||||
if (isError($updateRes)) return $updateRes;
|
||||
|
||||
$this->_ci->eprintflib->printMessage(
|
||||
"Fehler ".$fehler[self::FEHLERCODE].(isset($fehler[self::FEHLER_KURZBZ]) ? " (".$fehler[self::FEHLER_KURZBZ].")" : "")." updated"
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no fehler has been found
|
||||
|
||||
// then add the fehler to the database
|
||||
$updateRes = $this->_ci->FehlerModel->insert(
|
||||
array_merge($fehler, ['insertamum' => 'NOW()', 'insertvon' => self::UPSERT_BY])
|
||||
);
|
||||
|
||||
// If an error occurred then return the error itself
|
||||
if (isError($updateRes)) return $updateRes;
|
||||
|
||||
// Prints info about the new added fehler
|
||||
$this->_ci->eprintflib->printMessage(
|
||||
sprintf(
|
||||
'A new fehler has been added into the database: '.
|
||||
'fehlercode => %s | fehler_kurzbz => %s | fehlertyp => %s',
|
||||
$fehler[self::FEHLERCODE],
|
||||
$fehler[self::FEHLER_KURZBZ],
|
||||
$fehler[self::FEHLERTYP_KURZBZ]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// handle references
|
||||
if (isset($fehlerReferences[self::APP]))
|
||||
{
|
||||
$this->_ci->load->model('system/FehlerApp_model', 'FehlerAppModel');
|
||||
$apps = $fehlerReferences[self::APP];
|
||||
|
||||
// load all assigned apps
|
||||
$this->_ci->FehlerAppModel->addSelect(self::APP);
|
||||
$fehlerAppRes = $this->_ci->FehlerAppModel->loadWhere([self::FEHLERCODE => $fehler[self::FEHLERCODE]]);
|
||||
|
||||
$fehlerApps = hasData($fehlerAppRes) ? array_column(getData($fehlerAppRes), self::APP) : [];
|
||||
|
||||
$appsToInsert = array_diff($apps, $fehlerApps);
|
||||
|
||||
foreach ($appsToInsert as $app)
|
||||
{
|
||||
// check if app exists in db
|
||||
$fehlerAppsInsertRes = $this->_ci->FehlerAppModel->insert(
|
||||
[self::FEHLERCODE => $fehler[self::FEHLERCODE], self::APP => $app, 'insertamum' => 'NOW()', 'insertvon' => self::UPSERT_BY]
|
||||
);
|
||||
|
||||
if (isError($fehlerAppsInsertRes)) return $fehlerAppsInsertRes;
|
||||
|
||||
$this->_ci->eprintflib->printMessage(
|
||||
"Added app ".$app." to fehler ".$fehler[self::FEHLERCODE]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// If here then no blocking errors occurred
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an array with fehler data from config entry
|
||||
*/
|
||||
private function _createFehlerFromEntry($configEntry)
|
||||
{
|
||||
$fehler = ['fehler' => [], 'references' => []];
|
||||
foreach (self::FEHLER_ATTRIBUTES as $attributeName => $attributeInfo)
|
||||
{
|
||||
$required = isset($attributeInfo['required']) && $attributeInfo['required'];
|
||||
if (!isset($configEntry[$attributeName]))
|
||||
{
|
||||
if ($required) return error('attribute'.$attributeName.' is missing');
|
||||
continue;
|
||||
}
|
||||
|
||||
$attributeValue = $configEntry[$attributeName];
|
||||
$validType = false;
|
||||
if (isset($attributeInfo['types']) && is_array($attributeInfo['types']))
|
||||
{
|
||||
foreach ($attributeInfo['types'] as $type)
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case self::TYPE_STRING:
|
||||
if (is_string($attributeValue) || is_null($attributeValue)) $validType = true;
|
||||
break;
|
||||
case self::TYPE_ARRAY:
|
||||
if (is_array($attributeValue) && !($required && isEmptyArray($attributeValue))) $validType = true;
|
||||
break;
|
||||
//~ default:
|
||||
//~ if (is_string($configEntry[$attributeName]) || is_null($configEntry[$attributeName])) $validType = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$validType = is_string($attributeValue) || is_null($attributeValue);
|
||||
}
|
||||
|
||||
if (!$validType)
|
||||
{
|
||||
return error('attribute'.$attributeName.' has invalid type');
|
||||
}
|
||||
|
||||
if ($attributeName == self::APP)
|
||||
{
|
||||
if (is_string($attributeValue)) $attributeValue = [$attributeValue];
|
||||
|
||||
foreach ($attributeValue as $app)
|
||||
{
|
||||
// check if app exists in db
|
||||
$this->_ci->AppModel->addSelect('1');
|
||||
$appRes = $this->_ci->AppModel->loadWhere(['app' => $app]);
|
||||
|
||||
if (!hasData($appRes)) return error("App ".$app." does not exist");
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($attributeInfo['types']) && is_array($attributeInfo['types']) && in_array(self::TYPE_ARRAY, $attributeInfo['types']))
|
||||
{
|
||||
$fehler['references'][$attributeName] = $attributeValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$fehler['fehler'][$attributeName] = $attributeValue;
|
||||
}
|
||||
|
||||
}
|
||||
return success($fehler);
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,10 @@ class IssuesLib
|
||||
const ERRORTYPE_CODE = 'error';
|
||||
const WARNINGTYPE_CODE = 'warning';
|
||||
|
||||
const STATUS_KURZBZ = 'status_kurzbz';
|
||||
const VERARBEITET_AMUM = 'verarbeitetamum';
|
||||
const VERARBEITET_VON = 'verarbeitetvon';
|
||||
|
||||
public function __construct($params = null)
|
||||
{
|
||||
$this->_ci =& get_instance();
|
||||
@@ -91,12 +95,16 @@ class IssuesLib
|
||||
return error("fehlercode_extern missing");
|
||||
|
||||
// get external fehlercode (unique for each app)
|
||||
$this->_ci->FehlerModel->addSelect('fehlercode');
|
||||
$fehlerRes = $this->_ci->FehlerModel->loadWhere(
|
||||
array(
|
||||
'fehlercode_extern' => $fehlercode_extern,
|
||||
'app' => $this->_app
|
||||
)
|
||||
$fehlerRes = $this->_ci->FehlerModel->execReadOnlyQuery(
|
||||
'
|
||||
SELECT
|
||||
fehlercode
|
||||
FROM
|
||||
system.tbl_fehler fe
|
||||
WHERE
|
||||
fehlercode_extern = ?
|
||||
AND EXISTS (SELECT 1 FROM system.tbl_fehler_app WHERE fehlercode = fe.fehlercode AND app = ?)',
|
||||
[$fehlercode_extern, $this->_app]
|
||||
);
|
||||
|
||||
if (isError($fehlerRes))
|
||||
@@ -105,8 +113,10 @@ class IssuesLib
|
||||
// check if there is a predefined custom error for the external issue
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
$fehlerData = getData($fehlerRes)[0];
|
||||
// if found, use the code
|
||||
$fehlerData = getData($fehlerRes);
|
||||
if (count($fehlerData) > 1) return error("Multiple fehlercode_extern ".$fehlercode_extern. " for app ".$this->_app);
|
||||
$fehlerData = getData($fehlerRes)[0];
|
||||
$fehlercode = $fehlerData->fehlercode;
|
||||
}
|
||||
else
|
||||
@@ -128,9 +138,9 @@ class IssuesLib
|
||||
public function setBehoben($issue_id, $user)
|
||||
{
|
||||
$data = array(
|
||||
'status_kurzbz' => self::STATUS_BEHOBEN,
|
||||
'verarbeitetvon' => $user,
|
||||
'verarbeitetamum' => date('Y-m-d H:i:s')
|
||||
self::STATUS_KURZBZ => self::STATUS_BEHOBEN,
|
||||
self::VERARBEITET_VON => $user,
|
||||
self::VERARBEITET_AMUM => date('Y-m-d H:i:s')
|
||||
);
|
||||
|
||||
return $this->_changeIssueStatus($issue_id, $data, $user);
|
||||
@@ -145,8 +155,8 @@ class IssuesLib
|
||||
public function setInBearbeitung($issue_id, $user)
|
||||
{
|
||||
$data = array(
|
||||
'status_kurzbz' => self::STATUS_IN_BEARBEITUNG,
|
||||
'verarbeitetvon' => $user
|
||||
self::STATUS_KURZBZ => self::STATUS_IN_BEARBEITUNG,
|
||||
self::VERARBEITET_VON => $user
|
||||
);
|
||||
|
||||
return $this->_changeIssueStatus($issue_id, $data, $user);
|
||||
@@ -161,9 +171,9 @@ class IssuesLib
|
||||
public function setNeu($issue_id, $user)
|
||||
{
|
||||
$data = array(
|
||||
'status_kurzbz' => self::STATUS_NEU,
|
||||
'verarbeitetvon' => null,
|
||||
'verarbeitetamum' => null
|
||||
self::STATUS_KURZBZ => self::STATUS_NEU,
|
||||
self::VERARBEITET_VON => null,
|
||||
self::VERARBEITET_AMUM => null
|
||||
);
|
||||
|
||||
return $this->_changeIssueStatus($issue_id, $data, $user);
|
||||
@@ -185,13 +195,18 @@ class IssuesLib
|
||||
return error("Issue Id must be set correctly.");
|
||||
|
||||
// check if given status is same as existing
|
||||
$this->_ci->IssueModel->addSelect('status_kurzbz');
|
||||
$this->_ci->IssueModel->addSelect(self::STATUS_KURZBZ.', '.self::VERARBEITET_AMUM);
|
||||
$currStatus = $this->_ci->IssueModel->load($issue_id);
|
||||
|
||||
if (hasData($currStatus))
|
||||
{
|
||||
if (getData($currStatus)[0]->status_kurzbz == $data['status_kurzbz'])
|
||||
$currStatusData = getData($currStatus)[0];
|
||||
// if same status set, and verarbeitet amum is not being newly set
|
||||
if ($currStatusData->{self::STATUS_KURZBZ} == $data[self::STATUS_KURZBZ]
|
||||
&& !(isset($data[self::VERARBEITET_AMUM]) && !isset($currStatusData->{self::VERARBEITET_AMUM}))
|
||||
) {
|
||||
return success("Same status already set");
|
||||
}
|
||||
}
|
||||
else
|
||||
return error("Error when getting status");
|
||||
@@ -227,11 +242,10 @@ class IssuesLib
|
||||
$fehlercode_extern = null,
|
||||
$inhalt_extern = null
|
||||
) {
|
||||
if (isEmptyString($person_id) && isEmptyString($oe_kurzbz))
|
||||
return error("Person_id or oe_kurzbz must be set.");
|
||||
if (!is_numeric($person_id) && isEmptyString($oe_kurzbz)) return error("Person_id or oe_kurzbz must be set, fehlercode: $fehlercode");
|
||||
|
||||
// get fehlertextVorlage and replace it with params
|
||||
$fehlerRes = $this->_ci->FehlerModel->load($fehlercode);
|
||||
$fehlerRes = $this->_ci->FehlerModel->loadWhere(['fehlercode' => $fehlercode]);
|
||||
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
@@ -241,7 +255,7 @@ class IssuesLib
|
||||
if (!isEmptyArray($fehlertext_params))
|
||||
{
|
||||
if (count($fehlertext_params) != substr_count($fehlertextVorlage, '%s'))
|
||||
return error('Wrong number of parameters for Fehlertext, fehler_kurzbz ' . $fehlercode);
|
||||
return error('Wrong number of parameters for Fehlertext, fehlercode ' . $fehlercode);
|
||||
|
||||
$fehlertext = vsprintf($fehlertextVorlage, $fehlertext_params);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ use \DateTime as DateTime;
|
||||
use \DateTimeZone as DateTimeZone;
|
||||
use \DateInterval as DateInterval;
|
||||
use \DatePeriod as DatePeriod;
|
||||
use CI3_Events as Events;
|
||||
|
||||
class StundenplanLib
|
||||
{
|
||||
@@ -95,13 +94,13 @@ class StundenplanLib
|
||||
if (isError($benutzer_gruppen))
|
||||
return $benutzer_gruppen;
|
||||
$benutzer_gruppen = getData($benutzer_gruppen);
|
||||
$this->_ci->addMeta('spezialgruppen', $benutzer_gruppen);
|
||||
|
||||
// getting the student_lehrverbaende of the student in the different studiensemester
|
||||
$student_lehrverband = $this->fetchStudentlehrverbandFromStudiensemester($student_uid, $semester_range);
|
||||
if (isError($student_lehrverband))
|
||||
return $student_lehrverband;
|
||||
$student_lehrverband = getData($student_lehrverband);
|
||||
$this->_ci->addMeta('studentlehrvebaende', $student_lehrverband);
|
||||
|
||||
$stundenplan_query = $this->_ci->StundenplanModel->getStundenplanQuery(
|
||||
$start,
|
||||
$end,
|
||||
@@ -144,7 +143,7 @@ class StundenplanLib
|
||||
return $stundenplan_data;
|
||||
$stundenplan_data = getData($stundenplan_data) ?? [];
|
||||
|
||||
$function_error = $this->expandObjectInformation($stundenplan_data, true);
|
||||
$function_error = $this->expandObjectInformation($stundenplan_data);
|
||||
if ($function_error)
|
||||
return $function_error;
|
||||
|
||||
@@ -304,7 +303,7 @@ class StundenplanLib
|
||||
return success($lektoren);
|
||||
}
|
||||
|
||||
public function expandObjectInformation($data, $callExtensionsEvent = false)
|
||||
public function expandObjectInformation($data)
|
||||
{
|
||||
$this->_ci =& get_instance();
|
||||
|
||||
@@ -393,20 +392,6 @@ class StundenplanLib
|
||||
$item->lektor = $lektor_obj_array;
|
||||
|
||||
}
|
||||
|
||||
// info retrieved from extensions might not be necessary for some stundenplan use cases so the event
|
||||
// will be gated behind this flag
|
||||
|
||||
if($callExtensionsEvent) {
|
||||
Events::trigger(
|
||||
'extendStundenplanData',
|
||||
function & () use (&$data)
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function fetchFerienTageEvents($start_date, $end_date, $studiengang_kz)
|
||||
@@ -647,7 +632,6 @@ class StundenplanLib
|
||||
$result->semester = $item->semester;
|
||||
$result->verband = $item->verband;
|
||||
$result->gruppe = $item->gruppe;
|
||||
$result->studiensemester_kurzbz = $item->studiensemester_kurzbz;
|
||||
return $result;
|
||||
},
|
||||
$lehrverband_query_result);
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
use \DOMDocument as DOMDocument;
|
||||
|
||||
class XsdSchemaLib
|
||||
{
|
||||
private $ci;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an XSD into a field schema.
|
||||
* @param string $xsd the XSD as a string
|
||||
* @param string $templateKurzbz short name of the template
|
||||
* @return object success(array) with template_kurzbz, root, fields
|
||||
*/
|
||||
public function parseSchema($xsd, $templateKurzbz)
|
||||
{
|
||||
libxml_use_internal_errors(true);
|
||||
$dom = new DOMDocument();
|
||||
|
||||
if (!$dom->loadXML($xsd))
|
||||
{
|
||||
libxml_clear_errors();
|
||||
return error($this->ci->p->t('cms', 'xsdUngueltig'));
|
||||
}
|
||||
|
||||
libxml_clear_errors();
|
||||
|
||||
$root = null;
|
||||
$fields = array();
|
||||
$this->_walkElements($dom->documentElement, $root, $fields);
|
||||
|
||||
return success(array(
|
||||
'template_kurzbz' => $templateKurzbz,
|
||||
'root' => $root,
|
||||
'fields' => $fields
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the values of a content from the XML.
|
||||
* @param string $xml the value of tbl_contentsprache.content
|
||||
* @param array $schema the result of parseSchema
|
||||
* @return object success(array) field name => value
|
||||
*/
|
||||
public function extractValues($xml, $schema)
|
||||
{
|
||||
$values = array();
|
||||
|
||||
foreach ($schema['fields'] as $field)
|
||||
{
|
||||
$values[$field['name']] = '';
|
||||
}
|
||||
|
||||
if ($xml === null || trim($xml) === '')
|
||||
{
|
||||
return success($values);
|
||||
}
|
||||
|
||||
libxml_use_internal_errors(true);
|
||||
$dom = new DOMDocument();
|
||||
|
||||
if (!$dom->loadXML($xml))
|
||||
{
|
||||
libxml_clear_errors();
|
||||
return success($values);
|
||||
}
|
||||
|
||||
libxml_clear_errors();
|
||||
|
||||
foreach ($schema['fields'] as $field)
|
||||
{
|
||||
$nodes = $dom->getElementsByTagName($field['name']);
|
||||
if ($nodes->length > 0)
|
||||
{
|
||||
$values[$field['name']] = $nodes->item(0)->nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
return success($values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the XML from the values.
|
||||
* @param array $schema the result of parseSchema
|
||||
* @param array $values field name => value
|
||||
* @return object success(string) the XML
|
||||
*/
|
||||
public function buildXml($schema, $values)
|
||||
{
|
||||
$xml = '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
$xml .= "\n<" . $schema['root'] . '>';
|
||||
|
||||
foreach ($schema['fields'] as $field)
|
||||
{
|
||||
$value = isset($values[$field['name']]) ? $values[$field['name']] : '';
|
||||
$xml .= "\n<" . $field['name'] . '><![CDATA[' . $this->_escapeCdata($value) . ']]></' . $field['name'] . '>';
|
||||
}
|
||||
|
||||
$xml .= "\n</" . $schema['root'] . '>';
|
||||
|
||||
libxml_use_internal_errors(true);
|
||||
$check = new DOMDocument();
|
||||
|
||||
if (!$check->loadXML($xml))
|
||||
{
|
||||
libxml_clear_errors();
|
||||
return error($this->ci->p->t('cms', 'xmlUngueltig'));
|
||||
}
|
||||
|
||||
libxml_clear_errors();
|
||||
|
||||
return success($xml);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Walks xs:element nodes recursively.
|
||||
* The first element without a type attribute is the root.
|
||||
* Elements with a type attribute are fields.
|
||||
* xs:complexType and xs:sequence are traversed and ignored.
|
||||
*/
|
||||
private function _walkElements($node, &$root, &$fields)
|
||||
{
|
||||
if ($node->nodeType !== XML_ELEMENT_NODE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$localName = $node->localName;
|
||||
|
||||
if ($localName === 'element')
|
||||
{
|
||||
$typeAttr = $node->getAttribute('type');
|
||||
|
||||
if ($typeAttr === '')
|
||||
{
|
||||
if ($root === null)
|
||||
{
|
||||
$root = $node->getAttribute('name');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$minOccurs = $node->getAttribute('minOccurs');
|
||||
$required = ($minOccurs === '') ? true : ((int)$minOccurs > 0);
|
||||
|
||||
$fields[] = array(
|
||||
'name' => $node->getAttribute('name'),
|
||||
'type' => $this->_mapType($typeAttr),
|
||||
'required' => $required
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($node->childNodes as $child)
|
||||
{
|
||||
$this->_walkElements($child, $root, $fields);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps an XSD type to the field schema type.
|
||||
*/
|
||||
private function _mapType($xsdType)
|
||||
{
|
||||
$map = array(
|
||||
'xs:string' => 'string',
|
||||
'xs:decimal' => 'string',
|
||||
'xs:integer' => 'string',
|
||||
'xs:positiveInteger' => 'string',
|
||||
'xs:date' => 'date',
|
||||
'wysiwyg' => 'wysiwyg',
|
||||
'file' => 'file',
|
||||
'boolean' => 'boolean'
|
||||
);
|
||||
|
||||
return isset($map[$xsdType]) ? $map[$xsdType] : 'string';
|
||||
}
|
||||
|
||||
// Escapes ]]> in the value. The legacy code does not do this and writes broken XML.
|
||||
private function _escapeCdata($value)
|
||||
{
|
||||
return str_replace(']]>', ']]]]><![CDATA[>', $value);
|
||||
}
|
||||
}
|
||||
@@ -9,48 +9,40 @@ class PlausicheckDefinitionLib
|
||||
{
|
||||
// set fehler for core plausichecks
|
||||
// structure: fehler_kurzbz => class (library) name for resolving
|
||||
private $_fehlerLibMappings = array(
|
||||
'AbbrecherAktiv' => 'AbbrecherAktiv',
|
||||
'AbschlussstatusFehlt' => 'AbschlussstatusFehlt',
|
||||
'AktSemesterNull' => 'AktSemesterNull',
|
||||
'AktiverStudentOhneStatus' => 'AktiverStudentOhneStatus',
|
||||
'AusbildungssemPrestudentUngleichAusbildungssemStatus' => 'AusbildungssemPrestudentUngleichAusbildungssemStatus',
|
||||
'DatumAbschlusspruefungFehlt' => 'DatumAbschlusspruefungFehlt',
|
||||
'DatumSponsionFehlt' => 'DatumSponsionFehlt',
|
||||
'DatumStudiensemesterFalscheReihenfolge' => 'DatumStudiensemesterFalscheReihenfolge',
|
||||
'FalscheAnzahlAbschlusspruefungen' => 'FalscheAnzahlAbschlusspruefungen',
|
||||
'FalscheAnzahlHeimatadressen' => 'FalscheAnzahlHeimatadressen',
|
||||
'FalscheAnzahlZustelladressen' => 'FalscheAnzahlZustelladressen',
|
||||
'GbDatumWeitZurueck' => 'GbDatumWeitZurueck',
|
||||
'InaktiverStudentAktiverStatus' => 'InaktiverStudentAktiverStatus',
|
||||
'IncomingHeimatNationOesterreich' => 'IncomingHeimatNationOesterreich',
|
||||
'IncomingOhneIoDatensatz' => 'IncomingOhneIoDatensatz',
|
||||
'IncomingOrGsFoerderrelevant' => 'IncomingOrGsFoerderrelevant',
|
||||
'InskriptionVorLetzerBismeldung' => 'InskriptionVorLetzerBismeldung',
|
||||
'NationNichtOesterreichAberGemeinde' => 'NationNichtOesterreichAberGemeinde',
|
||||
'OrgformStgUngleichOrgformPrestudent' => 'OrgformStgUngleichOrgformPrestudent',
|
||||
'PrestudentMischformOhneOrgform' => 'PrestudentMischformOhneOrgform',
|
||||
'StgPrestudentUngleichStgStudienplan' => 'StgPrestudentUngleichStgStudienplan',
|
||||
'StgPrestudentUngleichStgStudent' => 'StgPrestudentUngleichStgStudent',
|
||||
'StudentstatusNachAbbrecher' => 'StudentstatusNachAbbrecher',
|
||||
private $_fehlerKurzbz = array(
|
||||
'AbbrecherAktiv',
|
||||
'AbschlussstatusFehlt',
|
||||
'AktSemesterNull',
|
||||
'AktiverStudentOhneStatus',
|
||||
'AusbildungssemPrestudentUngleichAusbildungssemStatus',
|
||||
'DatumAbschlusspruefungFehlt',
|
||||
'DatumSponsionFehlt',
|
||||
'DatumStudiensemesterFalscheReihenfolge',
|
||||
'FalscheAnzahlAbschlusspruefungen',
|
||||
'FalscheAnzahlHeimatadressen',
|
||||
'FalscheAnzahlZustelladressen',
|
||||
'GbDatumWeitZurueck',
|
||||
'InaktiverStudentAktiverStatus',
|
||||
'IncomingHeimatNationOesterreich',
|
||||
'IncomingOhneIoDatensatz',
|
||||
'IncomingOrGsFoerderrelevant',
|
||||
'InskriptionVorLetzerBismeldung',
|
||||
'NationNichtOesterreichAberGemeinde',
|
||||
'OrgformStgUngleichOrgformPrestudent',
|
||||
'PrestudentMischformOhneOrgform',
|
||||
'StgPrestudentUngleichStgStudienplan',
|
||||
'StgPrestudentUngleichStgStudent',
|
||||
'StudentstatusNachAbbrecher',
|
||||
'DualesStudiumOhneMarkierung' => 'DualesStudiumOhneMarkierung'
|
||||
//'StudienplanUngueltig' => 'StudienplanUngueltig'
|
||||
//'BewerberNichtZumRtAngetreten' => 'BewerberNichtZumRtAngetreten'
|
||||
//'StudienplanUngueltig',
|
||||
//'BewerberNichtZumRtAngetreten'
|
||||
);
|
||||
|
||||
/**
|
||||
* Gets all fehler_kurzbz-library mappings for fehler which need to be checked.
|
||||
*/
|
||||
public function getFehlerLibMappings()
|
||||
{
|
||||
return $this->_fehlerLibMappings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all fehler_kurzbz for fehler which need to be checked.
|
||||
*/
|
||||
public function getFehlerKurzbz()
|
||||
{
|
||||
return array_keys($this->_fehlerLibMappings);
|
||||
return $this->_fehlerKurzbz;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,36 +6,43 @@ class PlausicheckProducerLib
|
||||
{
|
||||
const CI_PATH = 'application';
|
||||
const CI_LIBRARY_FOLDER = 'libraries';
|
||||
const EXTENSIONS_FOLDER = 'extensions';
|
||||
const PLAUSI_ISSUES_FOLDER = 'issues/plausichecks';
|
||||
const EXECUTE_PLAUSI_CHECK_METHOD_NAME = 'executePlausiCheck';
|
||||
const CONFIG_FEHLER_NAME = 'fehler';
|
||||
const CONFIG_FEHLER_INDEX = 'fehler';
|
||||
const FEHLER_KURZBZ_NAME = 'fehler_kurzbz';
|
||||
const PRODUCER_LIB_NAME = 'producerLibName';
|
||||
const EXTENSION_NAME = 'extensionName';
|
||||
|
||||
private $_ci; // ci instance
|
||||
private $_extensionName; // name of extension
|
||||
private $_konfiguration = []; // configuration parameters
|
||||
private $_fehlerKurzbz = []; // fehler to produce
|
||||
private $_fehlerLibMappings = []; // mappings of fehler and libraries for producing them
|
||||
private $_isForResolutionCheck = false; // mappings of fehler and libraries for producing them
|
||||
private $_apps = []; // apps of fehler to produce
|
||||
|
||||
public function __construct($params = null)
|
||||
{
|
||||
// set extension name if called from extension
|
||||
if (isset($params['extensionName'])) $this->_extensionName = $params['extensionName'];
|
||||
if (isset($params['fehlerLibMappings'])) $this->_fehlerLibMappings = $params['fehlerLibMappings'];
|
||||
if (isset($params['isForResolutionCheck'])) $this->_isForResolutionCheck = $params['isForResolutionCheck'];
|
||||
|
||||
// set application
|
||||
$app = isset($params['app']) ? $params['app'] : null;
|
||||
// set application(s))
|
||||
if (isset($params['apps']))
|
||||
{
|
||||
if (is_string($params['apps'])) $params['apps'] = [$params['apps']];
|
||||
if (is_array($params['apps'])) $this->_apps = $params['apps'];
|
||||
}
|
||||
|
||||
$this->_ci =& get_instance(); // get ci instance
|
||||
|
||||
// load libraries
|
||||
$this->_ci->load->library('IssuesLib');
|
||||
$this->_ci->load->library('ExtensionsLib');
|
||||
|
||||
// load models
|
||||
$this->_ci->load->model('system/Fehler_model', 'FehlerModel');
|
||||
$this->_ci->load->model('system/Fehlerkonfiguration_model', 'FehlerkonfigurationModel');
|
||||
|
||||
// get all configuration parameters for the application
|
||||
$fehlerkonfigurationRes = $this->_ci->FehlerkonfigurationModel->getKonfiguration($app);
|
||||
$this->_ci->load->config(self::CONFIG_FEHLER_NAME);
|
||||
|
||||
// get all configuration parameters for the application(s))
|
||||
$fehlerkonfigurationRes = $this->_ci->FehlerkonfigurationModel->getKonfiguration($this->_apps);
|
||||
|
||||
if (hasData($fehlerkonfigurationRes))
|
||||
{
|
||||
@@ -46,10 +53,88 @@ class PlausicheckProducerLib
|
||||
$this->_konfiguration[$fk->fehler_kurzbz][$fk->konfigurationstyp_kurzbz] = $fk->konfiguration;
|
||||
}
|
||||
}
|
||||
|
||||
// get all fehler to be produced (by kurzbz array or app)
|
||||
if (isset($params['fehlerKurzbz']) && !isEmptyArray($params['fehlerKurzbz']))
|
||||
{
|
||||
$this->_fehlerKurzbz = $params['fehlerKurzbz'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// get fehler by apps
|
||||
$fehlerRes = $this->_ci->FehlerModel->getByApps($this->_apps);
|
||||
|
||||
if (hasData($fehlerRes)) $this->_fehlerKurzbz = array_column(getData($fehlerRes), 'fehler_kurzbz');
|
||||
}
|
||||
|
||||
// get producer file paths for the fehler
|
||||
|
||||
// Load Fehler Entries of Core
|
||||
$configArray = $this->_ci->config->item(self::CONFIG_FEHLER_INDEX);
|
||||
|
||||
if (isset($configArray) && is_array($configArray))
|
||||
{
|
||||
foreach ($configArray as $coreEntry)
|
||||
{
|
||||
if (!isset($coreEntry[self::FEHLER_KURZBZ_NAME])
|
||||
|| !isset($coreEntry[self::PRODUCER_LIB_NAME])
|
||||
|| !in_array($coreEntry[self::FEHLER_KURZBZ_NAME], $this->_fehlerKurzbz)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->_fehlerLibMappings[$coreEntry[self::FEHLER_KURZBZ_NAME]][self::PRODUCER_LIB_NAME] = $coreEntry[self::PRODUCER_LIB_NAME];
|
||||
}
|
||||
}
|
||||
|
||||
// load fehler entries of extensions
|
||||
$extensions = $this->_ci->extensionslib->getInstalledExtensions();
|
||||
|
||||
if (hasData($extensions))
|
||||
{
|
||||
$extensionArray = array();
|
||||
|
||||
$extensionsData = getData($extensions);
|
||||
|
||||
foreach ($extensionsData as $ext)
|
||||
{
|
||||
$configFilePath = ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/'.self::CONFIG_FEHLER_NAME.'.php';
|
||||
$configFilename = APPPATH.'config/'.$configFilePath;
|
||||
|
||||
// if fehler config file exists in extension
|
||||
if (file_exists($configFilename))
|
||||
{
|
||||
$config = array(); // default value
|
||||
|
||||
// include the config file
|
||||
include($configFilename);
|
||||
|
||||
if (isset($config[self::CONFIG_FEHLER_NAME]) && is_array($config[self::CONFIG_FEHLER_NAME]))
|
||||
{
|
||||
foreach ($config[self::CONFIG_FEHLER_NAME] as $extensionEntry)
|
||||
{
|
||||
if (
|
||||
!isset($extensionEntry[self::FEHLER_KURZBZ_NAME])
|
||||
|| !isset($extensionEntry[self::PRODUCER_LIB_NAME])
|
||||
|| !in_array($extensionEntry[self::FEHLER_KURZBZ_NAME], $this->_fehlerKurzbz)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// add extension config data to fehler lib mappings
|
||||
$fehler_kurzbz = $extensionEntry[self::FEHLER_KURZBZ_NAME];
|
||||
|
||||
$this->_fehlerLibMappings[$fehler_kurzbz][self::PRODUCER_LIB_NAME] = $extensionEntry[self::PRODUCER_LIB_NAME];
|
||||
$this->_fehlerLibMappings[$fehler_kurzbz][self::EXTENSION_NAME] = $ext->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces multiple plausicheck issues at once and saved them to db.
|
||||
* Produces multiple plausicheck issues at once, and saves them in the database.
|
||||
* @param array $params passed to each plausicheck
|
||||
* @return result object with occured error and info
|
||||
*/
|
||||
@@ -59,10 +144,17 @@ class PlausicheckProducerLib
|
||||
$result->errors = [];
|
||||
$result->infos = [];
|
||||
|
||||
foreach ($this->_fehlerLibMappings as $fehler_kurzbz => $libName)
|
||||
$mappingFehlerKurbz = array_keys($this->_fehlerLibMappings);
|
||||
|
||||
// check if all issues to produce could be found in database
|
||||
//~ $notFoundFehlerKurzbz = array_diff($this->_fehlerKurzbz, $mappingFehlerKurbz);
|
||||
|
||||
//~ if (!isEmptyArray($notFoundFehlerKurzbz))
|
||||
//~ $result->errors[] = error('Fehler to produce not defined in config: '.implode(', ', $notFoundFehlerKurzbz));
|
||||
|
||||
foreach ($mappingFehlerKurbz as $fehler_kurzbz)
|
||||
{
|
||||
$plausicheckRes = $this->producePlausicheckIssue(
|
||||
$libName,
|
||||
$fehler_kurzbz,
|
||||
$params
|
||||
);
|
||||
@@ -96,14 +188,23 @@ class PlausicheckProducerLib
|
||||
|
||||
/**
|
||||
* Executes plausicheck using a given library, returns the result.
|
||||
* @param $libName string name of library producing the issue
|
||||
* @param $fehler_kurzbz string unique short name of fehler, for which issue is produced
|
||||
* @param $params parameters passed to issue production method
|
||||
*/
|
||||
public function producePlausicheckIssue($libName, $fehler_kurzbz, $params)
|
||||
public function producePlausicheckIssue($fehler_kurzbz, $params)
|
||||
{
|
||||
//if (!isset($this->_fehlerLibMappings[$fehler_kurzbz])) return error("Mapping for Fehler " . $fehler_kurzbz . " was not found");
|
||||
if (!isset($this->_fehlerLibMappings[$fehler_kurzbz])) return success(null);
|
||||
|
||||
$mapping = $this->_fehlerLibMappings[$fehler_kurzbz];
|
||||
|
||||
if (!isset($mapping[self::PRODUCER_LIB_NAME]) || isEmptyString($mapping[self::PRODUCER_LIB_NAME]))
|
||||
return error("No producer lib name set for Fehler " . $fehler_kurzbz);
|
||||
|
||||
$libName = $mapping[self::PRODUCER_LIB_NAME];
|
||||
|
||||
// if called from extension (extension name set), path includes extension names
|
||||
$libRootPath = isset($this->_extensionName) ? self::EXTENSIONS_FOLDER . '/' . $this->_extensionName . '/' : '';
|
||||
$libRootPath = isset($mapping[self::EXTENSION_NAME]) ? ExtensionsLib::EXTENSIONS_DIR_NAME . '/' . $mapping[self::EXTENSION_NAME] . '/' : '';
|
||||
|
||||
// path for loading issue library
|
||||
$issuesLibPath = $libRootPath . self::PLAUSI_ISSUES_FOLDER . '/';
|
||||
@@ -121,7 +222,7 @@ class PlausicheckProducerLib
|
||||
// load library connected to fehlercode
|
||||
$this->_ci->load->library(
|
||||
$issuesLibPath . $libName,
|
||||
['configurationParams' => $config, 'isForResolutionCheck' => $this->_isForResolutionCheck]
|
||||
['configurationParams' => $config]
|
||||
);
|
||||
|
||||
$lowercaseLibName = mb_strtolower($libName);
|
||||
@@ -133,4 +234,13 @@ class PlausicheckProducerLib
|
||||
// call the function for checking for issue production
|
||||
return $this->_ci->{$lowercaseLibName}->{self::EXECUTE_PLAUSI_CHECK_METHOD_NAME}($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fehler kurzbz -> library mappings.
|
||||
* @return array with fehler kurzbz as key and fehlerinfo as values
|
||||
*/
|
||||
public function getFehlerMappings()
|
||||
{
|
||||
return $this->_fehlerLibMappings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,43 +9,177 @@ class PlausicheckResolverLib
|
||||
const EXTENSIONS_FOLDER = 'extensions';
|
||||
const ISSUE_RESOLVERS_FOLDER = 'issues/resolvers';
|
||||
const CHECK_ISSUE_RESOLVED_METHOD_NAME = 'checkIfIssueIsResolved';
|
||||
const CONFIG_FEHLER_NAME = 'fehler';
|
||||
const FEHLERCODE_NAME = 'fehlercode';
|
||||
const FEHLER_KURZBZ_NAME = 'fehler_kurzbz';
|
||||
const RESOLVER_LIB_NAME = 'resolverLibName';
|
||||
const PRODUCER_IS_RESOLVER_NAME = 'producerIsResolver';
|
||||
const EXTENSION_NAME = 'extensionName';
|
||||
|
||||
|
||||
private $_ci; // ci instance
|
||||
private $_extensionName; // name of extension
|
||||
private $_fehlercodes = []; // fehlercodes to resolve
|
||||
private $_apps = []; // apps for which issues should be resolved
|
||||
private $_codeLibMappings = []; // mappings for issues which explicitly defined resolver
|
||||
private $_codeProducerLibMappings = []; // mappings for issues which are resolved with the same check as they are produced
|
||||
private $_defaultIssueParams = ['issue_id' => 'issue_id', 'issue_person_id' => 'person_id', 'issue_oe_kurzbz' => 'oe_kurzbz'];
|
||||
|
||||
public function __construct($params = null)
|
||||
{
|
||||
// set extension name if called from extension
|
||||
if (isset($params['extensionName'])) $this->_extensionName = $params['extensionName'];
|
||||
if (isset($params['codeLibMappings'])) $this->_codeLibMappings = $params['codeLibMappings'];
|
||||
if (isset($params['codeProducerLibMappings'])) $this->_codeProducerLibMappings = $params['codeProducerLibMappings'];
|
||||
// set application(s))
|
||||
if (isset($params['apps']))
|
||||
{
|
||||
if (is_string($params['apps'])) $params['apps'] = [$params['apps']];
|
||||
if (is_array($params['apps'])) $this->_apps = $params['apps'];
|
||||
}
|
||||
|
||||
$this->_ci =& get_instance(); // get ci instance
|
||||
|
||||
// get all fehler to be produced (by kurzbz array or app)
|
||||
if (isset($params['fehlercodes']) && !isEmptyArray($params['fehlercodes']))
|
||||
{
|
||||
$this->_fehlercodes = $params['fehlercodes'];
|
||||
}
|
||||
elseif (isset($params['apps']) && !isEmptyArray($params['apps']))
|
||||
{
|
||||
$this->_ci->load->model('system/Fehler_model', 'FehlerModel');
|
||||
$fehlerRes = $this->_ci->FehlerModel->getByApps($this->_apps);
|
||||
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
$this->_fehlercodes = array_column(getData($fehlerRes), 'fehlercode');
|
||||
}
|
||||
}
|
||||
|
||||
$this->_ci->load->library('IssuesLib');
|
||||
$this->_ci->load->library('issues/PlausicheckProducerLib', ['extensionName' => $this->_extensionName, 'isForResolutionCheck' => true]);
|
||||
$this->_ci->load->library('ExtensionsLib');
|
||||
|
||||
$this->_ci->load->config('fehler');
|
||||
|
||||
// Load Fehler Entries of Core
|
||||
$configArray = $this->_ci->config->item(self::CONFIG_FEHLER_NAME);
|
||||
|
||||
foreach ($configArray as $coreEntry)
|
||||
{
|
||||
// each entry must have fehlercode
|
||||
if (!isset($coreEntry[self::FEHLERCODE_NAME])
|
||||
|| !in_array($coreEntry[self::FEHLERCODE_NAME], $this->_fehlercodes)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// fill code lib mappings with needed values
|
||||
$fehlercode = $coreEntry[self::FEHLERCODE_NAME];
|
||||
|
||||
if (isset($coreEntry[self::FEHLER_KURZBZ_NAME]))
|
||||
$this->_codeLibMappings[$fehlercode][self::FEHLER_KURZBZ_NAME] = $coreEntry[self::FEHLER_KURZBZ_NAME];
|
||||
|
||||
$this->_codeLibMappings[$fehlercode][self::RESOLVER_LIB_NAME] = $coreEntry[self::RESOLVER_LIB_NAME] ?? null;
|
||||
$this->_codeLibMappings[$fehlercode][self::PRODUCER_IS_RESOLVER_NAME]
|
||||
= $coreEntry[self::PRODUCER_IS_RESOLVER_NAME] ?? false;
|
||||
}
|
||||
|
||||
// load fehler entries of extensions
|
||||
$extensions = $this->_ci->extensionslib->getInstalledExtensions();
|
||||
|
||||
if (hasData($extensions))
|
||||
{
|
||||
$extensionArray = array();
|
||||
|
||||
$extensionsData = getData($extensions);
|
||||
|
||||
foreach ($extensionsData as $ext)
|
||||
{
|
||||
$configFilename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/'.self::CONFIG_FEHLER_NAME.'.php';
|
||||
|
||||
// if fehler config file exists in teh extension
|
||||
if (file_exists($configFilename))
|
||||
{
|
||||
$config = array(); // default value
|
||||
|
||||
// include config data
|
||||
include($configFilename);
|
||||
|
||||
if (isset($config[self::CONFIG_FEHLER_NAME]) && is_array($config[self::CONFIG_FEHLER_NAME]))
|
||||
{
|
||||
foreach ($config[self::CONFIG_FEHLER_NAME] as $extensionEntry)
|
||||
{
|
||||
if (
|
||||
!isset($extensionEntry[self::FEHLERCODE_NAME])
|
||||
|| !in_array($extensionEntry[self::FEHLERCODE_NAME], $this->_fehlercodes)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// add extension config data to fehlercode lib mappings
|
||||
$fehlercode = $extensionEntry[self::FEHLERCODE_NAME];
|
||||
if (isset($extensionEntry[self::FEHLER_KURZBZ_NAME]))
|
||||
$this->_codeLibMappings[$fehlercode][self::FEHLER_KURZBZ_NAME] = $extensionEntry[self::FEHLER_KURZBZ_NAME];
|
||||
|
||||
$this->_codeLibMappings[$fehlercode][self::RESOLVER_LIB_NAME]
|
||||
= $extensionEntry[self::RESOLVER_LIB_NAME] ?? null;
|
||||
$this->_codeLibMappings[$fehlercode][self::EXTENSION_NAME] = $ext->name;
|
||||
$this->_codeLibMappings[$fehlercode][self::PRODUCER_IS_RESOLVER_NAME]
|
||||
= $extensionEntry[self::PRODUCER_IS_RESOLVER_NAME] ?? false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reseolves multiple plausicheck issues at once.
|
||||
* @param array $codeLibMappings contains fehler type to check and library responsible for check (fehlercode => libName)
|
||||
* @param array $openIssues passed issues to resolve
|
||||
* @param array $openIssues passed issues to resolve. If null, issues with fehlercodes in _fehlercodes property are loaded
|
||||
* @return result object with occured error and info
|
||||
*/
|
||||
public function resolvePlausicheckIssues($openIssues)
|
||||
public function resolvePlausicheckIssues($openIssues = null)
|
||||
{
|
||||
// loading producer lib with fehler kurzbz of provided code mappings, for "self resolving" issues
|
||||
$this->_ci->load->library(
|
||||
'issues/PlausicheckProducerLib',
|
||||
['fehlerKurzbz' => array_column($this->_codeLibMappings, self::FEHLER_KURZBZ_NAME)], 'PlausicheckResolverProducerLib'
|
||||
);
|
||||
|
||||
if (!isset($openIssues))
|
||||
{
|
||||
if (!isEmptyArray($this->_fehlercodes))
|
||||
{
|
||||
$this->_ci->load->model('system/Issue_model', 'IssueModel');
|
||||
|
||||
// load open issues with given errorcodes
|
||||
$openIssuesRes = $this->_ci->IssueModel->getOpenIssues(
|
||||
$this->_fehlercodes
|
||||
);
|
||||
|
||||
$openIssues = hasData($openIssuesRes) ? getData($openIssuesRes) : [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result = new StdClass();
|
||||
$result->errors = [];
|
||||
$result->infos = [];
|
||||
|
||||
// check if all issues to resolve could be found in database
|
||||
//~ $mappingFehlerCodes = array_keys($this->_codeLibMappings);
|
||||
//~ $notFoundFehlerCodes = array_diff($this->_fehlercodes, $mappingFehlerCodes);
|
||||
|
||||
//~ if (!isEmptyArray($notFoundFehlerCodes))
|
||||
//~ $result->errors[] = error('Fehler to resolve not defined in config: '.implode(', ', $notFoundFehlerCodes));
|
||||
|
||||
foreach ($openIssues as $issue)
|
||||
{
|
||||
$params = [];
|
||||
foreach ($this->_defaultIssueParams as $index => $propertyName)
|
||||
{
|
||||
$params[$index] = $issue->{$propertyName};
|
||||
}
|
||||
|
||||
// add person id and oe kurzbz automatically as params, merge it with additional params
|
||||
// decode bewerbung_parameter into assoc array
|
||||
$params = array_merge(
|
||||
array('issue_id' => $issue->issue_id, 'issue_person_id' => $issue->person_id, 'issue_oe_kurzbz' => $issue->oe_kurzbz),
|
||||
$params,
|
||||
isset($issue->behebung_parameter) ? json_decode($issue->behebung_parameter, true) : array()
|
||||
);
|
||||
|
||||
@@ -54,69 +188,72 @@ class PlausicheckResolverLib
|
||||
// ignore if Fehlercode is not in libmappings (shouldn't be checked)
|
||||
if (isset($this->_codeLibMappings[$issue->fehlercode]))
|
||||
{
|
||||
$libName = $this->_codeLibMappings[$issue->fehlercode];
|
||||
$codeLibMapping = $this->_codeLibMappings[$issue->fehlercode];
|
||||
$libName = $codeLibMapping[self::RESOLVER_LIB_NAME] ?? null;
|
||||
$extensionName = $codeLibMapping[self::EXTENSION_NAME] ?? null;
|
||||
$producerIsResolver = $codeLibMapping[self::PRODUCER_IS_RESOLVER_NAME] ?? false;
|
||||
|
||||
// if called from extension (extension name set), path includes extension names
|
||||
$libRootPath = isset($this->_extensionName) ? self::EXTENSIONS_FOLDER . '/' . $this->_extensionName . '/' : '';
|
||||
|
||||
// path for loading issue library
|
||||
$issuesLibPath = $libRootPath . self::ISSUE_RESOLVERS_FOLDER . '/';
|
||||
|
||||
// file path of library for check if file exists
|
||||
$issuesLibFilePath = DOC_ROOT . self::CI_PATH
|
||||
. '/' . $libRootPath . self::CI_LIBRARY_FOLDER . '/' . self::ISSUE_RESOLVERS_FOLDER . '/' . $libName . '.php';
|
||||
|
||||
// check if library file exists
|
||||
if (!file_exists($issuesLibFilePath))
|
||||
if ($producerIsResolver)
|
||||
{
|
||||
// log error and continue with next issue if not
|
||||
$result->errors[] = "Issue library file " . $issuesLibFilePath . " does not exist";
|
||||
continue;
|
||||
}
|
||||
// execute same check as used for issue production
|
||||
$issueResolvedRes = $this->_ci->PlausicheckResolverProducerLib->producePlausicheckIssue(
|
||||
$issue->fehler_kurzbz,
|
||||
$params
|
||||
);
|
||||
|
||||
// load library connected to fehlercode
|
||||
$this->_ci->load->library($issuesLibPath . $libName);
|
||||
|
||||
$lowercaseLibName = mb_strtolower($libName);
|
||||
|
||||
// check if method is defined in library class
|
||||
if (!is_callable(array($this->_ci->{$lowercaseLibName}, self::CHECK_ISSUE_RESOLVED_METHOD_NAME)))
|
||||
{
|
||||
// log error and continue with next issue if not
|
||||
$result->errors[] = "Method " . self::CHECK_ISSUE_RESOLVED_METHOD_NAME . " is not defined in library $lowercaseLibName";
|
||||
continue;
|
||||
}
|
||||
|
||||
// call the function for checking for issue resolution
|
||||
$issueResolvedRes = $this->_ci->{$lowercaseLibName}->{self::CHECK_ISSUE_RESOLVED_METHOD_NAME}($params);
|
||||
|
||||
if (isError($issueResolvedRes))
|
||||
{
|
||||
$result->errors[] = getError($issueResolvedRes);
|
||||
if (isError($issueResolvedRes))
|
||||
{
|
||||
$result->errors[] = getError($issueResolvedRes);
|
||||
}
|
||||
else
|
||||
{
|
||||
$issueResolved = !hasData($issueResolvedRes);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$issueResolved = getData($issueResolvedRes) === true;
|
||||
}
|
||||
}
|
||||
elseif (isset($this->_codeProducerLibMappings[$issue->fehlercode])) // check if it is an issue without explicit resolver, "self-resolving"
|
||||
{
|
||||
$libName = $this->_codeProducerLibMappings[$issue->fehlercode];
|
||||
// if called from extension (extension name set), path includes extension names
|
||||
$libRootPath = isset($extensionName) ? self::EXTENSIONS_FOLDER . '/' . $extensionName . '/' : '';
|
||||
|
||||
// execute same check as used for issue production
|
||||
$issueResolvedRes = $this->_ci->plausicheckproducerlib->producePlausicheckIssue(
|
||||
$libName,
|
||||
$issue->fehler_kurzbz,
|
||||
$params
|
||||
);
|
||||
// path for loading issue library
|
||||
$issuesLibPath = $libRootPath . self::ISSUE_RESOLVERS_FOLDER . '/';
|
||||
|
||||
if (isError($issueResolvedRes))
|
||||
{
|
||||
$result->errors[] = getError($issueResolvedRes);
|
||||
}
|
||||
else
|
||||
{
|
||||
$issueResolved = !hasData($issueResolvedRes);
|
||||
// file path of library for check if file exists
|
||||
$issuesLibFilePath = DOC_ROOT . self::CI_PATH
|
||||
. '/' . $libRootPath . self::CI_LIBRARY_FOLDER . '/' . self::ISSUE_RESOLVERS_FOLDER . '/' . $libName . '.php';
|
||||
|
||||
// check if library file exists
|
||||
if (!file_exists($issuesLibFilePath))
|
||||
{
|
||||
// log error and continue with next issue if not
|
||||
$result->errors[] = "Issue library file " . $issuesLibFilePath . " does not exist";
|
||||
continue;
|
||||
}
|
||||
|
||||
// load library connected to fehlercode
|
||||
$this->_ci->load->library($issuesLibPath . $libName);
|
||||
|
||||
$lowercaseLibName = mb_strtolower($libName);
|
||||
|
||||
// check if method is defined in library class
|
||||
if (!is_callable(array($this->_ci->{$lowercaseLibName}, self::CHECK_ISSUE_RESOLVED_METHOD_NAME)))
|
||||
{
|
||||
// log error and continue with next issue if not
|
||||
$result->errors[] = "Method " . self::CHECK_ISSUE_RESOLVED_METHOD_NAME . " is not defined in library $lowercaseLibName";
|
||||
continue;
|
||||
}
|
||||
|
||||
// call the function for checking for issue resolution
|
||||
$issueResolvedRes = $this->_ci->{$lowercaseLibName}->{self::CHECK_ISSUE_RESOLVED_METHOD_NAME}($params);
|
||||
|
||||
if (isError($issueResolvedRes))
|
||||
{
|
||||
$result->errors[] = getError($issueResolvedRes);
|
||||
}
|
||||
else
|
||||
{
|
||||
$issueResolved = getData($issueResolvedRes) === true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,11 @@ class AbbrecherAktiv extends PlausiChecker
|
||||
AND benutzer.aktiv=true";
|
||||
|
||||
protected $_config_params = ['exkludierteStudiengaenge' => " AND stg.studiengang_kz NOT IN ?"];
|
||||
protected $_params_for_checking = ['studiengang_kz' => " AND stg.studiengang_kz = ?", 'prestudent_id' => " AND pre.prestudent_id = ?"];
|
||||
protected $_params_for_checking = [
|
||||
'studiengang_kz' => " AND stg.studiengang_kz = ?",
|
||||
'prestudent_id' => " AND pre.prestudent_id = ?",
|
||||
'person_id' => " AND pre.person_id = ?"
|
||||
];
|
||||
protected $_fehlertext_params = ['prestudent_id'];
|
||||
protected $_resolution_params = ['prestudent_id'];
|
||||
}
|
||||
|
||||
@@ -19,12 +19,14 @@ class AbschlussstatusFehlt extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getAbschlussstatusFehlt(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -55,6 +57,7 @@ class AbschlussstatusFehlt extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
@@ -62,6 +65,7 @@ class AbschlussstatusFehlt extends PlausiChecker
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
@@ -132,6 +136,12 @@ class AbschlussstatusFehlt extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,9 +19,10 @@ class AktSemesterNull extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getAktSemesterNull($studiensemester_kurzbz, $studiengang_kz, null, $exkludierte_studiengang_kz);
|
||||
$prestudentRes = $this->getAktSemesterNull($studiensemester_kurzbz, $studiengang_kz, null, $person_id, $exkludierte_studiengang_kz);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
@@ -56,11 +57,17 @@ class AktSemesterNull extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
public function getAktSemesterNull($studiensemester_kurzbz, $studiengang_kz = null, $prestudent_id = null, $exkludierte_studiengang_kz = null)
|
||||
{
|
||||
public function getAktSemesterNull(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array($studiensemester_kurzbz);
|
||||
|
||||
$qry = "
|
||||
@@ -89,6 +96,12 @@ class AktSemesterNull extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -18,9 +18,10 @@ class AktiverStudentOhneStatus extends PlausiChecker
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getAktiverStudentOhneStatus($studiengang_kz, null, $exkludierte_studiengang_kz);
|
||||
$prestudentRes = $this->getAktiverStudentOhneStatus($studiengang_kz, null, $person_id, $exkludierte_studiengang_kz);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
@@ -48,10 +49,11 @@ class AktiverStudentOhneStatus extends PlausiChecker
|
||||
* Students with active Benutzer should have a status in the current semester.
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
public function getAktiverStudentOhneStatus($studiengang_kz = null, $prestudent_id = null, $exkludierte_studiengang_kz = null)
|
||||
public function getAktiverStudentOhneStatus($studiengang_kz = null, $prestudent_id = null, $person_id = null, $exkludierte_studiengang_kz = null)
|
||||
{
|
||||
$params = array();
|
||||
|
||||
@@ -88,6 +90,12 @@ class AktiverStudentOhneStatus extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND prestudent.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,14 @@ class AktiverStudentstatusOhneKontobuchung extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getAktiverStudentstatusOhneKontobuchung(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -61,6 +63,7 @@ class AktiverStudentstatusOhneKontobuchung extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
@@ -68,6 +71,7 @@ class AktiverStudentstatusOhneKontobuchung extends PlausiChecker
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array($studiensemester_kurzbz);
|
||||
@@ -109,6 +113,13 @@ class AktiverStudentstatusOhneKontobuchung extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pers.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
+10
@@ -19,12 +19,14 @@ class AusbildungssemPrestudentUngleichAusbildungssemStatus extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getAusbildungssemPrestudentUngleichAusbildungssemStatus(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -64,6 +66,7 @@ class AusbildungssemPrestudentUngleichAusbildungssemStatus extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
@@ -71,6 +74,7 @@ class AusbildungssemPrestudentUngleichAusbildungssemStatus extends PlausiChecker
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array($studiensemester_kurzbz, $studiensemester_kurzbz, $studiensemester_kurzbz);
|
||||
@@ -105,6 +109,12 @@ class AusbildungssemPrestudentUngleichAusbildungssemStatus extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND prestudent.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,14 @@ class BewerberNichtZumRtAngetreten extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getBewerberNichtZumRtAngetreten(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -58,6 +60,7 @@ class BewerberNichtZumRtAngetreten extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
@@ -65,6 +68,7 @@ class BewerberNichtZumRtAngetreten extends PlausiChecker
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$this->_ci->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
@@ -112,6 +116,12 @@ class BewerberNichtZumRtAngetreten extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND prestudent.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,14 @@ class DatumAbschlusspruefungFehlt extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getDatumAbschlusspruefungFehlt(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -58,6 +60,7 @@ class DatumAbschlusspruefungFehlt extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param abschlusspruefung_id int if check is to be executed for a certain Abschlussprüfung
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
@@ -65,6 +68,7 @@ class DatumAbschlusspruefungFehlt extends PlausiChecker
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$abschlusspruefung_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
@@ -112,6 +116,12 @@ class DatumAbschlusspruefungFehlt extends PlausiChecker
|
||||
$params[] = $abschlusspruefung_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,14 @@ class DatumSponsionFehlt extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getDatumSponsionFehlt(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -58,6 +60,7 @@ class DatumSponsionFehlt extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param abschlusspruefung_id int if check is to be executed only for a certain Abschlussprüfung
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
@@ -65,6 +68,7 @@ class DatumSponsionFehlt extends PlausiChecker
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$abschlusspruefung_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
@@ -112,6 +116,12 @@ class DatumSponsionFehlt extends PlausiChecker
|
||||
$params[] = $abschlusspruefung_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
+15
-3
@@ -18,9 +18,10 @@ class DatumStudiensemesterFalscheReihenfolge extends PlausiChecker
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getDatumStudiensemesterFalscheReihenfolge($studiengang_kz, null, $exkludierte_studiengang_kz);
|
||||
$prestudentRes = $this->getDatumStudiensemesterFalscheReihenfolge($studiengang_kz, null, $person_id, $exkludierte_studiengang_kz);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
@@ -50,11 +51,16 @@ class DatumStudiensemesterFalscheReihenfolge extends PlausiChecker
|
||||
* Status Dates and status studysemester dates should be in correct order.
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if check is to be executed only for certain Studiengaenge
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
public function getDatumStudiensemesterFalscheReihenfolge($studiengang_kz = null, $prestudent_id = null, $exkludierte_studiengang_kz = null)
|
||||
{
|
||||
public function getDatumStudiensemesterFalscheReihenfolge(
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
|
||||
// all active students with Status student in current semester
|
||||
@@ -97,6 +103,12 @@ class DatumStudiensemesterFalscheReihenfolge extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,14 @@ class DualesStudiumOhneMarkierung extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getDualesStudiumOhneMarkierung(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -61,6 +63,7 @@ class DualesStudiumOhneMarkierung extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
@@ -68,6 +71,7 @@ class DualesStudiumOhneMarkierung extends PlausiChecker
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array($studiensemester_kurzbz);
|
||||
@@ -132,6 +136,12 @@ class DualesStudiumOhneMarkierung extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND tbl_person.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,14 @@ class FalscheAnzahlAbschlusspruefungen extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getFalscheAnzahlAbschlusspruefungen(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -55,6 +57,7 @@ class FalscheAnzahlAbschlusspruefungen extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
@@ -62,6 +65,7 @@ class FalscheAnzahlAbschlusspruefungen extends PlausiChecker
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
@@ -111,6 +115,12 @@ class FalscheAnzahlAbschlusspruefungen extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,13 @@ class FalscheAnzahlHeimatadressen extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$personRes = $this->getFalscheAnzahlHeimatadressen(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
|
||||
@@ -19,12 +19,13 @@ class FalscheAnzahlZustelladressen extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$personRes = $this->getFalscheAnzahlZustelladressen(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class FalscherIncomingZweckPlausi extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$bisio_id = isset($params['bisio_id']) ? $params['bisio_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getFalscherIncomingZweck(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$bisio_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
//'fehlertext_params' => array('bisio_id' => $prestudent->bisio_id),
|
||||
'resolution_params' => array('bisio_id' => $prestudent->bisio_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Incomings should have the correct Zweck.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param bisio_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getFalscherIncomingZweck(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$bisio_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
|
||||
$params = array();
|
||||
$studiensemester_clause = '';
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$studiensemester_clause = "AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
$qry = "
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
DISTINCT ON (bisio_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz, zw.zweck_code, stg.studiengang_kz,
|
||||
bisio.bisio_id, COUNT(zw.zweck_code) OVER (PARTITION BY bisio_id) AS anzahl
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_student stud USING (prestudent_id)
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiensemester sem ON status.studiensemester_kurzbz = sem.studiensemester_kurzbz
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
JOIN bis.tbl_bisio bisio ON stud.student_uid = bisio.student_uid
|
||||
JOIN bis.tbl_bisio_zweck zw USING (bisio_id)
|
||||
WHERE
|
||||
stg.melderelevant
|
||||
AND pre.bismelden
|
||||
AND status.status_kurzbz = 'Incoming'
|
||||
AND bisio.von::date < sem.ende AND bisio.bis::date > sem.start
|
||||
{$studiensemester_clause}
|
||||
) zwecke
|
||||
WHERE anzahl = 1 AND zweck_code NOT IN ('1', '2', '3')";
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND zwecke.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($bisio_id))
|
||||
{
|
||||
$qry .= " AND zwecke.bisio_id = ?";
|
||||
$params[] = $bisio_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND zwecke.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND zwecke.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,10 @@ class GbDatumWeitZurueck extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$personRes = $this->getGbDatumWeitZurueck($studiensemester_kurzbz, $studiengang_kz, null, $exkludierte_studiengang_kz);
|
||||
$personRes = $this->getGbDatumWeitZurueck($studiensemester_kurzbz, $studiengang_kz, $person_id, $exkludierte_studiengang_kz);
|
||||
|
||||
if (isError($personRes)) return $personRes;
|
||||
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class GeburtsnationFehlt extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$personRes = $this->_getGeburtsnationFehlt(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($personRes)) return $personRes;
|
||||
|
||||
if (hasData($personRes))
|
||||
{
|
||||
$persons = getData($personRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($persons as $person)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $person->person_id,
|
||||
'fehlertext_params' => array(),
|
||||
'resolution_params' => array()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Geburtsnation is missing.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getGeburtsnationFehlt(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT person_id
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
WHERE
|
||||
(geburtsnation IS NULL OR geburtsnation = '')
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,14 @@ class InaktiverStudentAktiverStatus extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getInaktiverStudentAktiverStatus(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -58,21 +60,26 @@ class InaktiverStudentAktiverStatus extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
public function getInaktiverStudentAktiverStatus(
|
||||
$studiensemester_kurzbz,
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$this->_ci->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
|
||||
$aktStudiensemesterRes = $this->_ci->StudiensemesterModel->getAkt();
|
||||
if (!isset($studiensemester_kurzbz))
|
||||
{
|
||||
$this->_ci->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
|
||||
$aktStudiensemesterRes = $this->_ci->StudiensemesterModel->getAkt();
|
||||
|
||||
if (isError($aktStudiensemesterRes)) return $aktStudiensemesterRes;
|
||||
if (isError($aktStudiensemesterRes)) return $aktStudiensemesterRes;
|
||||
|
||||
$studiensemester_kurzbz = hasData($aktStudiensemesterRes) ? getData($aktStudiensemesterRes)[0]->studiensemester_kurzbz : '';
|
||||
$studiensemester_kurzbz = hasData($aktStudiensemesterRes) ? getData($aktStudiensemesterRes)[0]->studiensemester_kurzbz : '';
|
||||
}
|
||||
|
||||
$params = array($studiensemester_kurzbz);
|
||||
|
||||
@@ -103,6 +110,12 @@ class InaktiverStudentAktiverStatus extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND prestudent.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,13 @@ class IncomingHeimatNationOesterreich extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$personRes = $this->getIncomingHeimatNationOesterreich(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
|
||||
@@ -18,9 +18,10 @@ class IncomingOhneIoDatensatz extends PlausiChecker
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getIncomingOhneIoDatensatz($studiengang_kz, null, $exkludierte_studiengang_kz);
|
||||
$prestudentRes = $this->getIncomingOhneIoDatensatz($studiengang_kz, null, $person_id, $exkludierte_studiengang_kz);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
@@ -48,10 +49,11 @@ class IncomingOhneIoDatensatz extends PlausiChecker
|
||||
* Incoming should have IN/OUT data.
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
public function getIncomingOhneIoDatensatz($studiengang_kz = null, $prestudent_id = null, $exkludierte_studiengang_kz = null)
|
||||
public function getIncomingOhneIoDatensatz($studiengang_kz = null, $prestudent_id = null, $person_id = null, $exkludierte_studiengang_kz = null)
|
||||
{
|
||||
$params = array();
|
||||
|
||||
@@ -85,6 +87,12 @@ class IncomingOhneIoDatensatz extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND tbl_person.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,14 @@ class IncomingOrGsFoerderrelevant extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getIncomingOrGsFoerderrelevant(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -55,6 +57,7 @@ class IncomingOrGsFoerderrelevant extends PlausiChecker
|
||||
* @param studiensemester_kurzbz string check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return object success or error
|
||||
*/
|
||||
@@ -62,6 +65,7 @@ class IncomingOrGsFoerderrelevant extends PlausiChecker
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
@@ -114,6 +118,12 @@ class IncomingOrGsFoerderrelevant extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pers.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,14 @@ class InskriptionVorLetzerBismeldung extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getInskriptionVorLetzerBismeldung(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -59,7 +61,7 @@ class InskriptionVorLetzerBismeldung extends PlausiChecker
|
||||
|
||||
/**
|
||||
* Students of a semester shouldn't start studies before the date of Bismeldung.
|
||||
* e.g. If student studies in WS2022 datum of status shouldn't be before 15.4.2020
|
||||
* e.g. If student studies in WS2022 datum of status shouldn't be before 15.4.2022
|
||||
* e.g. If student studies in SS2022 datum of status shouldn't be before 15.11.2022
|
||||
* @param studiensemester_kurzbz string check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
@@ -71,11 +73,14 @@ class InskriptionVorLetzerBismeldung extends PlausiChecker
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
// get Bismeldedatum
|
||||
$datumBis = $this->_getBisdateFromSemester($studiensemester_kurzbz);
|
||||
|
||||
if (!$datumBis) return success([]);
|
||||
|
||||
$params = array($datumBis, $studiensemester_kurzbz, $datumBis);
|
||||
|
||||
// get active students
|
||||
@@ -117,6 +122,12 @@ class InskriptionVorLetzerBismeldung extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND prestudent.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
@@ -132,17 +143,16 @@ class InskriptionVorLetzerBismeldung extends PlausiChecker
|
||||
*/
|
||||
private function _getBisdateFromSemester($studiensemester_kurzbz)
|
||||
{
|
||||
$semesterYear = substr($studiensemester_kurzbz, 2, 6);
|
||||
$semesterType = substr($studiensemester_kurzbz, 0, 2);
|
||||
$bisdate = null;
|
||||
|
||||
if ($semesterType == 'SS')
|
||||
{
|
||||
return date_format(date_create(($semesterYear - 1)."-11-15"), 'Y-m-d');
|
||||
}
|
||||
$this->_ci->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
$prevSemester = $this->_ci->StudiensemesterModel->getPreviousFrom($studiensemester_kurzbz);
|
||||
if (!hasData($prevSemester)) return null;
|
||||
$prevSemester = getData($prevSemester)[0]->studiensemester_kurzbz;
|
||||
|
||||
if ($semesterType == 'WS')
|
||||
{
|
||||
return date_format(date_create($semesterYear."-04-15"), 'Y-m-d');
|
||||
}
|
||||
$this->_ci->load->model('codex/Bismeldestichtag_model', 'BismeldestichtagModel');
|
||||
$bisDate = $this->_ci->BismeldestichtagModel->getLastReachedMeldestichtag($prevSemester);
|
||||
if (!hasData($bisDate)) return null;
|
||||
return getData($bisDate)[0]->meldestichtag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class KeinAufenthaltszweckPlausi extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$bisio_id = isset($params['bisio_id']) ? $params['bisio_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getKeinAufenthaltszweck(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$bisio_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
//'fehlertext_params' => array('bisio_id' => $prestudent->bisio_id),
|
||||
'resolution_params' => array('bisio_id' => $prestudent->bisio_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Students with mobility should have Aufenthaltszweck.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param bisio_id int if check is to be executed only for one prestudent
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getKeinAufenthaltszweck(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$bisio_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (bisio_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz,
|
||||
zw.zweck_code, stg.studiengang_kz, bisio.bisio_id
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_student stud USING (prestudent_id)
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiensemester sem ON status.studiensemester_kurzbz = sem.studiensemester_kurzbz
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
JOIN bis.tbl_bisio bisio ON stud.student_uid = bisio.student_uid
|
||||
LEFT JOIN bis.tbl_bisio_zweck zw USING (bisio_id)
|
||||
WHERE
|
||||
(zw.zweck_code IS NULL OR zw.zweck_code = '')
|
||||
AND bisio.von::date < sem.ende AND bisio.bis::date > sem.start
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($bisio_id))
|
||||
{
|
||||
$qry .= " AND bisio.bisio_id = ?";
|
||||
$params[] = $bisio_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $bisio_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -18,11 +18,12 @@ class NationNichtOesterreichAberGemeinde extends PlausiChecker
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$personRes = $this->getNationNichtOesterreichAberGemeinde(
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
|
||||
@@ -19,12 +19,14 @@ class OrgformStgUngleichOrgformPrestudent extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getOrgformStgUngleichOrgformPrestudent(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -70,6 +72,7 @@ class OrgformStgUngleichOrgformPrestudent extends PlausiChecker
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array($studiensemester_kurzbz);
|
||||
@@ -116,6 +119,12 @@ class OrgformStgUngleichOrgformPrestudent extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND prestudent.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class OutgoingAngerechneteEctsFehlenPlausi extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$bisio_id = isset($params['bisio_id']) ? $params['bisio_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getAngerechneteEctsFehlen(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$bisio_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
//'fehlertext_params' => array('bisio_id' => $prestudent->bisio_id),
|
||||
'resolution_params' => array('bisio_id' => $prestudent->bisio_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outgoing should have angerechnete ECTS.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param bisio_id int if check is to be executed only for one prestudent
|
||||
* @param person_id int if check is to be executed only for one person
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getAngerechneteEctsFehlen(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$bisio_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (bisio_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz,
|
||||
stg.studiengang_kz, bisio.bisio_id
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_student stud USING (prestudent_id)
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiensemester sem ON status.studiensemester_kurzbz = sem.studiensemester_kurzbz
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
JOIN bis.tbl_bisio bisio ON stud.student_uid = bisio.student_uid
|
||||
WHERE
|
||||
bisio.bis IS NOT NULL
|
||||
AND bisio.bis::date <= NOW()
|
||||
AND bisio.bis::date - bisio.von::date >= 29
|
||||
AND bisio.ects_angerechnet IS NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM public.tbl_prestudentstatus WHERE status_kurzbz = 'Incoming' AND prestudent_id = pre.prestudent_id)
|
||||
AND bisio.von::date < sem.ende AND bisio.bis::date > sem.start
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($bisio_id))
|
||||
{
|
||||
$qry .= " AND bisio.bisio_id = ?";
|
||||
$params[] = $bisio_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class OutgoingAufenthaltfoerderungfehltPlausi extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$bisio_id = isset($params['bisio_id']) ? $params['bisio_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getAufenthaltsfoerderungFehlt(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$bisio_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
//'fehlertext_params' => array('bisio_id' => $prestudent->bisio_id),
|
||||
'resolution_params' => array('bisio_id' => $prestudent->bisio_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Student with mobility should have Aufenthaltsfoerderung.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param bisio_id int if check is to be executed only for one prestudent
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getAufenthaltsfoerderungFehlt(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$bisio_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (bisio_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz,
|
||||
stg.studiengang_kz, bisio.bisio_id
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_student stud USING (prestudent_id)
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiensemester sem ON status.studiensemester_kurzbz = sem.studiensemester_kurzbz
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
JOIN bis.tbl_bisio bisio ON stud.student_uid = bisio.student_uid
|
||||
LEFT JOIN bis.tbl_bisio_aufenthaltfoerderung foerd USING (bisio_id)
|
||||
WHERE
|
||||
bisio.bis IS NOT NULL
|
||||
AND bisio.bis::date - bisio.von::date >= 29
|
||||
AND foerd.aufenthaltfoerderung_code IS NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM public.tbl_prestudentstatus WHERE status_kurzbz = 'Incoming' AND prestudent_id = pre.prestudent_id)
|
||||
AND bisio.von::date < sem.ende AND bisio.bis::date > sem.start
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($bisio_id))
|
||||
{
|
||||
$qry .= " AND bisio.bisio_id = ?";
|
||||
$params[] = $bisio_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class OutgoingErworbeneEctsFehlenPlausi extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$bisio_id = isset($params['bisio_id']) ? $params['bisio_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getAngerechneteEctsFehlen(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$bisio_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
//'fehlertext_params' => array('bisio_id' => $prestudent->bisio_id),
|
||||
'resolution_params' => array('bisio_id' => $prestudent->bisio_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outgoing should have erworbene ECTS.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param bisio_id int if check is to be executed only for one prestudent
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getAngerechneteEctsFehlen(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$bisio_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (bisio_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz,
|
||||
stg.studiengang_kz, bisio.bisio_id
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_student stud USING (prestudent_id)
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiensemester sem ON status.studiensemester_kurzbz = sem.studiensemester_kurzbz
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
JOIN bis.tbl_bisio bisio ON stud.student_uid = bisio.student_uid
|
||||
WHERE
|
||||
bisio.bis IS NOT NULL
|
||||
AND bisio.bis::date <= NOW()
|
||||
AND bisio.bis::date - bisio.von::date >= 29
|
||||
AND bisio.ects_erworben IS NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM public.tbl_prestudentstatus WHERE status_kurzbz = 'Incoming' AND prestudent_id = pre.prestudent_id)
|
||||
AND bisio.von::date < sem.ende AND bisio.bis::date > sem.start
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($bisio_id))
|
||||
{
|
||||
$qry .= " AND bisio.bisio_id = ?";
|
||||
$params[] = $bisio_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,12 @@
|
||||
*/
|
||||
abstract class PlausiChecker
|
||||
{
|
||||
const ISSUE_ID_NAME = 'issue_id';
|
||||
|
||||
protected $_ci; // code igniter instance
|
||||
protected $_config; // all applicable configuration parameters for this plausicheck
|
||||
protected $_db; // database for queries
|
||||
|
||||
protected $_isForResolutionCheck; // if true, additional parameters only needed for resolution are checked
|
||||
|
||||
protected $_config_params = []; // name of all config params which should be applied for this plausicheck, with sql [name] => [sql]
|
||||
protected $_params_for_checking = []; // name of all passed params for checking, with sql [name] => [sql]
|
||||
|
||||
@@ -24,8 +24,6 @@ abstract class PlausiChecker
|
||||
// set configuration
|
||||
$this->_config = $params['configurationParams'] ?? [];
|
||||
|
||||
$this->_isForResolutionCheck = $params['isForResolutionCheck'] ?? false;
|
||||
|
||||
// get database for queries
|
||||
$this->_db = new DB_Model();
|
||||
}
|
||||
@@ -41,15 +39,20 @@ abstract class PlausiChecker
|
||||
$params = [];
|
||||
$qry = $this->_base_sql;
|
||||
|
||||
if ($this->_isForResolutionCheck == true)
|
||||
// if issue id is set, issue is resolving - check if behebung parameter are present
|
||||
if (isset($paramsForChecking[self::ISSUE_ID_NAME]))
|
||||
{
|
||||
foreach ($this->_resolution_params as $resParam)
|
||||
{
|
||||
if (!isset($paramsForChecking[$resParam]))
|
||||
return error("$resParam missing".(isset($paramsForChecking['issue_id']) ? ", issue ID: ".$paramsForChecking['issue_id'] : ""));
|
||||
return error("$resParam missing"
|
||||
.(isset($paramsForChecking[self::ISSUE_ID_NAME]) ? ", issue ID: ".$paramsForChecking[self::ISSUE_ID_NAME] : ""));
|
||||
}
|
||||
}
|
||||
|
||||
// get fehlertext and resolution params
|
||||
|
||||
|
||||
// add config params to query
|
||||
if (isset($this->_config_params) && !isEmptyArray($this->_config_params))
|
||||
{
|
||||
|
||||
@@ -19,12 +19,14 @@ class PrestudentMischformOhneOrgform extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getPrestudentMischformOhneOrgform(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -68,6 +70,7 @@ class PrestudentMischformOhneOrgform extends PlausiChecker
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array($studiensemester_kurzbz);
|
||||
@@ -98,6 +101,12 @@ class PrestudentMischformOhneOrgform extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND tbl_person.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -18,9 +18,10 @@ class StgPrestudentUngleichStgStudent extends PlausiChecker
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getStgPrestudentUngleichStgStudent($studiengang_kz, null, $exkludierte_studiengang_kz);
|
||||
$prestudentRes = $this->getStgPrestudentUngleichStgStudent($studiengang_kz, null, $person_id, $exkludierte_studiengang_kz);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
@@ -51,7 +52,7 @@ class StgPrestudentUngleichStgStudent extends PlausiChecker
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
public function getStgPrestudentUngleichStgStudent($studiengang_kz = null, $prestudent_id = null, $exkludierte_studiengang_kz = null)
|
||||
public function getStgPrestudentUngleichStgStudent($studiengang_kz = null, $prestudent_id = null, $person_id = null, $exkludierte_studiengang_kz = null)
|
||||
{
|
||||
$params = array();
|
||||
|
||||
@@ -79,6 +80,12 @@ class StgPrestudentUngleichStgStudent extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pers.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -18,9 +18,10 @@ class StgPrestudentUngleichStgStudienplan extends PlausiChecker
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getStgPrestudentUngleichStgStudienplan($studiengang_kz, null, null, $exkludierte_studiengang_kz);
|
||||
$prestudentRes = $this->getStgPrestudentUngleichStgStudienplan($studiengang_kz, null, null, $person_id, $exkludierte_studiengang_kz);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
@@ -56,6 +57,7 @@ class StgPrestudentUngleichStgStudienplan extends PlausiChecker
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$studienordnung_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
@@ -93,6 +95,12 @@ class StgPrestudentUngleichStgStudienplan extends PlausiChecker
|
||||
$params[] = $studienordnung_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND tbl_person.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -18,9 +18,10 @@ class StudentstatusNachAbbrecher extends PlausiChecker
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getStudentstatusNachAbbrecher($studiengang_kz, null, $exkludierte_studiengang_kz);
|
||||
$prestudentRes = $this->getStudentstatusNachAbbrecher($studiengang_kz, null, $person_id, $exkludierte_studiengang_kz);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
@@ -51,7 +52,7 @@ class StudentstatusNachAbbrecher extends PlausiChecker
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
public function getStudentstatusNachAbbrecher($studiengang_kz = null, $prestudent_id = null, $exkludierte_studiengang_kz = null)
|
||||
public function getStudentstatusNachAbbrecher($studiengang_kz = null, $prestudent_id = null, $person_id = null, $exkludierte_studiengang_kz = null)
|
||||
{
|
||||
$params = array();
|
||||
|
||||
@@ -79,6 +80,12 @@ class StudentstatusNachAbbrecher extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND prestudent.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -19,12 +19,14 @@ class StudienplanUngueltig extends PlausiChecker
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->getStudienplanUngueltig(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
null,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
@@ -69,6 +71,7 @@ class StudienplanUngueltig extends PlausiChecker
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array($studiensemester_kurzbz);
|
||||
@@ -115,6 +118,12 @@ class StudienplanUngueltig extends PlausiChecker
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND tbl_person.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class UhstatPersonkennungFehltCore extends PlausiChecker
|
||||
{
|
||||
const PERSONKENNUNG_KENNZEICHEN_TYPEN = ['vbpkAs', 'vbpkBf'];
|
||||
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getUhstatPersonkennungFehlt(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id
|
||||
//'fehlertext_params' => array('person_id' => $prestudent->person_id),
|
||||
//'resolution_params' => array('person_id' => $prestudent->person_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Student should have Personenkennung for UHSTAT reporting.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getUhstatPersonkennungFehlt(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (person_id) prestudent_id, person_id
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_person pers USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
WHERE
|
||||
stg.melderelevant
|
||||
AND pre.bismelden
|
||||
AND EXISTS (SELECT 1 FROM bis.tbl_uhstat1daten WHERE person_id = pers.person_id)
|
||||
AND (SELECT COUNT (DISTINCT kennzeichentyp_kurzbz) FROM public.tbl_kennzeichen WHERE person_id = pers.person_id AND kennzeichentyp_kurzbz IN ('vbpkAs', 'vbpkBf')) < 2
|
||||
AND pers.ersatzkennzeichen IS NULL";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pers.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ZgvDatumInZukunft extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$prestudent_id = isset($params['prestudent_id']) ? $params['prestudent_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getZgvDatumInZukunft(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$prestudent_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
//'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
|
||||
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* ZGV date should be in the past.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getZgvDatumInZukunft(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (prestudent_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
WHERE
|
||||
pre.zgvdatum::date > NOW()
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
//~ $prevStudiensemesterRes = $this->_ci->StudiensemesterModel->getPreviousFrom($studiensemester_kurzbz);
|
||||
|
||||
//~ if (isError($prevStudiensemesterRes)) return $prevStudiensemesterRes;
|
||||
|
||||
//~ if (hasData($prevStudiensemesterRes))
|
||||
//~ {
|
||||
//~ // if Studiensemester given, check only if has status in current or previous semester
|
||||
//~ $prevStudiensemester = getData($prevStudiensemesterRes)[0]->studiensemester_kurzbz;
|
||||
//~ $qry .= " AND EXISTS (
|
||||
//~ SELECT 1
|
||||
//~ FROM public.tbl_prestudentstatus ps
|
||||
//~ WHERE studiensemester_kurzbz IN (?, ?)
|
||||
//~ AND ps.prestudent_id = pre.prestudent_id
|
||||
//~ )";
|
||||
//~ $params[] = $prevStudiensemester;
|
||||
//~ $params[] = $studiensemester_kurzbz;
|
||||
//~ }
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($prestudent_id))
|
||||
{
|
||||
$qry .= " AND pre.prestudent_id = ?";
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ZgvDatumVorGeburtsdatum extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$prestudent_id = isset($params['prestudent_id']) ? $params['prestudent_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getZgvDatumVorGeburtsdatum(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$prestudent_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
//'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
|
||||
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Zgv date should be after birthdate.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getZgvDatumVorGeburtsdatum(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (prestudent_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_person pers USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
WHERE
|
||||
pre.zgvdatum::date < pers.gebdatum
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($prestudent_id))
|
||||
{
|
||||
$qry .= " AND pre.prestudent_id = ?";
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pers.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ZgvMasterDatumInZukunft extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$prestudent_id = isset($params['prestudent_id']) ? $params['prestudent_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getZgvMasterDatumInZukunft(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$prestudent_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
//'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
|
||||
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* ZGV master date should be in the past.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getZgvMasterDatumInZukunft(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (prestudent_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
WHERE
|
||||
pre.zgvmadatum::date > NOW()
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($prestudent_id))
|
||||
{
|
||||
$qry .= " AND pre.prestudent_id = ?";
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ZgvMasterDatumVorGeburtsdatum extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$prestudent_id = isset($params['prestudent_id']) ? $params['prestudent_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getZgvMasterDatumVorGeburtsdatum(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$prestudent_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
//'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
|
||||
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* ZGV master date should be after birthdate.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getZgvMasterDatumVorGeburtsdatum(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (prestudent_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_person pers USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
WHERE
|
||||
pre.zgvmadatum::date < pers.gebdatum
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($prestudent_id))
|
||||
{
|
||||
$qry .= " AND pre.prestudent_id = ?";
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ZgvMasterDatumVorZgvdatum extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$prestudent_id = isset($params['prestudent_id']) ? $params['prestudent_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getZgvMasterDatumVorZgvDatum(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$prestudent_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
//'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
|
||||
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* ZGV master date should be before ZGV date.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getZgvMasterDatumVorZgvDatum(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$prestudent_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
$params = array();
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (prestudent_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
WHERE
|
||||
pre.zgvmadatum::date < pre.zgvdatum::date
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= " AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($prestudent_id))
|
||||
{
|
||||
$qry .= " AND pre.prestudent_id = ?";
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND pre.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ZuVieleZweckeIncomingPlausi extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// get parameters from config
|
||||
$exkludierte_studiengang_kz = isset($this->_config['exkludierteStudiengaenge']) ? $this->_config['exkludierteStudiengaenge'] : null;
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
$bisio_id = isset($params['bisio_id']) ? $params['bisio_id'] : null;
|
||||
$person_id = isset($params['person_id']) ? $params['person_id'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_getFalscherIncomingZweck(
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz,
|
||||
$bisio_id,
|
||||
$person_id,
|
||||
$exkludierte_studiengang_kz
|
||||
);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
'fehlertext_params' => array('anzahl' => $prestudent->anzahl),
|
||||
'resolution_params' => array('bisio_id' => $prestudent->bisio_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* There should be exactly one Incoming Zweck.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param bisio_id int if check is to be executed only for one prestudent
|
||||
* @param exkludierte_studiengang_kz array if certain Studiengänge have to be excluded from check
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
private function _getFalscherIncomingZweck(
|
||||
$studiensemester_kurzbz = null,
|
||||
$studiengang_kz = null,
|
||||
$bisio_id = null,
|
||||
$person_id = null,
|
||||
$exkludierte_studiengang_kz = null
|
||||
) {
|
||||
|
||||
$params = array();
|
||||
$studiensemester_clause = '';
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$studiensemester_clause = "AND status.studiensemester_kurzbz = ?";
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
$qry = "
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
DISTINCT ON (bisio_id) prestudent_id, person_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz, stg.studiengang_kz,
|
||||
bisio.bisio_id, (SELECT count(*) FROM bis.tbl_bisio_zweck WHERE bisio_id = bisio.bisio_id) AS anzahl
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_student stud USING (prestudent_id)
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiensemester sem ON status.studiensemester_kurzbz = sem.studiensemester_kurzbz
|
||||
JOIN public.tbl_studiengang stg ON pre.studiengang_kz = stg.studiengang_kz
|
||||
JOIN bis.tbl_bisio bisio ON stud.student_uid = bisio.student_uid
|
||||
WHERE
|
||||
stg.melderelevant
|
||||
AND pre.bismelden
|
||||
AND status.status_kurzbz = 'Incoming'
|
||||
AND bisio.von::date < sem.ende AND bisio.bis::date > sem.start
|
||||
{$studiensemester_clause}
|
||||
) zwecke
|
||||
WHERE anzahl > 1";
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND zwecke.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($bisio_id))
|
||||
{
|
||||
$qry .= " AND zwecke.bisio_id = ?";
|
||||
$params[] = $bisio_id;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= " AND zwecke.person_id = ?";
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz))
|
||||
{
|
||||
$qry .= " AND zwecke.studiengang_kz NOT IN ?";
|
||||
$params[] = $exkludierte_studiengang_kz;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ class CORE_INOUT_0005 implements IIssueResolvedChecker
|
||||
|
||||
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
|
||||
|
||||
// get all Zwecke
|
||||
// get bisio
|
||||
$this->_ci->BisioModel->addSelect('ects_angerechnet');
|
||||
$bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Geburtsnation missing
|
||||
*/
|
||||
class CORE_PERSON_0005 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['issue_person_id']) || !is_numeric($params['issue_person_id']))
|
||||
return error('Person Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
// load geburtsnation for the given person
|
||||
$this->_ci->PersonModel->addSelect('geburtsnation');
|
||||
$personRes = $this->_ci->PersonModel->load($params['issue_person_id']);
|
||||
|
||||
if (isError($personRes)) return $personRes;
|
||||
|
||||
if (hasData($personRes))
|
||||
{
|
||||
// get person data
|
||||
$personData = getData($personRes)[0];
|
||||
|
||||
// if geburtsnation present, issue is resolved
|
||||
return success(!isEmptyString($personData->geburtsnation));
|
||||
}
|
||||
else
|
||||
return success(false); // if no person found, not resolved
|
||||
}
|
||||
}
|
||||
@@ -12,16 +12,13 @@ class CORE_STUDENTSTATUS_0004 implements IIssueResolvedChecker
|
||||
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
|
||||
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
|
||||
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->library('issues/plausichecks/InaktiverStudentAktiverStatus');
|
||||
|
||||
// check if issue persists
|
||||
$checkRes = $this->_ci->inaktiverstudentaktiverstatus->getInaktiverStudentAktiverStatus(
|
||||
$params['studiensemester_kurzbz'],
|
||||
null,
|
||||
null,
|
||||
$params['prestudent_id']
|
||||
);
|
||||
|
||||
@@ -28,21 +28,10 @@ class CoreMissingZgvTagLib
|
||||
$this->ci->PrestudentModel->addJoin('public.tbl_prestudentstatus', 'prestudent_id');
|
||||
$this->ci->PrestudentModel->addJoin('public.tbl_benutzer bn', 'person_id');
|
||||
$this->ci->PrestudentModel->addJoin('public.tbl_studiengang', 'studiengang_kz');
|
||||
|
||||
$this->ci->PrestudentModel->db->group_start();
|
||||
|
||||
$this->ci->PrestudentModel->db->where('zgvdatum', null);
|
||||
$this->ci->PrestudentModel->db->where('typ', 'b');
|
||||
|
||||
$this->ci->PrestudentModel->db->or_group_start();
|
||||
$this->ci->PrestudentModel->db->where('zgvmadatum', null);
|
||||
$this->ci->PrestudentModel->db->where('typ', 'm');
|
||||
$this->ci->PrestudentModel->db->group_end();
|
||||
|
||||
$this->ci->PrestudentModel->db->group_end();
|
||||
|
||||
$result = $this->ci->PrestudentModel-> loadWhere(array(
|
||||
'bn.aktiv' => true,
|
||||
'bn.aktiv' => true, //check if necessary
|
||||
'zgvdatum' => null,
|
||||
'typ' => 'b',
|
||||
'studiensemester_kurzbz' => $semester
|
||||
));
|
||||
|
||||
@@ -71,36 +60,16 @@ class CoreMissingZgvTagLib
|
||||
$semester = $params['studiensemester_kurzbz'];
|
||||
$prestudent_id = $params['id'];
|
||||
|
||||
$this->ci->PrestudentModel->addSelect('prestudent_id');
|
||||
$this->ci->PrestudentModel->addSelect('start as von');
|
||||
$this->ci->PrestudentModel->addSelect('ende as bis');
|
||||
$this->ci->PrestudentModel->addJoin('public.tbl_prestudentstatus', 'prestudent_id');
|
||||
|
||||
//add studiensemester also here for manual rebuild
|
||||
$this->ci->PrestudentModel->addJoin('public.tbl_studiensemester', 'studiensemester_kurzbz');
|
||||
|
||||
$this->ci->PrestudentModel->addJoin('public.tbl_benutzer bn', 'person_id');
|
||||
$this->ci->PrestudentModel->addJoin('public.tbl_studiengang', 'studiengang_kz');
|
||||
|
||||
$this->ci->PrestudentModel->db->group_start();
|
||||
|
||||
$this->ci->PrestudentModel->db->where('zgvdatum', null);
|
||||
$this->ci->PrestudentModel->db->where('typ', 'b');
|
||||
|
||||
$this->ci->PrestudentModel->db->or_group_start();
|
||||
$this->ci->PrestudentModel->db->where('zgvmadatum', null);
|
||||
$this->ci->PrestudentModel->db->where('typ', 'm');
|
||||
$this->ci->PrestudentModel->db->group_end();
|
||||
|
||||
$this->ci->PrestudentModel->db->group_end();
|
||||
$this->ci->PrestudentModel->db->limit(1);
|
||||
|
||||
$result = $this->ci->PrestudentModel-> loadWhere(array(
|
||||
'bn.aktiv' => true,
|
||||
$result = $this->ci->PrestudentModel->loadWhere(array(
|
||||
'bn.aktiv' => true, //check if necessary
|
||||
'zgvdatum' => null,
|
||||
'typ' => 'b',
|
||||
'studiensemester_kurzbz' => $semester,
|
||||
'prestudent_id' => $prestudent_id
|
||||
));
|
||||
|
||||
if(hasData($result))
|
||||
{
|
||||
return $result;
|
||||
|
||||
@@ -31,20 +31,18 @@ class Vertrag_model extends DB_Model
|
||||
*/
|
||||
public function save($person_id, $mitarbeiter_uid, $lehrveranstaltung_id, $lehreinheit_id, $projektarbeit_id = null, $vertragsstunden, $betrag, $studiensemester_kurzbz)
|
||||
{
|
||||
$vertragstyp_kurzbz = (is_null($projektarbeit_id)) ? 'Lehrauftrag' : 'Betreuung';
|
||||
|
||||
$person_id = (isset($person_id) && is_numeric($person_id))
|
||||
$person_id = (isset($person_id) && is_numeric($person_id))
|
||||
? $person_id
|
||||
: show_error('peron_id must be set and numeric.');
|
||||
$lehreinheit_id = (isset($lehreinheit_id) && is_numeric($lehreinheit_id))
|
||||
? $lehreinheit_id
|
||||
: show_error('lehreinheit_id must be set and numeric.');
|
||||
$lehrveranstaltung_id = (isset($lehrveranstaltung_id) && is_numeric($lehrveranstaltung_id))
|
||||
? $lehrveranstaltung_id
|
||||
: show_error('lehrveranstaltung_id must be set and numeric.');
|
||||
$projektarbeit_id = (isset($projektarbeit_id) && is_numeric($projektarbeit_id))
|
||||
? $projektarbeit_id
|
||||
: null;
|
||||
$lehreinheit_id = (isset($lehreinheit_id) && is_numeric($lehreinheit_id))
|
||||
? $lehreinheit_id
|
||||
: (($vertragstyp_kurzbz == 'Betreuung') ? null : show_error('lehreinheit_id must be set and numeric.'));
|
||||
$vertragsstunden = (isset($vertragsstunden) && is_numeric($vertragsstunden))
|
||||
? $vertragsstunden
|
||||
: 0;
|
||||
@@ -55,7 +53,7 @@ class Vertrag_model extends DB_Model
|
||||
? $mitarbeiter_uid
|
||||
: show_error('mitarbeiter_uid must be set and a string value.');;
|
||||
|
||||
|
||||
$vertragstyp_kurzbz = (is_null($projektarbeit_id)) ? 'Lehrauftrag' : 'Betreuung';
|
||||
|
||||
// First check if Vertrag already exists for that Lehrauftrag or for that Projektbetreuerauftrag
|
||||
if ($vertragstyp_kurzbz == 'Lehrauftrag')
|
||||
@@ -259,7 +257,7 @@ class Vertrag_model extends DB_Model
|
||||
}
|
||||
elseif ($vertragstyp_kurzbz == 'Betreuung')
|
||||
{
|
||||
$this->addSelect('lehreinheit_id, lehre.tbl_projektarbeit.lehrveranstaltung_id, lehre.tbl_projektarbeit.studiensemester_kurzbz');
|
||||
$this->addSelect('lehreinheit_id');
|
||||
$this->addJoin('lehre.tbl_projektbetreuer', 'vertrag_id');
|
||||
$this->addJoin('lehre.tbl_projektarbeit', 'projektarbeit_id');
|
||||
if ($result = $this->loadWhere(array('vertrag_id' => $vertrag_id)))
|
||||
@@ -283,22 +281,17 @@ class Vertrag_model extends DB_Model
|
||||
{
|
||||
if ($result = getData($this->getLehreinheitID($vertrag_id)))
|
||||
{
|
||||
if (!empty($result[0]->lehreinheit_id))
|
||||
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
|
||||
$this->LehreinheitModel->addSelect($select);
|
||||
|
||||
if($result = $this->LehreinheitModel->load($result[0]->lehreinheit_id))
|
||||
{
|
||||
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
|
||||
$this->LehreinheitModel->addSelect($select);
|
||||
|
||||
if ($result = $this->LehreinheitModel->load($result[0]->lehreinheit_id))
|
||||
{
|
||||
return success($result->retval);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Fehler beim Laden der Lehreinheit');
|
||||
}
|
||||
return success($result->retval);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Fehler beim Laden der Lehreinheit');
|
||||
}
|
||||
|
||||
return success($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -570,13 +563,14 @@ SELECT
|
||||
null::integer as pruefung_id,
|
||||
projektarbeit_id,
|
||||
(tbl_projektbetreuer.stunden*tbl_projektbetreuer.stundensatz) as betrag1,
|
||||
tbl_projektarbeit.studiensemester_kurzbz,
|
||||
tbl_lehreinheit.studiensemester_kurzbz,
|
||||
tbl_projektbetreuer.betreuerart_kurzbz,
|
||||
(SELECT nachname || ' ' || vorname FROM public.tbl_person JOIN public.tbl_benutzer USING(person_id) WHERE uid=tbl_projektarbeit.student_uid)
|
||||
as bezeichnung
|
||||
FROM
|
||||
lehre.tbl_projektbetreuer
|
||||
JOIN lehre.tbl_projektarbeit USING(projektarbeit_id)
|
||||
JOIN lehre.tbl_lehreinheit USING(lehreinheit_id)
|
||||
WHERE
|
||||
tbl_projektbetreuer.person_id=?
|
||||
AND vertrag_id IS NULL
|
||||
@@ -625,13 +619,14 @@ SELECT
|
||||
null::integer as pruefung_id,
|
||||
projektarbeit_id,
|
||||
(tbl_projektbetreuer.stunden * tbl_projektbetreuer.stundensatz) as betrag,
|
||||
tbl_projektarbeit.studiensemester_kurzbz,
|
||||
tbl_lehreinheit.studiensemester_kurzbz,
|
||||
tbl_projektbetreuer.betreuerart_kurzbz,
|
||||
(SELECT nachname || ' ' || vorname FROM public.tbl_person JOIN public.tbl_benutzer USING(person_id) WHERE uid=tbl_projektarbeit.student_uid)
|
||||
as bezeichnung, vertrag_id
|
||||
FROM
|
||||
lehre.tbl_projektbetreuer
|
||||
JOIN lehre.tbl_projektarbeit USING(projektarbeit_id)
|
||||
JOIN lehre.tbl_lehreinheit USING(lehreinheit_id)
|
||||
WHERE
|
||||
tbl_projektbetreuer.person_id=?
|
||||
AND vertrag_id = ?
|
||||
|
||||
@@ -323,266 +323,4 @@ class Content_model extends DB_Model
|
||||
|
||||
return success(isset($result[$root_content_id]) ? $result[$root_content_id] : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Root contents without a parent in tbl_contentchild. Excludes news.
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getRootContent()
|
||||
{
|
||||
$query = '
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT DISTINCT ON (content_id) *
|
||||
FROM campus.tbl_content
|
||||
LEFT JOIN campus.tbl_contentchild USING (content_id)
|
||||
WHERE tbl_content.template_kurzbz <> ?
|
||||
AND content_id NOT IN (
|
||||
SELECT child_content_id FROM campus.tbl_contentchild
|
||||
WHERE child_content_id = tbl_content.content_id)
|
||||
) AS a
|
||||
ORDER BY sort, content_id
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, ['news']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recent news from the last two months, max 100 rows.
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getNewsContent()
|
||||
{
|
||||
$query = "
|
||||
SELECT *
|
||||
FROM campus.tbl_content
|
||||
JOIN campus.tbl_news USING (content_id)
|
||||
WHERE tbl_news.datum >= now() - '2 month'::interval
|
||||
ORDER BY datum DESC
|
||||
LIMIT 100
|
||||
";
|
||||
|
||||
return $this->execReadOnlyQuery($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search contents by content_id or titel. Excludes news. Returns content_ids only.
|
||||
* @param array $searchItems search terms
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function searchCms($searchItems)
|
||||
{
|
||||
if (empty($searchItems))
|
||||
return success([]);
|
||||
|
||||
$conditions = [];
|
||||
$params = [];
|
||||
foreach ($searchItems as $term)
|
||||
{
|
||||
$conditions[] = '(content_id::text = ? OR lower(titel) LIKE lower(?))';
|
||||
$params[] = $term;
|
||||
$params[] = '%' . $term . '%';
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT DISTINCT tbl_content.content_id
|
||||
FROM campus.tbl_contentsprache
|
||||
JOIN campus.tbl_content USING (content_id)
|
||||
WHERE tbl_content.template_kurzbz <> ?
|
||||
AND (' . implode(' OR ', $conditions) . ')
|
||||
ORDER BY content_id
|
||||
';
|
||||
|
||||
array_unshift($params, 'news');
|
||||
|
||||
return $this->execReadOnlyQuery($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Per content metadata for the tree filter. Excludes news, like getRootContent().
|
||||
* updateamum is the last touch on the content or on any of its versions.
|
||||
*
|
||||
* contentlength counts the visible characters of the newest version, the way getOne()
|
||||
* picks it: the default language first, then the highest version. The XML scaffolding,
|
||||
* the CDATA markers, the HTML tags, the entities and every space drop out, so a content
|
||||
* that nobody ever filled measures 0 whatever empty shape it carries. The title counts
|
||||
* too, so a content with a title and no body measures short instead of zero.
|
||||
*
|
||||
* @param string $uid current user, decides the mine flag
|
||||
* @param string $sprache preferred language of the measured version
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getTreeMeta($uid, $sprache)
|
||||
{
|
||||
$query = "
|
||||
SELECT tbl_content.content_id,
|
||||
(SELECT COUNT(*) FROM campus.tbl_contentchild
|
||||
WHERE tbl_contentchild.content_id = tbl_content.content_id) AS childcount,
|
||||
tbl_content.insertamum,
|
||||
GREATEST(
|
||||
tbl_content.updateamum,
|
||||
(SELECT MAX(updateamum) FROM campus.tbl_contentsprache
|
||||
WHERE tbl_contentsprache.content_id = tbl_content.content_id)
|
||||
) AS updateamum,
|
||||
COALESCE(
|
||||
tbl_content.insertvon = ? OR tbl_content.updatevon = ? OR EXISTS (
|
||||
SELECT 1 FROM campus.tbl_contentsprache
|
||||
WHERE tbl_contentsprache.content_id = tbl_content.content_id
|
||||
AND (tbl_contentsprache.insertvon = ?
|
||||
OR tbl_contentsprache.updatevon = ?)
|
||||
),
|
||||
false
|
||||
) AS mine,
|
||||
(SELECT length(
|
||||
regexp_replace(
|
||||
regexp_replace(
|
||||
regexp_replace(
|
||||
replace(replace(cs.content::text, '<![CDATA[', ''), ']]>', ''),
|
||||
'<[^>]*>', '', 'g'),
|
||||
'&[a-zA-Z]+;|&#[0-9]+;', '', 'g'),
|
||||
'\s+', '', 'g')
|
||||
)
|
||||
FROM campus.tbl_contentsprache cs
|
||||
WHERE cs.content_id = tbl_content.content_id
|
||||
ORDER BY (cs.sprache = ?) DESC, cs.version DESC
|
||||
LIMIT 1) AS contentlength
|
||||
FROM campus.tbl_content
|
||||
WHERE tbl_content.template_kurzbz <> ?
|
||||
";
|
||||
|
||||
return $this->execReadOnlyQuery(
|
||||
$query, [$uid, $uid, $uid, $uid, $sprache, 'news']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* All contents eligible as children: excludes ancestors, self, and news.
|
||||
* @param int $content_id the content to find children for
|
||||
* @param string $sprache language for the titel subselect
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getPossibleChilds($content_id, $sprache)
|
||||
{
|
||||
$query = '
|
||||
SELECT content_id, oe_kurzbz, template_kurzbz,
|
||||
(SELECT titel FROM campus.tbl_contentsprache
|
||||
WHERE sprache = ? AND content_id = tbl_content.content_id
|
||||
ORDER BY version LIMIT 1) AS titel
|
||||
FROM campus.tbl_content
|
||||
WHERE content_id NOT IN (
|
||||
WITH RECURSIVE parents(content_id, child_content_id) AS (
|
||||
SELECT content_id, child_content_id FROM campus.tbl_contentchild
|
||||
WHERE child_content_id = ?
|
||||
UNION ALL
|
||||
SELECT cc.content_id, cc.child_content_id
|
||||
FROM campus.tbl_contentchild cc, parents
|
||||
WHERE cc.child_content_id = parents.content_id)
|
||||
SELECT content_id FROM parents GROUP BY content_id)
|
||||
AND content_id <> ?
|
||||
AND template_kurzbz <> ?
|
||||
ORDER BY titel
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, [$sprache, $content_id, $content_id, 'news']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Where a content is referenced. Returns [{table, label}] for the delete dialog.
|
||||
* Tolerates missing addon/testtool schemas.
|
||||
* @param int $content_id
|
||||
* @return stdClass success with flat array or error
|
||||
*/
|
||||
public function getUsage($content_id)
|
||||
{
|
||||
$coreQuery = "
|
||||
SELECT 'campus.tbl_infoscreen_content' AS \"table\",
|
||||
infoscreen_id::text AS label
|
||||
FROM campus.tbl_infoscreen_content WHERE content_id = ?
|
||||
UNION ALL
|
||||
SELECT 'campus.tbl_news', betreff
|
||||
FROM campus.tbl_news WHERE content_id = ?
|
||||
UNION ALL
|
||||
SELECT 'public.tbl_ort', ort_kurzbz
|
||||
FROM public.tbl_ort WHERE content_id = ?
|
||||
UNION ALL
|
||||
SELECT 'public.tbl_service', bezeichnung
|
||||
FROM public.tbl_service WHERE content_id = ?
|
||||
UNION ALL
|
||||
SELECT 'public.tbl_statistik', bezeichnung
|
||||
FROM public.tbl_statistik WHERE content_id = ?
|
||||
";
|
||||
$coreParams = [$content_id, $content_id, $content_id, $content_id, $content_id];
|
||||
|
||||
$coreResult = $this->execReadOnlyQuery($coreQuery, $coreParams);
|
||||
$rows = [];
|
||||
|
||||
if (!isError($coreResult) && getData($coreResult))
|
||||
$rows = getData($coreResult);
|
||||
|
||||
// Optional schemas: testtool and addon may not exist. A failing query still writes a
|
||||
// db error into the response envelope, so check for the table before querying it.
|
||||
$optionalQueries = [
|
||||
[
|
||||
'testtool', 'tbl_ablauf_vorgaben',
|
||||
"SELECT 'testtool.tbl_ablauf_vorgaben' AS \"table\",
|
||||
ablauf_vorgaben_id::text AS label
|
||||
FROM testtool.tbl_ablauf_vorgaben WHERE content_id = ?"
|
||||
],
|
||||
[
|
||||
'addon', 'tbl_software',
|
||||
"SELECT 'addon.tbl_software' AS \"table\",
|
||||
software_id::text AS label
|
||||
FROM addon.tbl_software WHERE content_id = ?"
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($optionalQueries as $opt)
|
||||
{
|
||||
if (!$this->tableExists($opt[0], $opt[1]))
|
||||
continue;
|
||||
|
||||
$result = $this->execReadOnlyQuery($opt[2], [$content_id]);
|
||||
if (!isError($result) && getData($result))
|
||||
$rows = array_merge($rows, getData($result));
|
||||
}
|
||||
|
||||
return success($rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* True if a base table exists. Guards the optional testtool and addon schemas.
|
||||
* @param string $schema
|
||||
* @param string $table
|
||||
* @return bool
|
||||
*/
|
||||
private function tableExists($schema, $table)
|
||||
{
|
||||
$query = "
|
||||
SELECT 1 AS exists
|
||||
FROM information_schema.tables
|
||||
WHERE table_catalog = ? AND table_schema = ? AND table_name = ?
|
||||
";
|
||||
|
||||
return hasData($this->execReadOnlyQuery($query, [DB_NAME, $schema, $table]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns oe_kurzbz for a content as a string.
|
||||
* @param int $content_id
|
||||
* @return stdClass success with string or error
|
||||
*/
|
||||
public function getOeKurzbz($content_id)
|
||||
{
|
||||
$query = 'SELECT oe_kurzbz FROM campus.tbl_content WHERE content_id = ?';
|
||||
$result = $this->execReadOnlyQuery($query, [$content_id]);
|
||||
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
$data = getData($result);
|
||||
if (empty($data))
|
||||
return error('Content not found');
|
||||
|
||||
return success($data[0]->oe_kurzbz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<?php
|
||||
class Contentchild_model extends DB_Model
|
||||
{
|
||||
// swapSort reports the two boundary cases with this. See swapSort().
|
||||
const NO_NEIGHBOUR = 'no neighbour';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -14,345 +11,4 @@ class Contentchild_model extends DB_Model
|
||||
$this->dbTable = 'campus.tbl_contentchild';
|
||||
$this->pk = 'contentchild_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Children with titel, sorted by sort.
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getChilds($content_id, $sprache)
|
||||
{
|
||||
$query = '
|
||||
SELECT cc.contentchild_id, cc.child_content_id, cc.sort,
|
||||
(SELECT titel FROM campus.tbl_contentsprache
|
||||
WHERE content_id = cc.child_content_id AND sprache = ?
|
||||
ORDER BY version LIMIT 1) AS titel
|
||||
FROM campus.tbl_contentchild cc
|
||||
WHERE cc.content_id = ?
|
||||
ORDER BY cc.sort, cc.contentchild_id
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, [$sprache, $content_id]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parents of a content, with the title of each parent.
|
||||
* A content can hang under more than one parent, so this returns a list.
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getParents($content_id, $sprache)
|
||||
{
|
||||
$query = '
|
||||
SELECT cc.contentchild_id, cc.content_id, cc.sort,
|
||||
(SELECT titel FROM campus.tbl_contentsprache
|
||||
WHERE content_id = cc.content_id AND sprache = ?
|
||||
ORDER BY version LIMIT 1) AS titel
|
||||
FROM campus.tbl_contentchild cc
|
||||
WHERE cc.child_content_id = ?
|
||||
ORDER BY cc.content_id
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, [$sprache, $content_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Children of a content as a reader may see them.
|
||||
*
|
||||
* Differs from getChilds() on purpose. getChilds() serves the admin and returns every
|
||||
* child with the lowest version. A reader needs the newest visible version, only active
|
||||
* contents, and no page that a group rule keeps from them.
|
||||
*
|
||||
* The group rule follows CmsLib::getContent(): a content without a row in
|
||||
* tbl_contentgruppe is open, a content with rows needs membership in one of them.
|
||||
*
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @param string $uid
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getChildsForReader($content_id, $sprache, $uid)
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
cc.child_content_id AS content_id,
|
||||
cc.sort,
|
||||
COALESCE(
|
||||
(SELECT cs.titel FROM campus.tbl_contentsprache cs
|
||||
WHERE cs.content_id = cc.child_content_id
|
||||
AND cs.sprache = ?
|
||||
AND cs.sichtbar
|
||||
AND LENGTH(cs.titel) > 0
|
||||
ORDER BY cs.version DESC NULLS LAST LIMIT 1),
|
||||
(SELECT cs.titel FROM campus.tbl_contentsprache cs
|
||||
WHERE cs.content_id = cc.child_content_id
|
||||
AND cs.sichtbar
|
||||
AND LENGTH(cs.titel) > 0
|
||||
ORDER BY cs.version DESC NULLS LAST LIMIT 1),
|
||||
c.beschreibung
|
||||
) AS titel
|
||||
FROM campus.tbl_contentchild cc
|
||||
JOIN campus.tbl_content c ON c.content_id = cc.child_content_id
|
||||
WHERE cc.content_id = ?
|
||||
AND c.aktiv
|
||||
-- Without a visible version the reader cannot open the page at all.
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM campus.tbl_contentsprache cs
|
||||
WHERE cs.content_id = cc.child_content_id AND cs.sichtbar
|
||||
)
|
||||
AND (
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM campus.tbl_contentgruppe cg
|
||||
WHERE cg.content_id = cc.child_content_id
|
||||
)
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM campus.tbl_contentgruppe cg
|
||||
JOIN public.vw_gruppen vg ON vg.gruppe_kurzbz = cg.gruppe_kurzbz
|
||||
WHERE cg.content_id = cc.child_content_id AND vg.uid = ?
|
||||
)
|
||||
)
|
||||
ORDER BY cc.sort, cc.contentchild_id
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, [$sprache, $content_id, $uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Highest sort value. Returns 0 if no row exists.
|
||||
* @param int $content_id
|
||||
* @return stdClass success with int or error
|
||||
*/
|
||||
public function getMaxSort($content_id)
|
||||
{
|
||||
$query = '
|
||||
SELECT COALESCE(MAX(sort), 0) AS max_sort
|
||||
FROM campus.tbl_contentchild
|
||||
WHERE content_id = ?
|
||||
';
|
||||
|
||||
$result = $this->execReadOnlyQuery($query, [$content_id]);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
return success((int) getData($result)[0]->max_sort);
|
||||
}
|
||||
|
||||
/**
|
||||
* All descendant content_ids recursively. Returns a flat array.
|
||||
* @param int $content_id
|
||||
* @return stdClass success with array of ints or error
|
||||
*/
|
||||
public function getAllChildIds($content_id)
|
||||
{
|
||||
$query = '
|
||||
WITH RECURSIVE childs(content_id, child_content_id) AS (
|
||||
SELECT content_id, child_content_id FROM campus.tbl_contentchild WHERE content_id = ?
|
||||
UNION ALL
|
||||
SELECT cc.content_id, cc.child_content_id
|
||||
FROM campus.tbl_contentchild cc, childs
|
||||
WHERE cc.content_id = childs.child_content_id)
|
||||
SELECT DISTINCT child_content_id FROM childs
|
||||
';
|
||||
|
||||
$result = $this->execReadOnlyQuery($query, [$content_id]);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
$ids = [];
|
||||
if (getData($result))
|
||||
{
|
||||
foreach (getData($result) as $row)
|
||||
$ids[] = (int) $row->child_content_id;
|
||||
}
|
||||
|
||||
return success($ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap sort value with the neighbour. Direction is 'up' or 'down'.
|
||||
* @param int $contentchild_id
|
||||
* @param string $direction 'up' or 'down'
|
||||
* @return stdClass success or error
|
||||
*/
|
||||
public function swapSort($contentchild_id, $direction)
|
||||
{
|
||||
$currentResult = $this->load($contentchild_id);
|
||||
if (isError($currentResult))
|
||||
return $currentResult;
|
||||
$current = getData($currentResult)[0];
|
||||
|
||||
if ($direction === 'up')
|
||||
{
|
||||
$neighbourQuery = '
|
||||
SELECT contentchild_id, sort
|
||||
FROM campus.tbl_contentchild
|
||||
WHERE content_id = ? AND sort < ?
|
||||
ORDER BY sort DESC
|
||||
LIMIT 1
|
||||
';
|
||||
}
|
||||
else
|
||||
{
|
||||
$neighbourQuery = '
|
||||
SELECT contentchild_id, sort
|
||||
FROM campus.tbl_contentchild
|
||||
WHERE content_id = ? AND sort > ?
|
||||
ORDER BY sort ASC
|
||||
LIMIT 1
|
||||
';
|
||||
}
|
||||
|
||||
$neighbourResult = $this->execReadOnlyQuery($neighbourQuery, [$current->content_id, $current->sort]);
|
||||
if (isError($neighbourResult))
|
||||
return $neighbourResult;
|
||||
|
||||
$neighbourData = getData($neighbourResult);
|
||||
// A marker, not a message. The controller owns the wording, because a model has no
|
||||
// phrases. Returning a phrase key here put the key itself in front of the user.
|
||||
if (empty($neighbourData))
|
||||
return error(self::NO_NEIGHBOUR);
|
||||
|
||||
$neighbour = $neighbourData[0];
|
||||
|
||||
// Transaction wraps the swap; the legacy does not.
|
||||
$this->db->trans_start();
|
||||
|
||||
$this->execQuery(
|
||||
'UPDATE campus.tbl_contentchild SET sort = ? WHERE contentchild_id = ?',
|
||||
[$neighbour->sort, $current->contentchild_id]
|
||||
);
|
||||
$this->execQuery(
|
||||
'UPDATE campus.tbl_contentchild SET sort = ? WHERE contentchild_id = ?',
|
||||
[$current->sort, $neighbour->contentchild_id]
|
||||
);
|
||||
|
||||
$this->db->trans_complete();
|
||||
|
||||
if ($this->db->trans_status() === false)
|
||||
return error('Sort swap failed');
|
||||
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the whole order of one content in one transaction. Serves the drag and drop.
|
||||
* The list must hold every child of the content exactly once, or the rows left out
|
||||
* would keep a stale sort value.
|
||||
* @param int $content_id
|
||||
* @param array $contentchild_ids in the wanted order
|
||||
* @return stdClass success(true) or error
|
||||
*/
|
||||
public function setSortOrder($content_id, $contentchild_ids)
|
||||
{
|
||||
$currentResult = $this->execReadOnlyQuery(
|
||||
'SELECT contentchild_id FROM campus.tbl_contentchild WHERE content_id = ?',
|
||||
[$content_id]
|
||||
);
|
||||
if (isError($currentResult))
|
||||
return $currentResult;
|
||||
|
||||
$current = [];
|
||||
foreach ((array) getData($currentResult) as $row)
|
||||
$current[] = (int) $row->contentchild_id;
|
||||
|
||||
$wanted = array_map('intval', array_values($contentchild_ids));
|
||||
|
||||
$check = $wanted;
|
||||
sort($current);
|
||||
sort($check);
|
||||
if ($current !== $check)
|
||||
return error('Sort order does not match the children of the content');
|
||||
|
||||
$this->db->trans_start();
|
||||
|
||||
foreach ($wanted as $position => $contentchild_id)
|
||||
{
|
||||
$this->execQuery(
|
||||
'UPDATE campus.tbl_contentchild SET sort = ? WHERE contentchild_id = ?',
|
||||
[$position + 1, $contentchild_id]
|
||||
);
|
||||
}
|
||||
|
||||
$this->db->trans_complete();
|
||||
|
||||
if ($this->db->trans_status() === false)
|
||||
return error('Sort order update failed');
|
||||
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Every ancestor of the given contents, with the distance to the content it belongs to.
|
||||
*
|
||||
* The tree shows a search result out of its place: a title like "Team" says nothing
|
||||
* about which unit it belongs to. This delivers the way down to it.
|
||||
*
|
||||
* A content can hang under more than one parent, so a level can hold more than one
|
||||
* ancestor. Every one of them comes back, with tiefe 1 for the direct parent. The
|
||||
* caller decides how to draw that.
|
||||
*
|
||||
* tiefe also ends a cycle: a content whose parent chain leads back to itself would
|
||||
* otherwise recurse forever.
|
||||
*
|
||||
* @param array $content_ids contents to walk up from
|
||||
* @param int $maxTiefe how many levels to climb
|
||||
* @param string $sprache language of the ancestor titles
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getAncestors($content_ids, $maxTiefe, $sprache)
|
||||
{
|
||||
if (empty($content_ids))
|
||||
return success([]);
|
||||
|
||||
$platzhalter = implode(', ', array_fill(0, count($content_ids), '?'));
|
||||
|
||||
// The aggregate and the title sit in the final select. The recursive term names
|
||||
// the working table once and carries no subquery, which is what Postgres allows.
|
||||
$query = '
|
||||
WITH RECURSIVE auf(start_id, content_id, tiefe) AS (
|
||||
SELECT cc.child_content_id, cc.content_id, 1
|
||||
FROM campus.tbl_contentchild cc
|
||||
WHERE cc.child_content_id IN (' . $platzhalter . ')
|
||||
UNION ALL
|
||||
SELECT auf.start_id, cc.content_id, auf.tiefe + 1
|
||||
FROM campus.tbl_contentchild cc
|
||||
JOIN auf ON cc.child_content_id = auf.content_id
|
||||
WHERE auf.tiefe < ?
|
||||
)
|
||||
SELECT auf.start_id, auf.content_id, MIN(auf.tiefe) AS tiefe,
|
||||
(SELECT titel FROM campus.tbl_contentsprache cs
|
||||
WHERE cs.content_id = auf.content_id AND cs.sprache = ?
|
||||
ORDER BY cs.version LIMIT 1) AS titel,
|
||||
-- The caller turns this into the entitled flag, so the path can offer a
|
||||
-- link only for an ancestor the editor may open.
|
||||
(SELECT c.oe_kurzbz FROM campus.tbl_content c
|
||||
WHERE c.content_id = auf.content_id) AS oe_kurzbz
|
||||
FROM auf
|
||||
GROUP BY auf.start_id, auf.content_id
|
||||
ORDER BY auf.start_id, MIN(auf.tiefe) DESC, auf.content_id
|
||||
';
|
||||
|
||||
$params = array_map('intval', array_values($content_ids));
|
||||
$params[] = (int) $maxTiefe;
|
||||
$params[] = $sprache;
|
||||
|
||||
return $this->execReadOnlyQuery($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a content from the child table, as parent and as child.
|
||||
* @param int $content_id
|
||||
* @return stdClass
|
||||
*/
|
||||
public function deleteByContent($content_id)
|
||||
{
|
||||
return $this->execQuery(
|
||||
'DELETE FROM campus.tbl_contentchild
|
||||
WHERE content_id = ? OR child_content_id = ?',
|
||||
[$content_id, $content_id]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@ class Contentgruppe_model extends DB_Model
|
||||
parent::__construct();
|
||||
$this->dbTable = 'campus.tbl_contentgruppe';
|
||||
$this->pk = array('gruppe_kurzbz', 'content_id');
|
||||
// Composite key without a sequence, so insert() must skip insert_id() and its LASTVAL().
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,7 +18,7 @@ class Contentgruppe_model extends DB_Model
|
||||
*
|
||||
* @param int $content_id
|
||||
*
|
||||
* @return stdClass success(true) wenn locked sonst success(false)
|
||||
* @return stdClass success(true) wenn eingeschraenkt sonst success(false)
|
||||
*/
|
||||
public function islocked($content_id)
|
||||
{
|
||||
@@ -32,7 +30,7 @@ class Contentgruppe_model extends DB_Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft ob ein User die Berechtigung fuer das Anzeigen des
|
||||
* Prueft ob ein User die Berechtigung fuer das Anzeigen des
|
||||
* Contents besitzt
|
||||
*
|
||||
* @param int $content_id ID des Contents
|
||||
@@ -58,89 +56,5 @@ class Contentgruppe_model extends DB_Model
|
||||
return $result;
|
||||
return success(!!getData($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups assigned to a content, with bezeichnung.
|
||||
* @param int $content_id
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getGruppen($content_id)
|
||||
{
|
||||
$query = '
|
||||
SELECT cg.gruppe_kurzbz, g.bezeichnung
|
||||
FROM campus.tbl_contentgruppe cg
|
||||
JOIN public.tbl_gruppe g USING (gruppe_kurzbz)
|
||||
WHERE cg.content_id = ?
|
||||
ORDER BY cg.gruppe_kurzbz
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, [$content_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* All selectable groups. Returns gruppe_kurzbz and bezeichnung.
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getAllGruppen()
|
||||
{
|
||||
// content_visible marks a group as selectable for content rights. Generated groups
|
||||
// carry FALSE. admin.php filters the same way via getgruppe(...,$content_visible=true).
|
||||
$query = '
|
||||
SELECT gruppe_kurzbz, bezeichnung
|
||||
FROM public.tbl_gruppe
|
||||
WHERE content_visible = TRUE
|
||||
ORDER BY gruppe_kurzbz
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups for multiple contents in one query. Returns content_id => [gruppe_kurzbz, ...].
|
||||
* @param array $contentIds array of content_id values
|
||||
* @return stdClass success with associative array or error
|
||||
*/
|
||||
public function getGruppenForContents($contentIds)
|
||||
{
|
||||
if (empty($contentIds))
|
||||
return success([]);
|
||||
|
||||
$placeholders = implode(',', array_fill(0, count($contentIds), '?'));
|
||||
$query = '
|
||||
SELECT content_id, gruppe_kurzbz
|
||||
FROM campus.tbl_contentgruppe
|
||||
WHERE content_id IN (' . $placeholders . ')
|
||||
ORDER BY content_id, gruppe_kurzbz
|
||||
';
|
||||
|
||||
$result = $this->execReadOnlyQuery($query, array_values($contentIds));
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
$map = [];
|
||||
if (getData($result))
|
||||
{
|
||||
foreach (getData($result) as $row)
|
||||
{
|
||||
$id = (int) $row->content_id;
|
||||
if (!isset($map[$id]))
|
||||
$map[$id] = [];
|
||||
$map[$id][] = $row->gruppe_kurzbz;
|
||||
}
|
||||
}
|
||||
|
||||
return success($map);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @return stdClass
|
||||
*/
|
||||
public function deleteByContent($content_id)
|
||||
{
|
||||
return $this->execQuery(
|
||||
'DELETE FROM campus.tbl_contentgruppe WHERE content_id = ?',
|
||||
[$content_id]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,76 +11,4 @@ class Contentlog_model extends DB_Model
|
||||
$this->dbTable = 'campus.tbl_contentlog';
|
||||
$this->pk = 'contentlog_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* The open lock entry of a user (ende IS NULL). Returns null if none exists.
|
||||
* Match the holder and take the newest, otherwise the age belongs to an abandoned entry.
|
||||
* @param int $contentsprache_id
|
||||
* @param string $uid holder of the lock
|
||||
* @return stdClass success with row or null, or error
|
||||
*/
|
||||
public function getOpenLock($contentsprache_id, $uid)
|
||||
{
|
||||
$query = '
|
||||
SELECT contentlog_id, uid, contentsprache_id, start
|
||||
FROM campus.tbl_contentlog
|
||||
WHERE contentsprache_id = ? AND uid = ? AND ende IS NULL
|
||||
ORDER BY start DESC
|
||||
LIMIT 1
|
||||
';
|
||||
|
||||
$result = $this->execReadOnlyQuery($query, [$contentsprache_id, $uid]);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
$data = getData($result);
|
||||
return success(empty($data) ? null : $data[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends every open lock entry of a version. Without a uid it ends the entry of every
|
||||
* holder, which is what a take-over and a forced release need.
|
||||
* @param int $contentsprache_id
|
||||
* @param string|null $uid
|
||||
* @return stdClass
|
||||
*/
|
||||
public function closeOpenEntries($contentsprache_id, $uid = null)
|
||||
{
|
||||
$query = 'UPDATE campus.tbl_contentlog SET ende = now()
|
||||
WHERE contentsprache_id = ? AND ende IS NULL';
|
||||
$params = [$contentsprache_id];
|
||||
|
||||
if ($uid !== null)
|
||||
{
|
||||
$query .= ' AND uid = ?';
|
||||
$params[] = $uid;
|
||||
}
|
||||
|
||||
return $this->execQuery($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $contentsprache_id
|
||||
* @return stdClass
|
||||
*/
|
||||
public function deleteByContentsprache($contentsprache_id)
|
||||
{
|
||||
return $this->execQuery(
|
||||
'DELETE FROM campus.tbl_contentlog WHERE contentsprache_id = ?',
|
||||
[$contentsprache_id]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @return stdClass
|
||||
*/
|
||||
public function deleteByContent($content_id)
|
||||
{
|
||||
return $this->execQuery(
|
||||
'DELETE FROM campus.tbl_contentlog WHERE contentsprache_id IN
|
||||
(SELECT contentsprache_id FROM campus.tbl_contentsprache WHERE content_id = ?)',
|
||||
[$content_id]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,177 +38,5 @@ class Contentsprache_model extends DB_Model
|
||||
|
||||
return success(!!getData($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* All versions of a language, ascending by version.
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @return stdClass success with array of rows or error
|
||||
*/
|
||||
public function getVersions($content_id, $sprache)
|
||||
{
|
||||
$query = '
|
||||
SELECT contentsprache_id, version, sichtbar, titel,
|
||||
insertamum, insertvon, updateamum, updatevon, gesperrt_uid
|
||||
FROM campus.tbl_contentsprache
|
||||
WHERE content_id = ? AND sprache = ?
|
||||
ORDER BY version ASC
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, [$content_id, $sprache]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Distinct languages for a content. Returns a flat array of strings.
|
||||
* @param int $content_id
|
||||
* @return stdClass success with array of strings or error
|
||||
*/
|
||||
public function getLanguages($content_id)
|
||||
{
|
||||
$query = '
|
||||
SELECT DISTINCT sprache
|
||||
FROM campus.tbl_contentsprache
|
||||
WHERE content_id = ?
|
||||
ORDER BY sprache
|
||||
';
|
||||
|
||||
$result = $this->execReadOnlyQuery($query, [$content_id]);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
$languages = [];
|
||||
if (getData($result))
|
||||
{
|
||||
foreach (getData($result) as $row)
|
||||
$languages[] = $row->sprache;
|
||||
}
|
||||
|
||||
return success($languages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Highest version number. Returns 0 if no row exists.
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @return stdClass success with int or error
|
||||
*/
|
||||
public function getMaxVersion($content_id, $sprache)
|
||||
{
|
||||
$query = '
|
||||
SELECT COALESCE(MAX(version), 0) AS max_version
|
||||
FROM campus.tbl_contentsprache
|
||||
WHERE content_id = ? AND sprache = ?
|
||||
';
|
||||
|
||||
$result = $this->execReadOnlyQuery($query, [$content_id, $sprache]);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
return success((int) getData($result)[0]->max_version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Row count for a content+language. Used for the delete guard.
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @return stdClass success with int or error
|
||||
*/
|
||||
public function getNumberOfVersions($content_id, $sprache)
|
||||
{
|
||||
$query = '
|
||||
SELECT COUNT(*) AS cnt
|
||||
FROM campus.tbl_contentsprache
|
||||
WHERE content_id = ? AND sprache = ?
|
||||
';
|
||||
|
||||
$result = $this->execReadOnlyQuery($query, [$content_id, $sprache]);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
return success((int) getData($result)[0]->cnt);
|
||||
}
|
||||
|
||||
/**
|
||||
* One version, all columns. If $version is empty, returns the highest version.
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @param int|null $version
|
||||
* @return stdClass success with single row or error
|
||||
*/
|
||||
public function getOne($content_id, $sprache, $version = null)
|
||||
{
|
||||
$params = [$content_id, $sprache];
|
||||
|
||||
$versionClause = '';
|
||||
if (!empty($version))
|
||||
{
|
||||
$versionClause = ' AND version = ?';
|
||||
$params[] = $version;
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT * FROM campus.tbl_contentsprache
|
||||
WHERE content_id = ? AND sprache = ?' . $versionClause . '
|
||||
ORDER BY version DESC LIMIT 1
|
||||
';
|
||||
|
||||
$result = $this->execReadOnlyQuery($query, $params);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
$data = getData($result);
|
||||
if (empty($data))
|
||||
return error('Version not found');
|
||||
|
||||
return success($data[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the lock of a version. Without a uid it clears whoever holds it, which is
|
||||
* what a forced release needs.
|
||||
* @param int $contentsprache_id
|
||||
* @param string|null $uid
|
||||
* @return stdClass
|
||||
*/
|
||||
public function releaseLock($contentsprache_id, $uid = null)
|
||||
{
|
||||
$query = 'UPDATE campus.tbl_contentsprache SET gesperrt_uid = NULL
|
||||
WHERE contentsprache_id = ?';
|
||||
$params = [$contentsprache_id];
|
||||
|
||||
if ($uid !== null)
|
||||
{
|
||||
$query .= ' AND gesperrt_uid = ?';
|
||||
$params[] = $uid;
|
||||
}
|
||||
|
||||
return $this->execQuery($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @return stdClass
|
||||
*/
|
||||
public function deleteByContent($content_id)
|
||||
{
|
||||
return $this->execQuery(
|
||||
'DELETE FROM campus.tbl_contentsprache WHERE content_id = ?',
|
||||
[$content_id]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $content_id
|
||||
* @param string $sprache
|
||||
* @param int $version
|
||||
* @return stdClass
|
||||
*/
|
||||
public function deleteVersion($content_id, $sprache, $version)
|
||||
{
|
||||
return $this->execQuery(
|
||||
'DELETE FROM campus.tbl_contentsprache
|
||||
WHERE content_id = ? AND sprache = ? AND version = ?',
|
||||
[$content_id, $sprache, $version]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,241 +30,4 @@ class Dms_model extends DB_Model
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a DMS category and the access facts a listing needs.
|
||||
*
|
||||
* Mirrors the rule of cms/dms.php and dms.class.php at category level:
|
||||
* a category is locked when any category in its parent chain grants a group or
|
||||
* carries a berechtigung_kurzbz. The caller decides, this method only reports.
|
||||
*
|
||||
* @param string $kategorie_kurzbz
|
||||
* gesperrt and in_gruppe come back as 0 or 1, not as a boolean. A PostgreSQL boolean
|
||||
* reaches PHP as the string 'f' when the driver conversion does not run, and 'f' is
|
||||
* truthy. The int cast is correct in both cases.
|
||||
*
|
||||
* @param string $uid
|
||||
* @return object one row, or an empty result when the category does not exist
|
||||
*/
|
||||
public function getKategorieZugriff($kategorie_kurzbz, $uid)
|
||||
{
|
||||
// tiefe guards against a cyclic parent chain.
|
||||
$query = '
|
||||
WITH RECURSIVE chain(kategorie_kurzbz, parent_kategorie_kurzbz, berechtigung_kurzbz, tiefe) AS (
|
||||
SELECT kategorie_kurzbz, parent_kategorie_kurzbz, berechtigung_kurzbz, 1
|
||||
FROM campus.tbl_dms_kategorie
|
||||
WHERE kategorie_kurzbz = ?
|
||||
UNION ALL
|
||||
SELECT k.kategorie_kurzbz, k.parent_kategorie_kurzbz, k.berechtigung_kurzbz, c.tiefe + 1
|
||||
FROM campus.tbl_dms_kategorie k
|
||||
JOIN chain c ON k.kategorie_kurzbz = c.parent_kategorie_kurzbz
|
||||
WHERE c.tiefe < 32
|
||||
)
|
||||
SELECT
|
||||
kat.kategorie_kurzbz,
|
||||
kat.bezeichnung,
|
||||
kat.beschreibung,
|
||||
kat.berechtigung_kurzbz,
|
||||
(
|
||||
EXISTS (SELECT 1 FROM chain WHERE chain.berechtigung_kurzbz IS NOT NULL)
|
||||
OR EXISTS (
|
||||
SELECT 1
|
||||
FROM campus.tbl_dms_kategorie_gruppe g
|
||||
JOIN chain ON chain.kategorie_kurzbz = g.kategorie_kurzbz
|
||||
)
|
||||
)::int AS gesperrt,
|
||||
(EXISTS (
|
||||
SELECT 1
|
||||
FROM campus.tbl_dms_kategorie_gruppe g
|
||||
JOIN chain ON chain.kategorie_kurzbz = g.kategorie_kurzbz
|
||||
JOIN public.tbl_benutzergruppe b ON b.gruppe_kurzbz = g.gruppe_kurzbz
|
||||
WHERE b.uid = ?
|
||||
))::int AS in_gruppe
|
||||
FROM campus.tbl_dms_kategorie kat
|
||||
WHERE kat.kategorie_kurzbz = ?
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, array($kategorie_kurzbz, $uid, $kategorie_kurzbz));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists the newest version of every document in one DMS category.
|
||||
*
|
||||
* filename stays out of the result. The reader gets the document through
|
||||
* cms/dms.php?id=<dms_id>, never through the name on disk.
|
||||
*
|
||||
* @param string $kategorie_kurzbz
|
||||
* @return object
|
||||
*/
|
||||
public function getKategorieDokumente($kategorie_kurzbz)
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
d.dms_id,
|
||||
v.version,
|
||||
v.name,
|
||||
v.beschreibung,
|
||||
v.mimetype,
|
||||
COALESCE(v.updateamum, v.insertamum) AS geaendert
|
||||
FROM campus.tbl_dms d
|
||||
JOIN campus.tbl_dms_version v ON v.dms_id = d.dms_id
|
||||
WHERE d.kategorie_kurzbz = ?
|
||||
-- cis_suche marks a document as published to CIS readers. A category also
|
||||
-- holds working files, and those must not appear on a content page.
|
||||
AND v.cis_suche
|
||||
AND v.version = (
|
||||
SELECT MAX(version) FROM campus.tbl_dms_version WHERE dms_id = d.dms_id
|
||||
)
|
||||
-- A project document carries its own rule in dms.class.php and does not
|
||||
-- belong in a CMS category listing.
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM fue.tbl_projekt_dokument pd WHERE pd.dms_id = d.dms_id
|
||||
)
|
||||
ORDER BY LOWER(v.name)
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, array($kategorie_kurzbz));
|
||||
}
|
||||
|
||||
/**
|
||||
* Newest version of the named documents, in no particular order.
|
||||
*
|
||||
* Unlike getKategorieDokumente() this does NOT filter on cis_suche. An editor who names
|
||||
* a dms_id has chosen that document on purpose, and the flag only marks a document for
|
||||
* the CIS search. The category rule still applies, and the caller enforces it.
|
||||
*
|
||||
* @param array $ids dms_id values
|
||||
* @return object
|
||||
*/
|
||||
public function getDokumenteByIds($ids)
|
||||
{
|
||||
if (empty($ids))
|
||||
return success(array());
|
||||
|
||||
$platzhalter = implode(', ', array_fill(0, count($ids), '?'));
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
d.dms_id,
|
||||
d.kategorie_kurzbz,
|
||||
v.version,
|
||||
v.name,
|
||||
v.beschreibung,
|
||||
v.mimetype,
|
||||
COALESCE(v.updateamum, v.insertamum) AS geaendert
|
||||
FROM campus.tbl_dms d
|
||||
JOIN campus.tbl_dms_version v ON v.dms_id = d.dms_id
|
||||
WHERE d.dms_id IN (' . $platzhalter . ')
|
||||
AND v.version = (
|
||||
SELECT MAX(version) FROM campus.tbl_dms_version WHERE dms_id = d.dms_id
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM fue.tbl_projekt_dokument pd WHERE pd.dms_id = d.dms_id
|
||||
)
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, array_values($ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* Every document of one category, for the editor picker.
|
||||
*
|
||||
* Unlike getKategorieDokumente() this does NOT filter on cis_suche, because
|
||||
* dms-dokumente renders named documents regardless of that flag. The flag travels with
|
||||
* the row so the picker can mark a document that no reader would find by search.
|
||||
*
|
||||
* @param string $kategorie_kurzbz
|
||||
* @return object
|
||||
*/
|
||||
public function getKategorieDokumenteAlle($kategorie_kurzbz)
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
d.dms_id,
|
||||
v.name,
|
||||
v.cis_suche::int AS cis_suche
|
||||
FROM campus.tbl_dms d
|
||||
JOIN LATERAL (
|
||||
SELECT v.name, v.cis_suche
|
||||
FROM campus.tbl_dms_version v
|
||||
WHERE v.dms_id = d.dms_id
|
||||
ORDER BY v.version DESC
|
||||
LIMIT 1
|
||||
) v ON TRUE
|
||||
WHERE d.kategorie_kurzbz = ?
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM fue.tbl_projekt_dokument pd WHERE pd.dms_id = d.dms_id
|
||||
)
|
||||
ORDER BY LOWER(v.name)
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, array($kategorie_kurzbz));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists every DMS category with the number of documents it holds.
|
||||
* Used by the insert dialog of the CMS content component "dms-liste".
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function getKategorien()
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
k.kategorie_kurzbz,
|
||||
k.bezeichnung,
|
||||
k.oe_kurzbz,
|
||||
COALESCE(a.anzahl, 0) AS anzahl
|
||||
FROM campus.tbl_dms_kategorie k
|
||||
LEFT JOIN (
|
||||
SELECT d.kategorie_kurzbz, COUNT(*) AS anzahl
|
||||
FROM campus.tbl_dms d
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (dms_id) dms_id, cis_suche
|
||||
FROM campus.tbl_dms_version
|
||||
ORDER BY dms_id, version DESC
|
||||
) v ON v.dms_id = d.dms_id
|
||||
WHERE v.cis_suche
|
||||
GROUP BY d.kategorie_kurzbz
|
||||
) a ON a.kategorie_kurzbz = k.kategorie_kurzbz
|
||||
ORDER BY LOWER(COALESCE(k.bezeichnung, k.kategorie_kurzbz))
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* The category itself plus its sub categories, down to a depth.
|
||||
*
|
||||
* tiefe 0 returns only the category named. The depth bound also ends a cycle: a
|
||||
* category whose parent chain leads back to itself would otherwise recurse forever.
|
||||
*
|
||||
* The caller must still check the entitlement of every category it gets back. A sub
|
||||
* category carries its own group rule and may be closed while the parent is open.
|
||||
*
|
||||
* @param string $kategorie_kurzbz root of the walk
|
||||
* @param int $tiefe how many levels below the root to include
|
||||
* @return object success with array of rows or error
|
||||
*/
|
||||
public function getMitUnterkategorien($kategorie_kurzbz, $tiefe)
|
||||
{
|
||||
$query = '
|
||||
WITH RECURSIVE unter(kategorie_kurzbz, tiefe) AS (
|
||||
SELECT kategorie_kurzbz, 0
|
||||
FROM campus.tbl_dms_kategorie
|
||||
WHERE kategorie_kurzbz = ?
|
||||
UNION ALL
|
||||
SELECT k.kategorie_kurzbz, unter.tiefe + 1
|
||||
FROM campus.tbl_dms_kategorie k
|
||||
JOIN unter ON k.parent_kategorie_kurzbz = unter.kategorie_kurzbz
|
||||
WHERE unter.tiefe < ?
|
||||
)
|
||||
SELECT kategorie_kurzbz, MIN(tiefe) AS tiefe
|
||||
FROM unter
|
||||
GROUP BY kategorie_kurzbz
|
||||
ORDER BY MIN(tiefe), kategorie_kurzbz
|
||||
';
|
||||
|
||||
return $this->execReadOnlyQuery($query, [$kategorie_kurzbz, (int) $tiefe]);
|
||||
}
|
||||
}
|
||||
@@ -11,30 +11,4 @@ class Template_model extends DB_Model
|
||||
$this->dbTable = 'campus.tbl_template';
|
||||
$this->pk = 'template_kurzbz';
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the template carries a CIS4 stylesheet of its own, which is not true for every template.
|
||||
*
|
||||
* @param string $template_kurzbz
|
||||
* @return stdClass success(bool) or error
|
||||
*/
|
||||
public function hasCis4Stylesheet($template_kurzbz)
|
||||
{
|
||||
$query = '
|
||||
SELECT (xslt_xhtml_c4 IS NOT NULL
|
||||
AND xslt_xhtml_c4::text IS DISTINCT FROM xslt_xhtml::text) AS eigen
|
||||
FROM campus.tbl_template
|
||||
WHERE template_kurzbz = ?
|
||||
';
|
||||
|
||||
$result = $this->execReadOnlyQuery($query, [$template_kurzbz]);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
$data = getData($result);
|
||||
if (empty($data))
|
||||
return success(false);
|
||||
|
||||
return success($data[0]->eigen === 't' || $data[0]->eigen === true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ class Prestudentstatus_model extends DB_Model
|
||||
* @param prestudent_id ID of the Prestudent.
|
||||
* @param $status_kurzbz kurzbz of the status.
|
||||
* @param $ausbildungssemester ausbildungssemester of the status.
|
||||
* @param $studiensemester_kurzbz studiensemester of the status.
|
||||
* @param $studiensemester_kurzbz studiensemster of the status.
|
||||
*
|
||||
* @return result object with all the status entries
|
||||
*/
|
||||
|
||||
@@ -204,7 +204,7 @@ class Student_model extends DB_Model
|
||||
|
||||
Events::trigger(
|
||||
'generate_student_uid',
|
||||
function ($value) use (&$uid) {
|
||||
function ($value) use ($uid) {
|
||||
$uid = $value;
|
||||
},
|
||||
$stgkzl,
|
||||
|
||||
@@ -85,18 +85,9 @@ class Lehreinheitmitarbeiter_model extends DB_Model
|
||||
|
||||
public function getLektorenByLe($lehreinheit_id)
|
||||
{
|
||||
$this->addSelect('tbl_person.vorname, tbl_person.nachname, tbl_lehreinheitmitarbeiter.*, stundenplan.verplant,
|
||||
COALESCE(insertvonperson.vorname || \' \' || insertvonperson.nachname, tbl_lehreinheitmitarbeiter.insertvon) as insertvon,
|
||||
COALESCE(updatevonperson.vorname || \' \' || updatevonperson.nachname, tbl_lehreinheitmitarbeiter.updatevon) as updatevon');
|
||||
$this->addSelect('vorname, nachname, tbl_lehreinheitmitarbeiter.*, stundenplan.verplant');
|
||||
$this->addJoin('tbl_benutzer', 'uid = mitarbeiter_uid');
|
||||
$this->addJoin('tbl_person', 'person_id');
|
||||
$this->addJoin('tbl_benutzer insertvonbenutzer', 'insertvonbenutzer.uid = tbl_lehreinheitmitarbeiter.insertvon', 'LEFT');
|
||||
$this->addJoin('tbl_person insertvonperson', 'insertvonperson.person_id = insertvonbenutzer.person_id', 'LEFT');
|
||||
|
||||
$this->addJoin('tbl_benutzer updatevonbenutzer', 'updatevonbenutzer.uid = tbl_lehreinheitmitarbeiter.updatevon', 'LEFT');
|
||||
$this->addJoin('tbl_person updatevonperson', 'updatevonperson.person_id = updatevonbenutzer.person_id', 'LEFT');
|
||||
|
||||
|
||||
|
||||
$this->addJoin('(
|
||||
SELECT 1 as verplant, lehreinheit_id, mitarbeiter_uid
|
||||
|
||||
@@ -1263,39 +1263,6 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets lehrveranstaltungen of Studienplan of a certain lva_id set
|
||||
* used if a bigger set of lva id is already available and it needs to be checked against a certain studienplan aswell
|
||||
* @param $studienplan_id ID des Studienplans
|
||||
* @param $lva_ids LVA_ID welche abgegleicht werden sollen
|
||||
* @return array|null
|
||||
*/
|
||||
public function getLvsByStudienplanByLvaIDs($studienplan_id, $lva_ids)
|
||||
{
|
||||
$params = array($studienplan_id, $lva_ids);
|
||||
|
||||
$qry = "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 = ?
|
||||
AND tbl_studienplan_lehrveranstaltung.lehrveranstaltung_id IN ?
|
||||
";
|
||||
|
||||
$qry .= " ORDER BY stpllv_sort, semester, sort";
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
|
||||
public function getAllOe($lv_id)
|
||||
{
|
||||
$qry = "SELECT DISTINCT oe_kurzbz
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user