diff --git a/FHC-vendor/jquery-tablesorter/package.json b/FHC-vendor/jquery-tablesorter/package.json
index b16fcb45e..110042959 100644
--- a/FHC-vendor/jquery-tablesorter/package.json
+++ b/FHC-vendor/jquery-tablesorter/package.json
@@ -56,7 +56,7 @@
]
},
"devDependencies": {
- "grunt": "^0.4.5",
+ "grunt": "^1.3.0",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "^0.7.0",
"grunt-contrib-concat": "^0.5.1",
diff --git a/README.md b/README.md
index d5620010a..c5212a353 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# FH-Complete
* [FH-Complete Homepage](https://www.fhcomplete.org)
-* [Wiki](https://wiki.fhcomplete.org/)
+* [Wiki](https://wiki.fhcomplete.info/)
* [Changelog](CHANGELOG.md)
diff --git a/application/config/constants.php b/application/config/constants.php
index ef4cdaf2c..f21b6c962 100644
--- a/application/config/constants.php
+++ b/application/config/constants.php
@@ -31,6 +31,13 @@ define('EXIT_VALIDATION_UDF_NOT_VALID_VAL', 17); // UDF validation has been fail
define('EXIT_AUTO_MIN', 1000); // lowest automatically-assigned error code
define('EXIT_AUTO_MAX', 2000); // highest automatically-assigned error code
+/*
+|--------------------------------------------------------------------------
+| General purpose
+|--------------------------------------------------------------------------
+*/
+define('BEGINNING_OF_TIME', '1970-01-01');
+
/*
|--------------------------------------------------------------------------
| Authentication constants
diff --git a/application/config/infocenter.php b/application/config/infocenter.php
new file mode 100644
index 000000000..555c30996
--- /dev/null
+++ b/application/config/infocenter.php
@@ -0,0 +1,5 @@
+ array(
+ 'admin:rw',
+ 'developer:rw'
+ ),
+ 'OEHPayment' => 'developer:rw',
+ 'SAPPayment' => 'developer:rw'
+);
+
diff --git a/application/config/message.php b/application/config/message.php
index 35d34124b..8232cdfb7 100644
--- a/application/config/message.php
+++ b/application/config/message.php
@@ -18,6 +18,8 @@ $config['ou_receivers'] = array('ass');
$config['ou_receivers_no_notice'] = array('infocenter');
// Organization units that will not send the notice email to the internal account, but to the private one
$config['ou_receivers_private'] = array('eac', 'ewu', 'scs');
+//
+$config['ou_function_whitelist'] = array('ass', 'Leitung', 'fachzuordnung', 'oezuordnung');
$config['message_redirect_url'] = array();
$config['message_redirect_url']['fallback'] = site_url('system/messages/ViewMessage/writeReply');
diff --git a/application/config/navigation.php b/application/config/navigation.php
index 9253c87a1..c2d221a80 100644
--- a/application/config/navigation.php
+++ b/application/config/navigation.php
@@ -62,6 +62,15 @@ $config['navigation_header'] = array(
'lehre/lehrauftrag_bestellen:r',
'lehre/lehrauftrag_erteilen:r'
)
+ ),
+ 'zgvueberpruefung' => array(
+ 'link' => site_url('system/infocenter/ZGVUeberpruefung'),
+ 'description' => 'ZGV Überprüfung',
+ 'expand' => true,
+ 'sort' => 50,
+ 'requiredPermissions' => array(
+ 'lehre/zgvpruefung:r'
+ )
)
)
),
@@ -72,11 +81,18 @@ $config['navigation_header'] = array(
'sort' => 40,
'requiredPermissions' => 'basis/vilesci:r',
'children'=> array(
+ 'messages' => array(
+ 'link' => site_url('system/messages/MessageClient/read'),
+ 'icon' => '',
+ 'target' => '_blank',
+ 'description' => 'Messages',
+ 'sort' => 10,
+ ),
'bpk' => array(
'link' => site_url('person/BPKWartung'),
'icon' => '',
'description' => 'BPK Wartung',
- 'sort' => 10,
+ 'sort' => 20,
'requiredPermissions' => 'admin:r'
)
)
@@ -102,6 +118,13 @@ $config['navigation_header'] = array(
'expand' => true,
'sort' => 20,
'requiredPermissions' => 'system/developer:r'
+ ),
+ 'jobsqueueviewer' => array(
+ 'link' => site_url('system/jq/JobsQueueViewer'),
+ 'description' => 'Jobs Queue Viewer',
+ 'expand' => true,
+ 'sort' => 20,
+ 'requiredPermissions' => 'system/developer:r'
)
)
)
diff --git a/application/controllers/api/v1/system/Message.php b/application/controllers/api/v1/system/Message.php
index d5bd95f8d..59d6a0b2c 100644
--- a/application/controllers/api/v1/system/Message.php
+++ b/application/controllers/api/v1/system/Message.php
@@ -149,10 +149,10 @@ class Message extends API_Controller
if (isSuccess($postMessage))
{
$result = $this->messagelib->sendMessageUser(
- $this->post()['receiver_id']), // receiverPersonId
+ $this->post()['receiver_id'], // receiverPersonId
$this->post()['subject'], // subject
$this->post()['body'], // body
- $this->post()['person_id']) ? $this->post()['person_id'] : null, // sender_id
+ $this->post()['person_id'] ? $this->post()['person_id'] : null, // sender_id
isset($this->post()['oe_kurzbz']) ? $this->post()['oe_kurzbz'] : null, // senderOU
isset($this->post()['relationmessage_id']) ? $this->post()['relationmessage_id'] : null, // relationmessage_id
MSG_PRIORITY_NORMAL, // priority
diff --git a/application/controllers/jobs/AnrechnungJob.php b/application/controllers/jobs/AnrechnungJob.php
new file mode 100644
index 000000000..2868a8052
--- /dev/null
+++ b/application/controllers/jobs/AnrechnungJob.php
@@ -0,0 +1,87 @@
+load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel');
+ }
+
+ /**
+ * Sets the Grades in FAS to angerechnet if the request was successfull
+ * @return void
+ */
+ public function setAnrechnungGrades()
+ {
+ $this->logInfo('Start Anrechnung Grades Job');
+ // get all accepted requests that are not in the grades table yet
+
+ // get all placement tests with incorrect studyplan
+ $qry = "
+ SELECT
+ student_uid, lehrveranstaltung_id, studiensemester_kurzbz, genehmigt_von
+ FROM
+ lehre.tbl_anrechnung
+ JOIN public.tbl_student USING(prestudent_id)
+ WHERE
+ genehmigt_von is not null
+ AND EXISTS(
+ SELECT 1 FROM lehre.tbl_anrechnung_anrechnungstatus
+ WHERE anrechnung_id = tbl_anrechnung.anrechnung_id
+ AND status_kurzbz='approved'
+ AND datum>=now()-'5 days'::interval
+ )
+ AND NOT EXISTS(
+ SELECT 1 FROM lehre.tbl_zeugnisnote
+ WHERE
+ lehrveranstaltung_id = tbl_anrechnung.lehrveranstaltung_id
+ AND studiensemester_kurzbz = tbl_anrechnung.studiensemester_kurzbz
+ AND student_uid = tbl_student.student_uid
+ )
+ ";
+
+ $db = new DB_Model();
+ $result_grades = $db->execReadOnlyQuery($qry);
+
+ $cnt = 0;
+ if (hasData($result_grades))
+ {
+ $grades = getData($result_grades);
+ foreach ($grades as $anrechnung)
+ {
+ $cnt++;
+ // Set zeugnisnote to angerechnet (= note 6)
+ $ret = $this->ZeugnisnoteModel->insert(array(
+ 'lehrveranstaltung_id' => $anrechnung->lehrveranstaltung_id,
+ 'student_uid' => $anrechnung->student_uid,
+ 'studiensemester_kurzbz' => $anrechnung->studiensemester_kurzbz,
+ 'uebernahmedatum' => (new DateTime())->format('Y-m-d H:m:i'),
+ 'benotungsdatum' => (new DateTime())->format('Y-m-d H:m:i'),
+ 'note' => 6,
+ 'insertvon' => $anrechnung->genehmigt_von,
+ 'bemerkung' => 'Digitale Anrechnung'
+ )
+ );
+ }
+ }
+ $this->logInfo('End Anrechnung Grades Job', array('Number of Grades added'=>$cnt));
+ }
+}
diff --git a/application/controllers/jobs/LehrauftragJob.php b/application/controllers/jobs/LehrauftragJob.php
index 2f6b928c7..7f5754595 100644
--- a/application/controllers/jobs/LehrauftragJob.php
+++ b/application/controllers/jobs/LehrauftragJob.php
@@ -20,31 +20,31 @@ class LehrauftragJob extends JOB_Controller
{
const BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN = 'lehre/lehrauftrag_erteilen';
const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren';
-
+
const LEHRAUFTRAG_ERTEILEN_URI = 'lehre/lehrauftrag/LehrauftragErteilen';
const LEHRAUFTRAG_AKZEPTIEREN_URI = '/lehre/lehrauftrag/LehrauftragAkzeptieren';
-
+
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
-
+
// Load models
$this->load->model('accounting/Vertrag_model', 'VertragModel');
$this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel');
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
$this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel');
-
+
// Load libraries
$this->load->library('PermissionLib');
-
+
// Load helpers
$this->load->helper('hlp_sancho_helper');
}
-
+
/**
* This daily job sends information about all lehr-/projektauftraege ordered (and not approved) the day bofore.
* Receivers: Department-/Kompetenzfeldleiter
@@ -62,7 +62,7 @@ class LehrauftragJob extends JOB_Controller
foreach ($vertrag_arr as $vertrag)
{
$result = $this->VertragModel->getLehreinheitData($vertrag->vertrag_id, 'lehrveranstaltung_id, studiensemester_kurzbz');
-
+
if (hasData($result))
{
$obj = new StdClass();
@@ -72,7 +72,7 @@ class LehrauftragJob extends JOB_Controller
}
}
}
-
+
/**
* Build the data array to be used in the email. Data array is clustered as follows:
* Array
@@ -90,7 +90,7 @@ class LehrauftragJob extends JOB_Controller
foreach ($lehreinheit_data_arr as $lehreinheit_data)
{
$result = $this->_getLVData($lehreinheit_data->lehrveranstaltung_id);
-
+
if (hasData($result))
{
// Search if studiensemester exists in data_arr
@@ -102,12 +102,12 @@ class LehrauftragJob extends JOB_Controller
$data = array(
'studiensemester_kurzbz' => $lehreinheit_data->studiensemester_kurzbz
);
-
+
$data []= array(
'oe_kurzbz' => $result->retval[0]->oe_kurzbz,
'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung
);
-
+
// Add stg data to oe, start amount with 1
$data[0][] = array(
'stg_kz' => $result->retval[0]->studiengang_kz,
@@ -115,7 +115,7 @@ class LehrauftragJob extends JOB_Controller
'stg_bezeichnung' => $result->retval[0]->lv_stg_bezeichnung,
'amount' => 1
);
-
+
// Push to final data_arr
$data_arr []= $data;
}
@@ -124,7 +124,7 @@ class LehrauftragJob extends JOB_Controller
{
// Search if oe exists inside existing studiensemester of data_arr
$oe_index = array_search($result->retval[0]->oe_kurzbz, array_column($data_arr[$ss_index], 'oe_kurzbz'));
-
+
// If oe is new, add oe and stg to studiensemester
if ($oe_index === false)
{
@@ -132,7 +132,7 @@ class LehrauftragJob extends JOB_Controller
$data_arr[$ss_index][] = array(
'oe_kurzbz' => $result->retval[0]->oe_kurzbz,
'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung,
-
+
// Add stg data to oe, start amount with 1
array(
'stg_kz' => $result->retval[0]->studiengang_kz,
@@ -147,7 +147,7 @@ class LehrauftragJob extends JOB_Controller
{
// Search if stg exists inside existing oe of data_arr
$stg_index = array_search($result->retval[0]->studiengang_kz, array_column($data_arr[$ss_index][$oe_index], 'stg_kz'));
-
+
// If stg is new, add stg to oe, start amount with 1
if ($stg_index === false)
{
@@ -168,7 +168,7 @@ class LehrauftragJob extends JOB_Controller
}
}
}
-
+
/**
* Cluster data by uid of entitled mail receivers.
* Returning array is clustered as follows:
@@ -186,7 +186,7 @@ class LehrauftragJob extends JOB_Controller
* [amount] // amount of new ordered lehrauftraege of that stg
*/
$data_arr = $this->_clusterData_byReceiver($data_arr);
-
+
// Send email
if(!$this->_sendMail_toApprove($data_arr))
{
@@ -197,7 +197,7 @@ class LehrauftragJob extends JOB_Controller
$this->logError('Error when sending emails in job MailLehrauftragToApprove');
}
}
-
+
/**
* This daily job sends information about all lehr-/projektauftraege approved the day bofore.
* Receivers: lectors
@@ -208,7 +208,7 @@ class LehrauftragJob extends JOB_Controller
$this->VertragvertragsstatusModel->addSelect('vertrag_id, uid');
$this->VertragvertragsstatusModel->addOrder('uid');
$result = $this->VertragvertragsstatusModel->getApproved_fromDate('YESTERDAY');
-
+
/**
* Build the data array to be used in the email. Data array is clustered as follows:
* Array
@@ -228,10 +228,10 @@ class LehrauftragJob extends JOB_Controller
{
$studiensemester = $studiensemester[0]->vertragsstunden_studiensemester_kurzbz;
}
-
+
// Search if uid exists in data_arr
$uid_index = array_search($vertrag->uid, array_column($data_arr, 'uid'));
-
+
// If uid is new, add uid, studiensemester and start amount with 1
if ($uid_index === false)
{
@@ -249,7 +249,7 @@ class LehrauftragJob extends JOB_Controller
{
$data_arr[$uid_index]['studiensemester'] .= ' und '. $studiensemester;
}
-
+
// Increase amount +1
$data_arr[$uid_index]['amount']++;
}
@@ -266,11 +266,11 @@ class LehrauftragJob extends JOB_Controller
$this->logError('Error when sending emails in job MailLehrauftragToAccept');
}
}
-
+
//******************************************************************************************************************
// PRIVATE FUNCTIONS
//******************************************************************************************************************
-
+
/**
* Get data of given lehrveranstaltung.
* @param $lehrveranstaltung_id
@@ -286,7 +286,7 @@ class LehrauftragJob extends JOB_Controller
stg.typ AS "stg_typ",
stg.kurzbz AS "stg_kurzbz"
');
-
+
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan_lehrveranstaltung stpllv', 'lehrveranstaltung_id');
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan stpl', 'studienplan_id');
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienordnung sto', 'studienordnung_id');
@@ -294,10 +294,10 @@ class LehrauftragJob extends JOB_Controller
$this->LehrveranstaltungModel->addJoin('public.tbl_organisationseinheit oe', 'ON oe.oe_kurzbz = tbl_lehrveranstaltung.oe_kurzbz');
$this->LehrveranstaltungModel->addOrder('stpllv.insertamum', 'DESC');
$this->LehrveranstaltungModel->addLimit(1);
-
+
return $this->LehrveranstaltungModel->load($lehrveranstaltung_id);
}
-
+
/**
* Send Sancho eMail about ordered Lehrauftraege.
* @param $data_arr
@@ -310,12 +310,12 @@ class LehrauftragJob extends JOB_Controller
// Set mail recipients (department assistance/leader)
$to = $data['uid']. '@'. DOMAIN;
$html_table = $this->_renderData_LehrauftraegeToApprove($data);
-
+
// Prepare mail content
$content_data_arr = array(
'table' => $html_table
);
-
+
sendSanchoMail(
'LehrauftragNeueBestellungen',
$content_data_arr,
@@ -326,7 +326,7 @@ class LehrauftragJob extends JOB_Controller
);
}
}
-
+
/**
* Cluster the data array by entitled mail receiver.
* Returning array is clustered as follows:
@@ -383,8 +383,8 @@ class LehrauftragJob extends JOB_Controller
} // Else if UID exists
else
{
- // Search if studiensemester exists
- $ss_index = array_search($data['studiensemester_kurzbz'], array_column($mail_data_arr, 'studiensemester_kurzbz'));
+ // Search if studiensemester exists inside the existing UID array
+ $ss_index = array_search($data['studiensemester_kurzbz'], array_column($mail_data_arr[$uid_index], 'studiensemester_kurzbz'));
// If studiensemester is new, add studiensemester to existing UID
if ($ss_index === false)
@@ -394,13 +394,6 @@ class LehrauftragJob extends JOB_Controller
$data[$i]
);
}
- // Else if studiensemester exists
- else
- {
- // Add corresponding data to existing studiensemester of UID
- $mail_data_arr[$uid_index]['studiensemester_kurbz'][] = $data[$i];
- }
-
}
}
}
@@ -409,7 +402,7 @@ class LehrauftragJob extends JOB_Controller
return $mail_data_arr;
}
-
+
/**
* Render the data array for the mail template returing a HTML table.
* @param $data_arr Data to be used in HTML table
@@ -425,11 +418,11 @@ class LehrauftragJob extends JOB_Controller
if (isset($studiensemester_container['studiensemester_kurzbz']))
{
$studiensemester = $studiensemester_container['studiensemester_kurzbz'];
-
+
// Link to LehrauftragErteilen
$url = site_url(self::LEHRAUFTRAG_ERTEILEN_URI).'?studiensemester='. $studiensemester;
}
-
+
// HTML table header
$html .= '
@@ -446,7 +439,7 @@ class LehrauftragJob extends JOB_Controller
+ Folgende Bewerber wurden in einem höher priorisierten Studiengang abgewiesen:
'; + $mailcontent .= '| '.$bewerber.' |
diff --git a/application/controllers/lehre/Pruefungsprotokoll.php b/application/controllers/lehre/Pruefungsprotokoll.php
new file mode 100644
index 000000000..21f50acca
--- /dev/null
+++ b/application/controllers/lehre/Pruefungsprotokoll.php
@@ -0,0 +1,232 @@
+ 'lehre/pruefungsbeurteilung:r',
+ 'Protokoll' => 'lehre/pruefungsbeurteilung:r',
+ 'saveProtokoll' => 'lehre/pruefungsbeurteilung:rw',
+ )
+ );
+
+ // Load models
+ $this->load->model('education/Abschlusspruefung_model', 'AbschlusspruefungModel');
+ $this->load->model('education/Abschlussbeurteilung_model', 'AbschlussbeurteilungModel');
+
+ $this->load->library('PermissionLib');
+ $this->load->library('AuthLib');
+
+ // Load language phrases
+ $this->loadPhrases(
+ array(
+ 'ui',
+ 'global',
+ 'person',
+ 'abschlusspruefung',
+ 'password',
+ 'lehre'
+ )
+ );
+
+ $this->_setAuthUID(); // sets property uid
+
+ $this->setControllerId(); // sets the controller id
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Public methods
+ public function index()
+ {
+ $this->load->library('WidgetLib');
+
+ // Protokolle anzeigen seit heute / letzte Woche / alle
+ $period = $this->input->post('period');
+ $period = (!is_null($period)) ? $period : 'today';
+
+ $data = array('period' => $period);
+
+ $this->load->view('lehre/pruefungsprotokollUebersicht.php', $data);
+ }
+
+ /**
+ * Show Pruefungsprotokoll.
+ */
+ public function Protokoll()
+ {
+ $abschlusspruefung_id = $this->input->get('abschlusspruefung_id');
+
+ if (!is_numeric($abschlusspruefung_id))
+ show_error('invalid abschlusspruefung');
+
+ $abschlusspruefung_saved = false;
+ $abschlusspruefung = $this->_getAbschlusspruefungBerechtigt($abschlusspruefung_id);
+
+ if (isError($abschlusspruefung))
+ show_error(getError($abschlusspruefung));
+ else
+ {
+ $abschlusspruefung = getData($abschlusspruefung);
+ $abschlusspruefung_saved = isset($abschlusspruefung->protokoll) && isset($abschlusspruefung->abschlussbeurteilung_kurzbz);
+ }
+
+ $this->AbschlussbeurteilungModel->addOrder("sort", "ASC");
+ $this->AbschlussbeurteilungModel->addOrder("(CASE WHEN abschlussbeurteilung_kurzbz = 'ausgezeichnet' THEN 1
+ WHEN abschlussbeurteilung_kurzbz = 'gut' THEN 2
+ WHEN abschlussbeurteilung_kurzbz = 'bestanden' THEN 3
+ WHEN abschlussbeurteilung_kurzbz = 'angerechnet' THEN 4
+ ELSE 5
+ END
+ )");
+ $abschlussbeurteilung = $this->AbschlussbeurteilungModel->load();
+
+ if (isError($abschlussbeurteilung))
+ show_error(getError($abschlussbeurteilung));
+ else
+ $abschlussbeurteilung = getData($abschlussbeurteilung);
+
+ $language = getUserLanguage();
+
+ $data = array(
+ 'abschlusspruefung' => $abschlusspruefung,
+ 'abschlussbeurteilung' => $abschlussbeurteilung,
+ 'abschlusspruefung_saved' => $abschlusspruefung_saved,
+ 'language' => $language
+ );
+
+ $this->load->view('lehre/pruefungsprotokoll.php', $data);
+ }
+
+ /**
+ * Save Pruefungsprotokoll (including possible Freigabe)
+ */
+ public function saveProtokoll()
+ {
+ $abschlusspruefung_id = $this->input->post('abschlusspruefung_id');
+ $freigebendata = $this->input->post('freigebendata');
+ $protocoldata = $this->input->post('protocoldata');
+
+ if (isset($abschlusspruefung_id) && is_numeric($abschlusspruefung_id)
+ && isset($freigebendata['freigeben']) && isset($protocoldata))
+ {
+ // check permission
+ $berechtigt = $this->_getAbschlusspruefungBerechtigt($abschlusspruefung_id);
+ if (isError($berechtigt))
+ $this->outputJsonError(getError($berechtigt));
+ else
+ {
+ $freigabe = $freigebendata['freigeben'] === 'true';
+
+ if ($freigabe)
+ {
+ // Verify password
+ if (isset($freigebendata['password']) && !isEmptyString($freigebendata['password']))
+ {
+ $password = $freigebendata['password'];
+ $result = $this->authlib->checkUserAuthByUsernamePassword($this->_uid, $password);
+ if (isError($result))
+ {
+ return $this->outputJsonError($this->p->t('password', 'wrongPassword')); // exit if password is incorrect
+ }
+ }
+ else
+ {
+ return $this->outputJsonError($this->p->t('password', 'passwordMissing'));
+ }
+ }
+
+ $data = $this->_prepareAbschlusspruefungDataForSave($protocoldata, $freigabe);
+
+ $result = $this->AbschlusspruefungModel->update($abschlusspruefung_id, $data);
+
+ if (hasData($result))
+ {
+ $abschlusspruefung_id = getData($result);
+ $updateresult = array('abschlusspruefung_id' => $abschlusspruefung_id);
+ if ($freigabe)
+ $updateresult['freigabedatum'] = date_format(date_create($data['freigabedatum']), 'd.m.Y');
+
+ $this->outputJsonSuccess($updateresult);
+ }
+ else
+ $this->outputJsonError('Fehler beim Speichern des Prüfungsprotokolls');
+ }
+ }
+ else
+ $this->outputJsonError($this->p->t('ui', 'ungueltigeParameter'));
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Private methods
+
+ /**
+ * Retrieve the UID of the logged user and checks if it is valid
+ */
+ private function _setAuthUID()
+ {
+ $this->_uid = getAuthUID();
+
+ if (!$this->_uid) show_error('User authentification failed');
+ }
+
+ /**
+ * Retrieves an Abschlussprüfung, with permission check
+ * permission: admin, assistance of study programe or Vorsitz of the Prüfung
+ * @param $abschlusspruefung_id
+ * @return object success or error
+ */
+ private function _getAbschlusspruefungBerechtigt($abschlusspruefung_id)
+ {
+ $result = error('Error when getting Abschlusspruefung');
+
+ if (isset($this->_uid))
+ {
+ $abschlusspruefung = $this->AbschlusspruefungModel->getAbschlusspruefung($abschlusspruefung_id);
+
+ if (hasData($abschlusspruefung))
+ {
+ $abschlusspruefung_data = getData($abschlusspruefung);
+ if ($this->permissionlib->isBerechtigt('admin') ||
+ (isset($abschlusspruefung_data->studiengang_kz) && $this->permissionlib->isBerechtigt('assistenz', 'suid', $abschlusspruefung_data->studiengang_kz))
+ || $this->_uid === $abschlusspruefung_data->uid_vorsitz)
+ $result = $abschlusspruefung;
+ else
+ $result = error('Permission denied');
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Prepares Abschlussprüfung for save in database, replaces '' with null, sets Freigabedatum
+ * @param $data
+ * @return array
+ */
+ private function _prepareAbschlusspruefungDataForSave($data, $freigabe)
+ {
+ $nullfields = array('uhrzeit', 'endezeit', 'abschlussbeurteilung_kurzbz', 'protokoll');
+ foreach ($data as $idx => $item)
+ {
+ if (in_array($idx, $nullfields) && $item === '')
+ $data[$idx] = null;
+ }
+
+ if ($freigabe === true)
+ $data['freigabedatum'] = date('Y-m-d');
+
+ return $data;
+ }
+}
diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php
new file mode 100644
index 000000000..c5e4b94d8
--- /dev/null
+++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php
@@ -0,0 +1,531 @@
+ 'lehre/anrechnung_genehmigen:rw',
+ 'download' => 'lehre/anrechnung_genehmigen:rw',
+ 'approve' => 'lehre/anrechnung_genehmigen:rw',
+ 'reject' => 'lehre/anrechnung_genehmigen:rw',
+ 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw'
+ )
+ );
+
+ // Load models
+ $this->load->model('education/Anrechnung_model', 'AnrechnungModel');
+ $this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel');
+ $this->load->model('content/DmsVersion_model', 'DmsVersionModel');
+ $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
+ $this->load->model('crm/Student_model', 'StudentModel');
+ $this->load->model('person/Notiz_model', 'NotizModel');
+ $this->load->model('person/Person_model', 'PersonModel');
+ $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
+
+ // Load libraries
+ $this->load->library('WidgetLib');
+ $this->load->library('PermissionLib');
+ $this->load->library('AnrechnungLib');
+ $this->load->library('DmsLib');
+
+ // Load helpers
+ $this->load->helper('form');
+ $this->load->helper('url');
+ $this->load->helper('hlp_sancho_helper');
+
+ // Load language phrases
+ $this->loadPhrases(
+ array(
+ 'global',
+ 'ui',
+ 'anrechnung',
+ 'person',
+ 'lehre',
+ 'table'
+ )
+ );
+
+ $this->_setAuthUID();
+
+ $this->setControllerId();
+ }
+
+ public function index()
+ {
+ $anrechnung_id = $this->input->get('anrechnung_id');
+
+ if (!is_numeric($anrechnung_id))
+ {
+ show_error('Missing correct parameter');
+ }
+
+ // Check if user is entitled to read the Anrechnung
+ self::_checkIfEntitledToReadAnrechnung($anrechnung_id);
+
+ // Get Anrechung data
+ if (!$anrechnungData = getData($this->anrechnunglib->getAnrechnungData($anrechnung_id)))
+ {
+ show_error('Missing data for Anrechnung.');
+ }
+
+ // Get Empfehlung data
+ if(!$empfehlungData = getData($this->anrechnunglib->getEmpfehlungData($anrechnung_id)))
+ {
+ show_error('Missing data for recommendation');
+ }
+
+ // Get Genehmigung data
+ if(!$genehmigungData = getData($this->anrechnunglib->getGenehmigungData($anrechnung_id)))
+ {
+ show_error('Missing data for recommendation');
+ }
+
+ $viewData = array(
+ 'antragData' => $this->anrechnunglib->getAntragData(
+ $student_uid = $this->StudentModel->getUID($anrechnungData->prestudent_id),
+ $anrechnungData->studiensemester_kurzbz,
+ $anrechnungData->lehrveranstaltung_id
+ ),
+ 'anrechnungData' => $anrechnungData,
+ 'empfehlungData' => $empfehlungData,
+ 'genehmigungData' => $genehmigungData
+ );
+
+ $this->load->view('lehre/anrechnung/approveAnrechnungDetail.php', $viewData);
+ }
+
+ /**
+ * Approve Anrechnungen.
+ */
+ public function approve()
+ {
+ $data = $this->input->post('data');
+
+ if(isEmptyArray($data))
+ {
+ return $this->outputJsonError('Fehler beim Übertragen der Daten.');
+ }
+
+ // Get statusbezeichnung for 'approved'
+ $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig');
+ $approved = getData($this->AnrechnungstatusModel->load('approved'))[0];
+ $approved = getUserLanguage() == 'German'
+ ? $approved->bezeichnung_mehrsprachig[0]
+ : $approved->bezeichnung_mehrsprachig[1];
+
+ if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0])
+ {
+ show_error('Failed retrieving person data');
+ }
+
+ foreach ($data as $item)
+ {
+ // Approve Anrechnung
+ if(getData($this->anrechnunglib->approveAnrechnung($item['anrechnung_id'])))
+ {
+ $json[]= array(
+ 'anrechnung_id' => $item['anrechnung_id'],
+ 'status_kurzbz' => self::ANRECHNUNGSTATUS_APPROVED,
+ 'status_bezeichnung' => $approved,
+ 'abgeschlossen_am' => (new DateTime())->format('d.m.Y'),
+ 'abgeschlossen_von' => $person->vorname. ' '. $person->nachname
+ );
+
+ if(!$this->_sendSanchoMailToStudent($item['anrechnung_id'], self::ANRECHNUNGSTATUS_APPROVED))
+ {
+ show_error('Failed sending mail');
+ }
+ }
+ }
+
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ return $this->outputJsonSuccess($json);
+ }
+ else
+ {
+ return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.');
+ }
+ }
+
+ /**
+ * Reject Anrechnungen.
+ */
+ public function reject()
+ {
+ $data = $this->input->post('data');
+
+ if(isEmptyArray($data))
+ {
+ return $this->outputJsonError('Fehler beim Übertragen der Daten.');
+ }
+
+ // Get statusbezeichnung for 'rejected'
+ $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig');
+ $rejected = getData($this->AnrechnungstatusModel->load('rejected'))[0];
+ $rejected = getUserLanguage() == 'German'
+ ? $rejected->bezeichnung_mehrsprachig[0]
+ : $rejected->bezeichnung_mehrsprachig[1];
+
+ if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0])
+ {
+ show_error('Failed retrieving person data');
+ }
+
+ foreach ($data as $item)
+ {
+ // Reject Anrechnung
+ if(getData($this->anrechnunglib->rejectAnrechnung($item['anrechnung_id'], $item['begruendung'])))
+ {
+ $json[]= array(
+ 'anrechnung_id' => $item['anrechnung_id'],
+ 'status_kurzbz' => self::ANRECHNUNGSTATUS_REJECTED,
+ 'status_bezeichnung' => $rejected,
+ 'abgeschlossen_am' => (new DateTime())->format('d.m.Y'),
+ 'abgeschlossen_von' => $person->vorname. ' '. $person->nachname
+ );
+
+ if(!$this->_sendSanchoMailToStudent($item['anrechnung_id'], self::ANRECHNUNGSTATUS_REJECTED))
+ {
+ show_error('Failed sending mail');
+ }
+ }
+ }
+
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ return $this->outputJsonSuccess($json);
+ }
+ else
+ {
+ return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.');
+ }
+ }
+
+ /**
+ * Request recommendation for Anrechnungen.
+ */
+ public function requestRecommendation()
+ {
+ $data = $this->input->post('data');
+
+ if(isEmptyArray($data))
+ {
+ return $this->outputJsonError('Fehler beim Übertragen der Daten.');
+ }
+
+ // Get statusbezeichnung for 'inProgressLektor'
+ $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig');
+ $inProgressLektor = getData($this->AnrechnungstatusModel->load('inProgressLektor'))[0];
+ $inProgressLektor = getUserLanguage() == 'German'
+ ? $inProgressLektor->bezeichnung_mehrsprachig[0]
+ : $inProgressLektor->bezeichnung_mehrsprachig[1];
+
+ foreach ($data as $item)
+ {
+ // Approve Anrechnung
+ if(getData($this->anrechnunglib->requestRecommendation($item['anrechnung_id'])))
+ {
+ $json[]= array(
+ 'anrechnung_id' => $item['anrechnung_id'],
+ 'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR,
+ 'status_bezeichnung' => $inProgressLektor,
+ 'empfehlung_anrechnung' => null,
+ 'empfehlung_angefordert_am' => (new DateTime())->format('d.m.Y')
+ );
+ }
+ }
+
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ /**
+ * Send mails to lectors
+ * NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector
+ * even if they are required for more recommendations
+ * */
+ if (!$this->_sendSanchoMailToLectors($json))
+ {
+ show_error('Failed sending emails');
+ }
+
+ return $this->outputJsonSuccess($json);
+ }
+ else
+ {
+ return $this->outputJsonError('Es wurden keine Empfehlungen angefordert');
+ }
+ }
+
+ /**
+ * Download and open uploaded document (Nachweisdokument).
+ */
+ public function download()
+ {
+ $dms_id = $this->input->get('dms_id');
+
+ if (!is_numeric($dms_id))
+ {
+ show_error('Wrong parameter');
+ }
+
+ // Check if user is entitled to read dms doc
+ self::_checkIfEntitledToReadDMSDoc($dms_id);
+
+ $this->dmslib->download($dms_id);
+ }
+
+ /**
+ * Retrieve the UID of the logged user and checks if it is valid
+ */
+ private function _setAuthUID()
+ {
+ $this->_uid = getAuthUID();
+
+ if (!$this->_uid) show_error('User authentification failed');
+ }
+
+ /**
+ * Check if user is entitled to read this Anrechnung
+ * @param $anrechnung_id
+ */
+ private function _checkIfEntitledToReadAnrechnung($anrechnung_id)
+ {
+ $result = $this->AnrechnungModel->load($anrechnung_id);
+
+ if(!$result = getData($result)[0])
+ {
+ show_error('Failed loading Anrechnung');
+ }
+
+ $result = $this->LehrveranstaltungModel->loadWhere(array(
+ 'lehrveranstaltung_id' => $result->lehrveranstaltung_id
+ ));
+
+ if(!$result = getData($result)[0])
+ {
+ show_error('Failed loading Lehrveranstaltung');
+ }
+
+ // Get STGL
+ $result = $this->StudiengangModel->getLeitung($result->studiengang_kz);
+
+ if($result = getData($result)[0])
+ {
+ if ($result->uid == $this->_uid)
+ {
+ return;
+ }
+ }
+
+ show_error('You are not entitled to read this Anrechnung');
+ }
+
+ /**
+ * Check if user is entitled to read dms doc
+ * @param $dms_id
+ */
+ private function _checkIfEntitledToReadDMSDoc($dms_id)
+ {
+ $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id));
+
+ if(!$result = getData($result)[0])
+ {
+ show_error('Failed retrieving Anrechnung');
+ }
+
+ $result = $this->LehrveranstaltungModel->loadWhere(array(
+ 'lehrveranstaltung_id' => $result->lehrveranstaltung_id
+ ));
+
+ if(!$result = getData($result)[0])
+ {
+ show_error('Failed loading Lehrveranstaltung');
+ }
+
+ // Get STGL
+ $result = $this->StudiengangModel->getLeitung($result->studiengang_kz);
+
+ if($result = getData($result)[0])
+ {
+ if ($result->uid == $this->_uid)
+ {
+ return;
+ }
+ }
+
+ show_error('You are not entitled to read this document');
+ }
+
+ /**
+ * Send mail to student to inform if Anrechnung was approved or rejected
+ * @param $mail_params
+ */
+ private function _sendSanchoMailToStudent($anrechnung_id, $status_kurzbz)
+ {
+ $result = getData($this->anrechnunglib->getStudentData($anrechnung_id))[0];
+
+ // Get student name and mail address
+ $to = $result->uid. '@'. DOMAIN;
+
+ $anrede = $result->geschlecht == 'w' ? 'Sehr geehrte Frau ' : 'Sehr geehrter Herr ';
+
+ $text = $status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED
+ ? 'Ihrem Antrag auf Anerkennung nachgewiesener Kenntnisse der Lehrveranstaltung "'.
+ $result->lv_bezeichnung. '" wurde stattgegeben.'
+ : 'wir haben Ihren Antrag auf Anerkennung nachgewiesener Kenntnisse geprüft und können die Lehrveranstaltung "'.
+ $result->lv_bezeichnung. '" leider nicht anrechnen, weil die Gleichwertigkeit nicht festgestellt werden konnte.';
+
+ // Prepare mail content
+ $body_fields = array(
+ 'anrede_name' => $anrede. $result->vorname. ' '. $result->nachname,
+ 'text' => $text
+ );
+
+ sendSanchoMail(
+ 'AnrechnungGenehmigen',
+ $body_fields,
+ $to,
+ 'Anerkennung nachgewiesener Kenntnisse: Ihr Antrag ist abgeschlossen'
+ );
+
+ return true;
+ }
+
+ /**
+ * Send mail to lectors asking for recommendation. (first to LV-Leitung, if not present to all lectors of lv)
+ * @param $mail_params
+ * @return bool
+ */
+ private function _sendSanchoMailToLectors($mail_params)
+ {
+ // Get Lehrveranstaltungen
+ $anrechnung_arr = array();
+
+ foreach ($mail_params as $item)
+ {
+ $this->AnrechnungModel->addSelect('lehrveranstaltung_id, studiensemester_kurzbz');
+ $anrechnung_arr[]= array(
+ 'lehrveranstaltung_id' => $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->lehrveranstaltung_id,
+ 'studiensemester_kurzbz' => $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiensemester_kurzbz
+ );
+ }
+
+ $anrechnung_arr = array_unique($anrechnung_arr, SORT_REGULAR);
+
+
+ /**
+ * Get lectors (prio for LV-Leitung, if not present to all lectors of LV.
+ * Anyway this function will receive a unique array to avoid sending more mails to one and the same lector.
+ * **/
+ $lector_arr = $this->_getLectors($anrechnung_arr);
+
+ // Send mail to lectors
+ foreach ($lector_arr as $lector)
+ {
+ $to = $lector->uid;
+ $vorname = $lector->vorname;
+
+ // Get full name of stgl
+ $this->load->model('person/Person_model', 'PersonModel');
+ if (!$stgl_name = getData($this->PersonModel->getFullName($this->_uid)))
+ {
+ show_error ('Failed retrieving person');
+ }
+
+ // Link to Antrag genehmigen
+ $url =
+ CIS_ROOT. 'cis/index.php?menu='.
+ CIS_ROOT. 'cis/menu.php?content_id=&content='.
+ CIS_ROOT. index_page(). self::REVIEW_ANRECHNUNG_URI;
+
+ // Prepare mail content
+ $body_fields = array(
+ 'vorname' => $vorname,
+ 'stgl_name' => $stgl_name,
+ 'link' => anchor($url, 'Anrechnungsanträge Übersicht')
+ );
+
+ sendSanchoMail(
+ 'AnrechnungEmpfehlungAnfordern',
+ $body_fields,
+ $to,
+ 'Anerkennung nachgewiesener Kenntnisse: Deine Empfehlung wird benötigt'
+ );
+ }
+ return true;
+ }
+
+ /**
+ * Get lectors (prio for LV-Leitung, if not present to all lectors of LV.
+ * Anyway this function will receive a unique array to avoid sending more mails to one and the same lector.
+ * @param $anrechnung_arr
+ * @return array
+ */
+ private function _getLectors($anrechnung_arr)
+ {
+ $lector_arr = array();
+
+ // Get lectors
+ foreach($anrechnung_arr as $anrechnung)
+ {
+ $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
+ $result = $this->LehrveranstaltungModel->getLecturersByLv($anrechnung['studiensemester_kurzbz'], $anrechnung['lehrveranstaltung_id']);
+
+ if (!$result = getData($result))
+ {
+ show_error('Failed retrieving lectors of Lehrveranstaltung');
+ }
+
+ // Check if lv has LV-Leitung
+ $key = array_search(true, array_column($result, 'lvleiter'));
+
+ // If lv has LV-Leitung, keep only the one
+ if ($key !== false)
+ {
+ $lector_arr[]= $result[$key];
+ }
+ // ...otherwise keep all lectors
+ else
+ {
+ $lector_arr = array_merge($lector_arr, $result);
+ }
+ }
+
+ /**
+ * NOTE: This step is only done to make the array unique by uid, vorname and nachname in the following step
+ * (e.g. if same lector is ones LV-Leitung and another time not, then array_unique would leave both.
+ * But we wish to send only one email by to that one person)
+ * **/
+ foreach ($lector_arr as $lector)
+ {
+ unset($lector->lvleiter);
+ }
+
+ // Now make the lector array aka mail receivers unique
+ $lector_arr = array_unique($lector_arr, SORT_REGULAR);
+
+ return $lector_arr;
+
+ }
+
+}
diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php
new file mode 100644
index 000000000..b2d09fbe1
--- /dev/null
+++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php
@@ -0,0 +1,461 @@
+ 'lehre/anrechnung_genehmigen:rw',
+ 'download' => 'lehre/anrechnung_genehmigen:rw',
+ 'approve' => 'lehre/anrechnung_genehmigen:rw',
+ 'reject' => 'lehre/anrechnung_genehmigen:rw',
+ 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw'
+ )
+ );
+
+ // Load models
+ $this->load->model('education/Anrechnung_model', 'AnrechnungModel');
+ $this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel');
+ $this->load->model('content/DmsVersion_model', 'DmsVersionModel');
+
+ // Load libraries
+ $this->load->library('WidgetLib');
+ $this->load->library('PermissionLib');
+ $this->load->library('AnrechnungLib');
+ $this->load->library('DmsLib');
+
+ // Load helpers
+ $this->load->helper('form');
+ $this->load->helper('url');
+ $this->load->helper('hlp_sancho_helper');
+
+ // Load language phrases
+ $this->loadPhrases(
+ array(
+ 'global',
+ 'ui',
+ 'anrechnung',
+ 'person',
+ 'lehre',
+ 'table'
+ )
+ );
+
+ $this->_setAuthUID();
+
+ $this->setControllerId();
+ }
+
+ public function index()
+ {
+ $studiensemester_kurzbz = $this->input->get('studiensemester');
+
+ // Retrieve studiengaenge the user is entitled for
+ if (!$studiengang_kz_arr = $this->permissionlib->getSTG_isEntitledFor(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN))
+ {
+ show_error(getError($studiengang_kz_arr));
+ }
+
+ if (!is_string($studiensemester_kurzbz))
+ {
+ $studiensemester = $this->StudiensemesterModel->getNearest();
+ if (hasData($studiensemester))
+ {
+ $studiensemester_kurzbz = $studiensemester->retval[0]->studiensemester_kurzbz;
+ }
+ elseif (isError($studiensemester))
+ {
+ show_error(getError($studiensemester));
+ }
+ }
+
+ $viewData = array(
+ 'studiensemester_selected' => $studiensemester_kurzbz,
+ 'studiengaenge_entitled' => $studiengang_kz_arr
+ );
+
+ $this->load->view('lehre/anrechnung/approveAnrechnungUebersicht.php', $viewData);
+ }
+
+ /**
+ * Approve Anrechnungen.
+ */
+ public function approve()
+ {
+ $data = $this->input->post('data');
+
+ if(isEmptyArray($data))
+ {
+ return $this->outputJsonError('Fehler beim Übertragen der Daten.');
+ }
+
+ // Get statusbezeichnung for 'approved'
+ $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig');
+ $approved = getData($this->AnrechnungstatusModel->load('approved'))[0];
+ $approved = getUserLanguage() == 'German'
+ ? $approved->bezeichnung_mehrsprachig[0]
+ : $approved->bezeichnung_mehrsprachig[1];
+
+ foreach ($data as $item)
+ {
+ // Approve Anrechnung
+ if(getData($this->anrechnunglib->approveAnrechnung($item['anrechnung_id'])))
+ {
+ $json[]= array(
+ 'anrechnung_id' => $item['anrechnung_id'],
+ 'status_kurzbz' => self::ANRECHNUNGSTATUS_APPROVED,
+ 'status_bezeichnung' => $approved
+ );
+
+ if(!$this->_sendSanchoMailToStudent($item['anrechnung_id'], self::ANRECHNUNGSTATUS_APPROVED))
+ {
+ show_error('Failed sending mail');
+ }
+ }
+ }
+
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ return $this->outputJsonSuccess($json);
+ }
+ else
+ {
+ return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.');
+ }
+ }
+
+ /**
+ * Reject Anrechnungen.
+ */
+ public function reject()
+ {
+ $data = $this->input->post('data');
+
+ if(isEmptyArray($data))
+ {
+ return $this->outputJsonError('Fehler beim Übertragen der Daten.');
+ }
+
+ // Get statusbezeichnung for 'rejected'
+ $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig');
+ $rejected = getData($this->AnrechnungstatusModel->load('rejected'))[0];
+ $rejected = getUserLanguage() == 'German'
+ ? $rejected->bezeichnung_mehrsprachig[0]
+ : $rejected->bezeichnung_mehrsprachig[1];
+
+ foreach ($data as $item)
+ {
+ // Reject Anrechnung
+ if(getData($this->anrechnunglib->rejectAnrechnung($item['anrechnung_id'], $item['begruendung'])))
+ {
+ $json[]= array(
+ 'anrechnung_id' => $item['anrechnung_id'],
+ 'status_kurzbz' => self::ANRECHNUNGSTATUS_REJECTED,
+ 'status_bezeichnung' => $rejected
+ );
+
+ if(!$this->_sendSanchoMailToStudent($item['anrechnung_id'], self::ANRECHNUNGSTATUS_REJECTED))
+ {
+ show_error('Failed sending mail');
+ }
+ }
+ }
+
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ return $this->outputJsonSuccess($json);
+ }
+ else
+ {
+ return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.');
+ }
+ }
+
+ /**
+ * Request recommendation for Anrechnungen.
+ */
+ public function requestRecommendation()
+ {
+ $data = $this->input->post('data');
+
+ if(isEmptyArray($data))
+ {
+ return $this->outputJsonError('Fehler beim Übertragen der Daten.');
+ }
+
+ // Get statusbezeichnung for 'inProgressLektor'
+ $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig');
+ $inProgressLektor = getData($this->AnrechnungstatusModel->load('inProgressLektor'))[0];
+ $inProgressLektor = getUserLanguage() == 'German'
+ ? $inProgressLektor->bezeichnung_mehrsprachig[0]
+ : $inProgressLektor->bezeichnung_mehrsprachig[1];
+
+ foreach ($data as $item)
+ {
+ // Approve Anrechnung
+ if(getData($this->anrechnunglib->requestRecommendation($item['anrechnung_id'])))
+ {
+ $json[]= array(
+ 'anrechnung_id' => $item['anrechnung_id'],
+ 'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR,
+ 'status_bezeichnung' => $inProgressLektor,
+ 'empfehlung_anrechnung' => null
+ );
+ }
+ }
+
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ /**
+ * Send mails to lectors
+ * NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector
+ * even if they are required for more recommendations
+ * */
+ if (!$this->_sendSanchoMailToLectors($json))
+ {
+ show_error('Failed sending emails');
+ }
+
+ return $this->outputJsonSuccess($json);
+ }
+ else
+ {
+ return $this->outputJsonError('Es wurden keine Empfehlungen angefordert');
+ }
+ }
+
+ /**
+ * Download and open uploaded document (Nachweisdokument).
+ */
+ public function download()
+ {
+ $dms_id = $this->input->get('dms_id');
+
+ if (!is_numeric($dms_id))
+ {
+ show_error('Wrong parameter');
+ }
+
+ // Check if user is entitled to read dms doc
+ self::_checkIfEntitledToReadDMSDoc($dms_id);
+
+ $this->dmslib->download($dms_id);
+ }
+
+
+ /**
+ * Retrieve the UID of the logged user and checks if it is valid
+ */
+ private function _setAuthUID()
+ {
+ $this->_uid = getAuthUID();
+
+ if (!$this->_uid) show_error('User authentification failed');
+ }
+
+ /**
+ * Check if user is entitled to read dms doc
+ * @param $dms_id
+ */
+ private function _checkIfEntitledToReadDMSDoc($dms_id)
+ {
+ $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id));
+
+ if(!$result = getData($result)[0])
+ {
+ show_error('Failed retrieving Anrechnung');
+ }
+
+ $result = $this->LehrveranstaltungModel->loadWhere(array(
+ 'lehrveranstaltung_id' => $result->lehrveranstaltung_id
+ ));
+
+
+ if(!$result = getData($result)[0])
+ {
+ show_error('Failed loading Lehrveranstaltung');
+ }
+
+ // Get STGL
+ $result = $this->StudiengangModel->getLeitung($result->studiengang_kz);
+
+ if($result = getData($result)[0])
+ {
+ if ($result->uid == $this->_uid)
+ {
+ return;
+ }
+ }
+
+ show_error('You are not entitled to read this document');
+ }
+
+ /**
+ * Send mail to student to inform if Anrechnung was approved or rejected
+ * @param $mail_params
+ */
+ private function _sendSanchoMailToStudent($anrechnung_id, $status_kurzbz)
+ {
+ $result = getData($this->anrechnunglib->getStudentData($anrechnung_id))[0];
+
+ // Get student name and mail address
+ $to = $result->uid. '@'. DOMAIN;
+
+ $anrede = $result->geschlecht == 'w' ? 'Sehr geehrte Frau ' : 'Sehr geehrter Herr ';
+
+ $text = $status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED
+ ? 'Ihrem Antrag auf Anerkennung nachgewiesener Kenntnisse der Lehrveranstaltung "'.
+ $result->lv_bezeichnung. '" wurde stattgegeben.'
+ : 'wir haben Ihren Antrag auf Anerkennung nachgewiesener Kenntnisse geprüft und können die Lehrveranstaltung "'.
+ $result->lv_bezeichnung. '" leider nicht anrechnen, weil die Gleichwertigkeit nicht festgestellt werden konnte.';
+
+ // Prepare mail content
+ $body_fields = array(
+ 'anrede_name' => $anrede. $result->vorname. ' '. $result->nachname,
+ 'text' => $text
+ );
+
+ sendSanchoMail(
+ 'AnrechnungGenehmigen',
+ $body_fields,
+ $to,
+ 'Anerkennung nachgewiesener Kenntnisse: Ihr Antrag ist abgeschlossen'
+ );
+
+ return true;
+ }
+
+ /**
+ * Send mail to lectors asking for recommendation. (first to LV-Leitung, if not present to all lectors of lv)
+ * @param $mail_params
+ * @return bool
+ */
+ private function _sendSanchoMailToLectors($mail_params)
+ {
+ // Get Lehrveranstaltungen
+ $anrechnung_arr = array();
+
+ foreach ($mail_params as $item)
+ {
+ $this->AnrechnungModel->addSelect('lehrveranstaltung_id, studiensemester_kurzbz');
+ $anrechnung_arr[]= array(
+ 'lehrveranstaltung_id' => $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->lehrveranstaltung_id,
+ 'studiensemester_kurzbz' => $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiensemester_kurzbz
+ );
+ }
+
+ $anrechnung_arr = array_unique($anrechnung_arr, SORT_REGULAR);
+
+
+ /**
+ * Get lectors (prio for LV-Leitung, if not present to all lectors of LV.
+ * Anyway this function will receive a unique array to avoid sending more mails to one and the same lector.
+ * **/
+ $lector_arr = $this->_getLectors($anrechnung_arr);
+
+ // Send mail to lectors
+ foreach ($lector_arr as $lector)
+ {
+ $to = $lector->uid;
+ $vorname = $lector->vorname;
+
+ // Get full name of stgl
+ $this->load->model('person/Person_model', 'PersonModel');
+ if (!$stgl_name = getData($this->PersonModel->getFullName($this->_uid)))
+ {
+ show_error ('Failed retrieving person');
+ }
+
+ // Link to Antrag genehmigen
+ $url =
+ CIS_ROOT. 'cis/index.php?menu='.
+ CIS_ROOT. 'cis/menu.php?content_id=&content='.
+ CIS_ROOT. index_page(). self::REVIEW_ANRECHNUNG_URI;
+
+ // Prepare mail content
+ $body_fields = array(
+ 'vorname' => $vorname,
+ 'stgl_name' => $stgl_name,
+ 'link' => anchor($url, 'Anrechnungsanträge Übersicht')
+ );
+
+ sendSanchoMail(
+ 'AnrechnungEmpfehlungAnfordern',
+ $body_fields,
+ $to,
+ 'Anerkennung nachgewiesener Kenntnisse: Deine Empfehlung wird benötigt'
+ );
+ }
+ return true;
+ }
+
+ /**
+ * Get lectors (prio for LV-Leitung, if not present to all lectors of LV.
+ * Anyway this function will receive a unique array to avoid sending more mails to one and the same lector.
+ * @param $anrechnung_arr
+ * @return array
+ */
+ private function _getLectors($anrechnung_arr)
+ {
+ $lector_arr = array();
+
+ // Get lectors
+ foreach($anrechnung_arr as $anrechnung)
+ {
+ $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
+ $result = $this->LehrveranstaltungModel->getLecturersByLv($anrechnung['studiensemester_kurzbz'], $anrechnung['lehrveranstaltung_id']);
+
+ if (!$result = getData($result))
+ {
+ show_error('Failed retrieving lectors of Lehrveranstaltung');
+ }
+
+ // Check if lv has LV-Leitung
+ $key = array_search(true, array_column($result, 'lvleiter'));
+
+ // If lv has LV-Leitung, keep only the one
+ if ($key !== false)
+ {
+ $lector_arr[]= $result[$key];
+ }
+ // ...otherwise keep all lectors
+ else
+ {
+ $lector_arr = array_merge($lector_arr, $result);
+ }
+ }
+
+ /**
+ * NOTE: This step is only done to make the array unique by uid, vorname and nachname in the following step
+ * (e.g. if same lector is ones LV-Leitung and another time not, then array_unique would leave both.
+ * But we wish to send only one email by to that one person)
+ * **/
+ foreach ($lector_arr as $lector)
+ {
+ unset($lector->lvleiter);
+ }
+
+ // Now make the lector array aka mail receivers unique
+ $lector_arr = array_unique($lector_arr, SORT_REGULAR);
+
+ return $lector_arr;
+
+ }
+}
\ No newline at end of file
diff --git a/application/controllers/lehre/anrechnung/RequestAnrechnung.php b/application/controllers/lehre/anrechnung/RequestAnrechnung.php
new file mode 100644
index 000000000..4f589e5f5
--- /dev/null
+++ b/application/controllers/lehre/anrechnung/RequestAnrechnung.php
@@ -0,0 +1,409 @@
+ 'student/anrechnung_beantragen:rw',
+ 'apply' => 'student/anrechnung_beantragen:rw',
+ 'download' => 'student/anrechnung_beantragen:rw',
+ )
+ );
+
+ // Load models
+ $this->load->model('education/Anrechnung_model', 'AnrechnungModel');
+ $this->load->model('content/DmsVersion_model', 'DmsVersionModel');
+
+ // Load libraries
+ $this->load->library('WidgetLib');
+ $this->load->library('PermissionLib');
+ $this->load->library('AnrechnungLib');
+ $this->load->library('DmsLib');
+
+ // Load helpers
+ $this->load->helper('form');
+ $this->load->helper('url');
+ $this->load->helper('hlp_sancho_helper');
+
+ // Load language phrases
+ $this->loadPhrases(
+ array(
+ 'global',
+ 'ui',
+ 'anrechnung',
+ 'person',
+ 'lehre'
+ )
+ );
+
+ $this->_setAuthUID();
+
+ $this->setControllerId();
+ }
+
+ public function index()
+ {
+ $studiensemester_kurzbz = $this->input->get('studiensemester');
+ $lehrveranstaltung_id = $this->input->get('lv_id');
+
+ if (!is_numeric($lehrveranstaltung_id) || !is_string($studiensemester_kurzbz))
+ {
+ show_error('Missing correct parameter');
+ }
+
+ // Check if application deadline is expired
+ // $is_expired = $this->_checkAntragDeadline($studiensemester_kurzbz);
+ $is_expired = false; // Set to false until Deadline is defined
+
+ $student = $this->StudentModel->load(array('student_uid' => $this->_uid));
+ if (isSuccess($student) && hasData($student))
+ {
+ $prestudent_id = getData($student)[0]->prestudent_id;
+ }
+ else
+ show_error('Cant load User');
+
+ // Get Anrechung data
+ $result = $this->anrechnunglib->getAnrechnungDataByLv($lehrveranstaltung_id, $studiensemester_kurzbz, $prestudent_id);
+ if (!$anrechnungData = getData($result))
+ {
+ show_error(getError($anrechnungData));
+ }
+
+ // Dont show who is progressing the application to the student
+ if ($anrechnungData->status_kurzbz == self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL ||
+ $anrechnungData->status_kurzbz == self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR ||
+ $anrechnungData->status_kurzbz == self::ANRECHNUNGSTATUS_PROGRESSED_BY_KF)
+ {
+ $anrechnungData->status = getUserLanguage() == 'German' ? 'in Bearbeitung' : 'in process';
+ }
+
+ $antragData = $this->anrechnunglib->getAntragData($this->_uid, $studiensemester_kurzbz, $lehrveranstaltung_id);
+
+ $viewData = array(
+ 'antragData' => $antragData,
+ 'anrechnungData' => $anrechnungData,
+ 'is_expired' => $is_expired,
+ 'disabled' => $is_expired && empty($anrechnungData->anrechnung_id) || !empty($anrechnungData->anrechnung_id)
+ ? 'disabled'
+ : ''
+ );
+
+ $this->load->view('lehre/anrechnung/requestAnrechnung.php', $viewData);
+ }
+
+ /**
+ * Apply Anrechnungsantrag and send to STGL
+ */
+ public function apply()
+ {
+ $anmerkung = $this->input->post('anmerkung');
+ $begruendung_id = $this->input->post('begruendung');
+ $lehrveranstaltung_id = $this->input->post('lv_id');
+ $studiensemester_kurzbz = $this->input->post('studiensemester');
+
+ if (empty($_FILES['uploadfile']['name']))
+ {
+ show_error('Missing upload file');
+ }
+
+ if (!is_numeric($begruendung_id) || !is_numeric($lehrveranstaltung_id) || !is_string($studiensemester_kurzbz))
+ {
+ show_error('Missing correct parameter');
+ }
+
+ $student = $this->StudentModel->load(array('student_uid' => $this->_uid));
+ if (isSuccess($student) && hasData($student))
+ {
+ $prestudent_id = getData($student)[0]->prestudent_id;
+ }
+ else
+ show_error('Cant load User');
+
+ $result = $this->_getAnrechnung($lehrveranstaltung_id, $studiensemester_kurzbz, $prestudent_id);
+ if (hasData($result))
+ {
+ show_error('Der Antrag wurde bereits gestellt');
+ }
+
+ // Start DB transaction
+ $this->db->trans_start(false);
+
+ // Upload document
+ $dms = array(
+ 'kategorie_kurzbz' => 'anrechnung',
+ 'version' => 0,
+ 'name' => $_FILES['uploadfile']['name'],
+ 'mimetype' => $_FILES['uploadfile']['type'],
+ 'insertamum' => (new DateTime())->format('Y-m-d H:i:s'),
+ 'insertvon' => $this->_uid
+ );
+
+ if(isError($uploaddata = $this->dmslib->upload($dms, array('pdf'))))
+ {
+ show_error(getError($uploaddata));
+ }
+
+ // Get PrestudentID
+ $result = $this->_loadPrestudent($this->_uid, $studiensemester_kurzbz);
+
+ if (!$prestudent = getData($result)[0])
+ {
+ show_error('Failed retrieving prestudent');
+ }
+
+ // Save Anrechnung
+ $result = $this->AnrechnungModel->insert(array(
+ 'prestudent_id' => $prestudent->prestudent_id,
+ 'lehrveranstaltung_id' => $lehrveranstaltung_id,
+ 'begruendung_id' => $begruendung_id,
+ 'dms_id' => $uploaddata->retval['dms_id'],
+ 'studiensemester_kurzbz' => $studiensemester_kurzbz,
+ 'anmerkung_student' => $anmerkung,
+ 'insertvon' => $this->_uid
+ ));
+
+ if (isError($result))
+ {
+ show_error('Failed inserting Anrechnung');
+ }
+
+ // Save Anrechnungstatus 'inProgressSTGL'
+ $result = $this->AnrechnungModel->saveAnrechnungstatus($result->retval, self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL);
+
+ if (isError($result))
+ {
+ show_error('Failed saving Anrechnungstatus');
+ }
+
+ // Transaction complete!
+ $this->db->trans_complete();
+
+ if ($this->db->trans_status() === false || isError($result))
+ {
+ $this->db->trans_rollback();
+ show_error($result->msg, EXIT_ERROR);
+ }
+
+ // Send mail to STGL
+ $mail_params = array(
+ 'studiengang_kz' => $prestudent->studiengang_kz,
+ 'lehrveranstaltung_id' => $lehrveranstaltung_id
+ );
+
+ if(!$this->_sendSanchoMail($mail_params))
+ {
+ show_error('Failed sending mail');
+ }
+ else
+ {
+ redirect(site_url(). self::REQUEST_ANRECHNUNG_URI. '?studiensemester='. $studiensemester_kurzbz. '&lv_id='. $lehrveranstaltung_id);
+ }
+ }
+
+ /**
+ * Download and open uploaded document (Nachweisdokument).
+ */
+ public function download()
+ {
+ $dms_id = $this->input->get('dms_id');
+
+ if (!is_numeric($dms_id))
+ {
+ show_error('Wrong parameter');
+ }
+
+ // Check if user is entitled to read dms doc
+ self::_checkIfEntitledToReadDMSDoc($dms_id);
+
+ $this->dmslib->download($dms_id);
+ }
+
+ /**
+ * Retrieve the UID of the logged user and checks if it is valid
+ */
+ private function _setAuthUID()
+ {
+ $this->_uid = getAuthUID();
+
+ if (!$this->_uid) show_error('User authentification failed');
+ }
+
+ /**
+ * Load Prestudent by uid and Studiensemester.
+ * @param $uid
+ * @param $studiensemester_kurzbz
+ * @return mixed
+ */
+ private function _loadPrestudent($uid, $studiensemester_kurzbz)
+ {
+ $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
+ $this->load->model('crm/Student_model', 'StudentModel');
+
+ $this->PrestudentstatusModel->addJoin('public.tbl_student', 'prestudent_id');
+ return $this->PrestudentstatusModel->loadWhere(array(
+ 'student_uid' => $uid,
+ 'studiensemester_kurzbz' => $studiensemester_kurzbz
+ )
+ );
+ }
+
+ /**
+ * Check if application deadline is expired.
+ * @param $studiensemester_kurzbz
+ * @return bool True if semester start is more then 1 week ago
+ * @throws Exception
+ */
+ private function _checkAntragDeadline($studiensemester_kurzbz)
+ {
+ $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
+ $this->StudiensemesterModel->addSelect('start');
+ if (!$start = getData($this->StudiensemesterModel->load($studiensemester_kurzbz)))
+ {
+ show_error(getError($start));
+ }
+
+ $start = new DateTime($start[0]->start);
+ $today = new DateTime('today midnight');
+
+ // True if today > application deadline
+ return ($today > $start->add((new DateInterval(self::DEADLINE_INTERVAL_NACH_SEMESTERSTART))));
+ }
+
+ /**
+ * Check if user is entitled to read dms doc
+ * @param $dms_id
+ */
+ private function _checkIfEntitledToReadDMSDoc($dms_id)
+ {
+ if (!$student = getData($this->StudentModel->load(array('student_uid' => $this->_uid)))[0])
+ {
+ show_error('Failed loading Student');
+ }
+
+ $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id));
+
+ if($result = getData($result)[0])
+ {
+ if ($result->prestudent_id == $student->prestudent_id)
+ {
+ return;
+ }
+ }
+
+ show_error('You are not entitled to read this document');
+ }
+
+ /**
+ * Get Anrechnung by Lehrveranstaltung
+ * @param $lehrveranstaltung_id
+ * @return mixed
+ */
+ private function _getAnrechnung($lehrveranstaltung_id, $studiensemester_kurzbz, $prestudent_id)
+ {
+ $result = $this->AnrechnungModel->loadWhere(array(
+ 'lehrveranstaltung_id' => $lehrveranstaltung_id,
+ 'studiensemester_kurzbz' => $studiensemester_kurzbz,
+ 'prestudent_id' => $prestudent_id
+ ));
+
+ if (isError($result))
+ {
+ show_error(getError($result));
+ }
+
+ return $result;
+ }
+
+ /**
+ * Send mail to STGL (if not available, send to STGL assistance)
+ * @param $mail_params
+ */
+ private function _sendSanchoMail($mail_params)
+ {
+ // Get STGL mail address, if available, otherwise get assistance mail address
+ list ($to, $vorname) = $this->_getSTGLMailAddress($mail_params['studiengang_kz']);
+
+ // Get full name of student
+ $this->load->model('person/Person_model', 'PersonModel');
+ if (!$student_name = getData($this->PersonModel->getFullName($this->_uid)))
+ {
+ show_error ('Failed retrieving person');
+ }
+
+ // Get lehrveranstaltung bezeichnung
+ $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
+ if (!$lehrveranstaltung = getData($this->LehrveranstaltungModel->load($mail_params['lehrveranstaltung_id']))[0])
+ {
+ show_error ('Failed retrieving person');
+ }
+
+ // Link to Antrag genehmigen
+ $url =
+ CIS_ROOT. 'cis/index.php?menu='.
+ CIS_ROOT. 'cis/menu.php?content_id=&content='.
+ CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI;
+
+ // Prepare mail content
+ $body_fields = array(
+ 'vorname' => $vorname,
+ 'student_name' => $student_name,
+ 'lehrveranstaltung_bezeichnung' => $lehrveranstaltung->bezeichnung,
+ 'link' => anchor($url, 'Anrechnungsanträge Übersicht')
+ );
+
+ sendSanchoMail(
+ 'AnrechnungAntragStellen',
+ $body_fields,
+ $to,
+ 'Anerkennung nachgewiesener Kenntnisse: Neuer Antrag wurde gestellt'
+ );
+
+ return true;
+ }
+
+ // Get STGL mail address, if available, otherwise get assistance mail address
+ private function _getSTGLMailAddress($stg_kz)
+ {
+ $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
+ $result = $this->StudiengangModel->getLeitung($stg_kz);
+
+ // Get STGL mail address, if available
+ if (hasData($result))
+ {
+ return array(
+ $result->retval[0]->uid. '@'. DOMAIN,
+ $result->retval[0]->vorname
+ );
+ }
+ // ...otherwise get assistance mail address
+ else
+ {
+ $result = $this->StudiengangModel->load($stg_kz);
+
+ if (hasData($result))
+ {
+ return array(
+ $result->retval[0]->email,
+ ''
+ );
+ }
+ }
+ }
+}
diff --git a/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php
new file mode 100644
index 000000000..b9c723eee
--- /dev/null
+++ b/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php
@@ -0,0 +1,397 @@
+ 'lehre/anrechnung_empfehlen:rw',
+ 'download' => 'lehre/anrechnung_empfehlen:rw',
+ 'recommend' => 'lehre/anrechnung_empfehlen:rw',
+ 'dontRecommend' => 'lehre/anrechnung_empfehlen:rw'
+ )
+ );
+
+ // Load models
+ $this->load->model('education/Anrechnung_model', 'AnrechnungModel');
+ $this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel');
+ $this->load->model('content/DmsVersion_model', 'DmsVersionModel');
+ $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
+ $this->load->model('crm/Student_model', 'StudentModel');
+ $this->load->model('person/Notiz_model', 'NotizModel');
+ $this->load->model('person/Person_model', 'PersonModel');
+
+ // Load libraries
+ $this->load->library('WidgetLib');
+ $this->load->library('PermissionLib');
+ $this->load->library('AnrechnungLib');
+ $this->load->library('DmsLib');
+
+ // Load helpers
+ $this->load->helper('form');
+ $this->load->helper('url');
+ $this->load->helper('hlp_sancho_helper');
+
+ // Load language phrases
+ $this->loadPhrases(
+ array(
+ 'global',
+ 'ui',
+ 'anrechnung',
+ 'person',
+ 'lehre',
+ 'table'
+ )
+ );
+
+ $this->_setAuthUID();
+
+ $this->setControllerId();
+ }
+
+ public function index()
+ {
+ $anrechnung_id = $this->input->get('anrechnung_id');
+
+ if (!is_numeric($anrechnung_id))
+ {
+ show_error('Missing correct parameter');
+ }
+
+ // Check if user is entitled to read this Anrechnung
+ self::_checkIfEntitledToReadAnrechnung($anrechnung_id);
+
+ // Get Anrechung data
+ if (!$anrechnungData = getData($this->anrechnunglib->getAnrechnungData($anrechnung_id)))
+ {
+ show_error('Missing data for Anrechnung.');
+ }
+
+ // Get Empfehlung data
+ if(!$empfehlungData = getData($this->anrechnunglib->getEmpfehlungData($anrechnung_id)))
+ {
+ show_error('Missing data for recommendation');
+ }
+
+ $viewData = array(
+ 'antragData' => $this->anrechnunglib->getAntragData(
+ $student_uid = $this->StudentModel->getUID($anrechnungData->prestudent_id),
+ $anrechnungData->studiensemester_kurzbz,
+ $anrechnungData->lehrveranstaltung_id
+ ),
+ 'anrechnungData' => $anrechnungData,
+ 'empfehlungData' => $empfehlungData
+ );
+
+ $this->load->view('lehre/anrechnung/reviewAnrechnungDetail.php', $viewData);
+ }
+
+ /**
+ * Recommend Anrechnungen.
+ */
+ public function recommend()
+ {
+ $data = $this->input->post('data');
+
+ if(isEmptyArray($data))
+ {
+ return $this->outputJsonError('Fehler beim Übertragen der Daten.');
+ }
+
+ // Get statusbezeichnung for 'inProgressDP'
+ $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig');
+ $inProgressDP = getData($this->AnrechnungstatusModel->load('inProgressDP'))[0];
+ $inProgressDP = getUserLanguage() == 'German'
+ ? $inProgressDP->bezeichnung_mehrsprachig[0]
+ : $inProgressDP->bezeichnung_mehrsprachig[1];
+
+ if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0])
+ {
+ show_error('Failed retrieving person data');
+ }
+
+ foreach ($data as $item)
+ {
+ // Approve Anrechnung
+ if(getData($this->anrechnunglib->recommendAnrechnung($item['anrechnung_id'])))
+ {
+ $json[]= array(
+ 'anrechnung_id' => $item['anrechnung_id'],
+ 'empfehlung_anrechnung' => 'true',
+ 'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL,
+ 'status_bezeichnung' => $inProgressDP,
+ 'empfehlung_am' => (new DateTime())->format('d.m.Y'),
+ 'empfehlung_von' => $person->vorname. ' '. $person->nachname
+ );
+ }
+ }
+
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ /**
+ * Send mails to STGL (if not present STGL, send to STGL assistance)
+ * NOTE: mails are sent at the end to ensure sending only one mail to each STGL
+ * */
+ if (!$this->_sendSanchoMails($json, true))
+ {
+ show_error('Failed sending emails');
+ }
+
+ return $this->outputJsonSuccess($json);
+ }
+ else
+ {
+ return $this->outputJsonError('Empfehlungen wurden nicht durchgeführt');
+ }
+ }
+
+ /**
+ * Dont recommend Anrechnungen.
+ */
+ public function dontRecommend()
+ {
+ $data = $this->input->post('data');
+
+ if(isEmptyArray($data))
+ {
+ return $this->outputJsonError('Fehler beim Übertragen der Daten.');
+ }
+
+ // Get statusbezeichnung for 'inProgressDP'
+ $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig');
+ $inProgressDP = getData($this->AnrechnungstatusModel->load('inProgressDP'))[0];
+ $inProgressDP = getUserLanguage() == 'German'
+ ? $inProgressDP->bezeichnung_mehrsprachig[0]
+ : $inProgressDP->bezeichnung_mehrsprachig[1];
+
+ if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0])
+ {
+ show_error('Failed retrieving person data');
+ }
+
+ foreach ($data as $item)
+ {
+ // Approve Anrechnung
+ if(getData($this->anrechnunglib->dontRecommendAnrechnung($item['anrechnung_id'], $item['begruendung'])))
+ {
+ $json[]= array(
+ 'anrechnung_id' => $item['anrechnung_id'],
+ 'empfehlung_anrechnung' => 'false',
+ 'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL,
+ 'status_bezeichnung' => $inProgressDP,
+ 'empfehlumg_am' => (new DateTime())->format('d.m.Y'),
+ 'empfehlung_von' => $person->vorname. ' '. $person->nachname
+ );
+ }
+ }
+
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ // Send mails to STGL (if not present STGL, send to STGL assistance)
+ if (!$this->_sendSanchoMails($json, false))
+ {
+ show_error('Failed sending emails');
+ }
+
+ return $this->outputJsonSuccess($json);
+ }
+ else
+ {
+ return $this->outputJsonError('Empfehlungen wurden nicht durchgeführt');
+ }
+ }
+
+ /**
+ * Download and open uploaded document (Nachweisdokument).
+ */
+ public function download()
+ {
+ $dms_id = $this->input->get('dms_id');
+
+ if (!is_numeric($dms_id))
+ {
+ show_error('Wrong parameter');
+ }
+
+ // Check if user is entitled to read dms doc
+ self::_checkIfEntitledToReadDMSDoc($dms_id);
+
+ $this->dmslib->download($dms_id);
+ }
+
+
+ /**
+ * Retrieve the UID of the logged user and checks if it is valid
+ */
+ private function _setAuthUID()
+ {
+ $this->_uid = getAuthUID();
+
+ if (!$this->_uid) show_error('User authentification failed');
+ }
+
+ /**
+ * Check if user is entitled to read dms doc
+ * @param $dms_id
+ */
+ private function _checkIfEntitledToReadAnrechnung($anrechnung_id)
+ {
+ $result = $this->AnrechnungModel->load($anrechnung_id);
+
+ if(!$result = getData($result)[0])
+ {
+ show_error('Failed retrieving Anrechnung');
+ }
+
+ $result = $this->LehrveranstaltungModel
+ ->getLecturersByLv($result->studiensemester_kurzbz, $result->lehrveranstaltung_id);
+
+ if($result = getData($result))
+ {
+ $entitled_lector_arr = array_column($result, 'uid');
+
+ if (in_array($this->_uid, $entitled_lector_arr))
+ {
+ return;
+ }
+ }
+
+ show_error('You are not entitled to read this document');
+ }
+
+ /**
+ * Check if user is entitled to read dms doc
+ * @param $dms_id
+ */
+ private function _checkIfEntitledToReadDMSDoc($dms_id)
+ {
+ $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id));
+
+ if(!$result = getData($result)[0])
+ {
+ show_error('Failed retrieving Anrechnung');
+ }
+
+ $result = $this->LehrveranstaltungModel
+ ->getLecturersByLv($result->studiensemester_kurzbz, $result->lehrveranstaltung_id);
+
+ if($result = getData($result))
+ {
+ $entitled_lector_arr = array_column($result, 'uid');
+
+ if (in_array($this->_uid, $entitled_lector_arr))
+ {
+ return;
+ }
+ }
+
+ show_error('You are not entitled to read this document');
+ }
+
+ /**
+ * Send mails to STGL (if not present then to STGL assistance)
+ * @param $mail_params
+ * @param $empfehlung
+ * @return bool
+ */
+ private function _sendSanchoMails($mail_params, $empfehlung)
+ {
+ // Get studiengaenge
+ $studiengang_kz_arr = array();
+
+ foreach ($mail_params as $item)
+ {
+ $this->AnrechnungModel->addSelect('studiengang_kz');
+ $this->AnrechnungModel->addJoin('public.tbl_prestudent', 'prestudent_id');
+
+ $studiengang_kz_arr[]= $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiengang_kz;
+ }
+
+ $studiengang_kz_arr = array_unique($studiengang_kz_arr);
+
+ // Send mail to STGL of each studiengang
+ foreach ($studiengang_kz_arr as $studiengang_kz)
+ {
+ // Get STGL mail address, if available, otherwise get assistance mail address
+ list ($to, $vorname) = $this->_getSTGLMailAddress($studiengang_kz);
+
+ // Get full name of lector
+ $this->load->model('person/Person_model', 'PersonModel');
+ if (!$lector_name = getData($this->PersonModel->getFullName($this->_uid)))
+ {
+ show_error ('Failed retrieving person');
+ }
+
+ // Link to Antrag genehmigen
+ $url =
+ CIS_ROOT. 'cis/index.php?menu='.
+ CIS_ROOT. 'cis/menu.php?content_id=&content='.
+ CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI;
+
+ // Prepare mail content
+ $body_fields = array(
+ 'vorname' => $vorname,
+ 'lektor_name' => $lector_name,
+ 'empfehlung' => $empfehlung ? 'positive' : 'negative',
+ 'link' => anchor($url, 'Anrechnungsanträge Übersicht')
+ );
+
+ sendSanchoMail(
+ 'AnrechnungEmpfehlungAbgeben',
+ $body_fields,
+ $to,
+ 'Anerkennung nachgewiesener Kenntnisse: Empfehlung wurde abgegeben'
+ );
+ }
+
+ return true;
+ }
+
+ // Get STGL mail address, if available, otherwise get assistance mail address
+ private function _getSTGLMailAddress($stg_kz)
+ {
+ $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
+ $result = $this->StudiengangModel->getLeitung($stg_kz);
+
+ // Get STGL mail address, if available
+ if (hasData($result))
+ {
+ return array(
+ $result->retval[0]->uid. '@'. DOMAIN,
+ $result->retval[0]->vorname
+ );
+ }
+ // ...otherwise get assistance mail address
+ else
+ {
+ $result = $this->StudiengangModel->load($stg_kz);
+
+ if (hasData($result))
+ {
+ return array(
+ $result->retval[0]->email,
+ ''
+ );
+ }
+ }
+ }
+
+}
diff --git a/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php
new file mode 100644
index 000000000..005cde97a
--- /dev/null
+++ b/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php
@@ -0,0 +1,337 @@
+ 'lehre/anrechnung_empfehlen:rw',
+ 'download' => 'lehre/anrechnung_empfehlen:rw',
+ 'recommend' => 'lehre/anrechnung_empfehlen:rw',
+ 'dontRecommend' => 'lehre/anrechnung_empfehlen:rw'
+ )
+ );
+
+ // Load models
+ $this->load->model('education/Anrechnung_model', 'AnrechnungModel');
+ $this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel');
+ $this->load->model('content/DmsVersion_model', 'DmsVersionModel');
+ $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
+
+ // Load libraries
+ $this->load->library('WidgetLib');
+ $this->load->library('PermissionLib');
+ $this->load->library('AnrechnungLib');
+ $this->load->library('DmsLib');
+
+ // Load helpers
+ $this->load->helper('form');
+ $this->load->helper('url');
+ $this->load->helper('hlp_sancho_helper');
+
+ // Load language phrases
+ $this->loadPhrases(
+ array(
+ 'global',
+ 'ui',
+ 'anrechnung',
+ 'person',
+ 'lehre',
+ 'table'
+ )
+ );
+
+ $this->_setAuthUID();
+
+ $this->setControllerId();
+ }
+
+ public function index()
+ {
+ $studiensemester_kurzbz = $this->input->get('studiensemester');
+
+ if (!is_string($studiensemester_kurzbz))
+ {
+ $studiensemester = $this->StudiensemesterModel->getNearest();
+ if (hasData($studiensemester))
+ {
+ $studiensemester_kurzbz = $studiensemester->retval[0]->studiensemester_kurzbz;
+ }
+ elseif (isError($studiensemester))
+ {
+ show_error(getError($studiensemester));
+ }
+ }
+
+ $viewData = array(
+ 'studiensemester_selected' => $studiensemester_kurzbz
+ );
+
+ $this->load->view('lehre/anrechnung/reviewAnrechnungUebersicht.php', $viewData);
+ }
+
+ /**
+ * Recommend Anrechnungen.
+ */
+ public function recommend()
+ {
+ $data = $this->input->post('data');
+
+ if(isEmptyArray($data))
+ {
+ return $this->outputJsonError('Fehler beim Übertragen der Daten.');
+ }
+
+ // Get statusbezeichnung for 'inProgressDP'
+ $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig');
+ $inProgressDP = getData($this->AnrechnungstatusModel->load('inProgressDP'))[0];
+ $inProgressDP = getUserLanguage() == 'German'
+ ? $inProgressDP->bezeichnung_mehrsprachig[0]
+ : $inProgressDP->bezeichnung_mehrsprachig[1];
+
+ foreach ($data as $item)
+ {
+ // Approve Anrechnung
+ if(getData($this->anrechnunglib->recommendAnrechnung($item['anrechnung_id'])))
+ {
+ $json[]= array(
+ 'anrechnung_id' => $item['anrechnung_id'],
+ 'empfehlung_anrechnung' => 'true',
+ 'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL,
+ 'status_bezeichnung' => $inProgressDP
+ );
+ }
+ }
+
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ /**
+ * Send mails to STGL (if not present STGL, send to STGL assistance)
+ * NOTE: mails are sent at the end to ensure sending only one mail to each STGL
+ * */
+ if (!$this->_sendSanchoMails($json, true))
+ {
+ show_error('Failed sending emails');
+ }
+
+ return $this->outputJsonSuccess($json);
+ }
+ else
+ {
+ return $this->outputJsonError('Empfehlungen wurden nicht durchgeführt');
+ }
+ }
+
+ /**
+ * Dont recommend Anrechnungen.
+ */
+ public function dontRecommend()
+ {
+ $data = $this->input->post('data');
+
+ if(isEmptyArray($data))
+ {
+ return $this->outputJsonError('Fehler beim Übertragen der Daten.');
+ }
+
+ // Get statusbezeichnung for 'inProgressDP'
+ $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig');
+ $inProgressDP = getData($this->AnrechnungstatusModel->load('inProgressDP'))[0];
+ $inProgressDP = getUserLanguage() == 'German'
+ ? $inProgressDP->bezeichnung_mehrsprachig[0]
+ : $inProgressDP->bezeichnung_mehrsprachig[1];
+
+ foreach ($data as $item)
+ {
+ // Approve Anrechnung
+ if(getData($this->anrechnunglib
+ ->dontRecommendAnrechnung($item['anrechnung_id'], $item['begruendung'])))
+ {
+ $json[]= array(
+ 'anrechnung_id' => $item['anrechnung_id'],
+ 'empfehlung_anrechnung' => 'false',
+ 'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL,
+ 'status_bezeichnung' => $inProgressDP
+ );
+ }
+ }
+
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ // Send mails to STGL (if not present STGL, send to STGL assistance)
+ if (!$this->_sendSanchoMails($json, false))
+ {
+ show_error('Failed sending emails');
+ }
+
+ return $this->outputJsonSuccess($json);
+ }
+ else
+ {
+ return $this->outputJsonError('Empfehlungen wurden nicht durchgeführt');
+ }
+ }
+
+ /**
+ * Download and open uploaded document (Nachweisdokument).
+ */
+ public function download()
+ {
+ $dms_id = $this->input->get('dms_id');
+
+ if (!is_numeric($dms_id))
+ {
+ show_error('Wrong parameter');
+ }
+
+ // Check if user is entitled to read dms doc
+ self::_checkIfEntitledToReadDMSDoc($dms_id);
+
+ $this->dmslib->download($dms_id);
+ }
+
+
+ /**
+ * Retrieve the UID of the logged user and checks if it is valid
+ */
+ private function _setAuthUID()
+ {
+ $this->_uid = getAuthUID();
+
+ if (!$this->_uid) show_error('User authentification failed');
+ }
+
+ /**
+ * Check if user is entitled to read dms doc
+ * @param $dms_id
+ */
+ private function _checkIfEntitledToReadDMSDoc($dms_id)
+ {
+ $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id));
+
+ if(!$result = getData($result)[0])
+ {
+ show_error('Failed retrieving Anrechnung');
+ }
+
+ $result = $this->LehrveranstaltungModel
+ ->getLecturersByLv($result->studiensemester_kurzbz, $result->lehrveranstaltung_id);
+
+ if($result = getData($result))
+ {
+ $entitled_lector_arr = array_column($result, 'uid');
+
+ if (in_array($this->_uid, $entitled_lector_arr))
+ {
+ return;
+ }
+ }
+
+ show_error('You are not entitled to read this document');
+ }
+
+ /**
+ * Send mails to STGL (if not present then to STGL assistance)
+ * @param $mail_params
+ * @param $empfehlung
+ * @return bool
+ */
+ private function _sendSanchoMails($mail_params, $empfehlung)
+ {
+ // Get studiengaenge
+ $studiengang_kz_arr = array();
+
+ foreach ($mail_params as $item)
+ {
+ $this->AnrechnungModel->addSelect('studiengang_kz');
+ $this->AnrechnungModel->addJoin('public.tbl_prestudent', 'prestudent_id');
+
+ $studiengang_kz_arr[]= $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiengang_kz;
+ }
+
+ $studiengang_kz_arr = array_unique($studiengang_kz_arr);
+
+ // Send mail to STGL of each studiengang
+ foreach ($studiengang_kz_arr as $studiengang_kz)
+ {
+ // Get STGL mail address, if available, otherwise get assistance mail address
+ list ($to, $vorname) = $this->_getSTGLMailAddress($studiengang_kz);
+
+ // Get full name of lector
+ $this->load->model('person/Person_model', 'PersonModel');
+ if (!$lector_name = getData($this->PersonModel->getFullName($this->_uid)))
+ {
+ show_error ('Failed retrieving person');
+ }
+
+ // Link to Antrag genehmigen
+ $url =
+ CIS_ROOT. 'cis/index.php?menu='.
+ CIS_ROOT. 'cis/menu.php?content_id=&content='.
+ CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI;
+
+ // Prepare mail content
+ $body_fields = array(
+ 'vorname' => $vorname,
+ 'lektor_name' => $lector_name,
+ 'empfehlung' => $empfehlung ? 'positive' : 'negative',
+ 'link' => anchor($url, 'Anrechnungsanträge Übersicht')
+ );
+
+ sendSanchoMail(
+ 'AnrechnungEmpfehlungAbgeben',
+ $body_fields,
+ $to,
+ 'Anerkennung nachgewiesener Kenntnisse: Empfehlung wurde abgegeben'
+ );
+ }
+
+ return true;
+ }
+
+ // Get STGL mail address, if available, otherwise get assistance mail address
+ private function _getSTGLMailAddress($stg_kz)
+ {
+ $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
+ $result = $this->StudiengangModel->getLeitung($stg_kz);
+
+ // Get STGL mail address, if available
+ if (hasData($result))
+ {
+ return array(
+ $result->retval[0]->uid. '@'. DOMAIN,
+ $result->retval[0]->vorname
+ );
+ }
+ // ...otherwise get assistance mail address
+ else
+ {
+ $result = $this->StudiengangModel->load($stg_kz);
+
+ if (hasData($result))
+ {
+ return array(
+ $result->retval[0]->email,
+ ''
+ );
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/application/controllers/lehre/lehrauftrag/Lehrauftrag.php b/application/controllers/lehre/lehrauftrag/Lehrauftrag.php
index dade1fb21..0fe70a302 100644
--- a/application/controllers/lehre/lehrauftrag/Lehrauftrag.php
+++ b/application/controllers/lehre/lehrauftrag/Lehrauftrag.php
@@ -52,7 +52,8 @@ class Lehrauftrag extends Auth_Controller
array(
'global',
'ui',
- 'lehre'
+ 'lehre',
+ 'table'
)
);
@@ -91,7 +92,8 @@ class Lehrauftrag extends Auth_Controller
// Retrieve studiengaenge the user is entitled for to populate studiengang dropdown
if (!$studiengang_kz_arr = $this->permissionlib->getSTG_isEntitledFor(self::BERECHTIGUNG_LEHRAUFTRAG_BESTELLEN)) {
- show_error('Fehler bei Berechtigungsprüfung');
+ show_error('Keine Studiengänge gefunden.
+ Es muss eine passende Organisationseinheit hinterlegt werden.
');
}
// If studiengang_kz get param was set, check against entitled stg
@@ -268,7 +270,6 @@ class Lehrauftrag extends Auth_Controller
private function _sendMail($lehrvertrag_data_arr)
{
// Cluster data of new lehrvertraege as needed to send mail
- $lehrvertrag_data_arr = $this->_cluster_newVertragData($lehrvertrag_data_arr);
foreach ($lehrvertrag_data_arr as $lehrvertrag_data)
{
diff --git a/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php b/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php
index 4fc0a879b..6ac2da887 100644
--- a/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php
+++ b/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php
@@ -8,180 +8,196 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
*/
class LehrauftragAkzeptieren extends Auth_Controller
{
- const APP = 'lehrauftrag';
- const LEHRAUFTRAG_URI = 'lehre/lehrauftrag/LehrauftragAkzeptieren'; // URL prefix for this controller
- const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren';
+ const APP = 'lehrauftrag';
+ const LEHRAUFTRAG_URI = 'lehre/lehrauftrag/LehrauftragAkzeptieren'; // URL prefix for this controller
+ const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren';
- private $_uid; // uid of the logged user
+ private $_uid; // uid of the logged user
- /**
- * Constructor
- */
- public function __construct()
- {
- // Set required permissions
- parent::__construct(
- array(
- 'index' => 'lehre/lehrauftrag_akzeptieren:r',
- 'acceptLehrauftrag' => 'lehre/lehrauftrag_akzeptieren:rw',
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ // Set required permissions
+ parent::__construct(
+ array(
+ 'index' => 'lehre/lehrauftrag_akzeptieren:r',
+ 'acceptLehrauftrag' => 'lehre/lehrauftrag_akzeptieren:rw',
'checkInkludierteLehre' => 'lehre/lehrauftrag_akzeptieren:rw'
- )
- );
+ )
+ );
- // Load models
- $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
- $this->load->model('accounting/Vertrag_model', 'VertragModel');
- $this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel');
- $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
- $this->load->model('codex/Bisverwendung_model', 'BisverwendungModel');
- $this->load->model('person/Benutzer_model', 'BenutzerModel');
+ // Load models
+ $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
+ $this->load->model('accounting/Vertrag_model', 'VertragModel');
+ $this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel');
+ $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
+ $this->load->model('codex/Bisverwendung_model', 'BisverwendungModel');
+ $this->load->model('person/Benutzer_model', 'BenutzerModel');
- // Load libraries
- $this->load->library('WidgetLib');
- $this->load->library('PermissionLib');
- $this->load->library('AuthLib');
+ // Load libraries
+ $this->load->library('WidgetLib');
+ $this->load->library('PermissionLib');
+ $this->load->library('AuthLib');
- // Load helpers
- $this->load->helper('array');
- $this->load->helper('url');
+ // Load helpers
+ $this->load->helper('array');
+ $this->load->helper('url');
- // Load language phrases
- $this->loadPhrases(
- array(
- 'global',
- 'ui',
- 'lehre'
- )
- );
+ // Load language phrases
+ $this->loadPhrases(
+ array(
+ 'global',
+ 'ui',
+ 'lehre',
+ 'password',
+ 'dms',
+ 'table'
+ )
+ );
- $this->_setAuthUID(); // sets property uid
+ $this->_setAuthUID(); // sets property uid
- $this->setControllerId(); // sets the controller id
- }
+ $this->setControllerId(); // sets the controller id
+ }
- // -----------------------------------------------------------------------------------------------------------------
- // Public methods
+ // -----------------------------------------------------------------------------------------------------------------
+ // Public methods
- /**
- * Main page of Lehrauftrag
- */
- public function index()
- {
- // Set studiensemester selected for studiengang dropdown
- $studiensemester_kurzbz = $this->input->get('studiensemester'); // if provided by selected studiensemester
- if (is_null($studiensemester_kurzbz)) // else set next studiensemester as default value
- {
- $studiensemester = $this->StudiensemesterModel->getAktOrNextSemester();
- if (hasData($studiensemester))
- {
- $studiensemester_kurzbz = $studiensemester->retval[0]->studiensemester_kurzbz;
- }
- elseif (isError($studiensemester))
- {
- show_error(getError($studiensemester));
- }
- }
+ /**
+ * Main page of Lehrauftrag
+ */
+ public function index()
+ {
+ // Set studiensemester selected for studiengang dropdown
+ $studiensemester_kurzbz = $this->input->get('studiensemester'); // if provided by selected studiensemester
+ if (is_null($studiensemester_kurzbz)) // else set next studiensemester as default value
+ {
+ $studiensemester = $this->StudiensemesterModel->getAktOrNextSemester();
+ if (hasData($studiensemester))
+ {
+ $studiensemester_kurzbz = $studiensemester->retval[0]->studiensemester_kurzbz;
+ }
+ elseif (isError($studiensemester))
+ {
+ show_error(getError($studiensemester));
+ }
+ }
- $view_data = array(
- 'studiensemester_selected' => $studiensemester_kurzbz
- );
+ // Check if user is external lector
+ $this->MitarbeiterModel->addJoin('public.tbl_benutzer', 'uid = mitarbeiter_uid');
+ $result = $this->MitarbeiterModel->loadWhere(array(
+ 'uid' => $this->_uid,
+ 'fixangestellt' => false,
+ 'personalnummer > ' => 0,
+ 'lektor' => true,
+ 'aktiv' => true
+ ));
+
+ $is_external_lector = hasData($result) ? true : false;
+
+ $view_data = array(
+ 'studiensemester_selected' => $studiensemester_kurzbz,
+ 'is_external_lector' => $is_external_lector
+ );
- $this->load->view('lehre/lehrauftrag/acceptLehrauftrag.php', $view_data);
- }
+ $this->load->view('lehre/lehrauftrag/acceptLehrauftrag.php', $view_data);
+ }
- /**
- * Set the contract status of Lehrauftrag to 'akzeptiert'.
- * Performed on ajax call.
- */
- public function acceptLehrauftrag()
- {
- // Verify password
- $password = $this->input->post('password');
- if (!isEmptyString($password))
- {
- $result = $this->authlib->checkUserAuthByUsernamePassword($this->_uid, $password);
- if (isError($result))
- {
- return $this->outputJsonError('Passwort ist inkorrekt'); // exit if password is incorrect
- }
- }
- else
- {
+ /**
+ * Set the contract status of Lehrauftrag to 'akzeptiert'.
+ * Performed on ajax call.
+ */
+ public function acceptLehrauftrag()
+ {
+ // Verify password
+ $password = $this->input->post('password');
+ if (!isEmptyString($password))
+ {
+ $result = $this->authlib->checkUserAuthByUsernamePassword($this->_uid, $password);
+ if (isError($result))
+ {
+ return $this->outputJsonError('Passwort ist inkorrekt'); // exit if password is incorrect
+ }
+ }
+ else
+ {
return $this->outputJsonError('Passwort fehlt');
- }
+ }
- // Loop through lehraufträge
- $lehrauftrag_arr = $this->input->post('selected_data');
+ // Loop through lehraufträge
+ $lehrauftrag_arr = $this->input->post('selected_data');
- if(is_array($lehrauftrag_arr))
- {
- foreach($lehrauftrag_arr as $lehrauftrag)
- {
- $vertrag_id = (!is_null($lehrauftrag['vertrag_id'])) ? $lehrauftrag['vertrag_id'] : null;
+ if(is_array($lehrauftrag_arr))
+ {
+ foreach($lehrauftrag_arr as $lehrauftrag)
+ {
+ $vertrag_id = (!is_null($lehrauftrag['vertrag_id'])) ? $lehrauftrag['vertrag_id'] : null;
- // Check if user is entitled to accept this Lehrauftrag
- // * first retrieve person_id of the contract
- $this->VertragModel->addSelect('person_id');
+ // Check if user is entitled to accept this Lehrauftrag
+ // * first retrieve person_id of the contract
+ $this->VertragModel->addSelect('person_id');
- if ($result = getData($this->VertragModel->load($vertrag_id)))
- {
- // * then find the uid of that contracts person_id
- $this->BenutzerModel->addSelect('uid');
+ if ($result = getData($this->VertragModel->load($vertrag_id)))
+ {
+ // * then find the uid of that contracts person_id
+ $this->BenutzerModel->addSelect('uid');
- if ($result = getData($this->BenutzerModel->getFromPersonId($result[0]->person_id)))
- {
- // * finally check uid of contract against the logged in user
+ if ($result = getData($this->BenutzerModel->getFromPersonId($result[0]->person_id)))
+ {
+ // * finally check uid of contract against the logged in user
$account_found = false;
- foreach($result as $row_accounts)
+ foreach ($result as $row_accounts)
{
- if($row_accounts->uid == $this->_uid)
+ if ($row_accounts->uid == $this->_uid)
{
$account_found = true;
}
}
- if (!$account_found)
- {
+ if (!$account_found)
+ {
return $this->outputJsonError('Sie haben keine Berechtigung für einen Vertrag');
- }
- }
- else
- {
+ }
+ }
+ else
+ {
return $this->outputJsonError('Fehler beim Laden der Benutzerdaten');
- }
- }
- else
- {
+ }
+ }
+ else
+ {
return $this->outputJsonError('Fehler beim Laden des Vertrags');
- }
+ }
- // Set status to accepted
- $result = $this->VertragvertragsstatusModel->setStatus($vertrag_id, $this->_uid, 'akzeptiert');
+ // Set status to accepted
+ $result = $this->VertragvertragsstatusModel->setStatus($vertrag_id, $this->_uid, 'akzeptiert');
- if ($result->retval)
- {
- $json []= array(
- 'row_index' => $lehrauftrag['row_index'],
- 'akzeptiert' => date('Y-m-d')
- );
- }
+ if ($result->retval)
+ {
+ $json []= array(
+ 'row_index' => $lehrauftrag['row_index'],
+ 'akzeptiert' => date('Y-m-d')
+ );
+ }
else
{
return $this->outputJsonError($result->retval);
}
- }
+ }
- // Output json to ajax
- if (isset($json) && !isEmptyArray($json))
- {
- $this->outputJsonSuccess($json);
- }
- }
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ $this->outputJsonSuccess($json);
+ }
+ }
else
{
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
}
- }
+ }
/**
* Check if lectors latest Verwendung has inkludierte Lehre
@@ -189,7 +205,7 @@ class LehrauftragAkzeptieren extends Auth_Controller
* - inkludierte_lehre -1: fix employed lector -> has inkludierte Lehre (all inclusive)
* - inkludierte_lehre > 0: fix employed lector -> has inkludierte Lehre (value is amount of hours included)
*/
- public function checkInkludierteLehre()
+ public function checkInkludierteLehre()
{
$result = $this->BisverwendungModel->getLast($this->_uid, false);
@@ -203,17 +219,17 @@ class LehrauftragAkzeptieren extends Auth_Controller
}
}
- // -----------------------------------------------------------------------------------------------------------------
- // Private methods
+ // -----------------------------------------------------------------------------------------------------------------
+ // Private methods
- /**
- * Retrieve the UID of the logged user and checks if it is valid
- */
- private function _setAuthUID()
- {
- $this->_uid = getAuthUID();
+ /**
+ * Retrieve the UID of the logged user and checks if it is valid
+ */
+ private function _setAuthUID()
+ {
+ $this->_uid = getAuthUID();
- if (!$this->_uid) show_error('User authentification failed');
- }
+ if (!$this->_uid) show_error('User authentification failed');
+ }
}
diff --git a/application/controllers/lehre/lehrauftrag/LehrauftragErteilen.php b/application/controllers/lehre/lehrauftrag/LehrauftragErteilen.php
index b339c81a4..64a2be69b 100644
--- a/application/controllers/lehre/lehrauftrag/LehrauftragErteilen.php
+++ b/application/controllers/lehre/lehrauftrag/LehrauftragErteilen.php
@@ -50,7 +50,8 @@ class LehrauftragErteilen extends Auth_Controller
array(
'global',
'ui',
- 'lehre'
+ 'lehre',
+ 'table'
)
);
diff --git a/application/controllers/system/FAS_UDF.php b/application/controllers/system/FAS_UDF.php
index cd78d64d2..febe266c7 100644
--- a/application/controllers/system/FAS_UDF.php
+++ b/application/controllers/system/FAS_UDF.php
@@ -7,60 +7,34 @@ class FAS_UDF extends Auth_Controller
const FAS_UDF_SESSION_NAME = 'fasUdfSessionName';
public function __construct()
- {
- parent::__construct(
+ {
+ parent::__construct(
array(
'index' => 'basis/person:r',
'saveUDF' => 'basis/person:rw'
)
);
-
+
$this->load->model('person/Person_model', 'PersonModel');
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
- }
+ }
/**
*
*/
public function index()
{
- $fasUdfSession = getSession(self::FAS_UDF_SESSION_NAME);
-
$person_id = $this->input->get('person_id');
- if (isset($fasUdfSession['person_id']))
- {
- if (!isset($person_id))
- {
- $person_id = $fasUdfSession['person_id'];
- }
- unset($fasUdfSession['person_id']);
- }
-
$prestudent_id = $this->input->get('prestudent_id');
- if (isset($fasUdfSession['prestudent_id']))
- {
- if (!isset($prestudent_id))
- {
- $prestudent_id = $fasUdfSession['prestudent_id'];
- }
- unset($fasUdfSession['prestudent_id']);
- }
- $result = null;
- if (isset($fasUdfSession['result']))
- {
- $result = clone $fasUdfSession['result'];
- setSessionElement(self::FAS_UDF_SESSION_NAME, 'result', null);
- }
-
- $data = array('result' => $result);
+ $data = array();
if (isset($person_id) && is_numeric($person_id))
{
if ($this->PersonModel->hasUDF())
{
$personUdfs = $this->PersonModel->getUDFs($person_id);
- $personUdfs['person_id'] = $person_id;
+ $data['person_id'] = $person_id;
$data['personUdfs'] = $personUdfs;
}
}
@@ -70,61 +44,12 @@ class FAS_UDF extends Auth_Controller
if ($this->PrestudentModel->hasUDF())
{
$prestudentUdfs = $this->PrestudentModel->getUDFs($prestudent_id);
- $prestudentUdfs['prestudent_id'] = $prestudent_id;
+ $data['prestudent_id'] = $prestudent_id;
$data['prestudentUdfs'] = $prestudentUdfs;
}
}
$this->load->view('system/fas_udf', $data);
}
-
- /**
- *
- */
- public function saveUDF()
- {
- $udfs = $this->input->post();
- $validation = $this->_validate($udfs);
-
- $userdata = array(
- 'person_id' => $this->input->post('person_id'),
- 'prestudent_id' => $this->input->post('prestudent_id')
- );
-
- if (isSuccess($validation))
- {
- // Load model UDF_model
- $this->load->model('system/FAS_UDF_model', 'FASUDFModel');
-
- $result = $this->FASUDFModel->saveUDFs($udfs);
-
- $userdata['result'] = $result;
- }
- else
- {
- $userdata['result'] = $validation;
- }
-
- setSessionElement(self::FAS_UDF_SESSION_NAME, 'person_id', $userdata['person_id']);
- setSessionElement(self::FAS_UDF_SESSION_NAME, 'prestudent_id', $userdata['prestudent_id']);
- setSessionElement(self::FAS_UDF_SESSION_NAME, 'result', $userdata['result']);
-
- redirect('system/FAS_UDF');
- }
-
- /**
- *
- */
- private function _validate($udfs)
- {
- $validation = error('person_id or prestudent_id is missing');
-
- if((isset($udfs['person_id']) && !(is_null($udfs['person_id'])) && ($udfs['person_id'] != ''))
- || (isset($udfs['prestudent_id']) && !(is_null($udfs['prestudent_id'])) && ($udfs['prestudent_id'] != '')))
- {
- $validation = success(true);
- }
-
- return $validation;
- }
}
+
diff --git a/application/controllers/system/LogsViewer.php b/application/controllers/system/LogsViewer.php
index 8caf9f3a7..4e39db5e3 100644
--- a/application/controllers/system/LogsViewer.php
+++ b/application/controllers/system/LogsViewer.php
@@ -35,7 +35,7 @@ class LogsViewer extends Auth_Controller
// Public methods
/**
- * Main page of the InfoCenter tool
+ * Everything has a beginning
*/
public function index()
{
diff --git a/application/controllers/system/Phrases.php b/application/controllers/system/Phrases.php
index f589eaeb2..2bb003567 100644
--- a/application/controllers/system/Phrases.php
+++ b/application/controllers/system/Phrases.php
@@ -161,7 +161,7 @@ class Phrases extends Auth_Controller
$phrase_inhalt = $this->phraseslib->insertPhraseinhalt($data);
if ($phrase_inhalt->error)
- show_error(getError($phrase_inhalt);
+ show_error(getError($phrase_inhalt));
$phrase_inhalt_id = $phrase_inhalt->retval;
diff --git a/application/controllers/system/Variables.php b/application/controllers/system/Variables.php
index 20303118b..c56407416 100644
--- a/application/controllers/system/Variables.php
+++ b/application/controllers/system/Variables.php
@@ -20,7 +20,8 @@ class Variables extends Auth_Controller
array(
'setVar' => 'basis/variable:rw',
'getVar' => 'basis/variable:rw',
- 'changeStudiensemesterVar' => 'basis/variable:rw'
+ 'changeStudiensemesterVar' => 'basis/variable:rw',
+ 'changeStudengangsTypVar' => 'basis/variable:rw'
)
);
@@ -50,7 +51,9 @@ class Variables extends Auth_Controller
public function getVar()
{
$name = $this->input->get('name');
- $this->outputJson($this->VariableModel->getVariables($this->_uid, array($name)));
+ $typ = $this->input->get('typ');
+
+ $this->outputJson($this->VariableModel->getVariables($this->_uid, array($name, $typ)));
}
/**
@@ -66,6 +69,15 @@ class Variables extends Auth_Controller
$this->outputJson($result);
}
+ public function changeStudengangsTypVar()
+ {
+ $name = $this->input->post('name');
+ $change = $this->input->post('change');
+
+ $result = $this->variablelib->changeStudengangsTypVar($this->_uid, $name, $change);
+ $this->outputJson($result);
+ }
+
/**
* Retrieve the UID of the logged user and checks if it is valid
*/
diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php
index 92636e6df..44a1cf327 100644
--- a/application/controllers/system/infocenter/InfoCenter.php
+++ b/application/controllers/system/infocenter/InfoCenter.php
@@ -12,12 +12,17 @@ class InfoCenter extends Auth_Controller
const APP = 'infocenter';
const TAETIGKEIT = 'bewerbung';
const FREIGABE_MAIL_VORLAGE = 'InfocenterMailFreigabeAssistenz';
+ const ZGVPRUEFUNG_MAIL_VORLAGE = 'InfocenterMailZgvUeberpruefung';
+ const ZGVPRUEFUNG_MAIL_VORLAGE_MASTER = 'InfocenterMailZgvUeberpruefungM';
const INFOCENTER_URI = 'system/infocenter/InfoCenter'; // URL prefix for this controller
+ const ZGV_UEBERPRUEFUNG_URI = 'system/infocenter/ZGVUeberpruefung';
const INDEX_PAGE = 'index';
const FREIGEGEBEN_PAGE = 'freigegeben';
const REIHUNGSTESTABSOLVIERT_PAGE = 'reihungstestAbsolviert';
const SHOW_DETAILS_PAGE = 'showDetails';
+ const SHOW_ZGV_DETAILS_PAGE = 'showZGVDetails';
+ const ZGV_UBERPRUEFUNG_PAGE = 'ZGVUeberpruefung';
const NAVIGATION_PAGE = 'navigation_page';
const ORIGIN_PAGE = 'origin_page';
@@ -63,13 +68,32 @@ class InfoCenter extends Auth_Controller
'name' => 'Note updated',
'message' => 'Note with title %s was updated',
'success' => null
- )
+ ),
+ 'updatezgv' => array(
+ 'logtype' => 'Action',
+ 'name' => 'ZGV pruefung updated',
+ 'message' => 'ZGV with the ID %s was updated to %s',
+ 'success' => null
+ ),
+ 'newzgv' => array(
+ 'logtype' => 'Action',
+ 'name' => 'ZGV pruefung added',
+ 'message' => 'ZGV with the ID %s was added',
+ 'success' => null
+ ),
+ 'updatedoctyp' => array(
+ 'logtype' => 'Action',
+ 'name' => 'Document type updated',
+ 'message' => 'Type of Document %s was updated, set to %s',
+ 'success' => null
+ ),
);
// Name of Interessentenstatus
const INTERESSENTSTATUS = 'Interessent';
const ABGEWIESENERSTATUS = 'Abgewiesener';
const BEWERBERSTATUS = 'Bewerber';
+ const WARTENDER = 'Wartender';
// Statusgruende for which no Studiengangsfreigabemessage should be sent
private $_statusgruendeNoStgFreigabeMessage = array('FIT Programm', 'FIT program', 'FIT programme');
@@ -85,13 +109,18 @@ class InfoCenter extends Auth_Controller
'freigegeben' => 'infocenter:r',
'reihungstestAbsolviert' => 'infocenter:r',
'showDetails' => 'infocenter:r',
+ 'showZGVDetails' => 'lehre/zgvpruefung:r',
'unlockPerson' => 'infocenter:rw',
'saveFormalGeprueft' => 'infocenter:rw',
+ 'saveDocTyp' => 'infocenter:rw',
+ 'saveNachreichung' => 'infocenter:rw',
'getPrestudentData' => 'infocenter:r',
'getLastPrestudentWithZgvJson' => 'infocenter:r',
'getZgvInfoForPrestudent' => 'infocenter:r',
'saveBewPriorisierung' => 'infocenter:rw',
'saveZgvPruefung' => 'infocenter:rw',
+ 'zgvRueckfragen' => 'infocenter:rw',
+ 'zgvStatusUpdate' => 'lehre/zgvpruefung:rw',
'saveAbsage' => 'infocenter:rw',
'saveFreigabe' => 'infocenter:rw',
'getNotiz' => 'infocenter:r',
@@ -99,6 +128,7 @@ class InfoCenter extends Auth_Controller
'updateNotiz' => 'infocenter:rw',
'reloadZgvPruefungen' => 'infocenter:r',
'reloadMessages' => 'infocenter:r',
+ 'reloadDoks' => 'infocenter:r',
'reloadNotizen' => 'infocenter:r',
'reloadLogs' => 'infocenter:r',
'outputAkteContent' => 'infocenter:r',
@@ -108,15 +138,20 @@ class InfoCenter extends Auth_Controller
'setOnHold' => 'infocenter:rw',
'removeOnHold' => 'infocenter:rw',
'getStudienjahrEnd' => 'infocenter:r',
- 'setNavigationMenuArrayJson' => 'infocenter:r'
+ 'setNavigationMenuArrayJson' => 'infocenter:r',
+ 'getAbsageData' => 'infocenter:r',
+ 'saveAbsageForAll' => 'infocenter:rw'
)
);
// Loads models
$this->load->model('crm/Akte_model', 'AkteModel');
+ $this->load->model('crm/Dokument_model', 'DokumentModel');
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
$this->load->model('crm/Statusgrund_model', 'StatusgrundModel');
+ $this->load->model('crm/ZGVPruefung_model', 'ZGVPruefungModel');
+ $this->load->model('crm/ZGVPruefungStatus_model', 'ZGVPruefungStatusModel');
$this->load->model('person/Notiz_model', 'NotizModel');
$this->load->model('person/Person_model', 'PersonModel');
$this->load->model('system/Message_model', 'MessageModel');
@@ -178,6 +213,59 @@ class InfoCenter extends Auth_Controller
$this->load->view('system/infocenter/infocenterReihungstestAbsolviert.php');
}
+ /**
+ * Prestudenten/ZGV übersicht
+ * Holt sich die Informationen zu den ZGV vom Prestudenten und zeigt die dann an
+ */
+ public function showZGVDetails()
+ {
+ $this->_setNavigationMenuShowDetails(self::SHOW_ZGV_DETAILS_PAGE);
+
+ $prestudent_id = $this->input->get('prestudent_id');
+
+ if (!is_numeric($prestudent_id))
+ show_error('prestudent id is not numeric!');
+
+ $prestudentexists = $this->PrestudentModel->load($prestudent_id);
+
+ if (isError($prestudentexists))
+ show_error(getError($prestudentexists));
+
+ if (!hasData($prestudentexists))
+ show_error('Prestudent does not exist!');
+
+ $zgv = $this->ZGVPruefungStatusModel->getZgvStatusByPrestudent($prestudent_id);
+
+ if (isError($zgv))
+ show_error(getError($zgv));
+
+ if (!hasData($zgv))
+ show_error('ZGV has no status.');
+
+ $persondata = $this->_loadPersonData(getData($prestudentexists)[0]->person_id);
+ $prestudent_id = array('prestudent_id' => $prestudent_id);
+ $status = array('status' => getData($zgv)[0]->status);
+ $prestudent_data = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
+
+ $this->DokumentModel->addOrder('bezeichnung');
+ $dokumentdata = array('dokumententypen' => (getData($this->DokumentModel->load())));
+
+ $data = array_merge(
+ $persondata,
+ $prestudent_id,
+ $status,
+ $dokumentdata,
+ $prestudent_data
+ );
+
+ $origin_page = $this->input->get(self::ORIGIN_PAGE);
+
+ $data[self::FHC_CONTROLLER_ID] = $this->getControllerId();
+ $data[self::ORIGIN_PAGE] = $origin_page;
+ $data[self::PREV_FILTER_ID] = $this->input->get(self::PREV_FILTER_ID);
+
+ $this->load->view('system/infocenter/infocenterZgvDetails.php', $data);
+ }
/**
* Personal details page of the InfoCenter tool
* Initialization function, gets person and prestudent data and loads the view with the data
@@ -211,9 +299,13 @@ class InfoCenter extends Auth_Controller
$persondata = $this->_loadPersonData($person_id);
$prestudentdata = $this->_loadPrestudentData($person_id);
+ $this->DokumentModel->addOrder('bezeichnung');
+ $dokumentdata = array('dokumententypen' => (getData($this->DokumentModel->load())));
+
$data = array_merge(
$persondata,
- $prestudentdata
+ $prestudentdata,
+ $dokumentdata
);
$data[self::FHC_CONTROLLER_ID] = $this->getControllerId();
@@ -374,12 +466,18 @@ class InfoCenter extends Auth_Controller
$zgvdatum = isEmptyString($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d');
$zgvnation_code = $this->input->post('zgvnation') === 'null' ? null : $this->input->post('zgvnation');
- // zgvmasterdata
- $zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas');
- $zgvmaort = $this->input->post('zgvmaort');
- $zgvmadatum = $this->input->post('zgvmadatum');
- $zgvmadatum = isEmptyString($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
- $zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation');
+ $prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id);
+ $prestudentdata = getData($prestudent);
+
+ if ($prestudentdata->studiengangtyp === 'm')
+ {
+ // zgvmasterdata
+ $zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas');
+ $zgvmaort = $this->input->post('zgvmaort');
+ $zgvmadatum = $this->input->post('zgvmadatum');
+ $zgvmadatum = isEmptyString($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
+ $zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation');
+ }
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id, '', self::INTERESSENTSTATUS);
@@ -395,19 +493,29 @@ class InfoCenter extends Auth_Controller
);
}
- $prestresult = $this->PrestudentModel->update(
- $prestudent_id,
- array(
- 'zgv_code' => $zgv_code,
- 'zgvort' => $zgvort,
- 'zgvdatum' => $zgvdatum,
- 'zgvnation' => $zgvnation_code,
+ $updateArray = array(
+ 'zgv_code' => $zgv_code,
+ 'zgvort' => $zgvort,
+ 'zgvdatum' => $zgvdatum,
+ 'zgvnation' => $zgvnation_code,
+ 'updateamum' => date('Y-m-d H:i:s')
+ );
+
+ if ($prestudentdata->studiengangtyp === 'm')
+ {
+ $updateMasterArray = array(
'zgvmas_code' => $zgvmas_code,
'zgvmaort' => $zgvmaort,
'zgvmadatum' => $zgvmadatum,
- 'zgvmanation' => $zgvmanation_code,
- 'updateamum' => date('Y-m-d H:i:s')
- )
+ 'zgvmanation' => $zgvmanation_code
+ );
+
+ $updateArray = array_merge($updateArray, $updateMasterArray);
+ }
+
+ $prestresult = $this->PrestudentModel->update(
+ $prestudent_id,
+ $updateArray
);
if (isError($prestresult))
@@ -429,15 +537,195 @@ class InfoCenter extends Auth_Controller
$this->outputJson($json);
}
+ /**
+ * Sendet bei einer neuen ZGV Prüfung die Mail raus an den Studiengang
+ */
+ private function sendZgvMail($mail, $typ){
+ $data = array(
+ 'link' => site_url('system/infocenter/ZGVUeberpruefung')
+ );
+
+ $this->load->helper('hlp_sancho');
+
+ sendSanchoMail(
+ ($typ === 'm' ? self::ZGVPRUEFUNG_MAIL_VORLAGE_MASTER : self::ZGVPRUEFUNG_MAIL_VORLAGE),
+ $data,
+ $mail,
+ 'ZGV Ueberpruefung',
+ 'sancho_header_min_bw.jpg',
+ 'sancho_footer_min_bw.jpg'
+ );
+ }
+
+ /**
+ * Der Status von den ZGV wird geupdated
+ */
+ public function zgvStatusUpdate()
+ {
+ $prestudent_id = $this->input->post('prestudent_id');
+ $person_id = $this->input->post('person_id');
+ $status = $this->input->post('status');
+
+ if (isEmptyString($prestudent_id) || isEmptyString($person_id) || isEmptyString($status))
+ $this->terminateWithJsonError('Some data is missing');
+
+ $personInfos = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id);
+
+ if (!hasData($personInfos))
+ $this->terminateWithJsonError('Person id nicht gefunden');
+
+ $personInfos = getData($personInfos);
+
+ $zgv = $this->ZGVPruefungStatusModel->getZgvStatusByPrestudent($prestudent_id);
+
+ if (!hasData($zgv))
+ $this->terminateWithJsonError('ZGV-Status nicht gefunden');
+
+ $zgv = getData($zgv);
+
+ if ($zgv[0]->status === 'rejected' && $status === 'rejected')
+ $this->terminateWithJsonError('Bereits abgelehnt worden');
+ elseif ($zgv[0]->status === 'accepted' && $status === 'accepted')
+ $this->terminateWithJsonError('Bereits akzeptiert worden');
+
+ $insert = $this->ZGVPruefungStatusModel->insert(
+ array(
+ 'zgvpruefung_id' => $zgv[0]->zgvpruefung_id,
+ 'status' => $status
+ )
+ );
+
+ $update = $this->ZGVPruefungModel->update(
+ $zgv[0]->zgvpruefung_id,
+ array(
+ 'updateamum' => date('Y-m-d H:i:s'),
+ 'updatevon' => $this->_uid
+ )
+ );
+
+ if (isError($insert) || isError($update))
+ $this->terminateWithJsonError('Fehler beim Speichern');
+
+ $allZgvs = $this->ZGVPruefungStatusModel->getOpenZgvByPerson($personInfos->person_id, array('pruefung_stg'));
+ $openZgv = false;
+
+ if (hasData($allZgvs))
+ $openZgv = true;
+
+ $this->_log($person_id, 'updatezgv', array($zgv[0]->zgvpruefung_id, $status));
+
+ $this->outputJsonSuccess(
+ array
+ (
+ 'msg' => 'Erfolgreich gespeichert',
+ 'person_id' => $personInfos->person_id,
+ 'openZgv' => $openZgv
+ )
+ );
+
+ }
+
+ /**
+ * Fügt einen neuen ZGV Status hinzu oder updated einen bestehenden
+ * Falls es erfolgreich war, sendet er die Mail raus
+ */
+ public function zgvRueckfragen()
+ {
+ $prestudent_id = $this->input->post('prestudent_id');
+ $person_id = $this->input->post('person_id');
+
+ if (isEmptyString($prestudent_id) || isEmptyString($person_id))
+ $this->terminateWithJsonError('Prestudentid OR/AND Personid missing');
+
+ $zgv = $this->ZGVPruefungStatusModel->getZgvStatusByPrestudent($prestudent_id);
+
+ $data = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
+ $mail = $data['studiengang_mail'];
+ $typ = $data['studiengang_typ'];
+
+ if (hasData($zgv))
+ {
+ $zgv = getData($zgv);
+
+ if ($zgv[0]->status === 'pruefung_stg')
+ $this->terminateWithJsonError('Bereits in Prüfung');
+
+ $insert = $this->ZGVPruefungStatusModel->insert(
+ array(
+ 'zgvpruefung_id' => $zgv[0]->zgvpruefung_id,
+ 'status' => 'pruefung_stg'
+ )
+ );
+
+ $this->ZGVPruefungModel->update(
+ $zgv[0]->zgvpruefung_id,
+ array(
+ 'updateamum' => date('Y-m-d H:i:s'),
+ 'updatevon' => $this->_uid
+ )
+ );
+
+ $this->_log($person_id, 'updatezgv', array($zgv[0]->zgvpruefung_id, 'pruefung_stg'));
+
+ if (isSuccess($insert))
+ $this->sendZgvMail($mail, $typ);
+ elseif (isError($insert))
+ $this->terminateWithJsonError('Fehler beim Speichern');
+ }else
+ {
+ $insert = $this->ZGVPruefungModel->insert(
+ array(
+ 'prestudent_id' => $prestudent_id,
+ 'insertamum' => date('Y-m-d H:i:s'),
+ 'insertvon' => $this->_uid
+ )
+ );
+
+ if (isSuccess($insert))
+ {
+ $zgvpruefung_id = $this->ZGVPruefungModel->db->insert_id();
+ $result = $this->ZGVPruefungStatusModel->insert(
+ array(
+ 'zgvpruefung_id' => $zgvpruefung_id,
+ 'status' => 'pruefung_stg'
+ )
+ );
+
+ $this->_log($person_id, 'newzgv', array($zgvpruefung_id));
+
+ if (isSuccess($result))
+ $this->sendZgvMail($mail, $typ);
+ elseif (isError($result))
+ $this->terminateWithJsonError('Fehler beim Speichern');
+ }
+ }
+
+ $hold = false;
+ if ($this->personloglib->getOnHoldDate($person_id) !== null)
+ $hold = true;
+
+ $this->outputJsonSuccess(
+ array
+ (
+ 'msg' => 'Erfolgreich gespeichert',
+ 'person_id' => $data['person_id'],
+ 'hold' => $hold
+ )
+ );
+ }
+
/**
* Saves Absage for Prestudent including the reason for the Absage (statusgrund).
* inserts Studiensemester and Ausbildungssemester for the new Absage of (chronologically) last status.
*/
- public function saveAbsage()
+ public function saveAbsage($prestudent_id = null, $statusgrund = null)
{
$json = null;
- $prestudent_id = $this->input->post('prestudent_id');
- $statusgrund = $this->input->post('statusgrund');
+ if (is_null($prestudent_id))
+ $prestudent_id = $this->input->post('prestudent_id');
+
+ if (is_null($statusgrund))
+ $statusgrund = $this->input->post('statusgrund');
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
@@ -446,8 +734,10 @@ class InfoCenter extends Auth_Controller
if (hasData($lastStatus) && hasData($statusgrresult))
{
- //check if still Interessent and not freigegeben yet
- if ($lastStatus->retval[0]->status_kurzbz === self::INTERESSENTSTATUS && !isset($lastStatus->retval[0]->bestaetigtam))
+ //check if still Interessent
+ if ($lastStatus->retval[0]->status_kurzbz === self::INTERESSENTSTATUS
+ || $lastStatus->retval[0]->status_kurzbz === self::BEWERBERSTATUS
+ || $lastStatus->retval[0]->status_kurzbz === self::WARTENDER)
{
$result = $this->PrestudentstatusModel->insert(
array(
@@ -744,6 +1034,13 @@ class InfoCenter extends Auth_Controller
$this->load->view('system/infocenter/logs.php', array('logs' => $logs));
}
+ public function reloadDoks($person_id)
+ {
+ $dokumente_nachgereicht = $this->AkteModel->getAktenWithDokInfo($person_id, null, true);
+
+ $this->load->view('system/infocenter/dokNachzureichend.php', array('dokumente_nachgereicht' => $dokumente_nachgereicht->retval));
+ }
+
/**
* Outputs content of an Akte, sends appropriate headers (so the document can be downloaded)
* @param $akte_id
@@ -898,6 +1195,117 @@ class InfoCenter extends Auth_Controller
$this->outputJsonSuccess('success');
}
+ public function saveDocTyp($person_id)
+ {
+ $akte_id = $this->input->post('akte_id');
+ $typ = $this->input->post('typ');
+
+ if (!isset($akte_id) || !isset($typ) || !isset($person_id))
+ $this->terminateWithJsonError("Nicht alle sind Parameter übergeben worden");
+
+ $akte = $this->AkteModel->load($akte_id);
+
+ if (!hasData($akte))
+ $this->terminateWithJsonError("Fehler beim Laden der Akte");
+
+ $result = $this->AkteModel->update($akte_id, array('dokument_kurzbz' => $typ));
+
+ if (!isSuccess($result))
+ $this->terminateWithJsonError("Fehler beim Update aufgetreten");
+
+ $dokument = $this->DokumentModel->load($akte->retval[0]->dokument_kurzbz);
+
+ if (!hasData($dokument))
+ $this->terminateWithJsonError("Fehler beim Laden des Dokumententypes");
+
+ $this->_log(
+ $person_id,
+ 'updatedoctyp',
+ array(
+ isEmptyString($akte->retval[0]->titel) ? $akte->retval[0]->bezeichnung : $akte->retval[0]->titel,
+ isEmptyString($dokument->retval[0]->bezeichnung) ? $dokument->retval[0]->dokument_kurbz : $dokument->retval[0]->bezeichnung
+ )
+ );
+
+ $this->outputJsonSuccess('success');
+ }
+
+ public function saveNachreichung($person_id)
+ {
+ $nachreichungAm = $this->input->post('nachreichungAm');
+ $nachreichungAnmerkung = empty($this->input->post('nachreichungAnmerkung')) ? NULL : $this->input->post('nachreichungAnmerkung');
+ $typ = $this->input->post('typ');
+
+ $allowedTypes = [
+ 'VorlSpB2' => 'SprachB2',
+ 'ZgvBaPre' => 'zgv_bakk',
+ 'ZgvMaPre' => 'zgv_mast'
+ ];
+
+ if (!in_array($typ, array_keys($allowedTypes)))
+ $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern'));
+
+ if (empty($nachreichungAm))
+ $this->terminateWithJsonError($this->p->t('infocenter', 'datumUngueltig'));
+
+ if (!preg_match('/^\d{2}\.\d{2}\.(\d{2}|\d{4})$/ ', $nachreichungAm))
+ {
+ $this->terminateWithJsonError($this->p->t('infocenter', 'datumUngueltig'));
+ }
+ else
+ {
+ $ds = explode('.', $nachreichungAm);
+ if (! checkdate($ds[1], $ds[0], $ds[2]))
+ {
+ $this->terminateWithJsonError($this->p->t('infocenter', 'datumUngueltig'));
+ }
+ }
+
+ $nachreichungAm = (date_format(date_create($nachreichungAm), 'Y-m-d'));
+
+ $today = date('Y-m-d H:i:s');
+
+ if($nachreichungAm < $today)
+ $this->terminateWithJsonError($this->p->t('infocenter', 'nachreichDatumNichtVergangenheit'));
+
+
+ $akte = $this->AkteModel->loadWhere(array('person_id' => $person_id, 'dokument_kurzbz' => $allowedTypes[$typ]));
+
+ if (hasData($akte)) {
+ $akte = getData($akte)[0];
+ $this->AkteModel->update(
+ $akte->akte_id,
+ array(
+ 'anmerkung' => $nachreichungAnmerkung,
+ 'updateamum' => $today,
+ 'updatevon' => get_uid(),
+ 'nachgereicht' => true,
+ 'nachgereicht_am' => $nachreichungAm
+ )
+ );
+ }
+ else
+ {
+ $this->AkteModel->insert(
+ array(
+ 'dokument_kurzbz' => $allowedTypes[$typ],
+ 'person_id' => $person_id,
+ 'erstelltam' => NULL,
+ 'gedruckt' => false,
+ 'anmerkung' => $nachreichungAnmerkung,
+ 'updateamum' => $today,
+ 'updatevon' => get_uid(),
+ 'insertamum' => $today,
+ 'insertvon' => get_uid(),
+ 'uid' => NULL,
+ 'nachgereicht' => true,
+ 'nachgereicht_am' => $nachreichungAm
+ )
+ );
+ }
+
+ $this->outputJsonSuccess("Done!");
+ }
// -----------------------------------------------------------------------------------------------------------------
// Private methods
@@ -1058,9 +1466,9 @@ class InfoCenter extends Auth_Controller
/**
* Define the navigation menu for the showDetails page
*/
- private function _setNavigationMenuShowDetails()
+ private function _setNavigationMenuShowDetails($page = self::SHOW_DETAILS_PAGE)
{
- $this->load->library('NavigationLib', array(self::NAVIGATION_PAGE => self::INFOCENTER_URI.'/'.self::SHOW_DETAILS_PAGE));
+ $this->load->library('NavigationLib', array(self::NAVIGATION_PAGE => self::INFOCENTER_URI.'/'.$page));
$origin_page = $this->input->get(self::ORIGIN_PAGE);
@@ -1073,6 +1481,8 @@ class InfoCenter extends Auth_Controller
{
$link = site_url(self::INFOCENTER_URI.'/'.self::REIHUNGSTESTABSOLVIERT_PAGE);
}
+ if ($origin_page === self::ZGV_UBERPRUEFUNG_PAGE)
+ $link = site_url(self::ZGV_UEBERPRUEFUNG_URI);
$prevFilterId = $this->input->get(self::PREV_FILTER_ID);
if (isset($prevFilterId))
@@ -1337,7 +1747,7 @@ class InfoCenter extends Auth_Controller
show_error(getError($prestudentWithZgv));
}
- $zgvpruefung = $prestudentWithZgv->retval[0];
+ $zgvpruefung = getData($prestudentWithZgv);
if (isset($zgvpruefung->prestudentstatus))
{
@@ -1358,15 +1768,21 @@ class InfoCenter extends Auth_Controller
|| isset($zgvpruefung->prestudentstatus->bestaetigtam)
|| $zgvpruefung->prestudentstatus->status_kurzbz != self::INTERESSENTSTATUS;
+ $zgvpruefung->abgewiesener = $zgvpruefung->prestudentstatus->status_kurzbz === self::ABGEWIESENERSTATUS;
+
//wether prestudent was freigegeben for RT/Stg
$zgvpruefung->isRtFreigegeben = false;
$zgvpruefung->isStgFreigegeben = false;
$zgvpruefung->sendStgFreigabeMsg = true;//wether Stgudiengangfreigabemessage can be sent (for "exceptions", Studiengänge with no message sending)
- $this->PrestudentstatusModel->addSelect('bestaetigtam, statusgrund_id, tbl_status_grund.bezeichnung_mehrsprachig AS bezeichnung_statusgrund');
- $this->PrestudentstatusModel->addJoin('public.tbl_status_grund', 'statusgrund_id', 'LEFT');
- $isFreigegeben = $this->PrestudentstatusModel->loadWhere(array('studiensemester_kurzbz' => $zgvpruefung->prestudentstatus->studiensemester_kurzbz,
- 'tbl_prestudentstatus.status_kurzbz' => self::INTERESSENTSTATUS, 'prestudent_id' => $prestudent->prestudent_id));
+ $isFreigegeben = null;
+ if (isset($zgvpruefung->prestudentstatus->studiensemester_kurzbz))
+ {
+ $this->PrestudentstatusModel->addSelect('bestaetigtam, statusgrund_id, tbl_status_grund.bezeichnung_mehrsprachig AS bezeichnung_statusgrund');
+ $this->PrestudentstatusModel->addJoin('public.tbl_status_grund', 'statusgrund_id', 'LEFT');
+ $isFreigegeben = $this->PrestudentstatusModel->loadWhere(array('studiensemester_kurzbz' => $zgvpruefung->prestudentstatus->studiensemester_kurzbz,
+ 'tbl_prestudentstatus.status_kurzbz' => self::INTERESSENTSTATUS, 'prestudent_id' => $prestudent->prestudent_id));
+ }
if (hasData($isFreigegeben))
{
@@ -1374,7 +1790,7 @@ class InfoCenter extends Auth_Controller
{
if (isset($prestudentstatus->bestaetigtam))
{
- //if statusgrund set - RTfreigabe, otherwise Stgfreigabe
+ //if statusgrund set - freigegeben for Studiengang, otherwise freigegeben for RT
if (isset($prestudentstatus->statusgrund_id))
{
if (isset($prestudentstatus->bezeichnung_statusgrund[0])
@@ -1388,20 +1804,46 @@ class InfoCenter extends Auth_Controller
$zgvpruefung->isRtFreigegeben = true;
}
}
- }
+ }
- //application priority change possible?
- $zgvpruefung->changeup = false;
- $zgvpruefung->changedown = false;
+ //application priority change possible?
+ $zgvpruefung->changeup = false;
+ $zgvpruefung->changedown = false;
+ $zgvpruefung->hasBewerber = false;
- if (isset($zgvpruefung->prestudentstatus->status_kurzbz) && $zgvpruefung->prestudentstatus->status_kurzbz == self::INTERESSENTSTATUS)
+ if (isset($zgvpruefung->prestudentstatus->status_kurzbz) && $zgvpruefung->prestudentstatus->status_kurzbz == self::INTERESSENTSTATUS)
+ {
+ if (isset($zgvpruefung->prestudentstatus->studiensemester_kurzbz))
+ {
+ $studiensemester = $zgvpruefung->prestudentstatus->studiensemester_kurzbz;
+ //show warning if there is already another bewerber (RT result already exists)
+ $bewerber = $this->PersonModel->hasBewerber($person_id, $studiensemester, 'b');
+
+ if (hasData($bewerber))
+ {
+ $bewerbercnt = getData($bewerber);
+
+ if (is_numeric($bewerbercnt[0]->anzahl_bewerber) && $bewerbercnt[0]->anzahl_bewerber > 0)
+ {
+ $zgvpruefung->hasBewerber = true;
+ }
+ }
+
+ $zgvpruefung->changeup = $this->PrestudentModel->checkPrioChange($zgvpruefung->prestudent_id, $studiensemester, -1);
+ $zgvpruefung->changedown = $this->PrestudentModel->checkPrioChange($zgvpruefung->prestudent_id, $studiensemester, 1);
+ }
+ }
+ $zgvExist = $this->ZGVPruefungModel->loadWhere(array('prestudent_id' => $zgvpruefung->prestudent_id));
+
+ if (isSuccess($zgvExist) && hasData($zgvExist))
{
- if (isset($zgvpruefung->prestudentstatus->studiensemester_kurzbz))
- {
- $studiensemester = $zgvpruefung->prestudentstatus->studiensemester_kurzbz;
- $zgvpruefung->changeup = $this->PrestudentModel->checkPrioChange($zgvpruefung->prestudent_id, $studiensemester, -1);
- $zgvpruefung->changedown = $this->PrestudentModel->checkPrioChange($zgvpruefung->prestudent_id, $studiensemester, 1);
- }
+ $this->ZGVPruefungStatusModel->addOrder('datum', 'DESC');
+ $this->ZGVPruefungStatusModel->addLimit(1);
+
+ $statusZGV = $this->ZGVPruefungStatusModel->loadWhere(array('zgvpruefung_id' => $zgvExist->retval[0]->zgvpruefung_id));
+
+ if (isSuccess($statusZGV) && hasData($statusZGV))
+ $zgvpruefung->statusZGV = $statusZGV->retval[0]->status;
}
$zgvpruefungen[] = $zgvpruefung;
@@ -1409,8 +1851,8 @@ class InfoCenter extends Auth_Controller
$this->_sortPrestudents($zgvpruefungen);
- $abwstatusgruende = $this->StatusgrundModel->loadWhere(array('status_kurzbz' => self::ABGEWIESENERSTATUS))->retval;
- $intstatusgruende = $this->StatusgrundModel->loadWhere(array('status_kurzbz' => self::INTERESSENTSTATUS))->retval;
+ $abwstatusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
+ $intstatusgruende = $this->StatusgrundModel->getStatus(self::INTERESSENTSTATUS)->retval;
$data = array (
'zgvpruefungen' => $zgvpruefungen,
@@ -1523,11 +1965,14 @@ class InfoCenter extends Auth_Controller
show_error(getError($prestudent));
}
- $person_id = $prestudent->retval[0]->person_id;
- $studiengang_kurzbz = $prestudent->retval[0]->studiengang;
- $studiengang_bezeichnung = $prestudent->retval[0]->studiengangbezeichnung;
+ $prestudentdata = getData($prestudent);
+ $person_id = $prestudentdata->person_id;
+ $studiengang_kurzbz = $prestudentdata->studiengang;
+ $studiengang_bezeichnung = $prestudentdata->studiengangbezeichnung;
+ $studiengang_mail = $prestudentdata->studiengangmail;
+ $studiengang_typ = $prestudentdata->studiengangtyp;
- return array('person_id' => $person_id, 'studiengang_kurzbz' => $studiengang_kurzbz, 'studiengang_bezeichnung' => $studiengang_bezeichnung);
+ return array('person_id' => $person_id, 'studiengang_kurzbz' => $studiengang_kurzbz, 'studiengang_bezeichnung' => $studiengang_bezeichnung, 'studiengang_mail' => $studiengang_mail, 'studiengang_typ' => $studiengang_typ);
}
/**
@@ -1568,7 +2013,8 @@ class InfoCenter extends Auth_Controller
private function _sendFreigabeMail($prestudent_id)
{
//get data
- $prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id)->retval[0];
+ $prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id);
+ $prestudent = getData($prestudent);
$prestudentstatus = $prestudent->prestudentstatus;
$person_id = $prestudent->person_id;
$person = $this->PersonModel->getPersonStammdaten($person_id, true)->retval;
@@ -1667,4 +2113,45 @@ class InfoCenter extends Auth_Controller
$this->loglib->logError('Studiengang has no mail for sending Freigabe mail');
}
}
+
+ public function getAbsageData()
+ {
+ $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
+
+ $statusgruende = $this->StatusgrundModel->getStatus(self::ABGEWIESENERSTATUS, true)->retval;
+ $studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
+ $studiengaenge = $this->StudiengangModel->getStudiengaengeWithOrgForm(['b', 'm'], $studienSemester);
+
+ $data = array (
+ 'statusgruende' => $statusgruende,
+ 'studiengaenge' => $studiengaenge->retval
+ );
+
+ $this->outputJsonSuccess($data);
+ }
+
+ public function saveAbsageForAll()
+ {
+ $statusgrund = $this->input->post('statusgrund');
+ $studiengang = $this->input->post('studiengang');
+ $personen = $this->input->post('personen');
+ $studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
+
+ if ($statusgrund === 'null' || $studiengang === 'null' || empty($personen))
+ $this->terminateWithJsonError("Bitte Statusgrund, Studiengang und Personen auswählen.");
+
+ foreach($personen as $person)
+ {
+ $prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester);
+
+ if(!hasData($prestudent))
+ continue;
+
+ $prestudentData = getData($prestudent);
+
+ $this->saveAbsage($prestudentData[0]->prestudent_id, $statusgrund);
+ }
+
+ $this->outputJsonSuccess("Success");
+ }
}
diff --git a/application/controllers/system/infocenter/ZGVUeberpruefung.php b/application/controllers/system/infocenter/ZGVUeberpruefung.php
new file mode 100644
index 000000000..bb0c36b66
--- /dev/null
+++ b/application/controllers/system/infocenter/ZGVUeberpruefung.php
@@ -0,0 +1,55 @@
+ 'lehre/zgvpruefung:r',
+ 'getZgvStatusByPrestudent' => 'lehre/zgvpruefung:r'
+ )
+ );
+ $this->load->model('crm/ZGVPruefungStatus_model', 'ZGVPruefungStatusModel');
+ $this->load->model('crm/ZGVPruefung_model', 'ZGVPruefungModel');
+
+ $this->load->library('WidgetLib');
+
+ $this->setControllerId();
+ $this->loadPhrases(
+ array(
+ 'infocenter'
+ )
+ );
+ }
+
+ public function index()
+ {
+ $this->load->view('system/infocenter/infocenterZgvUeberpruefung.php');
+ }
+
+ public function getZgvStatusByPrestudent()
+ {
+ $prestudent_id = $this->input->get('prestudent_id');
+
+ $zgvExist = $this->ZGVPruefungModel->loadWhere(array('prestudent_id' => $prestudent_id));
+
+ if (!hasData($zgvExist))
+ $this->terminateWithJsonError('no ZGV exist');
+
+ $status = $this->ZGVPruefungStatusModel->getZgvStatus(getData($zgvExist)[0]->zgvpruefung_id);
+
+ if (!hasData($status))
+ $this->terminateWithJsonError('No status');
+
+ $status = getData($status)[0]->status;
+
+ $this->outputJsonSuccess($status);
+ }
+}
\ No newline at end of file
diff --git a/application/controllers/system/jq/JobsQueueManager.php b/application/controllers/system/jq/JobsQueueManager.php
new file mode 100644
index 000000000..e72607675
--- /dev/null
+++ b/application/controllers/system/jq/JobsQueueManager.php
@@ -0,0 +1,130 @@
+ 'admin:r',
+ 'addNewJobsToQueue' => 'admin:rw',
+ 'updateJobsQueue' => 'admin:rw'
+ )
+ );
+
+ // Loading config file jqm
+ $this->config->load('jqm');
+
+ // Loads JobsQueueLib
+ $this->load->library('JobsQueueLib');
+ // Loads permission lib
+ $this->load->library('PermissionLib');
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ /**
+ * To get all the most recently added jobs using the given job type
+ */
+ public function getLastJobs()
+ {
+ $type = $this->input->get(JobsQueueLib::PROPERTY_TYPE);
+
+ $this->_checkPermissions($type);
+
+ $this->outputJson($this->jobsqueuelib->getLastJobs($type));
+ }
+
+ /**
+ * Add new jobs in the jobs queue with the given type
+ * jobs is an array of job objects
+ */
+ public function addNewJobsToQueue()
+ {
+ $type = $this->input->post(JobsQueueLib::PROPERTY_TYPE);
+ $jobs = $this->input->post(self::PARAM_JOBS);
+
+ $this->_checkPermissions($type);
+
+ // Otherwise convert jobs from json to php and call JobsQueueLib library
+ $this->outputJson($this->jobsqueuelib->addNewJobsToQueue($type, $this->_convertJobs($jobs)));
+ }
+
+ /**
+ * Add new jobs in the jobs queue with the given type
+ * jobs is an array of job objects
+ */
+ public function updateJobsQueue()
+ {
+ $type = $this->input->post(JobsQueueLib::PROPERTY_TYPE);
+ $jobs = $this->input->post(self::PARAM_JOBS);
+
+ $this->_checkPermissions($type);
+
+ // Otherwise convert jobs from json to php and call JobsQueueLib library
+ $this->outputJson($this->jobsqueuelib->updateJobsQueue($type, $this->_convertJobs($jobs)));
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Private methods
+
+ /**
+ *
+ */
+ private function _checkPermissions($type)
+ {
+ // Checks if the caller has the permissions to add new jobs with the given type in the queue
+ if (!$this->permissionlib->isEntitled($this->config->item(self::JOB_TYPE_PERMISSIONS_WHITE_LIST), $type))
+ {
+ // Permissions NOT valid
+ $this->terminateWithJsonError('You are not allowed to access to this content');
+ }
+ }
+
+ /**
+ *
+ */
+ private function _convertJobs($jobs)
+ {
+ if (isEmptyArray($jobs)) return null; // if not a valid array then return null
+
+ $convertedJobsArray = array(); // returned values
+
+ // Loops through all the provided jobs
+ foreach ($jobs as $job)
+ {
+ $tmpObj = json_decode($job); // Try to decode json to php
+
+ // If decode was a success
+ if ($tmpObj != null)
+ {
+ $convertedJobsArray[] = $tmpObj; // then store the decoded object in the result array
+ }
+ else // otherwise
+ {
+ // Create a new object and store the error message in it
+ $tmpObj = new stdClass();
+ $tmpObj->{JobsQueueLib::PROPERTY_ERROR} = 'A not valid json was provided';
+
+ $convertedJobsArray[] = $tmpObj; // store this object into the result array
+ }
+ }
+
+ return $convertedJobsArray;
+ }
+}
diff --git a/application/controllers/system/jq/JobsQueueViewer.php b/application/controllers/system/jq/JobsQueueViewer.php
new file mode 100644
index 000000000..2698d79d1
--- /dev/null
+++ b/application/controllers/system/jq/JobsQueueViewer.php
@@ -0,0 +1,51 @@
+ 'system/developer:r'
+ )
+ );
+
+ // Loads WidgetLib
+ $this->load->library('WidgetLib');
+
+ // Loads JobsQueueLib
+ $this->load->library('JobsQueueLib');
+
+ // Loads phrases system
+ $this->loadPhrases(
+ array(
+ 'global',
+ 'ui',
+ 'filter'
+ )
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ /**
+ * Everything has a beginning
+ */
+ public function index()
+ {
+ $this->load->view('system/jq/jobsQueueViewer.php');
+ }
+}
diff --git a/application/controllers/system/messages/MessageClient.php b/application/controllers/system/messages/MessageClient.php
index a0cc5c518..5adb49296 100644
--- a/application/controllers/system/messages/MessageClient.php
+++ b/application/controllers/system/messages/MessageClient.php
@@ -34,7 +34,7 @@ class MessageClient extends FHC_Controller
public function read()
{
// Loads the view to read messages
- $this->load->view('system/messages/ajaxRead');
+ $this->load->view('system/messages/ajaxRead', $this->CLMessagesModel->prepareAjaxRead());
}
/**
diff --git a/application/controllers/system/messages/Messages.php b/application/controllers/system/messages/Messages.php
index 7b48b1fcf..296022ca4 100644
--- a/application/controllers/system/messages/Messages.php
+++ b/application/controllers/system/messages/Messages.php
@@ -92,9 +92,9 @@ class Messages extends Auth_Controller
*/
public function parseMessageText()
{
- $receiver_id = $this->input->get('receiver_id');
- $text = $this->input->get('text');
- $type = $this->input->get('type');
+ $receiver_id = $this->input->post('receiver_id');
+ $text = $this->input->post('text');
+ $type = $this->input->post('type');
if ($type == Messages_model::TYPE_PERSONS)
{
diff --git a/application/controllers/widgets/Filters.php b/application/controllers/widgets/Filters.php
index b5cbc07ea..748272f09 100644
--- a/application/controllers/widgets/Filters.php
+++ b/application/controllers/widgets/Filters.php
@@ -4,7 +4,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* This controller operates between (interface) the JS (GUI) and the FilterWidgetLib (back-end)
- * Provides data to the ajax get calls about the filter
+ * Provides data to the ajax get calls about the filter widget
* Accepts ajax post calls to change the filter data
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
* NOTE: extends the FHC_Controller instead of the Auth_Controller because the FilterWidget has its
@@ -12,7 +12,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
*/
class Filters extends FHC_Controller
{
- const FILTER_UNIQUE_ID = 'filterUniqueId';
+ const FILTER_UNIQUE_ID = 'filterUniqueId'; // Name of the filter widget unique id
/**
* Calls the parent's constructor and loads the FilterWidgetLib
diff --git a/application/controllers/widgets/Tables.php b/application/controllers/widgets/Tables.php
index 21161ff9f..b3ea7d5a5 100644
--- a/application/controllers/widgets/Tables.php
+++ b/application/controllers/widgets/Tables.php
@@ -4,7 +4,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* This controller operates between (interface) the JS (GUI) and the tablewidgetlib (back-end)
- * Provides data to the ajax get calls about the filter
+ * Provides data to the ajax get calls about the table widget
* Accepts ajax post calls to change the filter data
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
* NOTE: extends the FHC_Controller instead of the Auth_Controller because the TableWidget has its
@@ -12,7 +12,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
*/
class Tables extends FHC_Controller
{
- const TABLE_UNIQUE_ID = 'tableUniqueId';
+ const TABLE_UNIQUE_ID = 'tableUniqueId'; // Name of the table widget unique id
/**
* Calls the parent's constructor and loads the tablewidgetlib
diff --git a/application/controllers/widgets/UDF.php b/application/controllers/widgets/UDF.php
new file mode 100644
index 000000000..5b4c45776
--- /dev/null
+++ b/application/controllers/widgets/UDF.php
@@ -0,0 +1,107 @@
+load->library('AuthLib');
+
+ // Loads the UDFLib with HTTP GET/POST parameters
+ $this->_loadUDFLib();
+
+ // Checks if the caller is allow to use this UDF widget
+ $this->_isAllowed();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ /**
+ * Save data about the current UDFs and the result will be written on the output in JSON format
+ */
+ public function saveUDFs()
+ {
+ $udfUniqueId = $this->input->post(self::UDF_UNIQUE_ID);
+ $udfs = $this->input->post(UDFLib::UDFS_ARG_NAME);
+
+ if (!isEmptyString($udfs))
+ {
+ $jsonDecodedUDF = json_decode($udfs);
+ if ($jsonDecodedUDF != null)
+ {
+ $this->outputJson($this->udflib->saveUDFs($udfUniqueId, $jsonDecodedUDF));
+ }
+ else
+ {
+ $this->outputJsonError('No valid JSON format for UDF values');
+ }
+ }
+ else
+ {
+ $this->outputJsonError('UDFUniqueId, schema, table name, primary key name and primary key value are mandatory paramenters');
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Private methods
+
+ /**
+ * Checks if the user is allowed to use this UDFWidget
+ */
+ private function _isAllowed()
+ {
+ if (!$this->udflib->isAllowed())
+ {
+ $this->terminateWithJsonError('You are not allowed to access to this content');
+ }
+ }
+
+ /**
+ * Loads the UDFLib with the UDF_UNIQUE_ID parameter
+ * If the parameter UDF_UNIQUE_ID is not given then the execution of the controller is terminated and
+ * an error message is printed
+ */
+ private function _loadUDFLib()
+ {
+ // If the parameter UDF_UNIQUE_ID is present in the HTTP GET or POST
+ if (isset($_GET[self::UDF_UNIQUE_ID]) || isset($_POST[self::UDF_UNIQUE_ID]))
+ {
+ // If it is present in the HTTP GET
+ if (isset($_GET[self::UDF_UNIQUE_ID]))
+ {
+ $udfUniqueId = $this->input->get(self::UDF_UNIQUE_ID); // is retrieved from the HTTP GET
+ }
+ elseif (isset($_POST[self::UDF_UNIQUE_ID])) // Else if it is present in the HTTP POST
+ {
+ $udfUniqueId = $this->input->post(self::UDF_UNIQUE_ID); // is retrieved from the HTTP POST
+ }
+
+ // Loads the UDFLib that contains all the used logic
+ $this->load->library('UDFLib');
+
+ $this->udflib->setUDFUniqueId($udfUniqueId);
+ }
+ else // Otherwise an error will be written in the output
+ {
+ $this->terminateWithJsonError('Parameter "'.self::UDF_UNIQUE_ID.'" not provided!');
+ }
+ }
+}
diff --git a/application/core/CLI_Controller.php b/application/core/CLI_Controller.php
index 79e2a1283..7e1e2a1ab 100644
--- a/application/core/CLI_Controller.php
+++ b/application/core/CLI_Controller.php
@@ -3,7 +3,8 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
- *
+ * This is the super class for all those controllers that can only be called from command line
+ * It provides also an helper to display the possible calls
*/
abstract class CLI_Controller extends FHC_Controller
{
@@ -15,9 +16,9 @@ abstract class CLI_Controller extends FHC_Controller
/**
* Constructor
*/
- public function __construct()
+ public function __construct()
{
- parent::__construct();
+ parent::__construct();
// Checks if the controller is called from command line
$this->_isAllowed();
@@ -103,3 +104,4 @@ abstract class CLI_Controller extends FHC_Controller
}
}
}
+
diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php
index ca760c662..4b89ae5bf 100644
--- a/application/core/DB_Model.php
+++ b/application/core/DB_Model.php
@@ -60,6 +60,20 @@ class DB_Model extends CI_Model
// ------------------------------------------------------------------------------------------
// Public methods
+ /**
+ * This method provides a way to setup a database model without declaring one that extends this class
+ */
+ public function setup($schema, $table, $primaryKey, $hasSequence = true)
+ {
+ //
+ if (!isEmptyString($schema) && !isEmptyString($table) && !isEmptyString($primaryKey) && is_bool($hasSequence))
+ {
+ $this->dbTable = $schema.'.'.$table;
+ $this->pk = $primaryKey;
+ $this->hasSequence = $hasSequence;
+ }
+ }
+
/**
* Insert Data into DB-Table
*
@@ -690,7 +704,7 @@ class DB_Model extends CI_Model
*/
public function hasUDF()
{
- if($this->fieldExists(UDFLib::COLUMN_NAME))
+ if ($this->fieldExists(UDFLib::COLUMN_NAME))
{
$resultUDFsDefinitions = $this->UDFModel->getUDFsDefinitions($this->dbTable);
if (hasData($resultUDFsDefinitions))
@@ -727,8 +741,8 @@ class DB_Model extends CI_Model
$cleanedQuery = trim(preg_replace('/\t|\n|\r|;/', '', $query)); //
//
- if (stripos($cleanedQuery, 'SELECT') == 0
- && (stripos($cleanedQuery, 'INSERT') > 0 || stripos($cleanedQuery, 'INSERT') == false)
+ if (
+ (stripos($cleanedQuery, 'INSERT') > 0 || stripos($cleanedQuery, 'INSERT') == false)
&& (stripos($cleanedQuery, 'UPDATE') > 0 || stripos($cleanedQuery, 'UPDATE') == false)
&& (stripos($cleanedQuery, 'CREATE') > 0 || stripos($cleanedQuery, 'CREATE') == false)
&& (stripos($cleanedQuery, 'DELETE') > 0 || stripos($cleanedQuery, 'DELETE') == false)
diff --git a/application/core/JOB_Controller.php b/application/core/JOB_Controller.php
index ea779b169..8b32ba0f5 100644
--- a/application/core/JOB_Controller.php
+++ b/application/core/JOB_Controller.php
@@ -3,26 +3,36 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
- *
+ * This is the super class for a job.
+ * All the controllers that extends this class can only be called from command line.
+ * Provides utility methods to log into database
*/
abstract class JOB_Controller extends CLI_Controller
{
/**
* Constructor
*/
- public function __construct()
+ public function __construct()
{
- parent::__construct();
+ parent::__construct();
// Loads LogLib with different debug trace levels to get data of the job that extends this class
// It also specify parameters to set database fields
- $this->load->library('LogLib', array(
- 'classIndex' => 5,
- 'functionIndex' => 5,
- 'lineIndex' => 4,
- 'dbLogType' => 'job', // required
- 'dbExecuteUser' => 'Cronjob system'
- ));
+ $this->load->library(
+ 'LogLib',
+ array(
+ 'classIndex' => 5,
+ 'functionIndex' => 5,
+ 'lineIndex' => 4,
+ 'dbLogType' => 'job', // required
+ 'dbExecuteUser' => 'Cronjob system',
+ 'requestId' => 'JOB',
+ 'requestDataFormatter' => function($data) {
+ return json_encode($data);
+ }
+ ),
+ 'LogLibJob' // library alias case sensitive
+ );
}
//------------------------------------------------------------------------------------------------------------------
@@ -33,7 +43,7 @@ abstract class JOB_Controller extends CLI_Controller
*/
protected function logInfo($response, $parameters = null)
{
- $this->_log(LogLib::INFO, 'Cronjob info', $response, $parameters);
+ $this->_log(LogLib::INFO, $response, $parameters);
}
/**
@@ -41,7 +51,7 @@ abstract class JOB_Controller extends CLI_Controller
*/
protected function logDebug($response, $parameters = null)
{
- $this->_log(LogLib::DEBUG, 'Cronjob debug', $response, $parameters);
+ $this->_log(LogLib::DEBUG, $response, $parameters);
}
/**
@@ -49,7 +59,7 @@ abstract class JOB_Controller extends CLI_Controller
*/
protected function logWarning($response, $parameters = null)
{
- $this->_log(LogLib::WARNING, 'Cronjob warning', $response, $parameters);
+ $this->_log(LogLib::WARNING, $response, $parameters);
}
/**
@@ -57,7 +67,7 @@ abstract class JOB_Controller extends CLI_Controller
*/
protected function logError($response, $parameters = null)
{
- $this->_log(LogLib::ERROR, 'Cronjob error', $response, $parameters);
+ $this->_log(LogLib::ERROR, $response, $parameters);
}
//------------------------------------------------------------------------------------------------------------------
@@ -66,7 +76,7 @@ abstract class JOB_Controller extends CLI_Controller
/**
* Writes a log to database
*/
- private function _log($level, $requestId, $response, $parameters)
+ private function _log($level, $response, $parameters)
{
$data = new stdClass();
@@ -76,17 +86,18 @@ abstract class JOB_Controller extends CLI_Controller
switch($level)
{
case LogLib::INFO:
- $this->loglib->logInfoDB($requestId, json_encode(success($data, LogLib::INFO)));
+ $this->LogLibJob->logInfoDB($data);
break;
case LogLib::DEBUG:
- $this->loglib->logDebugDB($requestId, json_encode(success($data, LogLib::DEBUG)));
+ $this->LogLibJob->logDebugDB($data);
break;
case LogLib::WARNING:
- $this->loglib->logWarningDB($requestId, json_encode(error($data, LogLib::WARNING)));
+ $this->LogLibJob->logWarningDB($data);
break;
case LogLib::ERROR:
- $this->loglib->logErrorDB($requestId, json_encode(error($data, LogLib::ERROR)));
+ $this->LogLibJob->logErrorDB($data);
break;
}
}
}
+
diff --git a/application/core/JQW_Controller.php b/application/core/JQW_Controller.php
new file mode 100644
index 000000000..1b78a2a70
--- /dev/null
+++ b/application/core/JQW_Controller.php
@@ -0,0 +1,142 @@
+LogLibJob->setConfigs(
+ array(
+ 'dbExecuteUser' => 'Jobs queue system',
+ 'requestId' => 'JQW'
+ )
+ );
+
+ // Loads JobsQueueLib library
+ $this->load->library('JobsQueueLib');
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Protected methods
+
+ /**
+ * To get all the most recently added jobs using the given job type
+ */
+ protected function getLastJobs($type)
+ {
+ $jobs = $this->jobsqueuelib->getLastJobs($type);
+
+ // If an error occurred then log it in database
+ if (isError($jobs)) $this->logError(getError($jobs), $type);
+
+ return $jobs;
+ }
+
+ /**
+ * To get the oldest added job using the given job type
+ */
+ protected function getOldestJob($type)
+ {
+ $jobs = $this->jobsqueuelib->getOldestJob($type);
+
+ // If an error occurred then log it in database
+ if (isError($jobs)) $this->logError(getError($jobs), $type);
+
+ return $jobs;
+ }
+
+ /**
+ * To get all the jobs specified by the given parameters
+ */
+ protected function getJobsByTypeStatusInput($type, $status, $input)
+ {
+ $jobs = $this->jobsqueuelib->getJobsByTypeStatusInput($type, $status, $input);
+
+ // If an error occurred then log it in database
+ if (isError($jobs)) $this->logError(getError($jobs), array($type, $status, $input));
+
+ return $jobs;
+ }
+
+ /**
+ * Add new jobs in the jobs queue with the given type
+ * jobs is an array of job objects
+ */
+ protected function addNewJobsToQueue($type, $jobs)
+ {
+ $result = $this->jobsqueuelib->addNewJobsToQueue($type, $jobs);
+
+ // If an error occurred then log it in database
+ if (isError($result)) $this->logError(getError($result), $type);
+
+ return $result;
+ }
+
+ /**
+ * Updates jobs already present in the jobs queue
+ * jobs is an array of job objects
+ */
+ protected function updateJobsQueue($type, $jobs)
+ {
+ $result = $this->jobsqueuelib->updateJobsQueue($type, $jobs);
+
+ // If an error occurred then log it in database
+ if (isError($result)) $this->logError(getError($result), $type);
+
+ return $result;
+ }
+
+ /**
+ * Utility method to update the specified properties of the given jobs with the given values
+ */
+ protected function updateJobs($jobs, $properties, $values)
+ {
+ // If not valid arrays of properties and values arrays are not of the same size then exit
+ if (isEmptyArray($jobs) || isEmptyArray($properties) || isEmptyArray($values)) return;
+ if (count($properties) != count($values)) return;
+
+ // For each job
+ foreach ($jobs as $job)
+ {
+ // For each propery of the job
+ for ($pI = 0; $pI < count($properties); $pI++)
+ {
+ // If this property is present in the job object
+ if (property_exists($job, $properties[$pI]))
+ {
+ $job->{$properties[$pI]} = $values[$pI]; // set a new value
+ }
+ }
+ }
+ }
+
+ /**
+ * Utility method to generate a job with the given parameters and return it inside an array
+ * ready to be used by addNewJobsToQueue and updateJobsQueue
+ */
+ protected function generateJobs($status, $input)
+ {
+ $job = new stdClass();
+
+ $job->{JobsQueueLib::PROPERTY_STATUS} = $status;
+ $job->{JobsQueueLib::PROPERTY_INPUT} = $input;
+
+ return array($job);
+ }
+}
+
diff --git a/application/helpers/hlp_common_helper.php b/application/helpers/hlp_common_helper.php
index 6a2675a04..a7eda8827 100644
--- a/application/helpers/hlp_common_helper.php
+++ b/application/helpers/hlp_common_helper.php
@@ -301,3 +301,45 @@ function isLogged()
return isset($ci->authlib) && $ci->authlib->getAuthObj() != null;
}
+
+/**
+ * Konvertiert Problematische Sonderzeichen in Strings fuer
+ * Accountnamen und EMail-Aliase
+ *
+ * @param $str
+ * @return bereinigter String
+ */
+function sanitizeProblemChars($str)
+{
+ $enc = 'UTF-8';
+
+ $acentos = array(
+ 'A' => '/À|Á|Â|Ã|Å/',
+ 'Ae' => '/Ä/',
+ 'a' => '/à|á|â|ã|å/',
+ 'ae'=> '/ä/',
+ 'C' => '/Ç/',
+ 'c' => '/ç/',
+ 'E' => '/È|É|Ê|Ë/',
+ 'e' => '/è|é|ê|ë/',
+ 'I' => '/Ì|Í|Î|Ï/',
+ 'i' => '/ì|í|î|ï/',
+ 'N' => '/Ñ/',
+ 'n' => '/ñ/',
+ 'O' => '/Ò|Ó|Ô|Õ/',
+ 'Oe' => '/Ö/',
+ 'o' => '/ò|ó|ô|õ/',
+ 'oe' => '/ö/',
+ 'U' => '/Ù|Ú|Û/',
+ 'Ue' => '/Ü/',
+ 'u' => '/ù|ú|û/',
+ 'ue' => '/ü/',
+ 'Y' => '/Ý/',
+ 'y' => '/ý|ÿ/',
+ 'a.' => '/ª/',
+ 'o.' => '/º/',
+ 'ss' => '/ß/'
+ );
+
+ return preg_replace($acentos, array_keys($acentos), htmlentities($str,ENT_NOQUOTES, $enc));
+}
diff --git a/application/helpers/hlp_header_helper.php b/application/helpers/hlp_header_helper.php
index 1a0d9dc49..f8bbb9ad2 100644
--- a/application/helpers/hlp_header_helper.php
+++ b/application/helpers/hlp_header_helper.php
@@ -69,6 +69,8 @@ function generateCSSsInclude($CSSs)
*/
function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod)
{
+ $user_language = getUserLanguage();
+
$toPrint = "\n";
$toPrint .= '
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+