mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-26 09:04:28 +00:00
Merge branch 'master' into feature-6189/SAP_basic_structure_for_data_synchronization
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* FH-Complete
|
||||
*
|
||||
* @package FHC-API
|
||||
* @author FHC-Team
|
||||
* @copyright Copyright (c) 2021, fhcomplete.org
|
||||
* @license GPLv3
|
||||
* @link http://fhcomplete.org
|
||||
* @since Version 1.0
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class AnrechnungJob extends JOB_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->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));
|
||||
}
|
||||
}
|
||||
@@ -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 .= '
|
||||
<br>
|
||||
@@ -446,7 +439,7 @@ class LehrauftragJob extends JOB_Controller
|
||||
</thead>
|
||||
<tbody>'
|
||||
;
|
||||
|
||||
|
||||
// HTML table body
|
||||
foreach ($studiensemester_container as $oe_container)
|
||||
{
|
||||
@@ -456,7 +449,7 @@ class LehrauftragJob extends JOB_Controller
|
||||
{
|
||||
$oe_bezeichnung = $oe_container['oe_bezeichnung'];
|
||||
}
|
||||
|
||||
|
||||
foreach ($oe_container as $stg_data)
|
||||
{
|
||||
if (is_array($stg_data)) // is_array 'trims' the outer associative keys [oe_kurzbz] and [oe_bezeichnung]
|
||||
@@ -473,7 +466,7 @@ class LehrauftragJob extends JOB_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// HTML table body end and link
|
||||
$html .= '
|
||||
</tbody>
|
||||
@@ -484,10 +477,10 @@ class LehrauftragJob extends JOB_Controller
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send Sancho eMail about ordered Lehrauftraege.
|
||||
* @param $data_arr
|
||||
@@ -499,24 +492,24 @@ class LehrauftragJob extends JOB_Controller
|
||||
{
|
||||
// Set mail recipient (lector)
|
||||
$to = $data['uid']. '@'. DOMAIN;
|
||||
|
||||
|
||||
// Link to LehrauftragAkzeptieren
|
||||
$url = CIS_ROOT. 'cis/index.php?menu='.
|
||||
CIS_ROOT. 'cis/menu.php?content_id=&content='.
|
||||
CIS_ROOT. index_page(). self::LEHRAUFTRAG_AKZEPTIEREN_URI;
|
||||
|
||||
|
||||
// Get first name
|
||||
$first_name = '';
|
||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
$this->BenutzerModel->addSelect('vorname');
|
||||
$this->BenutzerModel->addJoin('public.tbl_person', 'person_id');
|
||||
$result = $this->BenutzerModel->loadWhere(array('uid' => $data['uid']));
|
||||
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
$first_name = $result->retval[0]->vorname;
|
||||
}
|
||||
|
||||
|
||||
// Prepare mail content
|
||||
$content_data_arr = array(
|
||||
'vorname' => $first_name,
|
||||
@@ -524,7 +517,7 @@ class LehrauftragJob extends JOB_Controller
|
||||
'anzahl' => $data['amount'],
|
||||
'link' => anchor($url, 'Lehraufträge Übersicht')
|
||||
);
|
||||
|
||||
|
||||
sendSanchoMail(
|
||||
'LehrauftragNeueErteilte',
|
||||
$content_data_arr,
|
||||
@@ -532,5 +525,6 @@ class LehrauftragJob extends JOB_Controller
|
||||
'Neu erteilte Lehraufträge zum Annehmen bereit'
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
/**
|
||||
* This job takes care of sending messages to a pool of users,
|
||||
* should not be a scheduled job, or maybe just for a short time,
|
||||
* but it is called manually every time it is needed.
|
||||
* Each method takes care to send a different message to a different pool of users,
|
||||
* so they are very specialize, diffucult to be reused.
|
||||
*/
|
||||
class OneTimeMessages extends JOB_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads CLMessagesModel
|
||||
$this->load->model('CL/Messages_model', 'CLMessagesModel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the same message to all the applicants whith:
|
||||
* - Status set as "Wartender"
|
||||
* - The given study course type (b = bachelor, m = master)
|
||||
* - The given semester (ex WS2020)
|
||||
* - How long since applicant (days)
|
||||
* - The given template id to be used as message subject and body (vorlage_kurzbz)
|
||||
* The sender of all the messages is specified by the parameter senderId (sender person_id)
|
||||
*/
|
||||
public function sendMessageToApplicantsStillWaiting($senderId, $studyCourseType, $semester, $days, $messageTemplate)
|
||||
{
|
||||
$this->logInfo('Send message to applicants still waiting start');
|
||||
|
||||
$queryParams = array(
|
||||
$semester,
|
||||
$studyCourseType,
|
||||
$semester,
|
||||
$studyCourseType,
|
||||
$semester,
|
||||
$studyCourseType
|
||||
);
|
||||
|
||||
$dbModel = new DB_Model();
|
||||
|
||||
$dbPrestudents = $dbModel->execReadOnlyQuery(
|
||||
'SELECT distinct on(person_id) p.prestudent_id
|
||||
FROM public.tbl_prestudent p
|
||||
JOIN public.tbl_prestudentstatus ps USING (prestudent_id)
|
||||
JOIN public.tbl_studiengang s USING (studiengang_kz)
|
||||
WHERE ps.status_kurzbz = \'Wartender\'
|
||||
AND ps.studiensemester_kurzbz = ?
|
||||
AND ps.datum <= NOW() - \''.$days.' days\'::interval
|
||||
AND s.typ = ?
|
||||
AND NOT EXISTS (
|
||||
SELECT pp.person_id
|
||||
FROM public.tbl_prestudent pp
|
||||
JOIN public.tbl_prestudentstatus pss USING (prestudent_id)
|
||||
JOIN public.tbl_studiengang ss USING (studiengang_kz)
|
||||
WHERE pss.status_kurzbz = \'Aufgenommener\'
|
||||
AND pss.studiensemester_kurzbz = ?
|
||||
AND ss.typ = ?
|
||||
AND pp.person_id = p.person_id
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT pp.person_id
|
||||
FROM public.tbl_prestudent pp
|
||||
JOIN public.tbl_prestudentstatus pss USING (prestudent_id)
|
||||
JOIN public.tbl_studiengang ss USING (studiengang_kz)
|
||||
WHERE pss.status_kurzbz = \'Student\'
|
||||
AND pss.studiensemester_kurzbz = ?
|
||||
AND ss.typ = ?
|
||||
AND pp.person_id = p.person_id
|
||||
)',
|
||||
$queryParams
|
||||
);
|
||||
|
||||
if (isError($dbPrestudents))
|
||||
{
|
||||
$this->logError(getError($dbPrestudents), $queryParams);
|
||||
}
|
||||
elseif (!hasData($dbPrestudents))
|
||||
{
|
||||
$this->logInfo('There were no users to send message');
|
||||
}
|
||||
else
|
||||
{
|
||||
$prestudentIdsArray = array();
|
||||
|
||||
foreach (getData($dbPrestudents) as $dbPrestudent)
|
||||
{
|
||||
$prestudentIdsArray[] = $dbPrestudent->prestudent_id;
|
||||
}
|
||||
|
||||
$sendMessage = $this->CLMessagesModel->sendExplicitTemplateSenderId(
|
||||
$senderId, // sender person id
|
||||
$prestudentIdsArray, // prestudents id
|
||||
null, // organization unit
|
||||
$messageTemplate, // template id
|
||||
null // extra variables
|
||||
);
|
||||
|
||||
if (isError($sendMessage))
|
||||
{
|
||||
$this->logError(
|
||||
getError($sendMessage),
|
||||
array(
|
||||
'prestudents' => $prestudentIdsArray,
|
||||
'template' => $messageTemplate
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->logInfo('Total amount of prestudents: '.count($prestudentIdsArray));
|
||||
}
|
||||
|
||||
$this->logInfo('Send message to applicants still waiting end');
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ReihungstestJob extends CLI_Controller
|
||||
class ReihungstestJob extends JOB_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
@@ -17,6 +17,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
$this->load->model('organisation/Studienplan_model', 'StudienplanModel');
|
||||
$this->load->model('crm/buchungstyp_model', 'BuchungstypModel');
|
||||
|
||||
// Load helpers
|
||||
$this->load->helper('hlp_sancho_helper');
|
||||
@@ -799,24 +800,39 @@ class ReihungstestJob extends CLI_Controller
|
||||
* @param string $bcc. Optional. BCC-Mailadress to send the Mails to
|
||||
* @param string $from. Optional. Sender-Mailadress shown to recipient
|
||||
*/
|
||||
public function prioritizationJob($bcc = null, $from = null)
|
||||
public function prioritizationJob($studiensemester, $bcc = null, $from = null)
|
||||
{
|
||||
$qry = " SELECT DISTINCT
|
||||
get_rolle_prestudent (tbl_prestudent.prestudent_id, 'WS2020') AS laststatus, /* Todo: Studiensemester dynamisch ermitteln oder als Parameter */
|
||||
tbl_prestudentstatus.studiensemester_kurzbz,
|
||||
tbl_prestudent.*
|
||||
if (!isset($studiensemester) || isEmptyString($studiensemester))
|
||||
{
|
||||
$this->logError("Studiensemster not passed as parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
$qry = "WITH prst AS (
|
||||
SELECT DISTINCT
|
||||
get_rolle_prestudent (tbl_prestudent.prestudent_id, ?) AS laststatus,
|
||||
tbl_prestudentstatus.studiensemester_kurzbz,
|
||||
tbl_prestudentstatus.datum AS prestudenstatus_datum,
|
||||
tbl_prestudent.*,
|
||||
tbl_studiengang.typ AS studiengang_typ
|
||||
FROM PUBLIC.tbl_person
|
||||
JOIN PUBLIC.tbl_prestudent USING (person_id)
|
||||
JOIN PUBLIC.tbl_prestudentstatus USING (prestudent_id)
|
||||
JOIN lehre.tbl_studienplan USING (studienplan_id)
|
||||
JOIN lehre.tbl_studienordnung USING (studienordnung_id)
|
||||
JOIN PUBLIC.tbl_studiengang ON (tbl_studienordnung.studiengang_kz = tbl_studiengang.studiengang_kz)
|
||||
WHERE tbl_prestudentstatus.datum >= (SELECT CURRENT_DATE -1)
|
||||
AND get_rolle_prestudent (tbl_prestudent.prestudent_id, 'WS2020') IN ('Aufgenommener','Bewerber','Wartender')
|
||||
AND studiensemester_kurzbz = 'WS2020' /* Todo: Studiensemester dynamisch ermitteln oder als Parameter */
|
||||
AND tbl_studiengang.typ = 'b'
|
||||
ORDER BY studiengang_kz, laststatus
|
||||
";
|
||||
JOIN PUBLIC.tbl_prestudent USING (person_id)
|
||||
JOIN PUBLIC.tbl_prestudentstatus USING (prestudent_id)
|
||||
JOIN lehre.tbl_studienplan USING (studienplan_id)
|
||||
JOIN lehre.tbl_studienordnung USING (studienordnung_id)
|
||||
JOIN PUBLIC.tbl_studiengang ON (tbl_studienordnung.studiengang_kz = tbl_studiengang.studiengang_kz)
|
||||
WHERE get_rolle_prestudent (tbl_prestudent.prestudent_id, ?) IN ('Aufgenommener','Bewerber','Wartender','Abgewiesener')
|
||||
AND studiensemester_kurzbz = ?
|
||||
AND tbl_studiengang.typ IN ('b', 'm')
|
||||
)
|
||||
SELECT * FROM prst
|
||||
WHERE prestudenstatus_datum >= (SELECT CURRENT_DATE - 1)
|
||||
AND (studiengang_typ = 'b' OR (studiengang_typ = 'm' AND EXISTS (SELECT 1 /* Master Studiengänge berücksichtigen wenn auch Bachelor im gleichen Semester */
|
||||
FROM prst prstb
|
||||
WHERE studiengang_typ = 'b'
|
||||
AND laststatus != 'Abgewiesener'
|
||||
AND prstb.person_id = prst.person_id )))
|
||||
ORDER BY studiengang_kz, laststatus";
|
||||
|
||||
// Encode Params
|
||||
if ($bcc != '')
|
||||
@@ -837,26 +853,22 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
|
||||
$db = new DB_Model();
|
||||
$result_prestudents = $db->execReadOnlyQuery($qry);
|
||||
$result_prestudents = $db->execReadOnlyQuery($qry, array_pad(array(), 3, $studiensemester));
|
||||
$mailArray = array();
|
||||
|
||||
if (hasdata($result_prestudents))
|
||||
{
|
||||
foreach ($result_prestudents->retval as $row_ps)
|
||||
{
|
||||
// Wenn der letzte Status "Aufgenommener" ist, alle niedrigeren Prios auf "Abgewiesen" setzen
|
||||
// falls diese Bewerber oder Warteliste sind
|
||||
// Danach Kaution einbuchen
|
||||
if ($row_ps->laststatus == 'Aufgenommener')
|
||||
{
|
||||
// Alle niedrigeren Prios laden
|
||||
$qryNiedrPrios = "
|
||||
// Alle niedrigeren Prios laden
|
||||
$qryNiedrPrios = "
|
||||
SELECT DISTINCT
|
||||
get_rolle_prestudent (tbl_prestudent.prestudent_id, '".$row_ps->studiensemester_kurzbz."') AS laststatus,
|
||||
tbl_studienplan.orgform_kurzbz,
|
||||
tbl_person.nachname,
|
||||
tbl_person.vorname,
|
||||
tbl_prestudent.*
|
||||
tbl_prestudent.*,
|
||||
tbl_studiengang.typ AS studiengang_typ
|
||||
FROM PUBLIC.tbl_person
|
||||
JOIN PUBLIC.tbl_prestudent USING (person_id)
|
||||
JOIN PUBLIC.tbl_prestudentstatus USING (prestudent_id)
|
||||
@@ -866,18 +878,30 @@ class ReihungstestJob extends CLI_Controller
|
||||
AND tbl_prestudent.prestudent_id != ".$row_ps->prestudent_id."
|
||||
AND get_rolle_prestudent (tbl_prestudent.prestudent_id, '".$row_ps->studiensemester_kurzbz."') IN ('Aufgenommener','Bewerber','Wartender')
|
||||
AND studiensemester_kurzbz = '".$row_ps->studiensemester_kurzbz."'
|
||||
AND tbl_studiengang.typ = 'b'
|
||||
AND tbl_studiengang.typ IN ('b', 'm')
|
||||
AND priorisierung > ".$row_ps->priorisierung."
|
||||
ORDER BY studiengang_kz, laststatus
|
||||
";
|
||||
|
||||
// Wenn der letzte Status "Aufgenommener" ist, alle niedrigeren Prios auf "Abgewiesen" setzen
|
||||
// falls diese Bewerber oder Warteliste sind
|
||||
// Danach Kaution einbuchen
|
||||
if ($row_ps->laststatus == 'Aufgenommener')
|
||||
{
|
||||
$resultNiedrPrios = $db->execReadOnlyQuery($qryNiedrPrios);
|
||||
|
||||
if (hasdata($resultNiedrPrios))
|
||||
{
|
||||
foreach ($resultNiedrPrios->retval as $rowNiedrPrios)
|
||||
{
|
||||
if ($rowNiedrPrios->laststatus == 'Bewerber')
|
||||
// nur Info wenn aufgenommen oder master
|
||||
if ($rowNiedrPrios->laststatus == 'Aufgenommener' || $rowNiedrPrios->studiengang_typ == 'm')
|
||||
{
|
||||
// Mail zur Info an Assistenz schicken, dass in höherer Prio aufgenommen wurde
|
||||
$mailArray[$rowNiedrPrios->studiengang_kz][$rowNiedrPrios->orgform_kurzbz]['AufnahmeHoeherePrio'][]
|
||||
= $rowNiedrPrios->nachname.' '.$rowNiedrPrios->vorname.' ('.$rowNiedrPrios->prestudent_id.')';
|
||||
}
|
||||
elseif ($rowNiedrPrios->laststatus == 'Bewerber')
|
||||
{
|
||||
// Abgewiesenen-Status mit Statusgrund "Aufnahme anderer Studiengang" (ID 5) setzen
|
||||
$lastStatus = $this->PrestudentstatusModel->getLastStatus($rowNiedrPrios->prestudent_id);
|
||||
@@ -929,43 +953,63 @@ class ReihungstestJob extends CLI_Controller
|
||||
= $rowNiedrPrios->nachname.' '.$rowNiedrPrios->vorname.' ('.$rowNiedrPrios->prestudent_id.')';
|
||||
}
|
||||
}
|
||||
elseif ($rowNiedrPrios->laststatus == 'Aufgenommener')
|
||||
{
|
||||
// Mail zur Info an Assistenz schicken, dass in höherer Prio aufgenommen wurde
|
||||
$mailArray[$rowNiedrPrios->studiengang_kz][$rowNiedrPrios->orgform_kurzbz]['AufnahmeHoeherePrio'][]
|
||||
= $rowNiedrPrios->nachname.' '.$rowNiedrPrios->vorname.' ('.$rowNiedrPrios->prestudent_id.')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Kaution einbuchen für $row_ps->prestudent_id
|
||||
// Kaution einbuchen für $row_ps->prestudent_id (für aufgenommenen Bachelor)
|
||||
// Vorher prüfen, ob schon eine Kaution gebucht ist
|
||||
// Todo: Betrag automatisch aus tbl_buchungstyp laden
|
||||
|
||||
$qryKautionExists = "
|
||||
if ($row_ps->studiengang_typ == 'b')
|
||||
{
|
||||
$qryKautionExists = "
|
||||
SELECT count(*) as anzahl
|
||||
FROM public.tbl_konto
|
||||
WHERE person_id = ".$row_ps->person_id."
|
||||
AND studiensemester_kurzbz = '".$row_ps->studiensemester_kurzbz."'
|
||||
AND buchungstyp_kurzbz = 'Kaution'";
|
||||
WHERE person_id = " . $row_ps->person_id . "
|
||||
AND studiensemester_kurzbz = '" . $row_ps->studiensemester_kurzbz . "'
|
||||
AND buchungstyp_kurzbz = 'StudiengebuehrAnzahlung'";
|
||||
|
||||
$resultKautionExists = $db->execReadOnlyQuery($qryKautionExists);
|
||||
if (hasdata($resultKautionExists))
|
||||
{
|
||||
if ($resultKautionExists->retval[0]->anzahl == '0')
|
||||
$resultKautionExists = $db->execReadOnlyQuery($qryKautionExists);
|
||||
if (hasdata($resultKautionExists))
|
||||
{
|
||||
// Todo: Zahlungsreferenz generieren (StudiengangsOE+Buchungsnummer)
|
||||
$this->KontoModel->insert(array(
|
||||
"person_id" => $row_ps->person_id,
|
||||
"studiengang_kz" => $row_ps->studiengang_kz,
|
||||
"studiensemester_kurzbz" => $row_ps->studiensemester_kurzbz,
|
||||
"betrag" => -150,
|
||||
"buchungsdatum" => date('Y-m-d'),
|
||||
"buchungstext" => 'Kaution',
|
||||
"buchungstyp_kurzbz" => 'Kaution',
|
||||
"insertvon" => 'prioritizationJob',
|
||||
"insertamum" => date('Y-m-d H:i:s')
|
||||
));
|
||||
if ($resultKautionExists->retval[0]->anzahl == '0')
|
||||
{
|
||||
// Betrag automatisch aus tbl_buchungstyp laden
|
||||
$this->BuchungstypModel->addSelect('buchungstyp_kurzbz, standardbetrag, standardtext');
|
||||
$buchungstypRes = $this->BuchungstypModel->loadWhere(array('buchungstyp_kurzbz' => 'StudiengebuehrAnzahlung'));
|
||||
|
||||
if (hasData($buchungstypRes))
|
||||
{
|
||||
$buchungstypData = getData($buchungstypRes)[0];
|
||||
|
||||
$this->KontoModel->insert(array(
|
||||
"person_id" => $row_ps->person_id,
|
||||
"studiengang_kz" => $row_ps->studiengang_kz,
|
||||
"studiensemester_kurzbz" => $row_ps->studiensemester_kurzbz,
|
||||
"betrag" => $buchungstypData->standardbetrag,
|
||||
"buchungsdatum" => date('Y-m-d'),
|
||||
"buchungstext" => $buchungstypData->standardtext,
|
||||
"buchungstyp_kurzbz" => $buchungstypData->buchungstyp_kurzbz,
|
||||
"insertvon" => 'prioritizationJob',
|
||||
"insertamum" => date('Y-m-d H:i:s')
|
||||
));
|
||||
}
|
||||
else
|
||||
$this->logError('No Buchungstyp found for Studiengebühr Anzahlung');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($row_ps->laststatus == 'Abgewiesener')
|
||||
{
|
||||
$resultNiedrPrios = $db->execReadOnlyQuery($qryNiedrPrios);
|
||||
|
||||
if (hasdata($resultNiedrPrios))
|
||||
{
|
||||
foreach ($resultNiedrPrios->retval as $rowNiedrPrios)
|
||||
{
|
||||
// Mail zur Info an Assistenz schicken, dass in höherer Prio abgewiesen wurde
|
||||
$mailArray[$rowNiedrPrios->studiengang_kz][$rowNiedrPrios->orgform_kurzbz]['AbgewiesenHoeherePrio'][]
|
||||
= $rowNiedrPrios->nachname . ' ' . $rowNiedrPrios->vorname . ' (' . $rowNiedrPrios->prestudent_id . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1015,6 +1059,19 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
$mailcontent .= '</tbody></table>';
|
||||
}
|
||||
if (isset($value['AbgewiesenHoeherePrio']) && !isEmptyArray($value['AbgewiesenHoeherePrio']))
|
||||
{
|
||||
$mailcontent .= '<p style="font-family: verdana, sans-serif;">
|
||||
Folgende Bewerber wurden in einem höher priorisierten Studiengang abgewiesen:</p>';
|
||||
$mailcontent .= '<table style="border-collapse: collapse; border: 1px solid grey;">';
|
||||
$mailcontent .= ' <tbody>';
|
||||
sort($value['AbgewiesenHoeherePrio']);
|
||||
foreach ($value['AbgewiesenHoeherePrio'] AS $key=>$bewerber)
|
||||
{
|
||||
$mailcontent .= '<tr><td style="font-family: verdana, sans-serif; border: 1px solid grey; padding: 3px">'.$bewerber.'</td></tr>';
|
||||
}
|
||||
$mailcontent .= '</tbody></table>';
|
||||
}
|
||||
if ($bcc != '' && isset($value['AbgewiesenWeilBewerber']) && !isEmptyArray($value['AbgewiesenWeilBewerber']))
|
||||
{
|
||||
$mailcontent .= '<p style="font-family: verdana, sans-serif;">
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*/
|
||||
class Pruefungsprotokoll extends Auth_Controller
|
||||
{
|
||||
private $_uid; // uid of the logged user
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => '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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,531 @@
|
||||
<?php
|
||||
|
||||
//if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class approveAnrechnungDetail extends Auth_Controller
|
||||
{
|
||||
const BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN = 'lehre/anrechnung_genehmigen';
|
||||
|
||||
const REVIEW_ANRECHNUNG_URI = '/lehre/anrechnung/ReviewAnrechnungUebersicht';
|
||||
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
|
||||
const ANRECHNUNGSTATUS_APPROVED = 'approved';
|
||||
const ANRECHNUNGSTATUS_REJECTED = 'rejected';
|
||||
|
||||
const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL = 'AnrechnungNotizSTGL';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => '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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,461 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class approveAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
const BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN = 'lehre/anrechnung_genehmigen';
|
||||
|
||||
const REVIEW_ANRECHNUNG_URI = '/lehre/anrechnung/ReviewAnrechnungUebersicht';
|
||||
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
|
||||
const ANRECHNUNGSTATUS_APPROVED = 'approved';
|
||||
const ANRECHNUNGSTATUS_REJECTED = 'rejected';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => '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;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,409 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class requestAnrechnung extends Auth_Controller
|
||||
{
|
||||
const REQUEST_ANRECHNUNG_URI = '/lehre/anrechnung/RequestAnrechnung';
|
||||
const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht';
|
||||
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
|
||||
const ANRECHNUNGSTATUS_APPROVED = 'approved';
|
||||
const ANRECHNUNGSTATUS_REJECTED = 'rejected';
|
||||
|
||||
const DEADLINE_INTERVAL_NACH_SEMESTERSTART = 'P1M'; // Deadline for application
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => '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,
|
||||
''
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,397 @@
|
||||
<?php
|
||||
|
||||
//if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class reviewAnrechnungDetail extends Auth_Controller
|
||||
{
|
||||
const BERECHTIGUNG_ANRECHNUNG_EMPFEHLEN = 'lehre/anrechnung_empfehlen';
|
||||
|
||||
const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht';
|
||||
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
|
||||
const ANRECHNUNGSTATUS_APPROVED = 'approved';
|
||||
const ANRECHNUNGSTATUS_REJECTED = 'rejected';
|
||||
|
||||
const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_LEKTOR = 'AnrechnungNotizLektor';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => '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,
|
||||
''
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
const BERECHTIGUNG_ANRECHNUNG_EMPFEHLEN = 'lehre/anrechnung_empfehlen';
|
||||
|
||||
const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht';
|
||||
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
|
||||
const ANRECHNUNGSTATUS_APPROVED = 'approved';
|
||||
const ANRECHNUNGSTATUS_REJECTED = 'rejected';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => '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,
|
||||
''
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.<br>
|
||||
Es muss eine passende Organisationseinheit hinterlegt werden.<br>');
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ class LehrauftragErteilen extends Auth_Controller
|
||||
array(
|
||||
'global',
|
||||
'ui',
|
||||
'lehre'
|
||||
'lehre',
|
||||
'table'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class LogsViewer extends Auth_Controller
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Main page of the InfoCenter tool
|
||||
* Everything has a beginning
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ZGVUeberpruefung extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => '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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This controller acts as REST JSON interface between the JobsQueueLib, that contains all the needed functionalities to
|
||||
* operate with the Jobs Queue System, and other tools that cannot access directly to such library
|
||||
*/
|
||||
class JobsQueueManager extends Auth_Controller
|
||||
{
|
||||
// Config entry name for White list of permissions...
|
||||
const JOB_TYPE_PERMISSIONS_WHITE_LIST = 'job_type_permissions_white_list';
|
||||
// Parameter names
|
||||
const PARAM_JOBS = 'jobs';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'getLastJobs' => '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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Jobs Queue Viewer
|
||||
*
|
||||
* This controller renders a FilterWidget to monitor the current status of the Jobs Queue System
|
||||
*/
|
||||
class JobsQueueViewer extends Auth_Controller
|
||||
{
|
||||
const PARAM_START_DATE = 'startDate';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => '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');
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This controller operates between (interface) the JS (GUI) and the UDFLib (back-end)
|
||||
* Provides data to the ajax get calls about the UDF widget
|
||||
* Accepts ajax post calls to save UDFs
|
||||
* 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 UDFWidget has its
|
||||
* own permissions check
|
||||
*/
|
||||
class UDF extends FHC_Controller
|
||||
{
|
||||
const UDF_UNIQUE_ID = 'udfUniqueId'; // Name of the udf widget unique id
|
||||
|
||||
/**
|
||||
* Calls the parent's constructor and loads the UDFLib
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads authentication library and starts authentication
|
||||
$this->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!');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user