mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
Merge branch 'master' into feature-6189/SAP_basic_structure_for_data_synchronization
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "^0.4.5",
|
||||
"grunt": "^1.3.0",
|
||||
"grunt-cli": "~0.1.13",
|
||||
"grunt-contrib-clean": "^0.7.0",
|
||||
"grunt-contrib-concat": "^0.5.1",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# FH-Complete
|
||||
|
||||
* [FH-Complete Homepage](https://www.fhcomplete.org)
|
||||
* [Wiki](https://wiki.fhcomplete.org/)
|
||||
* [Wiki](https://wiki.fhcomplete.info/)
|
||||
* [Changelog](CHANGELOG.md)
|
||||
|
||||
@@ -31,6 +31,13 @@ define('EXIT_VALIDATION_UDF_NOT_VALID_VAL', 17); // UDF validation has been fail
|
||||
define('EXIT_AUTO_MIN', 1000); // lowest automatically-assigned error code
|
||||
define('EXIT_AUTO_MAX', 2000); // highest automatically-assigned error code
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| General purpose
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
define('BEGINNING_OF_TIME', '1970-01-01');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication constants
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
$config['infocenter_studiengang_kz'] = '10021, 10027, 10002';
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
// White list of permissions (write mode have to be set) that are able to store a specific job type in database
|
||||
$config['job_type_permissions_white_list'] = array(
|
||||
'SAPStammdatenUpdate' => array(
|
||||
'admin:rw',
|
||||
'developer:rw'
|
||||
),
|
||||
'OEHPayment' => 'developer:rw',
|
||||
'SAPPayment' => 'developer:rw'
|
||||
);
|
||||
|
||||
@@ -18,6 +18,8 @@ $config['ou_receivers'] = array('ass');
|
||||
$config['ou_receivers_no_notice'] = array('infocenter');
|
||||
// Organization units that will not send the notice email to the internal account, but to the private one
|
||||
$config['ou_receivers_private'] = array('eac', 'ewu', 'scs');
|
||||
//
|
||||
$config['ou_function_whitelist'] = array('ass', 'Leitung', 'fachzuordnung', 'oezuordnung');
|
||||
|
||||
$config['message_redirect_url'] = array();
|
||||
$config['message_redirect_url']['fallback'] = site_url('system/messages/ViewMessage/writeReply');
|
||||
|
||||
@@ -62,6 +62,15 @@ $config['navigation_header'] = array(
|
||||
'lehre/lehrauftrag_bestellen:r',
|
||||
'lehre/lehrauftrag_erteilen:r'
|
||||
)
|
||||
),
|
||||
'zgvueberpruefung' => array(
|
||||
'link' => site_url('system/infocenter/ZGVUeberpruefung'),
|
||||
'description' => 'ZGV Überprüfung',
|
||||
'expand' => true,
|
||||
'sort' => 50,
|
||||
'requiredPermissions' => array(
|
||||
'lehre/zgvpruefung:r'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -72,11 +81,18 @@ $config['navigation_header'] = array(
|
||||
'sort' => 40,
|
||||
'requiredPermissions' => 'basis/vilesci:r',
|
||||
'children'=> array(
|
||||
'messages' => array(
|
||||
'link' => site_url('system/messages/MessageClient/read'),
|
||||
'icon' => '',
|
||||
'target' => '_blank',
|
||||
'description' => 'Messages',
|
||||
'sort' => 10,
|
||||
),
|
||||
'bpk' => array(
|
||||
'link' => site_url('person/BPKWartung'),
|
||||
'icon' => '',
|
||||
'description' => 'BPK Wartung',
|
||||
'sort' => 10,
|
||||
'sort' => 20,
|
||||
'requiredPermissions' => 'admin:r'
|
||||
)
|
||||
)
|
||||
@@ -102,6 +118,13 @@ $config['navigation_header'] = array(
|
||||
'expand' => true,
|
||||
'sort' => 20,
|
||||
'requiredPermissions' => 'system/developer:r'
|
||||
),
|
||||
'jobsqueueviewer' => array(
|
||||
'link' => site_url('system/jq/JobsQueueViewer'),
|
||||
'description' => 'Jobs Queue Viewer',
|
||||
'expand' => true,
|
||||
'sort' => 20,
|
||||
'requiredPermissions' => 'system/developer:r'
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -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!');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,8 @@
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
* This is the super class for all those controllers that can only be called from command line
|
||||
* It provides also an helper to display the possible calls
|
||||
*/
|
||||
abstract class CLI_Controller extends FHC_Controller
|
||||
{
|
||||
@@ -15,9 +16,9 @@ abstract class CLI_Controller extends FHC_Controller
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
// Checks if the controller is called from command line
|
||||
$this->_isAllowed();
|
||||
@@ -103,3 +104,4 @@ abstract class CLI_Controller extends FHC_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,20 @@ class DB_Model extends CI_Model
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* This method provides a way to setup a database model without declaring one that extends this class
|
||||
*/
|
||||
public function setup($schema, $table, $primaryKey, $hasSequence = true)
|
||||
{
|
||||
//
|
||||
if (!isEmptyString($schema) && !isEmptyString($table) && !isEmptyString($primaryKey) && is_bool($hasSequence))
|
||||
{
|
||||
$this->dbTable = $schema.'.'.$table;
|
||||
$this->pk = $primaryKey;
|
||||
$this->hasSequence = $hasSequence;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert Data into DB-Table
|
||||
*
|
||||
@@ -690,7 +704,7 @@ class DB_Model extends CI_Model
|
||||
*/
|
||||
public function hasUDF()
|
||||
{
|
||||
if($this->fieldExists(UDFLib::COLUMN_NAME))
|
||||
if ($this->fieldExists(UDFLib::COLUMN_NAME))
|
||||
{
|
||||
$resultUDFsDefinitions = $this->UDFModel->getUDFsDefinitions($this->dbTable);
|
||||
if (hasData($resultUDFsDefinitions))
|
||||
@@ -727,8 +741,8 @@ class DB_Model extends CI_Model
|
||||
$cleanedQuery = trim(preg_replace('/\t|\n|\r|;/', '', $query)); //
|
||||
|
||||
//
|
||||
if (stripos($cleanedQuery, 'SELECT') == 0
|
||||
&& (stripos($cleanedQuery, 'INSERT') > 0 || stripos($cleanedQuery, 'INSERT') == false)
|
||||
if (
|
||||
(stripos($cleanedQuery, 'INSERT') > 0 || stripos($cleanedQuery, 'INSERT') == false)
|
||||
&& (stripos($cleanedQuery, 'UPDATE') > 0 || stripos($cleanedQuery, 'UPDATE') == false)
|
||||
&& (stripos($cleanedQuery, 'CREATE') > 0 || stripos($cleanedQuery, 'CREATE') == false)
|
||||
&& (stripos($cleanedQuery, 'DELETE') > 0 || stripos($cleanedQuery, 'DELETE') == false)
|
||||
|
||||
@@ -3,26 +3,36 @@
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
* This is the super class for a job.
|
||||
* All the controllers that extends this class can only be called from command line.
|
||||
* Provides utility methods to log into database
|
||||
*/
|
||||
abstract class JOB_Controller extends CLI_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
// Loads LogLib with different debug trace levels to get data of the job that extends this class
|
||||
// It also specify parameters to set database fields
|
||||
$this->load->library('LogLib', array(
|
||||
'classIndex' => 5,
|
||||
'functionIndex' => 5,
|
||||
'lineIndex' => 4,
|
||||
'dbLogType' => 'job', // required
|
||||
'dbExecuteUser' => 'Cronjob system'
|
||||
));
|
||||
$this->load->library(
|
||||
'LogLib',
|
||||
array(
|
||||
'classIndex' => 5,
|
||||
'functionIndex' => 5,
|
||||
'lineIndex' => 4,
|
||||
'dbLogType' => 'job', // required
|
||||
'dbExecuteUser' => 'Cronjob system',
|
||||
'requestId' => 'JOB',
|
||||
'requestDataFormatter' => function($data) {
|
||||
return json_encode($data);
|
||||
}
|
||||
),
|
||||
'LogLibJob' // library alias case sensitive
|
||||
);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
@@ -33,7 +43,7 @@ abstract class JOB_Controller extends CLI_Controller
|
||||
*/
|
||||
protected function logInfo($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::INFO, 'Cronjob info', $response, $parameters);
|
||||
$this->_log(LogLib::INFO, $response, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +51,7 @@ abstract class JOB_Controller extends CLI_Controller
|
||||
*/
|
||||
protected function logDebug($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::DEBUG, 'Cronjob debug', $response, $parameters);
|
||||
$this->_log(LogLib::DEBUG, $response, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +59,7 @@ abstract class JOB_Controller extends CLI_Controller
|
||||
*/
|
||||
protected function logWarning($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::WARNING, 'Cronjob warning', $response, $parameters);
|
||||
$this->_log(LogLib::WARNING, $response, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +67,7 @@ abstract class JOB_Controller extends CLI_Controller
|
||||
*/
|
||||
protected function logError($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::ERROR, 'Cronjob error', $response, $parameters);
|
||||
$this->_log(LogLib::ERROR, $response, $parameters);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
@@ -66,7 +76,7 @@ abstract class JOB_Controller extends CLI_Controller
|
||||
/**
|
||||
* Writes a log to database
|
||||
*/
|
||||
private function _log($level, $requestId, $response, $parameters)
|
||||
private function _log($level, $response, $parameters)
|
||||
{
|
||||
$data = new stdClass();
|
||||
|
||||
@@ -76,17 +86,18 @@ abstract class JOB_Controller extends CLI_Controller
|
||||
switch($level)
|
||||
{
|
||||
case LogLib::INFO:
|
||||
$this->loglib->logInfoDB($requestId, json_encode(success($data, LogLib::INFO)));
|
||||
$this->LogLibJob->logInfoDB($data);
|
||||
break;
|
||||
case LogLib::DEBUG:
|
||||
$this->loglib->logDebugDB($requestId, json_encode(success($data, LogLib::DEBUG)));
|
||||
$this->LogLibJob->logDebugDB($data);
|
||||
break;
|
||||
case LogLib::WARNING:
|
||||
$this->loglib->logWarningDB($requestId, json_encode(error($data, LogLib::WARNING)));
|
||||
$this->LogLibJob->logWarningDB($data);
|
||||
break;
|
||||
case LogLib::ERROR:
|
||||
$this->loglib->logErrorDB($requestId, json_encode(error($data, LogLib::ERROR)));
|
||||
$this->LogLibJob->logErrorDB($data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
/**
|
||||
* Job Queue Worker
|
||||
*
|
||||
* This controller acts as interface of the JobsQueueLib that contains
|
||||
* all the needed functionalities to operate with the Jobs Queue System
|
||||
* This is an abstract class that provide basic functionalities,
|
||||
* it has to be extended to broaden its logic
|
||||
*/
|
||||
abstract class JQW_Controller extends JOB_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Changes the needed configs for LogLib
|
||||
$this->LogLibJob->setConfigs(
|
||||
array(
|
||||
'dbExecuteUser' => 'Jobs queue system',
|
||||
'requestId' => 'JQW'
|
||||
)
|
||||
);
|
||||
|
||||
// Loads JobsQueueLib library
|
||||
$this->load->library('JobsQueueLib');
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Protected methods
|
||||
|
||||
/**
|
||||
* To get all the most recently added jobs using the given job type
|
||||
*/
|
||||
protected function getLastJobs($type)
|
||||
{
|
||||
$jobs = $this->jobsqueuelib->getLastJobs($type);
|
||||
|
||||
// If an error occurred then log it in database
|
||||
if (isError($jobs)) $this->logError(getError($jobs), $type);
|
||||
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* To get the oldest added job using the given job type
|
||||
*/
|
||||
protected function getOldestJob($type)
|
||||
{
|
||||
$jobs = $this->jobsqueuelib->getOldestJob($type);
|
||||
|
||||
// If an error occurred then log it in database
|
||||
if (isError($jobs)) $this->logError(getError($jobs), $type);
|
||||
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* To get all the jobs specified by the given parameters
|
||||
*/
|
||||
protected function getJobsByTypeStatusInput($type, $status, $input)
|
||||
{
|
||||
$jobs = $this->jobsqueuelib->getJobsByTypeStatusInput($type, $status, $input);
|
||||
|
||||
// If an error occurred then log it in database
|
||||
if (isError($jobs)) $this->logError(getError($jobs), array($type, $status, $input));
|
||||
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new jobs in the jobs queue with the given type
|
||||
* jobs is an array of job objects
|
||||
*/
|
||||
protected function addNewJobsToQueue($type, $jobs)
|
||||
{
|
||||
$result = $this->jobsqueuelib->addNewJobsToQueue($type, $jobs);
|
||||
|
||||
// If an error occurred then log it in database
|
||||
if (isError($result)) $this->logError(getError($result), $type);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates jobs already present in the jobs queue
|
||||
* jobs is an array of job objects
|
||||
*/
|
||||
protected function updateJobsQueue($type, $jobs)
|
||||
{
|
||||
$result = $this->jobsqueuelib->updateJobsQueue($type, $jobs);
|
||||
|
||||
// If an error occurred then log it in database
|
||||
if (isError($result)) $this->logError(getError($result), $type);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to update the specified properties of the given jobs with the given values
|
||||
*/
|
||||
protected function updateJobs($jobs, $properties, $values)
|
||||
{
|
||||
// If not valid arrays of properties and values arrays are not of the same size then exit
|
||||
if (isEmptyArray($jobs) || isEmptyArray($properties) || isEmptyArray($values)) return;
|
||||
if (count($properties) != count($values)) return;
|
||||
|
||||
// For each job
|
||||
foreach ($jobs as $job)
|
||||
{
|
||||
// For each propery of the job
|
||||
for ($pI = 0; $pI < count($properties); $pI++)
|
||||
{
|
||||
// If this property is present in the job object
|
||||
if (property_exists($job, $properties[$pI]))
|
||||
{
|
||||
$job->{$properties[$pI]} = $values[$pI]; // set a new value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to generate a job with the given parameters and return it inside an array
|
||||
* ready to be used by addNewJobsToQueue and updateJobsQueue
|
||||
*/
|
||||
protected function generateJobs($status, $input)
|
||||
{
|
||||
$job = new stdClass();
|
||||
|
||||
$job->{JobsQueueLib::PROPERTY_STATUS} = $status;
|
||||
$job->{JobsQueueLib::PROPERTY_INPUT} = $input;
|
||||
|
||||
return array($job);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,3 +301,45 @@ function isLogged()
|
||||
|
||||
return isset($ci->authlib) && $ci->authlib->getAuthObj() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Konvertiert Problematische Sonderzeichen in Strings fuer
|
||||
* Accountnamen und EMail-Aliase
|
||||
*
|
||||
* @param $str
|
||||
* @return bereinigter String
|
||||
*/
|
||||
function sanitizeProblemChars($str)
|
||||
{
|
||||
$enc = 'UTF-8';
|
||||
|
||||
$acentos = array(
|
||||
'A' => '/À|Á|Â|Ã|Å/',
|
||||
'Ae' => '/Ä/',
|
||||
'a' => '/à|á|â|ã|å/',
|
||||
'ae'=> '/ä/',
|
||||
'C' => '/Ç/',
|
||||
'c' => '/ç/',
|
||||
'E' => '/È|É|Ê|Ë/',
|
||||
'e' => '/è|é|ê|ë/',
|
||||
'I' => '/Ì|Í|Î|Ï/',
|
||||
'i' => '/ì|í|î|ï/',
|
||||
'N' => '/Ñ/',
|
||||
'n' => '/ñ/',
|
||||
'O' => '/Ò|Ó|Ô|Õ/',
|
||||
'Oe' => '/Ö/',
|
||||
'o' => '/ò|ó|ô|õ/',
|
||||
'oe' => '/ö/',
|
||||
'U' => '/Ù|Ú|Û/',
|
||||
'Ue' => '/Ü/',
|
||||
'u' => '/ù|ú|û/',
|
||||
'ue' => '/ü/',
|
||||
'Y' => '/Ý/',
|
||||
'y' => '/ý|ÿ/',
|
||||
'a.' => '/ª/',
|
||||
'o.' => '/º/',
|
||||
'ss' => '/ß/'
|
||||
);
|
||||
|
||||
return preg_replace($acentos, array_keys($acentos), htmlentities($str,ENT_NOQUOTES, $enc));
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ function generateCSSsInclude($CSSs)
|
||||
*/
|
||||
function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod)
|
||||
{
|
||||
$user_language = getUserLanguage();
|
||||
|
||||
$toPrint = "\n";
|
||||
$toPrint .= '<script type="text/javascript">';
|
||||
$toPrint .= '
|
||||
|
||||
@@ -35,6 +35,12 @@ function getUserLanguage($language = null)
|
||||
{
|
||||
$language = $_SESSION[LANG_SESSION_CURRENT_LANGUAGE]; // then use it
|
||||
}
|
||||
// Else if the language is present in the cookie and it is valid
|
||||
elseif (isset($_COOKIE[LANG_SESSION_CURRENT_LANGUAGE]) && !isEmptyString($_COOKIE[LANG_SESSION_CURRENT_LANGUAGE]))
|
||||
{
|
||||
$language = $_COOKIE[LANG_SESSION_CURRENT_LANGUAGE];
|
||||
}
|
||||
|
||||
// Otherwise checks if the user is authenticated to retrieve the users's language
|
||||
// NOTE: this helper could be called when the user is NOT logged in the system
|
||||
// therefore is checked if the user is logged
|
||||
|
||||
@@ -89,7 +89,7 @@ function _parseMailContent($vorlage_kurzbz, $vorlage_data)
|
||||
$ci =& get_instance();
|
||||
$ci->load->library('VorlageLib');
|
||||
|
||||
$result = $ci->vorlagelib->getVorlagetextByVorlage($vorlage_kurzbz);
|
||||
$result = $ci->vorlagelib->loadVorlagetext($vorlage_kurzbz);
|
||||
|
||||
if (isSuccess($result))
|
||||
{
|
||||
|
||||
@@ -0,0 +1,643 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class AnrechnungLib
|
||||
{
|
||||
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';
|
||||
const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL = 'AnrechnungNotizSTGL';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->ci->load->model('education/Anrechnung_model', 'AnrechnungModel');
|
||||
$this->ci->load->model('person/Person_model', 'PersonModel');
|
||||
$this->ci->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||
$this->ci->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
$this->ci->load->model('crm/Student_model', 'StudentModel');
|
||||
$this->ci->load->model('content/DmsVersion_model', 'DmsVersionModel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Antrag data
|
||||
* @param $uid
|
||||
* @param $studiensemester_kurzbz
|
||||
* @param $lv_id
|
||||
* @return StdClass
|
||||
*/
|
||||
public function getAntragData($uid, $studiensemester_kurzbz, $lv_id)
|
||||
{
|
||||
$antrag_data = new StdClass();
|
||||
|
||||
// Get lehrveranstaltung data. Break, if course is not assigned to student.
|
||||
if(!$lv = getData($this->ci->LehrveranstaltungModel->getLvByStudent($uid, $studiensemester_kurzbz, $lv_id))[0])
|
||||
{
|
||||
show_error('You are not assigned to this course yet.');
|
||||
}
|
||||
|
||||
// Get the students personal data
|
||||
if (!$person = getData($this->ci->PersonModel->getByUid($uid))[0])
|
||||
{
|
||||
show_error('Failed loading person data.');
|
||||
}
|
||||
|
||||
// Get the internal personenkennzeichen
|
||||
if (!$student = getData($this->ci->StudentModel->load(array('student_uid' => $uid)))[0])
|
||||
{
|
||||
show_error(getError($student));
|
||||
}
|
||||
|
||||
// Get studiengang bezeichnung
|
||||
if (!$studiengang = getData($this->ci->StudiengangModel->load($lv->studiengang_kz))[0])
|
||||
{
|
||||
show_error('Failed loading studiengang data.');
|
||||
}
|
||||
|
||||
// Get lectors of lehrveranstaltung
|
||||
$antrag_data->lektoren = array();
|
||||
if (!$lv_lektoren = getData($this->ci->LehrveranstaltungModel->getLecturersByLv($studiensemester_kurzbz, $lv_id)))
|
||||
{
|
||||
show_error('Failed loading course lectors.');
|
||||
}
|
||||
|
||||
// Set the given studiensemester
|
||||
$antrag_data->lv_id = $lv_id;
|
||||
$antrag_data->lv_bezeichnung = $lv->bezeichnung;
|
||||
$antrag_data->ects = $lv->ects;
|
||||
$antrag_data->studiensemester_kurzbz = $studiensemester_kurzbz;
|
||||
$antrag_data->vorname = $person->vorname;
|
||||
$antrag_data->nachname = $person->nachname;
|
||||
$antrag_data->matrikelnr = $student->matrikelnr;
|
||||
$antrag_data->stg_bezeichnung = $studiengang->bezeichnung;
|
||||
$antrag_data->lektoren = $lv_lektoren;
|
||||
|
||||
return $antrag_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Anrechnung data, last status and Nachweisdokument dms data.
|
||||
* @param $anrechnung_id
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getAnrechnungData($anrechnung_id)
|
||||
{
|
||||
if (!is_numeric($anrechnung_id))
|
||||
{
|
||||
show_error('Incorrect parameter');
|
||||
}
|
||||
|
||||
$anrechnung_data = new StdClass();
|
||||
|
||||
$result = $this->ci->AnrechnungModel->load($anrechnung_id);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
if ($anrechnung = getData($result)[0])
|
||||
{
|
||||
$anrechnung_data = $this->_setAnrechnungDataObject($anrechnung);
|
||||
}
|
||||
|
||||
return success($anrechnung_data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Anrechnung data by Lehrveranstaltung. Also retrieves last status and Nachweisdokument dms data.
|
||||
* @param $lehrveranstaltung_id
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getAnrechnungDataByLv($lehrveranstaltung_id, $studiensemester_kurzbz, $prestudent_id)
|
||||
{
|
||||
$anrechnung_data = new StdClass();
|
||||
$anrechnung_data->anrechnung_id = '';
|
||||
$anrechnung_data->prestudent_id = '';
|
||||
$anrechnung_data->lehrveranstaltung = '';
|
||||
$anrechnung_data->begruendung_id = '';
|
||||
$anrechnung_data->anmerkung = '';
|
||||
$anrechnung_data->dms_id = '';
|
||||
$anrechnung_data->insertamum = '';
|
||||
$anrechnung_data->insertvon = '';
|
||||
$anrechnung_data->studiensemester_kurzbz = '';
|
||||
$anrechnung_data->empfehlung = '';
|
||||
$anrechnung_data->status_kurzbz = '';
|
||||
$anrechnung_data->status = getUserLanguage() == 'German' ? 'neu' : 'new';
|
||||
$anrechnung_data->dokumentname = '';
|
||||
|
||||
$result = $this->ci->AnrechnungModel->loadWhere(
|
||||
array(
|
||||
'lehrveranstaltung_id' => $lehrveranstaltung_id,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'prestudent_id' => $prestudent_id
|
||||
)
|
||||
);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
if ($anrechnung = getData($result)[0])
|
||||
{
|
||||
$anrechnung_data = $this->_setAnrechnungDataObject($anrechnung);
|
||||
}
|
||||
|
||||
return success($anrechnung_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get students data by Anrechnung
|
||||
* @param $anrechnung_id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStudentData($anrechnung_id)
|
||||
{
|
||||
if (!is_numeric($anrechnung_id))
|
||||
{
|
||||
show_error('Incorrect parameter');
|
||||
}
|
||||
|
||||
$this->ci->AnrechnungModel->addSelect('tbl_benutzer.uid, tbl_prestudent.prestudent_id, tbl_person.person_id, tbl_anrechnung.studiensemester_kurzbz, vorname, nachname, geschlecht, tbl_lehrveranstaltung.bezeichnung AS "lv_bezeichnung"');
|
||||
$this->ci->AnrechnungModel->addJoin('public.tbl_prestudent', 'prestudent_id');
|
||||
$this->ci->AnrechnungModel->addJoin('public.tbl_student', 'prestudent_id');
|
||||
$this->ci->AnrechnungModel->addJoin('public.tbl_benutzer', 'uid=student_uid');
|
||||
$this->ci->AnrechnungModel->addJoin('public.tbl_person', 'tbl_benutzer.person_id=tbl_person.person_id');
|
||||
$this->ci->AnrechnungModel->addJoin('lehre.tbl_lehrveranstaltung', 'lehrveranstaltung_id');
|
||||
|
||||
$result = $this->ci->AnrechnungModel->load($anrechnung_id);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
if (!hasData($result))
|
||||
{
|
||||
show_error('Failed retrieving students data');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Empfehlung data object.
|
||||
* @param $anrechnung_id
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getEmpfehlungData($anrechnung_id)
|
||||
{
|
||||
if (!is_numeric($anrechnung_id))
|
||||
{
|
||||
show_error('Incorrect parameter');
|
||||
}
|
||||
|
||||
$empfehlung_data = new stdClass();
|
||||
$empfehlung_data->empfehlung = null;
|
||||
$empfehlung_data->empfehlung_von = '-';
|
||||
$empfehlung_data->empfehlung_am = '-';
|
||||
$empfehlung_data->empfehlung_angefordert_am = '-';
|
||||
$empfehlung_data->notiz = ''; // Begruendung, if not recommended
|
||||
|
||||
|
||||
if(!$anrechnung = getData($this->ci->AnrechnungModel->load($anrechnung_id))[0])
|
||||
{
|
||||
show_error('Failed loading Anrechnung');
|
||||
}
|
||||
|
||||
// Get date, where recommendation was last requested
|
||||
$result = $this->ci->AnrechnungModel->getLastAnrechnungstatus(
|
||||
$anrechnung_id,
|
||||
self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR // when STLG asks for recommendation, status is set to in progress lektor
|
||||
);
|
||||
if ($result = getData($result)[0])
|
||||
{
|
||||
$empfehlung_data->empfehlung_angefordert_am = (new DateTime($result->insertamum))->format('d.m.Y');
|
||||
}
|
||||
|
||||
if (is_null($anrechnung->empfehlung_anrechnung))
|
||||
{
|
||||
return success($empfehlung_data);
|
||||
}
|
||||
|
||||
// If Empfehlung is true or false
|
||||
if (!is_null($anrechnung->empfehlung_anrechnung))
|
||||
{
|
||||
// Get last lector and date, where recommendation was given
|
||||
$result = $this->ci->AnrechnungModel->getLastAnrechnungstatus(
|
||||
$anrechnung_id,
|
||||
self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL // when lector sends recommendation, status is set to in progress STGL again
|
||||
);
|
||||
if ($result = getData($result)[0])
|
||||
{
|
||||
$empfehlung_datum = (new DateTime($result->insertamum))->format('d.m.Y');
|
||||
}
|
||||
|
||||
// Get full name of lector
|
||||
$result = $this->ci->PersonModel->getByUID($result->insertvon);
|
||||
if ($result = getData($result)[0])
|
||||
{
|
||||
$empfehlung_von = $result->vorname. ' '. $result->nachname;
|
||||
}
|
||||
|
||||
$empfehlung_data->empfehlung = $anrechnung->empfehlung_anrechnung;
|
||||
$empfehlung_data->empfehlung_von = $empfehlung_von;
|
||||
$empfehlung_data->empfehlung_am = $empfehlung_datum;
|
||||
}
|
||||
|
||||
// If Empfehlung is false, retrieve also Notiz with Begruendung
|
||||
if (!$anrechnung->empfehlung_anrechnung)
|
||||
{
|
||||
// Get Ablehnungsbegruendung (only set, if Anrechnung was not recommended yet)
|
||||
$this->ci->load->model('person/Notiz_model', 'NotizModel');
|
||||
$result = $this->ci->NotizModel->getNotizByAnrechnung($anrechnung_id, self::ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_LEKTOR);
|
||||
if ($notiz = getData($result)[0])
|
||||
{
|
||||
$empfehlung_data->notiz = $notiz->text;
|
||||
}
|
||||
}
|
||||
|
||||
return success($empfehlung_data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Genehmigung data object.
|
||||
* @param $anrechnung_id
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getGenehmigungData($anrechnung_id)
|
||||
{
|
||||
if (!is_numeric($anrechnung_id))
|
||||
{
|
||||
show_error('Incorrect parameter');
|
||||
}
|
||||
|
||||
$genehmigung_data = new stdClass();
|
||||
$genehmigung_data->genehmigung = null;
|
||||
$genehmigung_data->abgeschlossen_von = '-';
|
||||
$genehmigung_data->abgeschlossen_am = '-';
|
||||
$genehmigung_data->notiz = ''; // Begruendung, if rejected
|
||||
|
||||
|
||||
if(!$anrechnung = getData($this->ci->AnrechnungModel->load($anrechnung_id))[0])
|
||||
{
|
||||
show_error('Failed loading Anrechnung');
|
||||
}
|
||||
|
||||
// Get date of approvement or rejection
|
||||
$result = $this->ci->AnrechnungModel->getApprovedOrRejected($anrechnung_id);
|
||||
|
||||
if (!$result = getData($result)[0])
|
||||
{
|
||||
return success($genehmigung_data);
|
||||
}
|
||||
|
||||
|
||||
$genehmigung_data->genehmigung = $result->status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED
|
||||
? true
|
||||
: false;
|
||||
$genehmigung_data->abgeschlossen_am = (new DateTime($result->insertamum))->format('d.m.Y');
|
||||
|
||||
// Get full name of lector
|
||||
$result = $this->ci->PersonModel->getByUID($result->insertvon);
|
||||
if ($result = getData($result)[0])
|
||||
{
|
||||
$genehmigung_data->abgeschlossen_von = $result->vorname. ' '. $result->nachname;
|
||||
}
|
||||
|
||||
|
||||
// If Anrechnung was rejected, retrieve also Notiz with Begruendung
|
||||
if (!$genehmigung_data->genehmigung)
|
||||
{
|
||||
// Get Ablehnungsbegruendung (only set, if Anrechnung was not recommended yet)
|
||||
$this->ci->load->model('person/Notiz_model', 'NotizModel');
|
||||
$result = $this->ci->NotizModel->getNotizByAnrechnung($anrechnung_id, self::ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL);
|
||||
if ($notiz = getData($result)[0])
|
||||
{
|
||||
$genehmigung_data->notiz = $notiz->text;
|
||||
}
|
||||
}
|
||||
|
||||
return success($genehmigung_data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last Anrechnungstatusbezeichnung in users language.
|
||||
* @param $anrechnung_id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLastAnrechnungstatus($anrechnung_id)
|
||||
{
|
||||
$result = $this->ci->AnrechnungModel->getLastAnrechnungstatus($anrechnung_id);
|
||||
|
||||
$status_mehrsprachig = getData($result)[0]->bezeichnung_mehrsprachig;
|
||||
$status = getUserLanguage() == 'German' ? $status_mehrsprachig[0] : $status_mehrsprachig[1];
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Approve Anrechnung.
|
||||
* Checks last status of Anrechnung and will only approve if last status is not approved or rejected.
|
||||
* @param $anrechnung_id
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function approveAnrechnung($anrechnung_id)
|
||||
{
|
||||
// Check last Anrechnungstatus
|
||||
if (!$result = getData($this->ci->AnrechnungModel->getLastAnrechnungstatus($anrechnung_id))[0])
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
$status_kurzbz = $result->status_kurzbz;
|
||||
|
||||
// Exit if already approved or rejected
|
||||
if ($status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED || $status_kurzbz == self::ANRECHNUNGSTATUS_REJECTED)
|
||||
{
|
||||
return success(false); // dont approve
|
||||
}
|
||||
|
||||
// Start DB transaction
|
||||
$this->ci->db->trans_start(false);
|
||||
|
||||
$stgl_uid = getAuthUID();
|
||||
|
||||
// Insert new status approved
|
||||
$this->ci->AnrechnungModel->saveAnrechnungstatus($anrechnung_id, self::ANRECHNUNGSTATUS_APPROVED);
|
||||
|
||||
// Update genehmigt von
|
||||
$this->ci->AnrechnungModel->update(
|
||||
$anrechnung_id,
|
||||
array(
|
||||
'genehmigt_von' => $stgl_uid
|
||||
)
|
||||
);
|
||||
|
||||
// Transaction complete
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
{
|
||||
$this->ci->db->trans_rollback();
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
|
||||
return success(true); // approved
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject Anrechnung.
|
||||
* @param $anrechnung_id
|
||||
* @return array
|
||||
*/
|
||||
public function rejectAnrechnung($anrechnung_id, $begruendung)
|
||||
{
|
||||
// Check last Anrechnungstatus
|
||||
if (!$result = getData($this->ci->AnrechnungModel->getLastAnrechnungstatus($anrechnung_id))[0])
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
$status_kurzbz = $result->status_kurzbz;
|
||||
|
||||
// Exit if already approved or rejected
|
||||
if ($status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED || $status_kurzbz == self::ANRECHNUNGSTATUS_REJECTED)
|
||||
{
|
||||
return success(false); // dont reject
|
||||
}
|
||||
|
||||
// Insert new status rejected
|
||||
$result = $this->ci->AnrechnungModel->saveAnrechnungstatus($anrechnung_id, self::ANRECHNUNGSTATUS_REJECTED);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
// Add begruendung as notiz
|
||||
$this->ci->load->model('person/Notiz_model', 'NotizModel');
|
||||
$this->ci->NotizModel->addNotizForAnrechnung(
|
||||
$anrechnung_id,
|
||||
self::ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL,
|
||||
$begruendung,
|
||||
getAuthUID()
|
||||
);
|
||||
|
||||
return success(true); // rejected
|
||||
}
|
||||
|
||||
/**
|
||||
* Request recommendation.
|
||||
* @param $anrechnung_id
|
||||
* @return array
|
||||
*/
|
||||
public function requestRecommendation($anrechnung_id)
|
||||
{
|
||||
// Check last Anrechnungstatus
|
||||
if (!$result = getData($this->ci->AnrechnungModel->getLastAnrechnungstatus($anrechnung_id))[0])
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
$status_kurzbz = $result->status_kurzbz;
|
||||
|
||||
// Exit if already approved or rejected or processed by lector
|
||||
if ($status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED
|
||||
|| $status_kurzbz == self::ANRECHNUNGSTATUS_REJECTED
|
||||
|| $status_kurzbz == self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR)
|
||||
{
|
||||
return success(false); // dont ask for recommendation
|
||||
}
|
||||
|
||||
// Start DB transaction
|
||||
$this->ci->db->trans_start(false);
|
||||
|
||||
// Insert new status inProgressLektor
|
||||
$result = $this->ci->AnrechnungModel->saveAnrechnungstatus($anrechnung_id, self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR);
|
||||
|
||||
/**
|
||||
* Anyway update empfehlung_anrechnung to be null
|
||||
* Regardless of what empfehlung_anrechnung was already set (true/false/null), it should be (reset to ) null by
|
||||
* requesting a (new) recommendation.
|
||||
* **/
|
||||
$this->ci->AnrechnungModel->update(
|
||||
$anrechnung_id,
|
||||
array(
|
||||
'empfehlung_anrechnung' => null
|
||||
)
|
||||
);
|
||||
|
||||
// Transaction complete
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
{
|
||||
$this->ci->db->trans_rollback();
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
|
||||
return success(true); // recommended
|
||||
}
|
||||
|
||||
/**
|
||||
* Recommend Anrechnung.
|
||||
* @param $anrechnung_id
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function recommendAnrechnung($anrechnung_id)
|
||||
{
|
||||
// Check last Anrechnungstatus
|
||||
if (!$result = getData($this->ci->AnrechnungModel->getLastAnrechnungstatus($anrechnung_id))[0])
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
$status_kurzbz = $result->status_kurzbz;
|
||||
|
||||
// Exit if already approved or rejected
|
||||
if ($status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED || $status_kurzbz == self::ANRECHNUNGSTATUS_REJECTED)
|
||||
{
|
||||
return success(false); // dont approve
|
||||
}
|
||||
|
||||
// Start DB transaction
|
||||
$this->ci->db->trans_start(false);
|
||||
|
||||
// Insert new status progessed by stgl
|
||||
$this->ci->AnrechnungModel->saveAnrechnungstatus($anrechnung_id, self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL);
|
||||
|
||||
// Update empfehlung_anrechnung
|
||||
$this->ci->AnrechnungModel->update(
|
||||
$anrechnung_id,
|
||||
array(
|
||||
'empfehlung_anrechnung' => true
|
||||
)
|
||||
);
|
||||
|
||||
// Transaction complete
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
{
|
||||
$this->ci->db->trans_rollback();
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
|
||||
return success(true); // recommended
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not recommend Anrechnung.
|
||||
* @param $anrechnung_id
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function dontRecommendAnrechnung($anrechnung_id, $begruendung)
|
||||
{
|
||||
// Check last Anrechnungstatus
|
||||
if (!$result = getData($this->ci->AnrechnungModel->getLastAnrechnungstatus($anrechnung_id))[0])
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
$status_kurzbz = $result->status_kurzbz;
|
||||
|
||||
// Exit if already approved or rejected
|
||||
if ($status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED || $status_kurzbz == self::ANRECHNUNGSTATUS_REJECTED)
|
||||
{
|
||||
return success(false); // dont approve
|
||||
}
|
||||
|
||||
// Start DB transaction
|
||||
$this->ci->db->trans_start(false);
|
||||
|
||||
// Insert new status progessed by stgl
|
||||
$this->ci->AnrechnungModel->saveAnrechnungstatus($anrechnung_id, self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL);
|
||||
|
||||
// Update empfehlung_anrechnung
|
||||
$this->ci->AnrechnungModel->update(
|
||||
$anrechnung_id,
|
||||
array(
|
||||
'empfehlung_anrechnung' => false
|
||||
)
|
||||
);
|
||||
|
||||
$lektor_uid = getAuthUID();
|
||||
|
||||
// Add begruendung as notiz
|
||||
$this->ci->load->model('person/Notiz_model', 'NotizModel');
|
||||
$this->ci->NotizModel->addNotizForAnrechnung(
|
||||
$anrechnung_id,
|
||||
self::ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_LEKTOR,
|
||||
$begruendung,
|
||||
$lektor_uid
|
||||
);
|
||||
|
||||
// Transaction complete
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
{
|
||||
$this->ci->db->trans_rollback();
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
|
||||
return success(true); // recommended
|
||||
}
|
||||
|
||||
// Return an object with Anrechnungdata
|
||||
private function _setAnrechnungDataObject($anrechnung)
|
||||
{
|
||||
$anrechnung_data = new StdClass();
|
||||
|
||||
// Get Anrechnung data
|
||||
$anrechnung_data->anrechnung_id = $anrechnung->anrechnung_id;
|
||||
$anrechnung_data->prestudent_id = $anrechnung->prestudent_id;
|
||||
$anrechnung_data->lehrveranstaltung_id = $anrechnung->lehrveranstaltung_id;
|
||||
$anrechnung_data->begruendung_id = $anrechnung->begruendung_id;
|
||||
$anrechnung_data->anmerkung = $anrechnung->anmerkung_student;
|
||||
$anrechnung_data->dms_id = $anrechnung->dms_id;
|
||||
$anrechnung_data->insertamum = (new DateTime($anrechnung->insertamum))->format('d.m.Y');
|
||||
$anrechnung_data->insertvon= $anrechnung->insertvon;
|
||||
$anrechnung_data->studiensemester_kurzbz= $anrechnung->studiensemester_kurzbz;
|
||||
$anrechnung_data->empfehlung= $anrechnung->empfehlung_anrechnung;
|
||||
|
||||
// Get last status_kurzbz
|
||||
$result = $this->ci->AnrechnungModel->getLastAnrechnungstatus($anrechnung->anrechnung_id);
|
||||
$anrechnung_data->status_kurzbz = $result->retval[0]->status_kurzbz;
|
||||
|
||||
// Get last status bezeichnung in the users language
|
||||
$anrechnung_data->status = $this->getLastAnrechnungstatus($anrechnung->anrechnung_id);
|
||||
|
||||
|
||||
// Get document name
|
||||
$this->ci->DmsVersionModel->addSelect('name');
|
||||
$result = $this->ci->DmsVersionModel->loadWhere(array('dms_id' => $anrechnung->dms_id));
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
$anrechnung_data->dokumentname = $result->retval[0]->name;
|
||||
|
||||
return $anrechnung_data;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,9 @@ class DmsLib
|
||||
{
|
||||
const FILE_CONTENT_PROPERTY = 'file_content';
|
||||
|
||||
const FILE_INPUT_NAME = 'uploadfile'; // name of the HTML input tag containing the uploaded file
|
||||
private $UPLOAD_PATH = DMS_PATH; // temporary directory to store the upload file
|
||||
|
||||
/**
|
||||
* Object initialization
|
||||
*/
|
||||
@@ -93,6 +96,84 @@ class DmsLib
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads a document and saves it to DMS
|
||||
* @param $dms DMS assoc array
|
||||
* @param array $allowed_types Default: all. Param example: array(jpg, pdf)
|
||||
* @return array
|
||||
*/
|
||||
public function upload($dms, $allowed_types = array('*'))
|
||||
{
|
||||
// Init upload configs
|
||||
$this->_loadUploadLibrary($allowed_types);
|
||||
|
||||
if (!$this->ci->upload->do_upload(DmsLib::FILE_INPUT_NAME))
|
||||
{
|
||||
return error($this->ci->upload->display_errors());
|
||||
}
|
||||
|
||||
$upload_data = $this->ci->upload->data(); // data about the uploaded file
|
||||
$filename = $upload_data['file_name'];
|
||||
|
||||
// Insert to DMS table
|
||||
if (!$result = $this->ci->DmsModel->insert($this->ci->DmsModel->filterFields($dms)))
|
||||
{
|
||||
return error('Failed inserting to DMS');
|
||||
}
|
||||
$upload_data['dms_id'] = $result->retval;
|
||||
|
||||
// Insert DMS version
|
||||
if (!$result = $this->ci->DmsVersionModel->insert(
|
||||
$this->ci->DmsVersionModel->filterFields($dms, $result->retval, $filename)))
|
||||
{
|
||||
return error('Failed inserting DMS version');
|
||||
}
|
||||
|
||||
// return result of uploaded data
|
||||
return success($upload_data); // data about the uploaded file
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a document
|
||||
* @param $dms_id
|
||||
*/
|
||||
public function download($dms_id)
|
||||
{
|
||||
if (!is_numeric($dms_id))
|
||||
{
|
||||
show_error('Wrong parameter');
|
||||
}
|
||||
|
||||
$this->ci->DmsVersionModel->addSelect('filename');
|
||||
$result = $this->ci->DmsVersionModel->loadWhere(array('dms_id' => $dms_id));
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
$filename = $result->retval[0]->filename;
|
||||
$file = DMS_PATH. $filename;
|
||||
|
||||
if (file_exists($file))
|
||||
{
|
||||
$finfo = new finfo(FILEINFO_MIME);
|
||||
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: '.$finfo->file($file));
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('File does not exist');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a Document
|
||||
* @param object $dms DMS Object ot be saved.
|
||||
@@ -302,4 +383,18 @@ class DmsLib
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the upload library of CI
|
||||
*/
|
||||
private function _loadUploadLibrary($allowed_types)
|
||||
{
|
||||
$config['upload_path'] = $this->UPLOAD_PATH;
|
||||
$config['allowed_types'] = implode('|', $allowed_types);
|
||||
$config['overwrite'] = true;
|
||||
$config['file_name'] = uniqid().'.pdf';
|
||||
|
||||
$this->ci->load->library('upload', $config);
|
||||
$this->ci->upload->initialize($config);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@ class FilterWidgetLib
|
||||
const OP_NOT_SET = 'nset';
|
||||
|
||||
// Filter options values
|
||||
const OPT_MINUTES = 'minutes';
|
||||
const OPT_HOURS = 'hours';
|
||||
const OPT_DAYS = 'days';
|
||||
const OPT_MONTHS = 'months';
|
||||
|
||||
@@ -884,8 +886,10 @@ class FilterWidgetLib
|
||||
// It it's a date type
|
||||
if (is_numeric($filterDefinition->condition)
|
||||
&& isset($filterDefinition->option)
|
||||
&& ($filterDefinition->option == self::OPT_DAYS
|
||||
|| $filterDefinition->option == self::OPT_MONTHS))
|
||||
&& ($filterDefinition->option == self::OPT_HOURS
|
||||
|| $filterDefinition->option == self::OPT_DAYS
|
||||
|| $filterDefinition->option == self::OPT_MONTHS
|
||||
|| $filterDefinition->option == self::OPT_MINUTES))
|
||||
{
|
||||
$condition = '< (NOW() - \''.$filterDefinition->condition.' '.$filterDefinition->option.'\'::interval)';
|
||||
}
|
||||
@@ -899,8 +903,10 @@ class FilterWidgetLib
|
||||
// It it's a date type
|
||||
if (is_numeric($filterDefinition->condition)
|
||||
&& isset($filterDefinition->option)
|
||||
&& ($filterDefinition->option == self::OPT_DAYS
|
||||
|| $filterDefinition->option == self::OPT_MONTHS))
|
||||
&& ($filterDefinition->option == self::OPT_HOURS
|
||||
|| $filterDefinition->option == self::OPT_DAYS
|
||||
|| $filterDefinition->option == self::OPT_MONTHS
|
||||
|| $filterDefinition->option == self::OPT_MINUTES))
|
||||
{
|
||||
$condition = '> (NOW() - \''.$filterDefinition->condition.' '.$filterDefinition->option.'\'::interval)';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,383 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Library that contains all the needed functionalities to operate with the Jobs Queue System
|
||||
*/
|
||||
class JobsQueueLib
|
||||
{
|
||||
// Job statuses
|
||||
const STATUS_NEW = 'new';
|
||||
const STATUS_RUNNING = 'running';
|
||||
const STATUS_DONE = 'done';
|
||||
const STATUS_FAILED = 'failed';
|
||||
|
||||
// Job object properties
|
||||
const PROPERTY_JOBID = 'jobid';
|
||||
const PROPERTY_CREATIONTIME = 'creationtime';
|
||||
const PROPERTY_TYPE = 'type';
|
||||
const PROPERTY_STATUS = 'status';
|
||||
const PROPERTY_INPUT = 'input';
|
||||
const PROPERTY_OUTPUT = 'output';
|
||||
const PROPERTY_START_TIME = 'starttime';
|
||||
const PROPERTY_END_TIME = 'endtime';
|
||||
const PROPERTY_ERROR = 'error';
|
||||
|
||||
private $_ci; // CI instance
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct($authenticate = true)
|
||||
{
|
||||
// Gets CI instance
|
||||
$this->_ci =& get_instance();
|
||||
|
||||
// Loads all needed models
|
||||
$this->_ci->load->model('system/JobsQueue_model', 'JobsQueueModel');
|
||||
$this->_ci->load->model('system/JobTypes_model', 'JobTypesModel');
|
||||
$this->_ci->load->model('system/JobStatuses_model', 'JobStatusesModel');
|
||||
$this->_ci->load->model('system/JobTriggers_model', 'JobTriggersModel');
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* To get all the most recently added jobs using the given job type
|
||||
*/
|
||||
public function getLastJobs($type)
|
||||
{
|
||||
$this->_ci->JobsQueueModel->resetQuery();
|
||||
|
||||
$this->_ci->JobsQueueModel->addOrder('creationtime', 'DESC');
|
||||
|
||||
return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type));
|
||||
}
|
||||
|
||||
/**
|
||||
* To get the oldest added jobs using the given job type
|
||||
*/
|
||||
public function getOldestJob($type)
|
||||
{
|
||||
$this->_ci->JobsQueueModel->resetQuery();
|
||||
|
||||
$this->_ci->JobsQueueModel->addOrder('creationtime', 'ASC');
|
||||
$this->_ci->JobsQueueModel->addLimit('1');
|
||||
|
||||
return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type));
|
||||
}
|
||||
|
||||
/**
|
||||
* To get all the jobs specified by the given parameters
|
||||
*/
|
||||
public function getJobsByTypeStatusInput($type, $status, $input)
|
||||
{
|
||||
$this->_ci->JobsQueueModel->resetQuery();
|
||||
|
||||
$this->_ci->JobsQueueModel->addOrder('creationtime', 'DESC');
|
||||
|
||||
return $this->_ci->JobsQueueModel->loadWhere(array('status' => $status, 'type' => $type, 'input' => $input));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new jobs in the jobs queue with the given type
|
||||
* jobs is an array of job objects
|
||||
*/
|
||||
public function addNewJobsToQueue($type, $jobs)
|
||||
{
|
||||
// Checks parameters
|
||||
if (isEmptyString($type)) return error('The provided type parameter is not a valid string');
|
||||
if (isEmptyArray($jobs)) return error('The provided jobs parameter is not a valid array');
|
||||
|
||||
// Get all the job types
|
||||
$dbResult = $this->_ci->JobTypesModel->load();
|
||||
if (isError($dbResult)) return $dbResult;
|
||||
$types = getData($dbResult);
|
||||
|
||||
// If the given type is not present in database
|
||||
if (!$this->_checkJobType($type, $types)) return error('The provided type parameter is not valid');
|
||||
|
||||
$results = $jobs; // returned values
|
||||
$errorOccurred = false; // very optimistic
|
||||
|
||||
// Get all the job statuses
|
||||
$dbResult = $this->_ci->JobStatusesModel->load();
|
||||
if (isError($dbResult)) return $dbResult;
|
||||
$statuses = getData($dbResult);
|
||||
|
||||
// Loops through all the provided jobs
|
||||
foreach ($results as $job)
|
||||
{
|
||||
// If the structure of the job object is valid AND the type is valid AND the status is valid
|
||||
if ($this->_checkNewJobStructure($job) && $this->_checkJobStatus($job, $statuses))
|
||||
{
|
||||
$this->_dropNotAllowedPropertiesNewJob($job); // remove the black listed properties from this object
|
||||
|
||||
$job->{self::PROPERTY_TYPE} = $type; // What you asked is what you get!
|
||||
|
||||
// Try to insert the single job into database
|
||||
$dbNewJobResult = $this->_ci->JobsQueueModel->insert($job);
|
||||
|
||||
// If an error occurred during while inserting in database
|
||||
if (isError($dbNewJobResult))
|
||||
{
|
||||
$job->{self::PROPERTY_ERROR} = getError($dbNewJobResult); // retrieve the cause and store it in job object
|
||||
$errorOccurred = true; // set error occurred flag
|
||||
}
|
||||
else // otherwise
|
||||
{
|
||||
$job->{self::PROPERTY_JOBID} = getData($dbNewJobResult); // get the jobid and store it in job object
|
||||
|
||||
$dbNewTriggeredJobResult = $this->_addNewTriggeredJobToQueue($type, $job, array(self::STATUS_NEW));
|
||||
// If an error occurred during while inserting in database
|
||||
if (isError($dbNewTriggeredJobResult)) return $dbNewTriggeredJobResult;
|
||||
}
|
||||
}
|
||||
else // otherwise
|
||||
{
|
||||
$errorOccurred = true; // set error occurred flag
|
||||
}
|
||||
}
|
||||
|
||||
// If an error occurred then returns the results in an error object
|
||||
if ($errorOccurred) return error($results);
|
||||
|
||||
return success($results); // otherwise return results in a success object
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates jobs already present in the jobs queue
|
||||
* jobs is an array of job objects
|
||||
*/
|
||||
public function updateJobsQueue($type, $jobs)
|
||||
{
|
||||
// Checks parameters
|
||||
if (isEmptyArray($jobs)) return error('The provided jobs parameter is not a valid array');
|
||||
|
||||
$results = $jobs; // returned values
|
||||
$errorOccurred = false; // very optimistic
|
||||
|
||||
// Get all the job statuses
|
||||
$dbResultStatuses = $this->_ci->JobStatusesModel->load();
|
||||
if (isError($dbResultStatuses)) return $dbResultStatuses;
|
||||
$statuses = getData($dbResultStatuses);
|
||||
|
||||
// Loops through all the provided jobs
|
||||
foreach ($results as $job)
|
||||
{
|
||||
// Check if the required job is present in the database
|
||||
$dbResultJobs = $this->_ci->JobsQueueModel->load($job->{self::PROPERTY_JOBID});
|
||||
if (isError($dbResultJobs))
|
||||
{
|
||||
$job->{self::PROPERTY_ERROR} = getError($dbResultJobs); // retrieve the cause and store it in job object
|
||||
$errorOccurred = true; // set error occurred flag
|
||||
}
|
||||
elseif (!hasData($dbResultJobs)) // if no jobs were found
|
||||
{
|
||||
$job->{self::PROPERTY_ERROR} = 'The required job is not present';
|
||||
$errorOccurred = true; // set error occurred flag
|
||||
}
|
||||
else // if a job was found then it could be updated
|
||||
{
|
||||
// If the structure of the job object is valid
|
||||
if ($this->_checkUpdateJobStructure($job) && $this->_checkJobStatus($job, $statuses))
|
||||
{
|
||||
$this->_dropNotAllowedPropertiesUpdateJob($job); // remove the black listed properties from this object
|
||||
|
||||
$job->{self::PROPERTY_TYPE} = $type; // What you asked is what you get!
|
||||
|
||||
// Try to update the single job into database
|
||||
$dbResult = $this->_ci->JobsQueueModel->update($job->{self::PROPERTY_JOBID}, (array)$job);
|
||||
|
||||
// If an error occurred during while updating in database
|
||||
if (isError($dbResult))
|
||||
{
|
||||
$job->{self::PROPERTY_ERROR} = getError($dbResult); // retrieve the cause and store it in job object
|
||||
$errorOccurred = true; // set error occurred flag
|
||||
}
|
||||
else // otherwise
|
||||
{
|
||||
$dbNewTriggeredJobResult = $this->_addNewTriggeredJobToQueue(
|
||||
$type,
|
||||
$job,
|
||||
array($job->status)
|
||||
);
|
||||
// If an error occurred during while inserting in database
|
||||
if (isError($dbNewTriggeredJobResult)) return $dbNewTriggeredJobResult;
|
||||
}
|
||||
}
|
||||
else // otherwise
|
||||
{
|
||||
$errorOccurred = true; // set error occurred flag
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If an error occurred then returns the results in an error object
|
||||
if ($errorOccurred) return error($results);
|
||||
|
||||
return success($results); // otherwise return results in a success object
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Checks the job object structure when needed for insert
|
||||
*/
|
||||
private function _checkNewJobStructure(&$job)
|
||||
{
|
||||
// If job is a valid object and contains the required properties AND does NOT already contain the property error
|
||||
if (is_object($job)
|
||||
&& property_exists($job, self::PROPERTY_STATUS)
|
||||
&& !property_exists($job, self::PROPERTY_ERROR))
|
||||
{
|
||||
return true; // it is valid!
|
||||
}
|
||||
|
||||
// If not object then object it!
|
||||
if (!is_object($job)) $job = new stdClass();
|
||||
|
||||
// If an error property was not already previously stored then store an error message in job object
|
||||
if (!property_exists($job, self::PROPERTY_ERROR))
|
||||
{
|
||||
$job->{self::PROPERTY_ERROR} = 'The structure of the provided job is not valid';
|
||||
}
|
||||
|
||||
return false; // better sorry than wrong
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the job object structure when needed for update
|
||||
*/
|
||||
private function _checkUpdateJobStructure(&$job)
|
||||
{
|
||||
// If job is a valid object
|
||||
if (is_object($job) && property_exists($job, self::PROPERTY_JOBID)) return true; // it is valid!
|
||||
|
||||
// If not object then object it!
|
||||
if (!is_object($job)) $job = new stdClass();
|
||||
|
||||
// If an error property was not already previously stored then store an error message in job object
|
||||
if (!property_exists($job, self::PROPERTY_ERROR))
|
||||
{
|
||||
$job->{self::PROPERTY_ERROR} = 'The structure of the provided job is not valid';
|
||||
}
|
||||
|
||||
return false; // better sorry than wrong
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given job contains a valid type
|
||||
*/
|
||||
private function _checkJobType($type, $types)
|
||||
{
|
||||
return $this->_inArray($type, $types, self::PROPERTY_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given job contains a valid status
|
||||
*/
|
||||
private function _checkJobStatus(&$job, $statuses)
|
||||
{
|
||||
// If the given job doesn't have the property status then it is not valid
|
||||
if (!isset($job->{self::PROPERTY_STATUS}))
|
||||
{
|
||||
$found = false;
|
||||
}
|
||||
else // otherwise test if it valid
|
||||
{
|
||||
$found = $this->_inArray($job->{self::PROPERTY_STATUS}, $statuses, self::PROPERTY_STATUS);
|
||||
}
|
||||
|
||||
// No status was found and does NOT already contain the property error
|
||||
if (!$found && !property_exists($job, self::PROPERTY_ERROR))
|
||||
{
|
||||
$job->{self::PROPERTY_ERROR} = 'The provided status of this job is not valid'; // store the error message in the object
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search in an array the given value
|
||||
* The elements of the given array are objects
|
||||
* The given value is compared with the property specified by the $propertyName parameter of each object of the given array
|
||||
*/
|
||||
private function _inArray($value, $array, $propertyName)
|
||||
{
|
||||
$found = false;
|
||||
|
||||
foreach ($array as $element)
|
||||
{
|
||||
if ($value == $element->{$propertyName})
|
||||
{
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop not allowed properties from the given job
|
||||
*/
|
||||
private function _dropNotAllowedPropertiesNewJob(&$job)
|
||||
{
|
||||
unset($job->{self::PROPERTY_JOBID});
|
||||
unset($job->{self::PROPERTY_CREATIONTIME});
|
||||
unset($job->{self::PROPERTY_TYPE});
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop not allowed properties from the given job
|
||||
*/
|
||||
private function _dropNotAllowedPropertiesUpdateJob(&$job)
|
||||
{
|
||||
unset($job->{self::PROPERTY_CREATIONTIME});
|
||||
unset($job->{self::PROPERTY_TYPE});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add e new triggered job to the jobs queue
|
||||
* NOTE:
|
||||
* - In this method there are less checks compared to addNewJobsToQueue method because
|
||||
* the new jobs that will be added are generate in this method
|
||||
* - Job ids in this case are not returned, therefore the caller is not going to be informed about these new jobs
|
||||
*/
|
||||
private function _addNewTriggeredJobToQueue($type, $job, $triggeredStatuses)
|
||||
{
|
||||
// Get all the job trigggers for the given type and for the given statuses
|
||||
$dbTriggersResult = $this->_ci->JobTriggersModel->getJobtriggersByTypeStatuses($type, $triggeredStatuses);
|
||||
|
||||
// If an error occurred while getting job triggers from database then return it
|
||||
if (isError($dbTriggersResult)) return $dbTriggersResult;
|
||||
if (hasData($dbTriggersResult)) // If triggers were retrieved
|
||||
{
|
||||
// The output of the trigging job is the input of the trigged job
|
||||
$triggeredJobInput = null;
|
||||
if (isset($job->{self::PROPERTY_OUTPUT})) $triggeredJobInput = $job->{self::PROPERTY_OUTPUT};
|
||||
|
||||
// For each trigger
|
||||
foreach (getData($dbTriggersResult) as $trigger)
|
||||
{
|
||||
$triggeredJob = array(
|
||||
self::PROPERTY_TYPE => $trigger->following_type, // the new type is the one defined in tbl_jobtriggers
|
||||
self::PROPERTY_STATUS => self::STATUS_NEW, // new job status is new
|
||||
self::PROPERTY_INPUT => $triggeredJobInput // new job input
|
||||
);
|
||||
|
||||
// Try to insert the single job into database
|
||||
$dbNewJob = $this->_ci->JobsQueueModel->insert($triggeredJob);
|
||||
// If an error occurred during while inserting in database
|
||||
if (isError($dbNewJob)) return $dbNewJob;
|
||||
}
|
||||
}
|
||||
|
||||
return success(); // if here then it was a success!
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ class LDAPLib
|
||||
}
|
||||
|
||||
// LDAP connection
|
||||
$ldapConnection = @ldap_connect($ldapConfigs[self::SERVER], $ldapConfigs[self::PORT]);
|
||||
$ldapConnection = @ldap_connect($ldapConfigs[self::SERVER].':'.$ldapConfigs[self::PORT]);
|
||||
if ($ldapConnection) // if success
|
||||
{
|
||||
// Sets the LDAP protocol version
|
||||
@@ -220,7 +220,9 @@ class LDAPLib
|
||||
}
|
||||
else // Connection error
|
||||
{
|
||||
return error(ldap_error($ldapConnection));
|
||||
return error(
|
||||
'An error occurred while connecting to the LDAP server: '.$ldapConfigs[self::SERVER].':'.$ldapConfigs[self::PORT]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ class LogLib
|
||||
const P_NAME_LINE_INDEX = 'lineIndex';
|
||||
const P_NAME_DB_LOG_TYPE = 'dbLogType';
|
||||
const P_NAME_DB_EXECUTE_USER = 'dbExecuteUser';
|
||||
const P_NAME_REQUEST_ID = 'requestId';
|
||||
const P_NAME_REQUEST_DATA_FORMATTER = 'requestDataFormatter';
|
||||
|
||||
// Properties used to retrieve caller data
|
||||
private $_classIndex;
|
||||
@@ -52,6 +54,9 @@ class LogLib
|
||||
private $_dbLogType;
|
||||
private $_dbExecuteUser;
|
||||
|
||||
private $_requestId; // is it possible to specify a request id when loading this library
|
||||
private $_requestDataFormatter; // is possible to provide a function to format request data
|
||||
|
||||
/**
|
||||
* Set properties to a default value or overwrites them with the given parameters
|
||||
*/
|
||||
@@ -63,7 +68,18 @@ class LogLib
|
||||
$this->_lineIndex = self::LINE_INDEX;
|
||||
$this->_dbLogType = null;
|
||||
$this->_dbExecuteUser = self::DB_EXECUTE_USER;
|
||||
$this->_requestId = null;
|
||||
$this->_requestDataFormatter = null;
|
||||
|
||||
// If parameters are given then overwrite the default values
|
||||
if (!isEmptyArray($params)) $this->setConfigs($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store configuration parameters for this lib
|
||||
*/
|
||||
public function setConfigs($params)
|
||||
{
|
||||
// If parameters are given then overwrite the default values
|
||||
if (!isEmptyArray($params))
|
||||
{
|
||||
@@ -72,6 +88,8 @@ class LogLib
|
||||
if (isset($params[self::P_NAME_LINE_INDEX])) $this->_lineIndex = $params[self::P_NAME_LINE_INDEX];
|
||||
if (isset($params[self::P_NAME_DB_LOG_TYPE])) $this->_dbLogType = $params[self::P_NAME_DB_LOG_TYPE];
|
||||
if (isset($params[self::P_NAME_DB_EXECUTE_USER])) $this->_dbExecuteUser = $params[self::P_NAME_DB_EXECUTE_USER];
|
||||
if (isset($params[self::P_NAME_REQUEST_ID])) $this->_requestId = $params[self::P_NAME_REQUEST_ID];
|
||||
if (isset($params[self::P_NAME_REQUEST_DATA_FORMATTER])) $this->_requestDataFormatter = $params[self::P_NAME_REQUEST_DATA_FORMATTER];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,33 +126,33 @@ class LogLib
|
||||
/**
|
||||
* Writes an info log to database
|
||||
*/
|
||||
public function logInfoDB($requestId, $data)
|
||||
public function logInfoDB($data, $requestId = null)
|
||||
{
|
||||
$this->_logDB(self::INFO, $requestId, $data);
|
||||
$this->_logDB(self::INFO, $data, $requestId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a debug log to database
|
||||
*/
|
||||
public function logDebugDB($requestId, $data)
|
||||
public function logDebugDB($data, $requestId = null)
|
||||
{
|
||||
$this->_logDB(self::DEBUG, $requestId, $data);
|
||||
$this->_logDB(self::DEBUG, $data, $requestId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an warning log to database
|
||||
*/
|
||||
public function logWarningDB($requestId, $data)
|
||||
public function logWarningDB($data, $requestId = null)
|
||||
{
|
||||
$this->_logDB(self::WARNING, $requestId, $data);
|
||||
$this->_logDB(self::WARNING, $data, $requestId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an error log to database
|
||||
*/
|
||||
public function logErrorDB($requestId, $data)
|
||||
public function logErrorDB($data, $requestId = null)
|
||||
{
|
||||
$this->_logDB(self::ERROR, $requestId, $data);
|
||||
$this->_logDB(self::ERROR, $data, $requestId);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
@@ -151,8 +169,15 @@ class LogLib
|
||||
/**
|
||||
* Writes logs to database
|
||||
*/
|
||||
private function _logDB($level, $requestId, $data)
|
||||
private function _logDB($level, $data, $requestId, $executionTime = null)
|
||||
{
|
||||
// If there isn't a valid request id provided during the loading of this library or when any log to db method is called
|
||||
// NOTE: this message will be displayed only to the developer AND stops the execution
|
||||
if (isEmptyString($this->_requestId) && isEmptyString($requestId))
|
||||
{
|
||||
show_error('To log to database you need to specify or give the "'.self::P_NAME_REQUEST_ID.'" parameter when the LogLib is loaded or when log'.ucfirst($level).'DB is called');
|
||||
}
|
||||
|
||||
// If the _dbLogType parameter was not given when this library was loaded
|
||||
// NOTE: this message will be displayed only to the developer AND stops the execution
|
||||
if ($this->_dbLogType == null)
|
||||
@@ -175,14 +200,21 @@ class LogLib
|
||||
// Get caller data
|
||||
$callerData = $this->_getCaller();
|
||||
|
||||
// If a request data formatter was defined then use it
|
||||
$request_data = $data;
|
||||
if ($this->_requestDataFormatter != null && is_callable($this->_requestDataFormatter))
|
||||
{
|
||||
$request_data = call_user_func_array($this->_requestDataFormatter, array($data));
|
||||
}
|
||||
|
||||
// Writes a log to database
|
||||
$ci->WebservicelogModel->insert(array(
|
||||
'webservicetyp_kurzbz' => $this->_dbLogType,
|
||||
'request_id' => $requestId,
|
||||
'request_id' => (!isEmptyString($requestId) ? $requestId : $this->_requestId).' - '.$level,
|
||||
'beschreibung' => $this->_getDatabaseDescription($callerData),
|
||||
'request_data' => $data,
|
||||
'request_data' => $request_data,
|
||||
'execute_user' => $this->_dbExecuteUser,
|
||||
'execute_time' => 'NOW()' // current time
|
||||
'execute_time' => $executionTime == null ? 'NOW()' : $executionTime // default current time, if not otherwise specified
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -251,3 +283,4 @@ class LogLib
|
||||
return $formatted;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ class MessageLib
|
||||
const CFG_OU_RECEIVERS = 'ou_receivers';
|
||||
const CFG_OU_RECEIVERS_NO_NOTICE = 'ou_receivers_no_notice';
|
||||
const CFG_OU_RECEIVERS_PRIVATE = 'ou_receivers_private';
|
||||
const CFG_OU_FUNCTION_WHITELIST = 'ou_function_whitelist';
|
||||
const CFG_REDIRECT_VIEW_MESSAGE_URL = 'redirect_view_message_url';
|
||||
|
||||
// Templates names
|
||||
@@ -214,6 +215,31 @@ class MessageLib
|
||||
|
||||
return $messageVars; // otherwise returns the error
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves message vars of the logged in user from view vw_msg_vars_user
|
||||
*/
|
||||
public function getMessageVarsLoggedInUser()
|
||||
{
|
||||
// Retrieves message vars from view vw_msg_vars
|
||||
$messageVars = $this->_ci->MessageModel->getMsgVarsLoggedInUser();
|
||||
if (isSuccess($messageVars)) // if everything is ok
|
||||
{
|
||||
$variablesArray = array();
|
||||
$tmpVariablesArray = getData($messageVars);
|
||||
|
||||
// Starts from 1 to skip the first element which is uid
|
||||
for ($i = 1; $i < count($tmpVariablesArray); $i++)
|
||||
{
|
||||
$variablesArray['{'.str_replace(' ', '_', strtolower($tmpVariablesArray[$i])).'}']
|
||||
= strtoupper($tmpVariablesArray[$i]);
|
||||
}
|
||||
|
||||
return success($variablesArray);
|
||||
}
|
||||
|
||||
return $messageVars; // otherwise returns the error
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves organisation units for each role that a user plays inside that organisation unit
|
||||
@@ -229,7 +255,14 @@ class MessageLib
|
||||
$ouArray = array();
|
||||
|
||||
// Copies organisation units in $ouArray array
|
||||
foreach (getData($benutzer) as $val) $ouArray[] = $val->oe_kurzbz;
|
||||
foreach (getData($benutzer) as $val)
|
||||
{
|
||||
// If the function is in the white list then get the organisation unit
|
||||
if (in_array($val->funktion_kurzbz, $this->_ci->config->item(self::CFG_OU_FUNCTION_WHITELIST)))
|
||||
{
|
||||
$ouArray[] = $val->oe_kurzbz;
|
||||
}
|
||||
}
|
||||
|
||||
return success($ouArray);
|
||||
}
|
||||
@@ -587,11 +620,24 @@ class MessageLib
|
||||
$this->_ci->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
|
||||
// And the receiver has an active account for the given organisation unit
|
||||
$benutzerResult = $this->_ci->BenutzerModel->getActiveUserByPersonIdAndOrganisationUnit($message->receiver_id, $message->sender_ou);
|
||||
$benutzerResult = $this->_ci->BenutzerModel->getActiveUserByPersonIdAndOrganisationUnit(
|
||||
$message->receiver_id,
|
||||
$message->sender_ou
|
||||
);
|
||||
|
||||
if (isError($benutzerResult)) return $benutzerResult; // if an error occured then return it
|
||||
|
||||
// Use the uid + domain email
|
||||
if (hasData($benutzerResult)) $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN;
|
||||
// If an active user for the given organization unit was found
|
||||
if (hasData($benutzerResult))
|
||||
{
|
||||
// Checks if the user was NOT created in the last 24 hours
|
||||
if (getData($benutzerResult)[0]->insertamum < date('Y-m-d H:i:s', strtotime('-1 day')))
|
||||
{
|
||||
// Use the uid + domain email
|
||||
$message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN;
|
||||
}
|
||||
// otherwise do NOT use the internal email account
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise try with the private email
|
||||
@@ -636,7 +682,7 @@ class MessageLib
|
||||
// If there are presetudent
|
||||
if (hasData($prestudentResults))
|
||||
{
|
||||
$inArray = true;
|
||||
$privateOnly = false;
|
||||
$organisationUnits = getData($prestudentResults);
|
||||
|
||||
// Look if any of the organization units of this prestudent are in the list of the
|
||||
@@ -644,16 +690,21 @@ class MessageLib
|
||||
foreach ($organisationUnits as $organisationUnit)
|
||||
{
|
||||
// If the recipient organisation unit is NOT in the list of organisation units that sent only to private emails
|
||||
// NOTE: done in this way because it is easyer to check the result of array_search
|
||||
if (array_search($organisationUnit, $this->_ci->config->item(self::CFG_OU_RECEIVERS_PRIVATE)) === false)
|
||||
{
|
||||
$inArray = false;
|
||||
// NOP
|
||||
}
|
||||
else // otherwise If the recipient organisation unit is the list of organisation units that sent only to private emails
|
||||
{
|
||||
$privateOnly = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the recipient prestudent organization unit is not in in the list of the
|
||||
// organization units that will not send the notice email to the internal account
|
||||
if (!$inArray)
|
||||
if ($privateOnly)
|
||||
{
|
||||
// Then use the private email
|
||||
$privateEmailResult = $this->_getPrivateEmail($message->receiver_id);
|
||||
@@ -668,10 +719,37 @@ class MessageLib
|
||||
$this->_ci->BenutzerModel->addOrder('updateamum', 'DESC');
|
||||
$this->_ci->BenutzerModel->addOrder('insertamum', 'DESC');
|
||||
|
||||
$benutzerResult = $this->_ci->BenutzerModel->loadWhere(array('person_id' => $message->receiver_id));
|
||||
$benutzerResult = $this->_ci->BenutzerModel->loadWhere(
|
||||
array(
|
||||
'person_id' => $message->receiver_id
|
||||
)
|
||||
);
|
||||
if (isError($benutzerResult)) return $benutzerResult; // if an error occured then return it
|
||||
|
||||
$message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; // Use the uid + domain email
|
||||
// If an active user for the given organization unit was found
|
||||
if (hasData($benutzerResult))
|
||||
{
|
||||
// For each benutzer found for this person
|
||||
foreach (getData($benutzerResult) as $benutzer)
|
||||
{
|
||||
// Checks if the user was NOT created in the last 24 hours
|
||||
if (getData($benutzerResult)[0]->insertamum < date('Y-m-d H:i:s', strtotime('-1 day')))
|
||||
{
|
||||
// Use the uid + domain as email address
|
||||
$message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise try with the private email
|
||||
if (isEmptyString($message->receiverContact))
|
||||
{
|
||||
// Then use the private email
|
||||
$privateEmailResult = $this->_getPrivateEmail($message->receiver_id);
|
||||
if (isError($privateEmailResult)) return $privateEmailResult; // if an error occured then return it
|
||||
|
||||
if (hasData($privateEmailResult)) $message->receiverContact = getData($privateEmailResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class PermissionLib
|
||||
|
||||
$accessType = '';
|
||||
|
||||
// Checks if the required access type is compliant with the HTTP method (GET => r, POST => w)
|
||||
// Set the access type
|
||||
if (strpos($requiredAccessType, PermissionLib::READ_RIGHT) !== false)
|
||||
{
|
||||
$accessType = PermissionLib::SELECT_RIGHT; // S
|
||||
@@ -184,12 +184,12 @@ class PermissionLib
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('The given permission array does not contain the called method or is not correctly set');
|
||||
show_error('The given permission array does not contain the given method or is not correctly set');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('You must give the permissions array as parameter to the constructor of the controller');
|
||||
show_error('The given permissions is not a valid array or it is an empty one');
|
||||
}
|
||||
|
||||
return $checkPermissions;
|
||||
|
||||
+284
-119
@@ -3,15 +3,20 @@
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Library to manage UDF
|
||||
* Library to manage UDFs
|
||||
*/
|
||||
class UDFLib
|
||||
{
|
||||
const WIDGET_NAME = 'UDFWidget';
|
||||
const SCHEMA_ARG_NAME = 'schema';
|
||||
const TABLE_ARG_NAME = 'table';
|
||||
const FIELD_ARG_NAME = 'field';
|
||||
const UDFS_ARG_NAME = 'udfs';
|
||||
const UDF_UNIQUE_ID = 'udfUniqueId'; // Name of the UDF widget unique id
|
||||
|
||||
const SESSION_NAME = 'FHC_UDF_WIDGET'; // Name of the session area used for UDFs
|
||||
|
||||
// Parameters names
|
||||
const WIDGET_NAME = 'UDFWidget'; // UDFWidget name
|
||||
const SCHEMA_ARG_NAME = 'schema'; // Schema parameter name
|
||||
const TABLE_ARG_NAME = 'table'; // Table parameter name
|
||||
const FIELD_ARG_NAME = 'field'; // Field parameter name
|
||||
const UDFS_ARG_NAME = 'udfs'; // UDFs parameter name
|
||||
|
||||
// UDF json schema attributes
|
||||
const NAME = 'name'; // UDF name attribute
|
||||
@@ -22,6 +27,16 @@ class UDFLib
|
||||
const FE_REGEX_LANGUAGE = 'js'; // UDF javascript regex language attribute (front end)
|
||||
const BE_REGEX_LANGUAGE = 'php'; // UDF php regex language attribute (back end)
|
||||
|
||||
// ...to specify permissions that are needed to use this TableWidget
|
||||
const REQUIRED_PERMISSIONS_PARAMETER = 'requiredPermissions';
|
||||
|
||||
// ...to specify the primary key name and value
|
||||
const PRIMARY_KEY_NAME = 'primaryKeyName';
|
||||
const PRIMARY_KEY_VALUE = 'primaryKeyValue';
|
||||
|
||||
const PERMISSION_TABLE_METHOD = 'UDFWidget'; // Name for fake method to be checked by the PermissionLib
|
||||
const PERMISSION_TYPE = 'rw';
|
||||
|
||||
// HTML components
|
||||
const LABEL = 'title';
|
||||
const TITLE = 'description';
|
||||
@@ -47,8 +62,10 @@ class UDFLib
|
||||
|
||||
private $_ci; // Code igniter instance
|
||||
|
||||
private $_udfUniqueId; // Property that contains the UDF widget unique id
|
||||
|
||||
/**
|
||||
* Loads fhc helper
|
||||
* Gets CI instance
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -63,8 +80,8 @@ class UDFLib
|
||||
*/
|
||||
public function UDFWidget($args, $htmlArgs = array())
|
||||
{
|
||||
if ((isset($args[UDFLib::SCHEMA_ARG_NAME]) && !isEmptyString($args[UDFLib::SCHEMA_ARG_NAME]))
|
||||
&& (isset($args[UDFLib::TABLE_ARG_NAME]) && !isEmptyString($args[UDFLib::TABLE_ARG_NAME])))
|
||||
if ((isset($args[self::SCHEMA_ARG_NAME]) && !isEmptyString($args[self::SCHEMA_ARG_NAME]))
|
||||
&& (isset($args[self::TABLE_ARG_NAME]) && !isEmptyString($args[self::TABLE_ARG_NAME])))
|
||||
{
|
||||
// Loads the widget library
|
||||
$this->_ci->load->library('WidgetLib');
|
||||
@@ -73,26 +90,26 @@ class UDFLib
|
||||
loadResource(APPPATH.'widgets/udf');
|
||||
|
||||
// Default external block is true
|
||||
if (!isset($args[UDFLib::FIELD_ARG_NAME]) && !isset($htmlArgs[HTMLWidget::EXTERNAL_BLOCK]))
|
||||
if (!isset($args[self::FIELD_ARG_NAME]) && !isset($htmlArgs[HTMLWidget::EXTERNAL_BLOCK]))
|
||||
{
|
||||
$htmlArgs[HTMLWidget::EXTERNAL_BLOCK] = true;
|
||||
}
|
||||
|
||||
return $this->_ci->widgetlib->widget(
|
||||
UDFLib::WIDGET_NAME,
|
||||
self::WIDGET_NAME,
|
||||
$args,
|
||||
$htmlArgs
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isset($args[UDFLib::SCHEMA_ARG_NAME]) || isEmptyString($args[UDFLib::SCHEMA_ARG_NAME]))
|
||||
if (!isset($args[self::SCHEMA_ARG_NAME]) || isEmptyString($args[self::SCHEMA_ARG_NAME]))
|
||||
{
|
||||
show_error(UDFLib::SCHEMA_ARG_NAME.' parameter is missing!');
|
||||
show_error(self::SCHEMA_ARG_NAME.' parameter is missing!');
|
||||
}
|
||||
if (!isset($args[UDFLib::TABLE_ARG_NAME]) || isEmptyString($args[UDFLib::TABLE_ARG_NAME]))
|
||||
if (!isset($args[self::TABLE_ARG_NAME]) || isEmptyString($args[self::TABLE_ARG_NAME]))
|
||||
{
|
||||
show_error(UDFLib::TABLE_ARG_NAME.' parameter is missing!');
|
||||
show_error(self::TABLE_ARG_NAME.' parameter is missing!');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,12 +122,12 @@ class UDFLib
|
||||
*/
|
||||
public function displayUDFWidget(&$widgetData)
|
||||
{
|
||||
$schema = $widgetData[UDFLib::SCHEMA_ARG_NAME]; // schema attribute
|
||||
$table = $widgetData[UDFLib::TABLE_ARG_NAME]; // table attribute
|
||||
$schema = $widgetData[self::SCHEMA_ARG_NAME]; // schema attribute
|
||||
$table = $widgetData[self::TABLE_ARG_NAME]; // table attribute
|
||||
|
||||
if (isset($widgetData[UDFLib::FIELD_ARG_NAME]))
|
||||
if (isset($widgetData[self::FIELD_ARG_NAME]))
|
||||
{
|
||||
$field = $widgetData[UDFLib::FIELD_ARG_NAME]; // UDF name
|
||||
$field = $widgetData[self::FIELD_ARG_NAME]; // UDF name
|
||||
}
|
||||
|
||||
$udfResults = $this->_loadUDF($schema, $table); // loads UDF definition
|
||||
@@ -122,6 +139,9 @@ class UDFLib
|
||||
$jsonSchemas = json_decode($udf->jsons); // decode the json schema
|
||||
if (is_object($jsonSchemas) || is_array($jsonSchemas))
|
||||
{
|
||||
//
|
||||
$this->_printStartUDFBlock($widgetData);
|
||||
|
||||
// If the schema is an object then convert it into an array
|
||||
if (is_object($jsonSchemas))
|
||||
{
|
||||
@@ -140,18 +160,18 @@ class UDFLib
|
||||
foreach ($jsonSchemasArray as $jsonSchema)
|
||||
{
|
||||
// If the type property is not present then show an error
|
||||
if (!isset($jsonSchema->{UDFLib::TYPE}))
|
||||
if (!isset($jsonSchema->{self::TYPE}))
|
||||
{
|
||||
show_error(sprintf('%s.%s: Attribute "type" not present in the json schema', $schema, $table));
|
||||
}
|
||||
// If the name property is not present then show an error
|
||||
if (!isset($jsonSchema->{UDFLib::NAME}))
|
||||
if (!isset($jsonSchema->{self::NAME}))
|
||||
{
|
||||
show_error(sprintf('%s.%s: Attribute "name" not present in the json schema', $schema, $table));
|
||||
}
|
||||
|
||||
// If a UDF is specified and is present in the json schemas list or no UDF is specified
|
||||
if ((isset($field) && $field == $jsonSchema->{UDFLib::NAME}) || !isset($field))
|
||||
if ((isset($field) && $field == $jsonSchema->{self::NAME}) || !isset($field))
|
||||
{
|
||||
// Set attributes using phrases
|
||||
$this->_setAttributesWithPhrases($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]);
|
||||
@@ -166,7 +186,7 @@ class UDFLib
|
||||
$this->_render($jsonSchema, $widgetData);
|
||||
|
||||
// If a UDf is specified and it was found then stop looking through this list
|
||||
if (isset($field) && $field == $jsonSchema->{UDFLib::NAME})
|
||||
if (isset($field) && $field == $jsonSchema->{self::NAME})
|
||||
{
|
||||
$found = true;
|
||||
break;
|
||||
@@ -179,6 +199,9 @@ class UDFLib
|
||||
{
|
||||
show_error(sprintf('%s.%s: No schema present for field: %s', $schema, $table, $field));
|
||||
}
|
||||
|
||||
//
|
||||
$this->_printEndUDFBlock();
|
||||
}
|
||||
else // not a valid schema
|
||||
{
|
||||
@@ -218,7 +241,7 @@ class UDFLib
|
||||
|
||||
// Decodes json that define the UDFs for this table
|
||||
$decodedUDFDefinitions = json_decode(
|
||||
$resultUDFsDefinitions->retval[0]->{UDFLib::COLUMN_JSON_DESCRIPTION}
|
||||
$resultUDFsDefinitions->retval[0]->{self::COLUMN_JSON_DESCRIPTION}
|
||||
);
|
||||
|
||||
// Loops through the UDFs definitions
|
||||
@@ -232,28 +255,28 @@ class UDFLib
|
||||
$tmpValidate = success(true); // temporary variable used to store the returned value from _validateUDFs
|
||||
|
||||
// If this is the definition of this UDF
|
||||
if ($decodedUDFDefinition->{UDFLib::NAME} == $key)
|
||||
if ($decodedUDFDefinition->{self::NAME} == $key)
|
||||
{
|
||||
if (isset($decodedUDFDefinition->{UDFLib::VALIDATION})) // If validation rules are present for this UDF
|
||||
if (isset($decodedUDFDefinition->{self::VALIDATION})) // If validation rules are present for this UDF
|
||||
{
|
||||
// Checks if the given UDF is required and the result will be stored in $chkRequiredPassed
|
||||
// If $chkRequiredPassed == true => required check passed
|
||||
// If $chkRequiredPassed == false => required check NOT passed
|
||||
$chkRequiredPassed = true;
|
||||
// If required property is present in the UDF description and it is true
|
||||
if (isset($decodedUDFDefinition->{UDFLib::VALIDATION}->{UDFLib::REQUIRED})
|
||||
&& $decodedUDFDefinition->{UDFLib::VALIDATION}->{UDFLib::REQUIRED} === true)
|
||||
if (isset($decodedUDFDefinition->{self::VALIDATION}->{self::REQUIRED})
|
||||
&& $decodedUDFDefinition->{self::VALIDATION}->{self::REQUIRED} === true)
|
||||
{
|
||||
// If this UDF is a checkbox and the given value is false
|
||||
// OR
|
||||
// if this UDF is NOT a checkbox and the given value is null
|
||||
if (($decodedUDFDefinition->{UDFLib::TYPE} == UDFLib::CHKBOX_TYPE && $val === false)
|
||||
|| ($decodedUDFDefinition->{UDFLib::TYPE} != UDFLib::CHKBOX_TYPE && $val == null))
|
||||
// if this UD7F is NOT a checkbox and the given value is null
|
||||
if (($decodedUDFDefinition->{self::TYPE} == self::CHKBOX_TYPE && $val === false)
|
||||
|| ($decodedUDFDefinition->{self::TYPE} != self::CHKBOX_TYPE && $val == null))
|
||||
{
|
||||
$chkRequiredPassed = false; // not passed
|
||||
// A new error is generated and added to array $requiredUDFsArray
|
||||
$requiredUDFsArray[$decodedUDFDefinition->{UDFLib::NAME}] = error(
|
||||
$decodedUDFDefinition->{UDFLib::NAME},
|
||||
$requiredUDFsArray[$decodedUDFDefinition->{self::NAME}] = error(
|
||||
$decodedUDFDefinition->{self::NAME},
|
||||
EXIT_VALIDATION_UDF_REQUIRED
|
||||
);
|
||||
}
|
||||
@@ -267,22 +290,22 @@ class UDFLib
|
||||
// If $toBeValidated == false => validation is NOT performed
|
||||
$toBeValidated = false;
|
||||
// If this UDF is NOT a checkbox
|
||||
if ($decodedUDFDefinition->{UDFLib::TYPE} != UDFLib::CHKBOX_TYPE)
|
||||
if ($decodedUDFDefinition->{self::TYPE} != self::CHKBOX_TYPE)
|
||||
{
|
||||
// If required property is NOT present in the UDF description
|
||||
if (!isset($decodedUDFDefinition->{UDFLib::VALIDATION}->{UDFLib::REQUIRED}))
|
||||
if (!isset($decodedUDFDefinition->{self::VALIDATION}->{self::REQUIRED}))
|
||||
{
|
||||
$toBeValidated = true;
|
||||
}
|
||||
// If required property is present in the UDF description and it is true
|
||||
if (isset($decodedUDFDefinition->{UDFLib::VALIDATION}->{UDFLib::REQUIRED})
|
||||
&& $decodedUDFDefinition->{UDFLib::VALIDATION}->{UDFLib::REQUIRED} === true)
|
||||
if (isset($decodedUDFDefinition->{self::VALIDATION}->{self::REQUIRED})
|
||||
&& $decodedUDFDefinition->{self::VALIDATION}->{self::REQUIRED} === true)
|
||||
{
|
||||
$toBeValidated = true;
|
||||
}
|
||||
// If required property is present in the UDF description and it is true and the given value is null
|
||||
if (isset($decodedUDFDefinition->{UDFLib::VALIDATION}->{UDFLib::REQUIRED})
|
||||
&& $decodedUDFDefinition->{UDFLib::VALIDATION}->{UDFLib::REQUIRED} === false
|
||||
if (isset($decodedUDFDefinition->{self::VALIDATION}->{self::REQUIRED})
|
||||
&& $decodedUDFDefinition->{self::VALIDATION}->{self::REQUIRED} === false
|
||||
&& $val != null)
|
||||
{
|
||||
$toBeValidated = true;
|
||||
@@ -292,8 +315,8 @@ class UDFLib
|
||||
if ($toBeValidated === true) // Checks if validation should be performed
|
||||
{
|
||||
$tmpValidate = $this->_validateUDFs(
|
||||
$decodedUDFDefinition->{UDFLib::VALIDATION},
|
||||
$decodedUDFDefinition->{UDFLib::NAME},
|
||||
$decodedUDFDefinition->{self::VALIDATION},
|
||||
$decodedUDFDefinition->{self::NAME},
|
||||
$val
|
||||
);
|
||||
}
|
||||
@@ -341,7 +364,7 @@ class UDFLib
|
||||
if ($encodedToBeStoredUDFs !== false) // if encode was ok
|
||||
{
|
||||
// Save the supplied UDFs values
|
||||
$data[UDFLib::COLUMN_NAME] = $encodedToBeStoredUDFs;
|
||||
$data[self::COLUMN_NAME] = $encodedToBeStoredUDFs;
|
||||
}
|
||||
}
|
||||
else // otherwise the returning value will be the list of UDFs validation errors
|
||||
@@ -360,8 +383,8 @@ class UDFLib
|
||||
{
|
||||
$isUDFColumn = false;
|
||||
|
||||
if (substr($columnName, 0, strlen(UDFLib::COLUMN_PREFIX)) == UDFLib::COLUMN_PREFIX
|
||||
&& $columnType == UDFLib::COLUMN_TYPE)
|
||||
if (substr($columnName, 0, strlen(self::COLUMN_PREFIX)) == self::COLUMN_PREFIX
|
||||
&& $columnType == self::COLUMN_TYPE)
|
||||
{
|
||||
$isUDFColumn = true;
|
||||
}
|
||||
@@ -369,9 +392,151 @@ class UDFLib
|
||||
return $isUDFColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the _udfUniqueId property
|
||||
*/
|
||||
public function setUDFUniqueId($udfUniqueId)
|
||||
{
|
||||
$this->_udfUniqueId = $udfUniqueId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an unique string that identify this UDF widget
|
||||
* NOTE: The default value is the URI where the FilterWidget is called
|
||||
* If the fhc_controller_id is present then is also used
|
||||
*/
|
||||
public function setUDFUniqueIdByParams($params)
|
||||
{
|
||||
if ($params != null
|
||||
&& is_array($params)
|
||||
&& isset($params[self::UDF_UNIQUE_ID])
|
||||
&& !isEmptyString($params[self::UDF_UNIQUE_ID]))
|
||||
{
|
||||
$udfUniqueId = $this->_ci->router->directory.$this->_ci->router->class.'/'.
|
||||
$this->_ci->router->method.'/'.
|
||||
$params[self::UDF_UNIQUE_ID];
|
||||
|
||||
$this->setUDFUniqueId($udfUniqueId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to retrieve the whole session for this UDF widget
|
||||
*/
|
||||
public function getSession()
|
||||
{
|
||||
return getSessionElement(self::SESSION_NAME, $this->_udfUniqueId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to retrieve one element from the session of this UDF widget
|
||||
*/
|
||||
public function getSessionElement($name)
|
||||
{
|
||||
$session = getSessionElement(self::SESSION_NAME, $this->_udfUniqueId);
|
||||
|
||||
if (isset($session[$name]))
|
||||
{
|
||||
return $session[$name];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to set the whole session for this UDF widget
|
||||
*/
|
||||
public function setSession($data)
|
||||
{
|
||||
setSessionElement(self::SESSION_NAME, $this->_udfUniqueId, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to set one element in the session for this UDF widget
|
||||
*/
|
||||
public function setSessionElement($name, $value)
|
||||
{
|
||||
$session = getSessionElement(self::SESSION_NAME, $this->_udfUniqueId);
|
||||
|
||||
$session[$name] = $value;
|
||||
|
||||
setSessionElement(self::SESSION_NAME, $this->_udfUniqueId, $session); // stores the single value
|
||||
}
|
||||
|
||||
/**
|
||||
* Save UDFs
|
||||
*/
|
||||
public function saveUDFs($udfUniqueId, $udfs)
|
||||
{
|
||||
// Read the all session for this udf widget
|
||||
$session = $this->getSession();
|
||||
|
||||
// If session is empty then return an error
|
||||
if ($session == null) return error('No UDFWidget loaded');
|
||||
|
||||
// Workaround to load CI
|
||||
$this->_ci->load->model('system/UDF_model', 'UDFModel');
|
||||
|
||||
// Initialize a new DB_Model
|
||||
$dbModel = new DB_Model();
|
||||
|
||||
// Setup the new dbModel object with...
|
||||
$dbModel->setup(
|
||||
$session[self::SCHEMA_ARG_NAME], // ... schema...
|
||||
$session[self::TABLE_ARG_NAME], // ...table...
|
||||
$session[self::PRIMARY_KEY_NAME] // ...and primary key name
|
||||
);
|
||||
|
||||
// Returns the result of the database update operation to save UDFs
|
||||
return $dbModel->update(
|
||||
array($session[self::PRIMARY_KEY_NAME] => $session[self::PRIMARY_KEY_VALUE]),
|
||||
(array)$udfs
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if at least one of the permissions given as parameter (requiredPermissions) belongs
|
||||
* to the authenticated user, if confirmed then is allowed to use this UDFWidget.
|
||||
* If the parameter requiredPermissions is NOT given or is not present in the session,
|
||||
* then NO one is allow to use this UDFWidget
|
||||
* Wrapper method to permissionlib->hasAtLeastOne
|
||||
*/
|
||||
public function isAllowed($requiredPermissions = null)
|
||||
{
|
||||
$this->_ci->load->library('PermissionLib'); // Load permission library
|
||||
|
||||
// Gets the required permissions from the session if they are not provided as parameter
|
||||
$rq = $requiredPermissions;
|
||||
if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS_PARAMETER);
|
||||
|
||||
return $this->_ci->permissionlib->hasAtLeastOne($rq, self::PERMISSION_TABLE_METHOD, self::PERMISSION_TYPE);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Print the block for UDFs
|
||||
*/
|
||||
private function _printStartUDFBlock($widgetData)
|
||||
{
|
||||
$startBlock = '<div type="%s" udfUniqueId="%s">'."\n";
|
||||
|
||||
echo sprintf(
|
||||
$startBlock,
|
||||
self::WIDGET_NAME,
|
||||
$widgetData[self::UDF_UNIQUE_ID]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the end of the UDFs block
|
||||
*/
|
||||
private function _printEndUDFBlock()
|
||||
{
|
||||
echo '</div>'."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Move UDFs from $data to $UDFs
|
||||
*/
|
||||
@@ -381,7 +546,7 @@ class UDFLib
|
||||
|
||||
foreach ($data as $key => $val)
|
||||
{
|
||||
if (substr($key, 0, 4) == UDFLib::COLUMN_PREFIX)
|
||||
if (substr($key, 0, 4) == self::COLUMN_PREFIX)
|
||||
{
|
||||
$udfsParameters[$key] = $val; // stores UDF value into property UDFs
|
||||
unset($data[$key]); // remove from data
|
||||
@@ -416,8 +581,8 @@ class UDFLib
|
||||
{
|
||||
// If min value attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{UDFLib::MIN_VALUE})
|
||||
&& $udfVal < $decodedUDFValidation->{UDFLib::MIN_VALUE})
|
||||
if (isset($decodedUDFValidation->{self::MIN_VALUE})
|
||||
&& $udfVal < $decodedUDFValidation->{self::MIN_VALUE})
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MIN_VALUE);
|
||||
@@ -425,8 +590,8 @@ class UDFLib
|
||||
|
||||
// If max value attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{UDFLib::MAX_VALUE})
|
||||
&& $udfVal > $decodedUDFValidation->{UDFLib::MAX_VALUE})
|
||||
if (isset($decodedUDFValidation->{self::MAX_VALUE})
|
||||
&& $udfVal > $decodedUDFValidation->{self::MAX_VALUE})
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MAX_VALUE);
|
||||
@@ -436,8 +601,8 @@ class UDFLib
|
||||
$strUdfVal = strval($udfVal); // store in $strUdfVal the string conversion of $udfVal
|
||||
// If min length attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{UDFLib::MIN_LENGTH}) && isset($strUdfVal)
|
||||
&& strlen($strUdfVal) < $decodedUDFValidation->{UDFLib::MIN_LENGTH})
|
||||
if (isset($decodedUDFValidation->{self::MIN_LENGTH}) && isset($strUdfVal)
|
||||
&& strlen($strUdfVal) < $decodedUDFValidation->{self::MIN_LENGTH})
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MIN_LENGTH);
|
||||
@@ -445,8 +610,8 @@ class UDFLib
|
||||
|
||||
// If max length attribute is present in the validation for this UDF,
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{UDFLib::MAX_LENGTH}) && isset($strUdfVal)
|
||||
&& strlen($strUdfVal) > $decodedUDFValidation->{UDFLib::MAX_LENGTH})
|
||||
if (isset($decodedUDFValidation->{self::MAX_LENGTH}) && isset($strUdfVal)
|
||||
&& strlen($strUdfVal) > $decodedUDFValidation->{self::MAX_LENGTH})
|
||||
{
|
||||
// validation is failed and the error is stored in $returnArrayValidation
|
||||
$returnArrayValidation[] = error($udfName, EXIT_VALIDATION_UDF_MAX_LENGTH);
|
||||
@@ -457,12 +622,12 @@ class UDFLib
|
||||
{
|
||||
// Search for a php regular expression in the validation of this UDF, if one is found
|
||||
// then checks if the value of this UDF is compliant to this attribute
|
||||
if (isset($decodedUDFValidation->{UDFLib::REGEX})
|
||||
&& is_array($decodedUDFValidation->{UDFLib::REGEX}))
|
||||
if (isset($decodedUDFValidation->{self::REGEX})
|
||||
&& is_array($decodedUDFValidation->{self::REGEX}))
|
||||
{
|
||||
foreach ($decodedUDFValidation->{UDFLib::REGEX} as $regexIndx => $regex)
|
||||
foreach ($decodedUDFValidation->{self::REGEX} as $regexIndx => $regex)
|
||||
{
|
||||
if ($regex->language == UDFLib::BE_REGEX_LANGUAGE)
|
||||
if ($regex->language == self::BE_REGEX_LANGUAGE)
|
||||
{
|
||||
if (preg_match($regex->expression, $udfVal) != 1)
|
||||
{
|
||||
@@ -494,8 +659,8 @@ class UDFLib
|
||||
*/
|
||||
private function _setNameAndId($jsonSchema, &$htmlParameters)
|
||||
{
|
||||
$htmlParameters[HTMLWidget::HTML_ID] = $jsonSchema->{UDFLib::NAME};
|
||||
$htmlParameters[HTMLWidget::HTML_NAME] = $jsonSchema->{UDFLib::NAME};
|
||||
$htmlParameters[HTMLWidget::HTML_ID] = $jsonSchema->{self::NAME};
|
||||
$htmlParameters[HTMLWidget::HTML_NAME] = $jsonSchema->{self::NAME};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -504,20 +669,20 @@ class UDFLib
|
||||
private function _sortJsonSchemas(&$jsonSchemasArray)
|
||||
{
|
||||
usort($jsonSchemasArray, function ($a, $b) {
|
||||
if (!isset($a->{UDFLib::SORT}))
|
||||
if (!isset($a->{self::SORT}))
|
||||
{
|
||||
$a->{UDFLib::SORT} = 9999;
|
||||
$a->{self::SORT} = 9999;
|
||||
}
|
||||
if (!isset($b->{UDFLib::SORT}))
|
||||
if (!isset($b->{self::SORT}))
|
||||
{
|
||||
$b->{UDFLib::SORT} = 9999;
|
||||
$b->{self::SORT} = 9999;
|
||||
}
|
||||
if ($a->{UDFLib::SORT} == $b->{UDFLib::SORT})
|
||||
if ($a->{self::SORT} == $b->{self::SORT})
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a->{UDFLib::SORT} < $b->{UDFLib::SORT}) ? -1 : 1;
|
||||
return ($a->{self::SORT} < $b->{self::SORT}) ? -1 : 1;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -565,32 +730,32 @@ class UDFLib
|
||||
private function _render($jsonSchema, &$widgetData)
|
||||
{
|
||||
// Checkbox
|
||||
if ($jsonSchema->{UDFLib::TYPE} == 'checkbox')
|
||||
if ($jsonSchema->{self::TYPE} == 'checkbox')
|
||||
{
|
||||
$this->_renderCheckbox($jsonSchema, $widgetData);
|
||||
}
|
||||
// Textfield
|
||||
elseif ($jsonSchema->{UDFLib::TYPE} == 'textfield')
|
||||
elseif ($jsonSchema->{self::TYPE} == 'textfield')
|
||||
{
|
||||
$this->_renderTextfield($jsonSchema, $widgetData);
|
||||
}
|
||||
// Textarea
|
||||
elseif ($jsonSchema->{UDFLib::TYPE} == 'textarea')
|
||||
elseif ($jsonSchema->{self::TYPE} == 'textarea')
|
||||
{
|
||||
$this->_renderTextarea($jsonSchema, $widgetData);
|
||||
}
|
||||
// Date
|
||||
elseif ($jsonSchema->{UDFLib::TYPE} == 'date')
|
||||
elseif ($jsonSchema->{self::TYPE} == 'date')
|
||||
{
|
||||
// To be done
|
||||
}
|
||||
// Dropdown
|
||||
elseif ($jsonSchema->{UDFLib::TYPE} == 'dropdown')
|
||||
elseif ($jsonSchema->{self::TYPE} == 'dropdown')
|
||||
{
|
||||
$this->_renderDropdown($jsonSchema, $widgetData);
|
||||
}
|
||||
// Multiple dropdown
|
||||
elseif ($jsonSchema->{UDFLib::TYPE} == 'multipledropdown')
|
||||
elseif ($jsonSchema->{self::TYPE} == 'multipledropdown')
|
||||
{
|
||||
$this->_renderDropdown($jsonSchema, $widgetData, true);
|
||||
}
|
||||
@@ -602,29 +767,29 @@ class UDFLib
|
||||
private function _renderDropdown($jsonSchema, &$widgetData, $multiple = false)
|
||||
{
|
||||
// Selected element/s
|
||||
if (isset($widgetData[UDFLib::UDFS_ARG_NAME])
|
||||
&& isset($widgetData[UDFLib::UDFS_ARG_NAME][$jsonSchema->{UDFLib::NAME}]))
|
||||
if (isset($widgetData[self::UDFS_ARG_NAME])
|
||||
&& isset($widgetData[self::UDFS_ARG_NAME][$jsonSchema->{self::NAME}]))
|
||||
{
|
||||
$widgetData[DropdownWidget::SELECTED_ELEMENT] = $widgetData[UDFLib::UDFS_ARG_NAME][$jsonSchema->{UDFLib::NAME}];
|
||||
$widgetData[DropdownWidget::SELECTED_ELEMENT] = $widgetData[self::UDFS_ARG_NAME][$jsonSchema->{self::NAME}];
|
||||
}
|
||||
else
|
||||
{
|
||||
$widgetData[DropdownWidget::SELECTED_ELEMENT] = null;
|
||||
}
|
||||
|
||||
$dropdownWidgetUDF = new DropdownWidgetUDF(UDFLib::WIDGET_NAME, $widgetData);
|
||||
$dropdownWidgetUDF = new DropdownWidgetUDF(self::WIDGET_NAME, $widgetData);
|
||||
$parameters = array();
|
||||
|
||||
// If the list of values to show is an array
|
||||
if (isset($jsonSchema->{UDFLib::LIST_VALUES}->enum))
|
||||
if (isset($jsonSchema->{self::LIST_VALUES}->enum))
|
||||
{
|
||||
$parameters = $jsonSchema->{UDFLib::LIST_VALUES}->enum;
|
||||
$parameters = $jsonSchema->{self::LIST_VALUES}->enum;
|
||||
}
|
||||
// If the list of values to show should be retrieved with a SQL statement
|
||||
elseif (isset($jsonSchema->{UDFLib::LIST_VALUES}->sql))
|
||||
elseif (isset($jsonSchema->{self::LIST_VALUES}->sql))
|
||||
{
|
||||
// UDFModel is loaded in method _loadUDF that is called before the current method
|
||||
$queryResult = $this->_ci->UDFModel->execReadOnlyQuery($jsonSchema->{UDFLib::LIST_VALUES}->sql);
|
||||
$queryResult = $this->_ci->UDFModel->execReadOnlyQuery($jsonSchema->{self::LIST_VALUES}->sql);
|
||||
if (hasData($queryResult))
|
||||
{
|
||||
$parameters = $queryResult->retval;
|
||||
@@ -645,13 +810,13 @@ class UDFLib
|
||||
private function _renderTextarea($jsonSchema, &$widgetData)
|
||||
{
|
||||
$text = null; // text value
|
||||
$textareaUDF = new TextareaWidgetUDF(UDFLib::WIDGET_NAME, $widgetData);
|
||||
$textareaUDF = new TextareaWidgetUDF(self::WIDGET_NAME, $widgetData);
|
||||
|
||||
// Set text value if present in the DB
|
||||
if (isset($widgetData[UDFLib::UDFS_ARG_NAME])
|
||||
&& isset($widgetData[UDFLib::UDFS_ARG_NAME][$jsonSchema->{UDFLib::NAME}]))
|
||||
if (isset($widgetData[self::UDFS_ARG_NAME])
|
||||
&& isset($widgetData[self::UDFS_ARG_NAME][$jsonSchema->{self::NAME}]))
|
||||
{
|
||||
$text = $widgetData[UDFLib::UDFS_ARG_NAME][$jsonSchema->{UDFLib::NAME}];
|
||||
$text = $widgetData[self::UDFS_ARG_NAME][$jsonSchema->{self::NAME}];
|
||||
}
|
||||
|
||||
$textareaUDF->render($text);
|
||||
@@ -663,13 +828,13 @@ class UDFLib
|
||||
private function _renderTextfield($jsonSchema, &$widgetData)
|
||||
{
|
||||
$text = null; // text value
|
||||
$textareaUDF = new TextfieldWidgetUDF(UDFLib::WIDGET_NAME, $widgetData);
|
||||
$textareaUDF = new TextfieldWidgetUDF(self::WIDGET_NAME, $widgetData);
|
||||
|
||||
// Set text value if present in the DB
|
||||
if (isset($widgetData[UDFLib::UDFS_ARG_NAME])
|
||||
&& isset($widgetData[UDFLib::UDFS_ARG_NAME][$jsonSchema->{UDFLib::NAME}]))
|
||||
if (isset($widgetData[self::UDFS_ARG_NAME])
|
||||
&& isset($widgetData[self::UDFS_ARG_NAME][$jsonSchema->{self::NAME}]))
|
||||
{
|
||||
$text = $widgetData[UDFLib::UDFS_ARG_NAME][$jsonSchema->{UDFLib::NAME}];
|
||||
$text = $widgetData[self::UDFS_ARG_NAME][$jsonSchema->{self::NAME}];
|
||||
}
|
||||
|
||||
$textareaUDF->render($text);
|
||||
@@ -681,17 +846,17 @@ class UDFLib
|
||||
private function _renderCheckbox($jsonSchema, &$widgetData)
|
||||
{
|
||||
// Set checkbox value if present in the DB
|
||||
if (isset($widgetData[UDFLib::UDFS_ARG_NAME])
|
||||
&& isset($widgetData[UDFLib::UDFS_ARG_NAME][$jsonSchema->{UDFLib::NAME}]))
|
||||
if (isset($widgetData[self::UDFS_ARG_NAME])
|
||||
&& isset($widgetData[self::UDFS_ARG_NAME][$jsonSchema->{self::NAME}]))
|
||||
{
|
||||
$widgetData[CheckboxWidget::VALUE_FIELD] = $widgetData[UDFLib::UDFS_ARG_NAME][$jsonSchema->{UDFLib::NAME}];
|
||||
$widgetData[CheckboxWidget::VALUE_FIELD] = $widgetData[self::UDFS_ARG_NAME][$jsonSchema->{self::NAME}];
|
||||
}
|
||||
else
|
||||
{
|
||||
$widgetData[CheckboxWidget::VALUE_FIELD] = CheckboxWidget::HTML_DEFAULT_VALUE;
|
||||
}
|
||||
|
||||
$checkboxWidgetUDF = new CheckboxWidgetUDF(UDFLib::WIDGET_NAME, $widgetData);
|
||||
$checkboxWidgetUDF = new CheckboxWidgetUDF(self::WIDGET_NAME, $widgetData);
|
||||
|
||||
$checkboxWidgetUDF->render();
|
||||
}
|
||||
@@ -707,21 +872,21 @@ class UDFLib
|
||||
$htmlParameters[HTMLWidget::PLACEHOLDER] = null;
|
||||
|
||||
// Description, title and placeholder
|
||||
if (isset($jsonSchema->{UDFLib::LABEL})
|
||||
|| isset($jsonSchema->{UDFLib::TITLE})
|
||||
|| isset($jsonSchema->{UDFLib::PLACEHOLDER}))
|
||||
if (isset($jsonSchema->{self::LABEL})
|
||||
|| isset($jsonSchema->{self::TITLE})
|
||||
|| isset($jsonSchema->{self::PLACEHOLDER}))
|
||||
{
|
||||
// Loads phrases library
|
||||
$this->_ci->load->library('PhrasesLib');
|
||||
|
||||
// If is set the label property in the json schema
|
||||
if (isset($jsonSchema->{UDFLib::LABEL}))
|
||||
if (isset($jsonSchema->{self::LABEL}))
|
||||
{
|
||||
// Load the related phrase
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases(
|
||||
UDFLib::PHRASES_APP_NAME,
|
||||
self::PHRASES_APP_NAME,
|
||||
getUserLanguage(),
|
||||
$jsonSchema->{UDFLib::LABEL},
|
||||
$jsonSchema->{self::LABEL},
|
||||
null,
|
||||
null,
|
||||
'no'
|
||||
@@ -733,13 +898,13 @@ class UDFLib
|
||||
}
|
||||
|
||||
// If is set the title property in the json schema
|
||||
if (isset($jsonSchema->{UDFLib::TITLE}))
|
||||
if (isset($jsonSchema->{self::TITLE}))
|
||||
{
|
||||
// Load the related phrase
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases(
|
||||
UDFLib::PHRASES_APP_NAME,
|
||||
self::PHRASES_APP_NAME,
|
||||
getUserLanguage(),
|
||||
$jsonSchema->{UDFLib::TITLE},
|
||||
$jsonSchema->{self::TITLE},
|
||||
null,
|
||||
null,
|
||||
'no'
|
||||
@@ -751,13 +916,13 @@ class UDFLib
|
||||
}
|
||||
|
||||
// If is set the placeholder property in the json schema
|
||||
if (isset($jsonSchema->{UDFLib::PLACEHOLDER}))
|
||||
if (isset($jsonSchema->{self::PLACEHOLDER}))
|
||||
{
|
||||
// Load the related phrase
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases(
|
||||
UDFLib::PHRASES_APP_NAME,
|
||||
self::PHRASES_APP_NAME,
|
||||
getUserLanguage(),
|
||||
$jsonSchema->{UDFLib::PLACEHOLDER},
|
||||
$jsonSchema->{self::PLACEHOLDER},
|
||||
null,
|
||||
null,
|
||||
'no'
|
||||
@@ -784,17 +949,17 @@ class UDFLib
|
||||
$htmlParameters[HTMLWidget::MAX_LENGTH] = null;
|
||||
|
||||
// If validation property is present in the json schema
|
||||
if (isset($jsonSchema->{UDFLib::VALIDATION}))
|
||||
if (isset($jsonSchema->{self::VALIDATION}))
|
||||
{
|
||||
$jsonSchemaValidation =& $jsonSchema->{UDFLib::VALIDATION}; // Reference for a better code readability
|
||||
$jsonSchemaValidation =& $jsonSchema->{self::VALIDATION}; // Reference for a better code readability
|
||||
|
||||
// Front-end regex
|
||||
if (isset($jsonSchemaValidation->{UDFLib::REGEX})
|
||||
&& is_array($jsonSchemaValidation->{UDFLib::REGEX}))
|
||||
if (isset($jsonSchemaValidation->{self::REGEX})
|
||||
&& is_array($jsonSchemaValidation->{self::REGEX}))
|
||||
{
|
||||
foreach ($jsonSchemaValidation->{UDFLib::REGEX} as $regex)
|
||||
foreach ($jsonSchemaValidation->{self::REGEX} as $regex)
|
||||
{
|
||||
if ($regex->language === UDFLib::FE_REGEX_LANGUAGE)
|
||||
if ($regex->language === self::FE_REGEX_LANGUAGE)
|
||||
{
|
||||
$htmlParameters[HTMLWidget::REGEX] = $regex->expression;
|
||||
}
|
||||
@@ -802,33 +967,33 @@ class UDFLib
|
||||
}
|
||||
|
||||
// Required
|
||||
if (isset($jsonSchemaValidation->{UDFLib::REQUIRED}))
|
||||
if (isset($jsonSchemaValidation->{self::REQUIRED}))
|
||||
{
|
||||
$htmlParameters[HTMLWidget::REQUIRED] = $jsonSchemaValidation->{UDFLib::REQUIRED};
|
||||
$htmlParameters[HTMLWidget::REQUIRED] = $jsonSchemaValidation->{self::REQUIRED};
|
||||
}
|
||||
|
||||
// Min value
|
||||
if (isset($jsonSchemaValidation->{UDFLib::MIN_VALUE}))
|
||||
if (isset($jsonSchemaValidation->{self::MIN_VALUE}))
|
||||
{
|
||||
$htmlParameters[HTMLWidget::MIN_VALUE] = $jsonSchemaValidation->{UDFLib::MIN_VALUE};
|
||||
$htmlParameters[HTMLWidget::MIN_VALUE] = $jsonSchemaValidation->{self::MIN_VALUE};
|
||||
}
|
||||
|
||||
// Max value
|
||||
if (isset($jsonSchemaValidation->{UDFLib::MAX_VALUE}))
|
||||
if (isset($jsonSchemaValidation->{self::MAX_VALUE}))
|
||||
{
|
||||
$htmlParameters[HTMLWidget::MAX_VALUE] = $jsonSchemaValidation->{UDFLib::MAX_VALUE};
|
||||
$htmlParameters[HTMLWidget::MAX_VALUE] = $jsonSchemaValidation->{self::MAX_VALUE};
|
||||
}
|
||||
|
||||
// Min length
|
||||
if (isset($jsonSchemaValidation->{UDFLib::MIN_LENGTH}))
|
||||
if (isset($jsonSchemaValidation->{self::MIN_LENGTH}))
|
||||
{
|
||||
$htmlParameters[HTMLWidget::MIN_LENGTH] = $jsonSchemaValidation->{UDFLib::MIN_LENGTH};
|
||||
$htmlParameters[HTMLWidget::MIN_LENGTH] = $jsonSchemaValidation->{self::MIN_LENGTH};
|
||||
}
|
||||
|
||||
// Max length
|
||||
if (isset($jsonSchemaValidation->{UDFLib::MAX_LENGTH}))
|
||||
if (isset($jsonSchemaValidation->{self::MAX_LENGTH}))
|
||||
{
|
||||
$htmlParameters[HTMLWidget::MAX_LENGTH] = $jsonSchemaValidation->{UDFLib::MAX_LENGTH};
|
||||
$htmlParameters[HTMLWidget::MAX_LENGTH] = $jsonSchemaValidation->{self::MAX_LENGTH};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,18 @@ class VariableLib
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function changeStudengangsTypVar($uid, $name, $change)
|
||||
{
|
||||
$result = error('error when setting variable!');
|
||||
|
||||
if (isEmptyString($uid) || isEmptyString($name) || isEmptyString($change))
|
||||
return $result;
|
||||
|
||||
$result = $this->_ci->VariableModel->setVariable($uid, $name, $change);
|
||||
$this->_setVariable($uid, $name);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Refreshes" variable value with given name by retrieving current value from db and saving it.
|
||||
* @param $uid
|
||||
|
||||
@@ -48,6 +48,9 @@ class Messages_model extends CI_Model
|
||||
$this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel');
|
||||
// Loads model Prestudent_model
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
// Loads model Benutzer_model
|
||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
@@ -91,6 +94,23 @@ class Messages_model extends CI_Model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares data for the view system/messages/ajaxRead
|
||||
*/
|
||||
public function prepareAjaxRead()
|
||||
{
|
||||
$psResult = $this->PrestudentModel->loadWhere(array('person_id' => getAuthPersonId()));
|
||||
|
||||
if (isError($psResult)) show_error('An error occurred while loading this page, please contact the site administrator');
|
||||
|
||||
if (hasData($psResult))
|
||||
{
|
||||
return array('writeButton' => '<input id="writeMessage" type="button" value="'.$this->p->t('ui', 'nachrichtSenden').'">');
|
||||
}
|
||||
|
||||
return array('writeButton' => '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares data for the view system/messages/ajaxWrite
|
||||
*/
|
||||
@@ -267,21 +287,25 @@ class Messages_model extends CI_Model
|
||||
|
||||
$sender = getData($senderResult)[0]; // Found sender data
|
||||
|
||||
// Check if the receiver is an employee
|
||||
$isEmployee = false; // not by default
|
||||
$isEmployeeResult = $this->MessageTokenModel->isEmployee($message->receiver_id);
|
||||
if (isError($isEmployeeResult)) show_error(getError($isEmployeeResult));
|
||||
if (hasData($isEmployeeResult)) $isEmployee = true;
|
||||
|
||||
// If the sender is not an employee and are present configurations to reply
|
||||
// If the sender is not the system sender and the receiver is not the system sender
|
||||
// and are present configurations to reply
|
||||
$hrefReply = '';
|
||||
if (!$isEmployee && !isEmptyString($this->config->item(MessageLib::CFG_REDIRECT_VIEW_MESSAGE_URL)))
|
||||
if ($message->sender_id != $this->config->item(MessageLib::CFG_SYSTEM_PERSON_ID)
|
||||
&& $message->receiver_id != $this->config->item(MessageLib::CFG_SYSTEM_PERSON_ID)
|
||||
&& !isEmptyString($this->config->item(MessageLib::CFG_REDIRECT_VIEW_MESSAGE_URL)))
|
||||
{
|
||||
$hrefReply = $this->config->item(MessageLib::CFG_MESSAGE_SERVER).
|
||||
$this->config->item(MessageLib::CFG_REDIRECT_VIEW_MESSAGE_URL).
|
||||
$token;
|
||||
}
|
||||
|
||||
// If the receiver is the system sender (the message was sent to an organization unit)
|
||||
// redirect the reply to an authenticated controller to reply
|
||||
if ($message->receiver_id == $this->config->item(MessageLib::CFG_SYSTEM_PERSON_ID))
|
||||
{
|
||||
$hrefReply = site_url('system/messages/MessageClient/writeReply?token='.$token);
|
||||
}
|
||||
|
||||
return array (
|
||||
'sender' => $sender,
|
||||
'message' => $message,
|
||||
@@ -381,7 +405,10 @@ class Messages_model extends CI_Model
|
||||
// Looping on receivers data
|
||||
foreach (getData($msgVarsData) as $receiver)
|
||||
{
|
||||
$msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)$receiver); // replaces array keys
|
||||
// Merge receivers data with logged in user data
|
||||
$msgVarsDataArray = $this->_addMsgVarsDataOfLoggedInUser($receiver);
|
||||
|
||||
$msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)getData($msgVarsDataArray)[0]); // replaces array keys
|
||||
$parsedSubject = parseText($subject, $msgVarsDataArray);
|
||||
$parsedBody = parseText($body, $msgVarsDataArray);
|
||||
|
||||
@@ -399,33 +426,30 @@ class Messages_model extends CI_Model
|
||||
|
||||
$message = $this->messagelib->sendMessageUser(
|
||||
$msgVarsDataArray['person_id'], // receiverPersonId
|
||||
$parsedSubject, // subject
|
||||
$parsedBody, // body
|
||||
$sender_id, // sender_id
|
||||
$senderOU, // senderOU
|
||||
$relationmessage_id, // relationmessage_id
|
||||
MSG_PRIORITY_NORMAL // priority
|
||||
$parsedSubject, // subject
|
||||
$parsedBody, // body
|
||||
$sender_id, // sender_id
|
||||
$senderOU, // senderOU
|
||||
$relationmessage_id, // relationmessage_id
|
||||
MSG_PRIORITY_NORMAL // priority
|
||||
);
|
||||
|
||||
if (isError($message)) return $message;
|
||||
if (!hasData($message)) return error('No messages were saved in database');
|
||||
|
||||
// Write log entry only if persons were given
|
||||
if ($type == self::TYPE_PERSONS)
|
||||
{
|
||||
$personLog = $this->_personLog($sender_id, $msgVarsDataArray['person_id'], getData($message)[0]);
|
||||
if (isError($personLog)) return $personLog;
|
||||
}
|
||||
// Write log entry only
|
||||
$personLog = $this->_personLog($sender_id, $msgVarsDataArray['person_id'], getData($message)[0]);
|
||||
if (isError($personLog)) return $personLog;
|
||||
|
||||
$receiversCounter++; // increment the counter
|
||||
}
|
||||
|
||||
return success('Messages sent successfully');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends a new message using the given template and information present in parameter prestudents
|
||||
* Extra variables can be added using parameter $msgVars
|
||||
* Wrapper method for sendExplicitTemplateSenderId
|
||||
* The sender id is retrieved from the authentication session, if not present an error would be raised
|
||||
*/
|
||||
public function sendExplicitTemplate($prestudents, $oe_kurzbz, $vorlage_kurzbz, $msgVars)
|
||||
{
|
||||
@@ -433,12 +457,30 @@ class Messages_model extends CI_Model
|
||||
$sender_id = getAuthPersonId();
|
||||
if (!is_numeric($sender_id)) show_error('The current logged user person_id is not defined');
|
||||
|
||||
return $this->sendExplicitTemplateSenderId($sender_id, $prestudents, $oe_kurzbz, $vorlage_kurzbz, $msgVars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a new message using the given template and information present in parameter prestudents
|
||||
* Extra variables can be added using parameter $msgVars
|
||||
*/
|
||||
public function sendExplicitTemplateSenderId($sender_id, $prestudents, $oe_kurzbz, $vorlage_kurzbz, $msgVars)
|
||||
{
|
||||
// Retrieves message vars data for the given user/s
|
||||
$msgVarsData = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudents);
|
||||
if (isError($msgVarsData)) show_error(getError($msgVarsData));
|
||||
if (!hasData($msgVarsData)) show_error('No recipients were given');
|
||||
|
||||
$prestudentsData = $this->PrestudentModel->getOrganisationunits($prestudents);
|
||||
|
||||
// Get the senders uid (if user is an active employee)
|
||||
$this->BenutzerModel->addSelect('uid');
|
||||
$this->BenutzerModel->addJoin('public.tbl_mitarbeiter ma', 'ma.mitarbeiter_uid = uid');
|
||||
if (!$result = getData($this->BenutzerModel->getFromPersonId($sender_id)))
|
||||
{
|
||||
show_error('No sender_uid found');
|
||||
}
|
||||
$sender_uid = $result[0]->uid;
|
||||
|
||||
// Adds the organisation unit to each prestudent
|
||||
if (isEmptyString($oe_kurzbz) && hasData($msgVarsData) && hasData($prestudentsData))
|
||||
@@ -448,18 +490,26 @@ class Messages_model extends CI_Model
|
||||
|
||||
foreach (getData($msgVarsData) as $receiver)
|
||||
{
|
||||
$msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)$receiver); // replaces array keys
|
||||
/**
|
||||
* Merge receivers data with senders data
|
||||
* NOTE: _addMsgVarsDataOfLoggedInUser usually retrieves data of the logged in user that is set in the
|
||||
* templates user fields. As sendExplicitTemplateSenderId is run by a job, a sender uid is passed to be used
|
||||
* instead the logged in user.
|
||||
*/
|
||||
$msgVarsDataArray = $this->_addMsgVarsDataOfLoggedInUser($receiver, $sender_uid);
|
||||
|
||||
$msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)getData($msgVarsDataArray)[0]); // replaces array keys
|
||||
|
||||
// Additional message variables
|
||||
if (is_array($msgVars)) $msgVarsDataArray = array_merge($msgVarsDataArray, $msgVars);
|
||||
|
||||
$message = $this->messagelib->sendMessageUserTemplate(
|
||||
$msgVarsDataArray['person_id'], // receiversPersonId
|
||||
$vorlage_kurzbz, // vorlage
|
||||
$msgVarsDataArray, // parseData
|
||||
null, // orgform
|
||||
$sender_id, // sender_id
|
||||
$oe_kurzbz // senderOU
|
||||
$msgVarsDataArray['person_id'], // receiversPersonId
|
||||
$vorlage_kurzbz, // vorlage
|
||||
$msgVarsDataArray, // parseData
|
||||
null, // orgform
|
||||
$sender_id, // sender_id
|
||||
$oe_kurzbz // senderOU
|
||||
);
|
||||
|
||||
if (isError($message)) return $message;
|
||||
@@ -562,9 +612,9 @@ class Messages_model extends CI_Model
|
||||
if (!isEmptyString($vorlage_kurzbz))
|
||||
{
|
||||
$this->load->model('system/Vorlagestudiengang_model', 'VorlagestudiengangModel');
|
||||
$this->VorlagestudiengangModel->addOrder('version','DESC');
|
||||
$this->VorlagestudiengangModel->addOrder('version', 'DESC');
|
||||
|
||||
$getVorlage = $this->VorlagestudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz));
|
||||
$getVorlage = $this->VorlagestudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz, 'aktiv' => true));
|
||||
}
|
||||
|
||||
return $getVorlage;
|
||||
@@ -579,6 +629,9 @@ class Messages_model extends CI_Model
|
||||
$parseMessageText = error('The given person_id is not a valid number');
|
||||
|
||||
if (is_numeric($person_id)) $parseMessageText = $this->MessageModel->getMsgVarsDataByPersonId($person_id);
|
||||
|
||||
// Add message vars data of the logged in user
|
||||
$parseMessageText = $this->_addMsgVarsDataOfLoggedInUser($parseMessageText);
|
||||
|
||||
if (hasData($parseMessageText))
|
||||
{
|
||||
@@ -602,7 +655,10 @@ class Messages_model extends CI_Model
|
||||
$parseMessageText = error('The given prestudent_id is not a valid number');
|
||||
|
||||
if (is_numeric($prestudent_id)) $parseMessageText = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id);
|
||||
|
||||
|
||||
// Add message vars data of the logged in user
|
||||
$parseMessageText = $this->_addMsgVarsDataOfLoggedInUser($parseMessageText);
|
||||
|
||||
if (hasData($parseMessageText))
|
||||
{
|
||||
$parseMessageText = success(
|
||||
@@ -812,6 +868,26 @@ class Messages_model extends CI_Model
|
||||
|
||||
$variables[] = $tmpVar;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Retrieves message vars of logged in user from database view vw_msg_vars_person
|
||||
$result = null;
|
||||
|
||||
// If data contains a prestudent id
|
||||
$result = $this->messagelib->getMessageVarsLoggedInUser();
|
||||
|
||||
if (isError($result)) show_error(getError($result));
|
||||
|
||||
// Then builds an array that contains objects with field name and field description of logged in user data
|
||||
$user_fields = array();
|
||||
foreach (getData($result) as $id => $description)
|
||||
{
|
||||
$obj = new stdClass();
|
||||
$obj->id = $id;
|
||||
$obj->description = $description;
|
||||
|
||||
$user_fields[] = $obj;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Retrieves the sender id
|
||||
@@ -832,6 +908,7 @@ class Messages_model extends CI_Model
|
||||
'subject' => $replySubject,
|
||||
'body' => $replyBody,
|
||||
'variables' => $variables,
|
||||
'user_fields' => $user_fields,
|
||||
'organisationUnits' => getData($organisationUnits),
|
||||
'senderIsAdmin' => getData($senderIsAdmin),
|
||||
'recipientsArray' => $recipientsArray,
|
||||
@@ -840,4 +917,30 @@ class Messages_model extends CI_Model
|
||||
'type' => $type
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds message vars data of the logged in user to the given object (that should also have message vars data)
|
||||
* @param object $otherMsgVarsDataObj Can be success object or simple object.
|
||||
* @return object Returns success object.
|
||||
*/
|
||||
public function _addMsgVarsDataOfLoggedInUser($otherMsgVarsDataObj, $uid = null)
|
||||
{
|
||||
// First check if param type is object
|
||||
if (!is_object($otherMsgVarsDataObj)) show_error('Must pass an object to merge with data of logged in user');
|
||||
|
||||
// If it is a return object, extract the simple data object
|
||||
if (isSuccess($otherMsgVarsDataObj))
|
||||
{
|
||||
$otherMsgVarsDataObj = getData($otherMsgVarsDataObj)[0];
|
||||
}
|
||||
|
||||
// Retrieve message vars data of the logged in user
|
||||
if (!$msgVarsDataLoggedInUser = getData($this->MessageModel->getMsgVarsDataByLoggedInUser($uid))[0])
|
||||
{
|
||||
return success($otherMsgVarsDataObj); // If failed, return at least given object as expected success object
|
||||
}
|
||||
|
||||
return success(array((object)(array_merge((array) $otherMsgVarsDataObj, (array) $msgVarsDataLoggedInUser))));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
class Bisioaufenthaltfoerderung_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'bis.tbl_bisio_aufenthaltfoerderung';
|
||||
$this->pk = array('bisio_id', 'aufenthaltfoerderung_code');
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
}
|
||||
@@ -41,4 +41,35 @@ class Bisverwendung_model extends DB_Model
|
||||
|
||||
return $this->loadWhere($condition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Verwendungen of the user, optionally in a time span.
|
||||
* @param string $uid
|
||||
* @param string $beginn
|
||||
* @param string $ende
|
||||
* @return array
|
||||
*/
|
||||
public function getVerwendungen($uid, $beginn = null, $ende = null)
|
||||
{
|
||||
$params = array($uid);
|
||||
|
||||
$qry = 'SELECT * FROM bis.tbl_bisverwendung
|
||||
WHERE mitarbeiter_uid = ?';
|
||||
|
||||
if (isset($beginn))
|
||||
{
|
||||
$qry .= ' AND ( ende >= ? OR ende IS NULL )';
|
||||
$params[] = $beginn;
|
||||
}
|
||||
|
||||
if (isset($ende))
|
||||
{
|
||||
$qry .= ' AND ( beginn <= ? OR beginn IS NULL )';
|
||||
$params[] = $ende;
|
||||
}
|
||||
|
||||
$qry .= ' ORDER BY beginn, ende';
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,61 @@ class Konto_model extends DB_Model
|
||||
$this->dbTable = 'public.tbl_konto';
|
||||
$this->pk = 'buchungsnr';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a Payment as paid
|
||||
*/
|
||||
public function setPaid($buchungsnr)
|
||||
{
|
||||
// get payment
|
||||
$buchungResult = $this->loadWhere(array('buchungsnr' => $buchungsnr));
|
||||
|
||||
if(isSuccess($buchungResult) && hasData($buchungResult))
|
||||
{
|
||||
// get already paid amount
|
||||
$this->addSelect('sum(betrag) as bezahlt');
|
||||
$this->addGroupBy('buchungsnr_verweis');
|
||||
$buchungVerweisResult = $this->loadWhere(array('buchungsnr_verweis' => $buchungsnr));
|
||||
|
||||
if(isSuccess($buchungVerweisResult))
|
||||
{
|
||||
if(hasData($buchungVerweisResult))
|
||||
{
|
||||
$betragBezahltResult = getData($buchungVerweisResult);
|
||||
$betragBezahlt = $betragBezahltResult->bezahlt;
|
||||
}
|
||||
else
|
||||
$betragBezahlt = 0;
|
||||
|
||||
$buchung = getData($buchungResult);
|
||||
$buchung = $buchung[0];
|
||||
|
||||
// calculate open amount
|
||||
$betragOffen = $betragBezahlt - $buchung->betrag*(-1);
|
||||
|
||||
$data = array(
|
||||
'person_id' => $buchung->person_id,
|
||||
'studiengang_kz' => $buchung->studiengang_kz,
|
||||
'studiensemester_kurzbz' => $buchung->studiensemester_kurzbz,
|
||||
'buchungsnr_verweis' => $buchungsnr,
|
||||
'betrag' => str_replace(',','.',$betragOffen*(-1)),
|
||||
'buchungsdatum' => date('Y-m-d'),
|
||||
'buchungstext' => $buchung->buchungstext,
|
||||
'insertamum' => date('Y-m-d H:i:s'),
|
||||
'insertvon' => '',
|
||||
'buchungstyp_kurzbz' => $buchung->buchungstyp_kurzbz,
|
||||
);
|
||||
|
||||
return $this->insert($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Failed to load Payment');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Failed to load Payment');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ class Prestudent_model extends DB_Model
|
||||
{
|
||||
$this->addSelect('tbl_prestudent.*, tbl_studiengang.studiengang_kz, tbl_studiengang.kurzbzlang as studiengang, tbl_studiengang.bezeichnung as studiengangbezeichnung, tbl_studiengang.english as studiengangenglish,
|
||||
tbl_studiengang.email as studiengangmail, tbl_studiengang.typ as studiengangtyp, tbl_studiengangstyp.bezeichnung as studiengangtyp_bez,
|
||||
tbl_zgv.zgv_code, tbl_zgv.zgv_bez, tbl_prestudent.zgvnation as zgvnation_code, zgvnat.kurztext as zgvnation_kurzbez, zgvnat.langtext as zgvnation_bez, zgvnat.engltext as zgvnation_englbez,
|
||||
tbl_zgv.zgv_code, tbl_zgv.zgv_bez, tbl_prestudent.zgvnation as zgvnation_code, zgvnat.kurztext as zgvnation_kurzbez, zgvnat.langtext as zgvnation_bez, zgvnat.engltext as zgvnation_englbez, zgvnat.nationengruppe_kurzbz as zgvnation_nationengruppe,
|
||||
tbl_zgvmaster.zgvmas_code, tbl_zgvmaster.zgvmas_bez, tbl_prestudent.zgvmanation as zgvmanation_code, zgvmanat.kurztext as zgvmanation_kurzbez, zgvmanat.langtext as zgvmanation_bez, zgvmanat.engltext as zgvmanation_englbez');
|
||||
$this->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT');
|
||||
$this->addJoin('public.tbl_studiengangstyp', 'typ', 'LEFT');
|
||||
@@ -209,66 +209,95 @@ class Prestudent_model extends DB_Model
|
||||
if (!hasData($prestudent))
|
||||
return error('prestudent could not be loaded');
|
||||
|
||||
$prestudentdata = getData($prestudent);
|
||||
$prestudentdata = $prestudentdata[0];
|
||||
|
||||
//Prestudentstatus
|
||||
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
|
||||
if ($lastStatus->error)
|
||||
if (isError($lastStatus))
|
||||
{
|
||||
return $lastStatus;
|
||||
}
|
||||
|
||||
if (count($lastStatus->retval) > 0)
|
||||
if (hasData($lastStatus))
|
||||
{
|
||||
$lastStatusData = getData($lastStatus);
|
||||
$lastStatusData = $lastStatusData[0];
|
||||
//get Studiengangname from Studienplan and -ordnung
|
||||
$studienordnung = $this->PrestudentstatusModel->getStudienordnungFromPrestudent($prestudent_id);
|
||||
if ($studienordnung->error)
|
||||
if (isError($studienordnung))
|
||||
return $studienordnung;
|
||||
|
||||
if (count($studienordnung->retval) > 0)
|
||||
if (hasData($studienordnung))
|
||||
{
|
||||
$lastStatus->retval[0]->studiengang_kz = $studienordnung->retval[0]->studiengang_kz;
|
||||
$lastStatus->retval[0]->studiengangkurzbzlang = $studienordnung->retval[0]->studiengangkurzbzlang;
|
||||
$lastStatus->retval[0]->studiengangbezeichnung = $studienordnung->retval[0]->studiengangbezeichnung;
|
||||
$lastStatus->retval[0]->studiengangbezeichnung_englisch = $studienordnung->retval[0]->studiengangbezeichnung_englisch;
|
||||
$lastStatus->retval[0]->regelstudiendauer = $studienordnung->retval[0]->regelstudiendauer;
|
||||
$studienordnungdata = getData($studienordnung);
|
||||
$studienordnungdata = $studienordnungdata[0];
|
||||
|
||||
$lastStatusData->studiengang_kz = $studienordnungdata->studiengang_kz;
|
||||
$lastStatusData->studiengangkurzbzlang = $studienordnungdata->studiengangkurzbzlang;
|
||||
$lastStatusData->studiengangbezeichnung = $studienordnungdata->studiengangbezeichnung;
|
||||
$lastStatusData->studiengangbezeichnung_englisch = $studienordnungdata->studiengangbezeichnung_englisch;
|
||||
$lastStatusData->regelstudiendauer = $studienordnungdata->regelstudiendauer;
|
||||
}
|
||||
|
||||
//get Sprache
|
||||
$this->load->model('system/sprache_model', 'SpracheModel');
|
||||
$this->SpracheModel->addSelect('sprache, locale, bezeichnung');
|
||||
$language = $this->SpracheModel->load($lastStatus->retval[0]->sprache);
|
||||
$language = $this->SpracheModel->load($lastStatusData->sprache);
|
||||
|
||||
if ($language->error)
|
||||
if (isError($language))
|
||||
return $language;
|
||||
|
||||
if (count($language->retval) > 0)
|
||||
$lastStatus->retval[0]->sprachedetails = $language->retval[0];
|
||||
if (hasData($language))
|
||||
{
|
||||
$languagedata = getData($language);
|
||||
$languagedata = $languagedata[0];
|
||||
$lastStatusData->sprachedetails = $languagedata;
|
||||
}
|
||||
|
||||
//get Bewerbungsfrist
|
||||
$this->load->model('crm/bewerbungstermine_model', 'BewerbungstermineModel');
|
||||
$this->BewerbungstermineModel->addSelect('ende, nachfrist_ende');
|
||||
$this->BewerbungstermineModel->addOrder('ende', 'DESC');
|
||||
$this->BewerbungstermineModel->addOrder('updateamum', 'DESC');
|
||||
$this->BewerbungstermineModel->addOrder('insertamum', 'DESC');
|
||||
$this->BewerbungstermineModel->addOrder('ende');
|
||||
$this->BewerbungstermineModel->addLimit(1);
|
||||
$bewerbungstermin = $this->BewerbungstermineModel->loadWhere(
|
||||
array(
|
||||
'studienplan_id' => $lastStatus->retval[0]->studienplan_id,
|
||||
'studiensemester_kurzbz' => $lastStatus->retval[0]->studiensemester_kurzbz,
|
||||
'studiengang_kz' => $prestudent->retval[0]->studiengang_kz
|
||||
)
|
||||
|
||||
$fristparams = array(
|
||||
'studienplan_id' => $lastStatusData->studienplan_id,
|
||||
'studiensemester_kurzbz' => $lastStatusData->studiensemester_kurzbz,
|
||||
'studiengang_kz' => $prestudentdata->studiengang_kz
|
||||
);
|
||||
|
||||
if (isset($prestudentdata->zgvnation_nationengruppe))
|
||||
$fristparams['nationengruppe_kurzbz'] = $prestudentdata->zgvnation_nationengruppe;
|
||||
|
||||
$bewerbungstermin = $this->BewerbungstermineModel->loadWhere(
|
||||
$fristparams
|
||||
);
|
||||
if ($bewerbungstermin->error)
|
||||
|
||||
if (isError($bewerbungstermin))
|
||||
return $bewerbungstermin;
|
||||
|
||||
if (count($bewerbungstermin->retval) > 0)
|
||||
if (hasData($bewerbungstermin))
|
||||
{
|
||||
$lastStatus->retval[0]->bewerbungstermin = $bewerbungstermin->retval[0]->ende;
|
||||
$lastStatus->retval[0]->bewerbungsnachfrist = $bewerbungstermin->retval[0]->nachfrist_ende;
|
||||
$bewerbungstermindata = getData($bewerbungstermin);
|
||||
$bewerbungstermindata = $bewerbungstermindata[0];
|
||||
$lastStatusData->bewerbungstermin = $bewerbungstermindata->ende;
|
||||
$lastStatusData->bewerbungsnachfrist = $bewerbungstermindata->nachfrist_ende;
|
||||
}
|
||||
|
||||
$prestudent->retval[0]->prestudentstatus = $lastStatus->retval[0];
|
||||
$prestudentdata->prestudentstatus = $lastStatusData;
|
||||
|
||||
|
||||
if ($this->hasUDF())
|
||||
{
|
||||
$prestudentdata->prestudentUdfs = $this->getUDFs($prestudent_id);
|
||||
}
|
||||
}
|
||||
|
||||
return success($prestudent->retval);
|
||||
return success($prestudentdata);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -552,4 +581,19 @@ class Prestudent_model extends DB_Model
|
||||
|
||||
return $this->execQuery($query, array($person_id));
|
||||
}
|
||||
|
||||
public function getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester)
|
||||
{
|
||||
$query = "SELECT ps.prestudent_id
|
||||
FROM public.tbl_prestudentstatus pss
|
||||
JOIN public.tbl_prestudent ps USING(prestudent_id)
|
||||
JOIN public.tbl_studiengang sg USING(studiengang_kz)
|
||||
JOIN lehre.tbl_studienplan sp USING(studienplan_id)
|
||||
WHERE ps.person_id = ?
|
||||
AND UPPER((sg.typ || sg.kurzbz) || ':' || sp.orgform_kurzbz) = ?
|
||||
AND pss.studiensemester_kurzbz = ?
|
||||
";
|
||||
|
||||
return $this->execQuery($query, array($person, $studiengang, $studienSemester));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,4 +182,30 @@ class Prestudentstatus_model extends DB_Model
|
||||
return success(array());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getLastStatuses
|
||||
*/
|
||||
public function getLastStatusPerson($person_id, $studiensemester_kurzbz = null)
|
||||
{
|
||||
$query = 'SELECT *
|
||||
FROM public.tbl_prestudent p
|
||||
JOIN (
|
||||
SELECT DISTINCT ON(prestudent_id) *
|
||||
FROM public.tbl_prestudentstatus
|
||||
WHERE prestudent_id IN (SELECT prestudent_id FROM public.tbl_prestudent WHERE person_id = ?)
|
||||
ORDER BY prestudent_id, datum desc, insertamum desc
|
||||
) ps USING(prestudent_id)
|
||||
JOIN public.tbl_status USING(status_kurzbz)';
|
||||
|
||||
$parametersArray = array($person_id);
|
||||
|
||||
if ($studiensemester_kurzbz != '')
|
||||
{
|
||||
array_push($parametersArray, $studiensemester_kurzbz);
|
||||
$query .= ' AND ps.studiensemester_kurzbz = ?';
|
||||
}
|
||||
|
||||
return $this->execQuery($query, $parametersArray);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,18 @@ class Statusgrund_model extends DB_Model
|
||||
$this->dbTable = "public.tbl_status_grund";
|
||||
$this->pk = "statusgrund_id";
|
||||
}
|
||||
|
||||
public function getStatus($status_kurzbz = null, $aktiv = null)
|
||||
{
|
||||
$this->addOrder('bezeichnung_mehrsprachig');
|
||||
$where = array();
|
||||
if (!is_null($status_kurzbz))
|
||||
$where['status_kurzbz'] = $status_kurzbz;
|
||||
if (!is_null($aktiv))
|
||||
$where['aktiv'] = $aktiv;
|
||||
|
||||
$status = $this->loadWhere($where);
|
||||
|
||||
return success($status->retval);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,25 @@ class Student_model extends DB_Model
|
||||
$max += 1;
|
||||
return $matrikelnummer.sprintf("%03d", $max);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get students UID by PrestudentID.
|
||||
* @param $prestudent_id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUID($prestudent_id)
|
||||
{
|
||||
$this->addSelect('student_uid');
|
||||
|
||||
$result = $this->loadWhere(
|
||||
array('prestudent_id' => $prestudent_id)
|
||||
);
|
||||
|
||||
if (!hasData($result))
|
||||
{
|
||||
show_error('Failed getting UID by prestudent_id');
|
||||
}
|
||||
|
||||
return $result->retval[0]->student_uid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ZGVPruefungStatus_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_zgvpruefungstatus_status';
|
||||
$this->pk = 'zgv_pruefung_status_id';
|
||||
$this->hasSequence = true;
|
||||
}
|
||||
|
||||
public function getZgvStatus($zgvpruefung_id)
|
||||
{
|
||||
$this->addOrder('datum', 'DESC');
|
||||
$this->addLimit(1);
|
||||
|
||||
return $this->loadWhere(array('zgvpruefung_id' => $zgvpruefung_id));
|
||||
}
|
||||
|
||||
public function getZgvStatusByPrestudent($prestudent_id)
|
||||
{
|
||||
$this->addJoin('public.tbl_zgvpruefung', 'zgvpruefung_id');
|
||||
$this->addOrder($this->dbTable . '.datum', 'DESC');
|
||||
$this->addLimit(1);
|
||||
return $this->loadWhere(array('prestudent_id' => $prestudent_id));
|
||||
}
|
||||
|
||||
public function getOpenZgvByPerson($person_id, $status)
|
||||
{
|
||||
$query = 'SELECT status.zgvpruefung_id, status.datum, status.status
|
||||
FROM public.tbl_zgvpruefungstatus_status status
|
||||
INNER JOIN
|
||||
(
|
||||
SELECT zgvpruefung_id, max(datum) as MaxDate
|
||||
FROM public.tbl_zgvpruefungstatus_status
|
||||
GROUP BY zgvpruefung_id
|
||||
) sub ON status.zgvpruefung_id = sub.zgvpruefung_id AND status.datum = sub.MaxDate
|
||||
JOIN public.tbl_zgvpruefung ON status.zgvpruefung_id = public.tbl_zgvpruefung.zgvpruefung_id
|
||||
JOIN public.tbl_prestudent USING (prestudent_id)
|
||||
WHERE person_id = ?
|
||||
AND status.status IN ?';
|
||||
|
||||
return $this->execQuery($query, array($person_id, $status));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ZGVPruefung_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_zgvpruefung';
|
||||
$this->pk = 'zgvpruefung_id';
|
||||
$this->hasSequence = true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,4 +11,106 @@ class Abschlusspruefung_model extends DB_Model
|
||||
$this->dbTable = 'lehre.tbl_abschlusspruefung';
|
||||
$this->pk = 'abschlusspruefung_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data of an Abschlusspruefung, including Abschlussarbeit.
|
||||
* @param $abschlusspruefung_id
|
||||
* @return object
|
||||
*/
|
||||
public function getAbschlusspruefung($abschlusspruefung_id)
|
||||
{
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
$this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel');
|
||||
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
|
||||
$abschlusspruefungdata = array();
|
||||
|
||||
$this->addSelect('tbl_abschlusspruefung.abschlusspruefung_id, tbl_abschlusspruefung.datum, tbl_abschlusspruefung.pruefungstyp_kurzbz AS studiengangstyp, tbl_abschlusspruefung.abschlussbeurteilung_kurzbz, tbl_abschlusspruefung.uhrzeit AS pruefungsbeginn, tbl_abschlusspruefung.endezeit AS pruefungsende,
|
||||
tbl_abschlusspruefung.freigabedatum, tbl_abschlusspruefung_antritt.bezeichnung AS pruefungsantritt_bezeichnung, tbl_abschlusspruefung_antritt.bezeichnung_english AS pruefungsantritt_bezeichnung_english, tbl_abschlusspruefung.protokoll,
|
||||
studentpers.vorname AS vorname_student, studentpers.nachname AS nachname_student, studentpers.titelpre AS titelpre_student, studentpers.titelpost AS titelpost_student, studentben.uid AS uid_student, matrikelnr,
|
||||
vorsitzenderben.uid AS uid_vorsitz, vorsitzenderpers.vorname AS vorname_vorsitz, vorsitzenderpers.nachname AS nachname_vorsitz, vorsitzenderpers.titelpre AS titelpre_vorsitz, vorsitzenderpers.titelpost AS titelpost_vorsitz,
|
||||
erstprueferpers.vorname AS vorname_erstpruefer, erstprueferpers.nachname AS nachname_erstpruefer, erstprueferpers.titelpre AS titelpre_erstpruefer, erstprueferpers.titelpost AS titelpost_erstpruefer,
|
||||
zweitprueferpers.vorname AS vorname_zweitpruefer, zweitprueferpers.nachname AS nachname_zweitpruefer, zweitprueferpers.titelpre AS titelpre_zweitpruefer, zweitprueferpers.titelpost AS titelpost_zweitpruefer
|
||||
');
|
||||
$this->addJoin('lehre.tbl_abschlusspruefung_antritt', 'pruefungsantritt_kurzbz', 'LEFT');
|
||||
$this->addJoin('public.tbl_benutzer studentben', 'tbl_abschlusspruefung.student_uid = studentben.uid');
|
||||
$this->addJoin('public.tbl_person studentpers', 'studentben.person_id = studentpers.person_id');
|
||||
$this->addJoin('public.tbl_student', 'studentben.uid = tbl_student.student_uid');
|
||||
$this->addJoin('public.tbl_benutzer vorsitzenderben', 'vorsitz = vorsitzenderben.uid', 'LEFT');
|
||||
$this->addJoin('public.tbl_person vorsitzenderpers', 'vorsitzenderben.person_id = vorsitzenderpers.person_id', 'LEFT');
|
||||
$this->addJoin('public.tbl_person erstprueferpers', 'pruefer1 = erstprueferpers.person_id', 'LEFT');
|
||||
$this->addJoin('public.tbl_person zweitprueferpers', 'pruefer2 = zweitprueferpers.person_id', 'LEFT');
|
||||
|
||||
$abschlusspruefung = $this->load($abschlusspruefung_id);
|
||||
|
||||
if (isError($abschlusspruefung))
|
||||
return $abschlusspruefung;
|
||||
elseif (hasData($abschlusspruefung))
|
||||
{
|
||||
$abschlusspruefungdata = getData($abschlusspruefung)[0];
|
||||
|
||||
// get Studiengang of Student
|
||||
$student_uid = $abschlusspruefungdata->uid_student;
|
||||
$this->StudentModel->addSelect('prestudent_id');
|
||||
$prestudent_id = $this->StudentModel->load(array('student_uid' => $student_uid));
|
||||
|
||||
if (isError($prestudent_id))
|
||||
return $prestudent_id;
|
||||
elseif (hasData($prestudent_id))
|
||||
{
|
||||
//get Studiengangname from Studienplan and -ordnung
|
||||
$studienordnung = $this->PrestudentstatusModel->getStudienordnungFromPrestudent(getData($prestudent_id)[0]->prestudent_id);
|
||||
|
||||
if (isError($studienordnung))
|
||||
return $studienordnung;
|
||||
elseif (hasData($studienordnung))
|
||||
{
|
||||
$studienordnungdata = getData($studienordnung)[0];
|
||||
|
||||
$abschlusspruefungdata->studiengang_kz = $studienordnungdata->studiengang_kz;
|
||||
$abschlusspruefungdata->studiengangbezeichnung = $studienordnungdata->studiengangbezeichnung;
|
||||
$abschlusspruefungdata->studiengangbezeichnung_englisch = $studienordnungdata->studiengangbezeichnung_englisch;
|
||||
}
|
||||
// if no Studienordnung available (e.g. Incomings), use Studiengangname provided by table student
|
||||
elseif (!hasData($studienordnung))
|
||||
{
|
||||
$this->resetQuery();
|
||||
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$this->addSelect('studiengang_kz, bezeichnung, english');
|
||||
$this->addJoin('public.tbl_studiengang', 'studiengang_kz');
|
||||
$result = $this->StudentModel->load(array(
|
||||
'student_uid' => $student_uid)
|
||||
);
|
||||
|
||||
if ($result = getData($result)[0])
|
||||
{
|
||||
$abschlusspruefungdata->studiengang_kz = $result->studiengang_kz;
|
||||
$abschlusspruefungdata->studiengangbezeichnung = $result->bezeichnung;
|
||||
$abschlusspruefungdata->studiengangbezeichnung_englisch = $result->english;
|
||||
}
|
||||
}
|
||||
|
||||
// get Abschlussarbeit
|
||||
if (isset($abschlusspruefungdata->studiengang_kz) && !empty($abschlusspruefungdata->studiengang_kz))
|
||||
{
|
||||
$projekttyp = array('Bachelor','Diplom','Master','Dissertation','Lizenziat','Magister');
|
||||
$abschlussarbeit = $this->ProjektarbeitModel->getProjektarbeit($student_uid, $abschlusspruefungdata->studiengang_kz, null, $projekttyp, true);
|
||||
|
||||
if (isError($abschlussarbeit))
|
||||
return $abschlussarbeit;
|
||||
if (hasData($abschlussarbeit))
|
||||
{
|
||||
$abschlussarbeit = getData($abschlussarbeit)[0];
|
||||
$abschlusspruefungdata->projektarbeit_studiengangstyp_name = $abschlussarbeit->projekttyp_kurzbz;
|
||||
$abschlusspruefungdata->abschlussarbeit_titel = $abschlussarbeit->titel;
|
||||
$abschlusspruefungdata->abschlussarbeit_note = $abschlussarbeit->note;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return success($abschlusspruefungdata);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,76 @@ class Anrechnung_model extends DB_Model
|
||||
$this->dbTable = 'lehre.tbl_anrechnung';
|
||||
$this->pk = 'anrechnung_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Anrechnungstatus.
|
||||
* @param $anrechnung_id
|
||||
* @param $status_kurzbz
|
||||
* @return array|null
|
||||
*/
|
||||
public function saveAnrechnungstatus($anrechnung_id, $status_kurzbz)
|
||||
{
|
||||
$qry = '
|
||||
INSERT INTO lehre.tbl_anrechnung_anrechnungstatus (
|
||||
anrechnung_id, status_kurzbz, insertvon
|
||||
) VALUES ( ?, ?, ?);
|
||||
';
|
||||
|
||||
return $this->execQuery($qry, array($anrechnung_id, $status_kurzbz, getAuthUID()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last inserted Anrechnungstatus
|
||||
* @param $anrechnung_id
|
||||
* @return array|null
|
||||
*/
|
||||
public function getLastAnrechnungstatus($anrechnung_id, $status_kurzbz = null)
|
||||
{
|
||||
if (is_string($status_kurzbz))
|
||||
{
|
||||
$qry = '
|
||||
SELECT *
|
||||
FROM lehre.tbl_anrechnungstatus
|
||||
JOIN lehre.tbl_anrechnung_anrechnungstatus USING (status_kurzbz)
|
||||
WHERE anrechnung_id = ?
|
||||
AND status_kurzbz = ?
|
||||
ORDER BY insertamum DESC
|
||||
LIMIT 1
|
||||
';
|
||||
|
||||
return $this->execQuery($qry, array($anrechnung_id, $status_kurzbz));
|
||||
}
|
||||
|
||||
|
||||
$qry = '
|
||||
SELECT *
|
||||
FROM lehre.tbl_anrechnungstatus
|
||||
JOIN lehre.tbl_anrechnung_anrechnungstatus USING (status_kurzbz)
|
||||
WHERE anrechnung_id = ?
|
||||
ORDER BY insertamum DESC
|
||||
LIMIT 1
|
||||
';
|
||||
|
||||
return $this->execQuery($qry, array($anrechnung_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status approved / rejected, if present.
|
||||
* @param $anrechnung_id
|
||||
* @return array|null
|
||||
*/
|
||||
public function getApprovedOrRejected($anrechnung_id)
|
||||
{
|
||||
$qry = '
|
||||
SELECT *
|
||||
FROM lehre.tbl_anrechnungstatus
|
||||
JOIN lehre.tbl_anrechnung_anrechnungstatus USING (status_kurzbz)
|
||||
WHERE anrechnung_id = ?
|
||||
AND (status_kurzbz = \'approved\' OR status_kurzbz = \'rejected\')
|
||||
ORDER BY insertamum DESC
|
||||
LIMIT 1
|
||||
';
|
||||
|
||||
return $this->execQuery($qry, array($anrechnung_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Anrechnungstatus_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'lehre.tbl_anrechnungstatus';
|
||||
$this->pk = 'status_kurzbz';
|
||||
}
|
||||
}
|
||||
@@ -119,9 +119,10 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
* Gets all students of a Lehrveranstaltung
|
||||
* @param $studiensemester_kurzbz
|
||||
* @param $lehrveranstaltung_id
|
||||
* @param $active optional, if true, only active students retrieved, false - only inactive, all students otherwise
|
||||
* @return array|null
|
||||
*/
|
||||
public function getStudentsByLv($studiensemester_kurzbz, $lehrveranstaltung_id)
|
||||
public function getStudentsByLv($studiensemester_kurzbz, $lehrveranstaltung_id, $active = null)
|
||||
{
|
||||
$query = "SELECT
|
||||
distinct on(nachname, vorname, person_id) vorname, nachname, matrikelnr,
|
||||
@@ -144,8 +145,18 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
WHERE
|
||||
vw_student_lehrveranstaltung.studiensemester_kurzbz=?
|
||||
AND
|
||||
vw_student_lehrveranstaltung.lehrveranstaltung_id=?
|
||||
ORDER BY nachname, vorname, person_id, tbl_bisio.bis DESC";
|
||||
vw_student_lehrveranstaltung.lehrveranstaltung_id=?";
|
||||
|
||||
if (isset($active))
|
||||
{
|
||||
if ($active === true)
|
||||
$query .= " AND tbl_benutzer.aktiv";
|
||||
elseif ($active === false)
|
||||
$query .= " AND tbl_benutzer.aktiv = false";
|
||||
}
|
||||
|
||||
$query .=
|
||||
" ORDER BY nachname, vorname, person_id, tbl_bisio.bis DESC";
|
||||
|
||||
return $this->execQuery($query, array($studiensemester_kurzbz, $lehrveranstaltung_id));
|
||||
}
|
||||
@@ -262,4 +273,24 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
|
||||
return $this->execQuery($query, $parametersarray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Lehrveranstaltung and its Lehreinheiten (multiple rows possible).
|
||||
* Returns empty array if student has no Lehrveranstaltung.
|
||||
* @param $uid
|
||||
* @param $studiensemester_kurzbz
|
||||
* @param $lehrveranstaltung_id
|
||||
* @return array|null
|
||||
*/
|
||||
public function getLvByStudent($uid, $studiensemester_kurzbz, $lehrveranstaltung_id)
|
||||
{
|
||||
$query = '
|
||||
SELECT * FROM campus.vw_student_lehrveranstaltung
|
||||
WHERE uid = ?
|
||||
AND studiensemester_kurzbz = ?
|
||||
AND lehrveranstaltung_id = ?;
|
||||
';
|
||||
|
||||
return $this->execQuery($query, array($uid, $studiensemester_kurzbz, $lehrveranstaltung_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,62 @@ class Projektarbeit_model extends DB_Model
|
||||
$this->dbTable = 'lehre.tbl_projektarbeit';
|
||||
$this->pk = 'projektarbeit_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Projektarbeit(en) of a student for a Studiengang, Semester, Projekttyp, final.
|
||||
* @param $student_uid
|
||||
* @param $studiengang_kz
|
||||
* @param $studiensemester_kurzbz
|
||||
* @param $projekttyp
|
||||
* @param $final
|
||||
* @return object
|
||||
*/
|
||||
public function getProjektarbeit($student_uid, $studiengang_kz = null, $studiensemester_kurzbz = null, $projekttyp = null, $final = null)
|
||||
{
|
||||
$qry = "SELECT
|
||||
tbl_projektarbeit.* , tbl_projekttyp.bezeichnung
|
||||
FROM
|
||||
lehre.tbl_projektarbeit
|
||||
JOIN
|
||||
lehre.tbl_projekttyp USING (projekttyp_kurzbz), lehre.tbl_lehreinheit, lehre.tbl_lehrveranstaltung
|
||||
|
||||
WHERE
|
||||
tbl_projektarbeit.lehreinheit_id=tbl_lehreinheit.lehreinheit_id AND
|
||||
tbl_lehreinheit.lehrveranstaltung_id = tbl_lehrveranstaltung.lehrveranstaltung_id AND
|
||||
tbl_projektarbeit.student_uid = ?";
|
||||
|
||||
$params = array($student_uid);
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= ' AND tbl_lehrveranstaltung.studiengang_kz=?';
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= ' AND tbl_lehreinheit.studiensemester_kurzbz=?';
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
if (isset($projekttyp))
|
||||
{
|
||||
if (is_array($projekttyp))
|
||||
$qry .= ' AND tbl_projektarbeit.projekttyp_kurzbz IN ?';
|
||||
else
|
||||
$qry .= ' AND tbl_projektarbeit.projekttyp_kurzbz=?';
|
||||
|
||||
$params[] = $projekttyp;
|
||||
}
|
||||
|
||||
if (isset($final))
|
||||
{
|
||||
$qry .= ' AND tbl_projektarbeit.final=?';
|
||||
$params[] = $final;
|
||||
}
|
||||
|
||||
$qry .= ' ORDER BY beginn DESC, projektarbeit_id DESC';
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,4 +41,23 @@ class Projektbetreuer_model extends DB_Model
|
||||
return error ('Incorrect parameter type');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Projektbetreuer data by authentification token
|
||||
* @param $zugangstoken
|
||||
* @return object
|
||||
*/
|
||||
public function getBetreuerByToken($zugangstoken)
|
||||
{
|
||||
$qry = '
|
||||
SELECT tbl_projektbetreuer.person_id, tbl_projektbetreuer.projektarbeit_id, student_uid
|
||||
FROM lehre.tbl_projektbetreuer
|
||||
JOIN lehre.tbl_projektarbeit USING (projektarbeit_id)
|
||||
WHERE zugangstoken = ? AND zugangstoken_gueltigbis >= NOW()
|
||||
ORDER BY tbl_projektbetreuer.insertamum DESC, projektarbeit_id DESC
|
||||
LIMIT 1
|
||||
';
|
||||
|
||||
return $this->execQuery($qry, array($zugangstoken));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,6 @@ class Zeugnisnote_model extends DB_Model
|
||||
parent::__construct();
|
||||
$this->dbTable = 'lehre.tbl_zeugnisnote';
|
||||
$this->pk = array('studiensemester_kurzbz', 'student_uid', 'lehrveranstaltung_id');
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class Organisationseinheit_model extends DB_Model
|
||||
FROM tree JOIN tbl_organisationseinheit oe ON (tree.oe_kurzbz = oe.oe_parent_kurzbz)
|
||||
)
|
||||
SELECT oe_kurzbz AS id,
|
||||
SUBSTRING(REGEXP_REPLACE(path, '[A-z]+\|', '-', 'g') || bezeichnung, 2) AS description
|
||||
SUBSTRING(REGEXP_REPLACE(path, '[A-z0-9]+\|', '-', 'g') || bezeichnung, 2) AS description
|
||||
FROM tree";
|
||||
|
||||
$parametersArray = array();
|
||||
@@ -125,12 +125,12 @@ class Organisationseinheit_model extends DB_Model
|
||||
public function getChilds($oe_kurzbz, $includeinactive = false)
|
||||
{
|
||||
$query = "
|
||||
WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
|
||||
WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
|
||||
(
|
||||
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
|
||||
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
|
||||
WHERE oe_kurzbz=? %s
|
||||
UNION ALL
|
||||
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
|
||||
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
|
||||
WHERE o.oe_parent_kurzbz=oes.oe_kurzbz %s
|
||||
)
|
||||
SELECT oe_kurzbz
|
||||
@@ -150,12 +150,12 @@ class Organisationseinheit_model extends DB_Model
|
||||
public function getParents($oe_kurzbz, $includeinactive = false)
|
||||
{
|
||||
$query=
|
||||
"WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
|
||||
"WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
|
||||
(
|
||||
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
|
||||
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
|
||||
WHERE oe_kurzbz=? %s
|
||||
UNION ALL
|
||||
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
|
||||
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
|
||||
WHERE o.oe_kurzbz=oes.oe_parent_kurzbz %s
|
||||
)
|
||||
SELECT oe_kurzbz
|
||||
@@ -177,7 +177,7 @@ class Organisationseinheit_model extends DB_Model
|
||||
{
|
||||
$condition = '
|
||||
oe_kurzbz = (
|
||||
SELECT
|
||||
SELECT
|
||||
oe_parent_kurzbz
|
||||
FROM
|
||||
public.tbl_organisationseinheit
|
||||
|
||||
@@ -448,4 +448,51 @@ class Studiengang_model extends DB_Model
|
||||
|
||||
return $this->execQuery($query, array($typ));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Studiengangsleitung
|
||||
* @param null $studiengang_kz
|
||||
* @return array
|
||||
*/
|
||||
public function getLeitung($studiengang_kz = null)
|
||||
{
|
||||
$this->addSelect('uid, studiengang_kz, oe_kurzbz, vorname, nachname, email');
|
||||
$this->addJoin('public.tbl_benutzerfunktion', 'oe_kurzbz');
|
||||
$this->addJoin('public.tbl_benutzer', 'uid');
|
||||
$this->addJoin('public.tbl_person', 'person_id');
|
||||
|
||||
if (is_null($studiengang_kz))
|
||||
{
|
||||
$condition = '
|
||||
funktion_kurzbz = \'Leitung\'
|
||||
AND ( datum_von <= NOW() OR datum_von IS NULL )
|
||||
AND ( datum_bis >= NOW() OR datum_bis IS NULL )
|
||||
';
|
||||
}
|
||||
elseif (is_numeric($studiengang_kz))
|
||||
{
|
||||
$condition = '
|
||||
funktion_kurzbz = \'Leitung\'
|
||||
AND ( datum_von <= NOW() OR datum_von IS NULL )
|
||||
AND ( datum_bis >= NOW() OR datum_bis IS NULL )
|
||||
AND studiengang_kz = ' . $this->db->escape($studiengang_kz, FHC_INTEGER)
|
||||
;
|
||||
}
|
||||
|
||||
return $this->loadWhere($condition);
|
||||
}
|
||||
|
||||
public function getStudiengaengeWithOrgForm($typ, $semester)
|
||||
{
|
||||
$query = "SELECT DISTINCT (UPPER(sg.typ || sg.kurzbz || ':' || sp.orgform_kurzbz)) AS Studiengang
|
||||
FROM public.tbl_studiengang sg
|
||||
JOIN lehre.tbl_studienordnung USING (studiengang_kz)
|
||||
JOIN lehre.tbl_studienplan sp USING (studienordnung_id)
|
||||
JOIN lehre.tbl_studienplan_semester spsem USING (studienplan_id)
|
||||
WHERE sp.aktiv = TRUE AND sg.aktiv = TRUE AND sg.typ IN ?
|
||||
AND spsem.studiensemester_kurzbz = ?
|
||||
ORDER BY Studiengang";
|
||||
|
||||
return $this->execQuery($query, array($typ, $semester));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class Studienjahr_model extends DB_Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets current Studienjahr, as determined by its start and enddate
|
||||
* Gets current Studienjahr, as determined by start and enddate of current semester
|
||||
* @return array|null
|
||||
*/
|
||||
public function getCurrStudienjahr()
|
||||
|
||||
@@ -39,7 +39,7 @@ class Studiensemester_model extends DB_Model
|
||||
$days = 60;
|
||||
}
|
||||
|
||||
$query = 'SELECT studiensemester_kurzbz
|
||||
$query = 'SELECT studiensemester_kurzbz, start, ende
|
||||
FROM public.tbl_studiensemester
|
||||
WHERE start < NOW() - \'' . $days . ' DAYS\'::INTERVAL
|
||||
ORDER BY start DESC
|
||||
@@ -59,7 +59,7 @@ class Studiensemester_model extends DB_Model
|
||||
$days = 62;
|
||||
}
|
||||
|
||||
$query = 'SELECT studiensemester_kurzbz
|
||||
$query = 'SELECT studiensemester_kurzbz, start, ende
|
||||
FROM public.tbl_studiensemester
|
||||
WHERE start < NOW() + \'' . $days . ' DAYS\':: INTERVAL
|
||||
ORDER BY start DESC
|
||||
@@ -132,7 +132,7 @@ class Studiensemester_model extends DB_Model
|
||||
$query .= ' WHERE SUBSTRING(studiensemester_kurzbz FROM 1 FOR 2) = \'' . $ss . '\'';
|
||||
}
|
||||
|
||||
$query .= ' ORDER BY delta LIMIT 1';
|
||||
$query .= ' ORDER BY delta, start LIMIT 1';
|
||||
|
||||
return $this->execQuery($query);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ class Studiensemester_model extends DB_Model
|
||||
{
|
||||
$query = "SELECT studiensemester_kurzbz, start, ende FROM public.vw_studiensemester
|
||||
WHERE studiensemester_kurzbz <> ?
|
||||
ORDER BY delta LIMIT 1";
|
||||
ORDER BY delta, start LIMIT 1";
|
||||
|
||||
return $this->execQuery($query, array($studiensemester_kurzbz));
|
||||
}
|
||||
|
||||
@@ -14,12 +14,14 @@ class Adresse_model extends DB_Model
|
||||
|
||||
|
||||
/**
|
||||
* gets person data from uid
|
||||
* @param $uid
|
||||
* Get Zustelladress of given person.
|
||||
* @param string $person_id
|
||||
* @param string $select
|
||||
* @return array
|
||||
*/
|
||||
public function getZustellAdresse($person_id)
|
||||
public function getZustellAdresse($person_id, $select = '*')
|
||||
{
|
||||
$this->addSelect($select);
|
||||
return $this->loadWhere(array('person_id' => $person_id, 'zustelladresse'=> true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,11 @@ class Benutzer_model extends DB_Model
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets active Benutzer from person_id
|
||||
* @param $person_id
|
||||
* @return object
|
||||
*/
|
||||
public function getFromPersonId($person_id)
|
||||
{
|
||||
return $this->loadWhere(array('person_id' => $person_id, 'aktiv' => true));
|
||||
@@ -23,14 +28,81 @@ class Benutzer_model extends DB_Model
|
||||
*/
|
||||
public function getActiveUserByPersonIdAndOrganisationUnit($person_id, $oe_kurzbz)
|
||||
{
|
||||
$sql = 'SELECT b.uid
|
||||
FROM public.tbl_benutzer b
|
||||
JOIN public.tbl_prestudent ps USING (person_id)
|
||||
JOIN public.tbl_studiengang sg USING (studiengang_kz)
|
||||
WHERE ps.person_id = ?
|
||||
AND sg.oe_kurzbz = ?
|
||||
AND b.aktiv = TRUE';
|
||||
$sql = 'SELECT
|
||||
b.uid,
|
||||
b.insertamum
|
||||
FROM
|
||||
public.tbl_prestudent ps
|
||||
JOIN public.tbl_studiengang sg USING (studiengang_kz)
|
||||
JOIN public.tbl_student USING(prestudent_id)
|
||||
JOIN public.tbl_benutzer b ON(uid = student_uid)
|
||||
WHERE ps.person_id = ?
|
||||
AND sg.oe_kurzbz = ?
|
||||
AND b.aktiv = TRUE';
|
||||
|
||||
return $this->execQuery($sql, array($person_id, $oe_kurzbz));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if alias exists
|
||||
* @param $alias
|
||||
*/
|
||||
public function aliasExists($alias)
|
||||
{
|
||||
$this->addSelect('1');
|
||||
$result = $this->loadWhere(array('alias' => $alias));
|
||||
|
||||
if (isSuccess($result))
|
||||
{
|
||||
if (hasData($result))
|
||||
{
|
||||
$result = success(array(true));
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = success(array(false));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates alias for a uid.
|
||||
* @param $uid
|
||||
* @return array the alias if newly generated
|
||||
*/
|
||||
public function generateAlias($uid)
|
||||
{
|
||||
$aliasres = '';
|
||||
$this->addLimit(1);
|
||||
$this->addSelect('vorname, nachname');
|
||||
$this->addJoin('public.tbl_person', 'person_id');
|
||||
$nameresult = $this->loadWhere(array('uid' => $uid));
|
||||
|
||||
if (hasData($nameresult))
|
||||
{
|
||||
$aliasdata = getData($nameresult);
|
||||
$alias = $this->_sanitizeAliasName($aliasdata[0]->vorname).'.'.$this->_sanitizeAliasName($aliasdata[0]->nachname);
|
||||
$aliasexists = $this->aliasExists($alias);
|
||||
|
||||
if (hasData($aliasexists) && !getData($aliasexists)[0])
|
||||
$aliasres = $alias;
|
||||
}
|
||||
return success($aliasres);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Sanitizes a string used for alias. Replaces special characters, spaces, sets lower case.
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
private function _sanitizeAliasName($str)
|
||||
{
|
||||
$str = sanitizeProblemChars($str);
|
||||
return mb_strtolower(str_replace(' ','_', $str));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,44 @@ class Benutzerfunktion_model extends DB_Model
|
||||
$this->pk = 'benutzerfunktion_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Lädt alle Benutzerfunktionen zu einer UID
|
||||
* @param type $uid UID des Mitarbeiters
|
||||
* @param type $funktion_kurzbz OPTIONAL Kurzbezeichnung der Funktion
|
||||
* @param type $startZeitraum OPTIONAL Start Zeitraum in dem die Funktion aktiv ist
|
||||
* @param type $endeZeitraum OPTIONAL Ende Zeitraum in dem die Funktion aktiv ist
|
||||
* @return boolean
|
||||
*/
|
||||
public function getBenutzerFunktionByUid($uid, $funktion_kurzbz=null, $startZeitraum=null, $endeZeitraum=null)
|
||||
{
|
||||
$params = array($uid);
|
||||
|
||||
$qry = "SELECT tbl_benutzerfunktion.*, tbl_organisationseinheit.bezeichnung as organisationseinheit_bezeichnung,
|
||||
tbl_organisationseinheit.organisationseinheittyp_kurzbz
|
||||
FROM public.tbl_benutzerfunktion
|
||||
LEFT JOIN public.tbl_organisationseinheit USING(oe_kurzbz)
|
||||
WHERE uid=?";
|
||||
if(!is_null($funktion_kurzbz))
|
||||
{
|
||||
$qry .= ' AND funktion_kurzbz = ?';
|
||||
$params[] = $funktion_kurzbz;
|
||||
}
|
||||
if(!is_null($startZeitraum))
|
||||
{
|
||||
$qry .=' AND (datum_bis IS NULL OR datum_bis >= ?)';
|
||||
$params[] = $startZeitraum;
|
||||
}
|
||||
if(!is_null($endeZeitraum))
|
||||
{
|
||||
$qry .=' AND (datum_von IS NULL OR datum_von <= ?)';
|
||||
$params[] = $endeZeitraum;
|
||||
}
|
||||
|
||||
$qry .= "ORDER BY datum_bis NULLS LAST, datum_von NULLS LAST;";
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Benutzerfunktion using the person_id
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,7 @@ class Kontakt_model extends DB_Model
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_kontakt';
|
||||
$this->pk = 'kontakt_id';
|
||||
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||
}
|
||||
|
||||
public function getWholeKontakt($kontakt_id, $person_id = null, $kontakttyp = null)
|
||||
@@ -59,4 +60,142 @@ class Kontakt_model extends DB_Model
|
||||
|
||||
return $this->execQuery($sql, array($person_id, $kontakttyp));
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt einen Kontakt eines Standortes
|
||||
* Es wird nur der erste Eintrag zurueckgeliefert!
|
||||
* @param $standort_id
|
||||
* @param $kontakttyp
|
||||
*/
|
||||
public function getFirmaKontakttyp($standort_id, $kontakttyp)
|
||||
{
|
||||
if (!is_numeric($standort_id))
|
||||
{
|
||||
return error('StandortID ist ungueltig');
|
||||
}
|
||||
|
||||
$qry = "SELECT kontakt, kontakt_id FROM public.tbl_kontakt WHERE standort_id=? AND kontakttyp=? ORDER BY kontakt_id LIMIT 1;";
|
||||
|
||||
return $this->execQuery($qry, array('standort_id' => $standort_id, 'kontakttyp' => $kontakttyp));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Firmentelefon for a uid, can be Vorwahl with Telefonklappe or Firmenhandy
|
||||
* @param $uid
|
||||
*/
|
||||
public function getFirmentelefon($uid)
|
||||
{
|
||||
$firmentelefon = success(array());
|
||||
|
||||
$this->MitarbeiterModel->addSelect('standort_id, telefonklappe, person_id');
|
||||
$this->MitarbeiterModel->addJoin('public.tbl_benutzer', 'tbl_mitarbeiter.mitarbeiter_uid = tbl_benutzer.uid');
|
||||
$mitarbeiter = $this->MitarbeiterModel->load(array('uid' => $uid));
|
||||
|
||||
if (hasData($mitarbeiter))
|
||||
{
|
||||
$mitarbeiter = getData($mitarbeiter);
|
||||
if (isEmptyString($mitarbeiter[0]->telefonklappe))
|
||||
{
|
||||
$this->addSelect('kontakt');
|
||||
$this->addOrder('updateamum, insertamum', 'DESC');
|
||||
$this->addLimit(1);
|
||||
$firmenhandy = $this->loadWhere(array('person_id' => $mitarbeiter[0]->person_id, 'kontakttyp' => 'firmenhandy'));
|
||||
if (hasData($firmenhandy))
|
||||
{
|
||||
$firmenhandy = getData($firmenhandy);
|
||||
$firmentelefon = success(array('kontakt' => $firmenhandy[0]->kontakt, 'telefonklappe' => ''));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$firmaKontakttyp = $this->getFirmaKontakttyp($mitarbeiter[0]->standort_id, 'telefon');
|
||||
if (hasData($firmaKontakttyp))
|
||||
{
|
||||
$vorwahl = getData($firmaKontakttyp);
|
||||
$vorwahl = $vorwahl[0]->kontakt;
|
||||
$firmentelefon = success(array('kontakt' => $vorwahl, 'telefonklappe' => $mitarbeiter[0]->telefonklappe));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $firmentelefon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all latest contact data of person, where Zustellung is true
|
||||
* @param $person_id
|
||||
* @return array
|
||||
*/
|
||||
public function getAll_byPersonID($person_id)
|
||||
{
|
||||
$this->addSelect('DISTINCT ON (kontakttyp) kontakttyp, kontakt');
|
||||
$this->addJoin('public.tbl_standort', 'standort_id', 'LEFT');
|
||||
$this->addJoin('public.tbl_firma', 'firma_id', 'LEFT');
|
||||
$this->addOrder('kontakttyp, kontakt, tbl_kontakt.updateamum, tbl_kontakt.insertamum');
|
||||
|
||||
return $this->loadWhere(array(
|
||||
'zustellung' => TRUE,
|
||||
'person_id' => $person_id
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all latest phones of person where zustellung is true. Ordered by
|
||||
* telefon > mobil > firmenhandy > else.
|
||||
* @param string person_id
|
||||
*/
|
||||
public function getPhones_byPerson($person_id)
|
||||
{
|
||||
$qry = '
|
||||
WITH latest_phones AS(
|
||||
SELECT DISTINCT ON (kontakttyp) kontakttyp, kontakt
|
||||
FROM public.tbl_kontakt kontakt
|
||||
LEFT JOIN public.tbl_standort USING (standort_id)
|
||||
LEFT JOIN public.tbl_firma USING (firma_id)
|
||||
WHERE person_id = ?
|
||||
AND zustellung
|
||||
AND kontakttyp IN (\'telefon\', \'mobil\', \'firmenhandy\')
|
||||
ORDER BY kontakttyp, kontakt, kontakt.updateamum
|
||||
)
|
||||
|
||||
SELECT * FROM latest_phones
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN kontakttyp = \'telefon\' THEN 0
|
||||
WHEN kontakttyp = \'mobil\' THEN 1
|
||||
WHEN kontakttyp = \'firmenhandy\' THEN 2
|
||||
ELSE 3
|
||||
END
|
||||
';
|
||||
|
||||
return $this->execQuery($qry, array($person_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads main contact, i.e. most recent Zustellkontakt with the given kontakttypes.
|
||||
* @param $person_id
|
||||
* @param $kontakttypen array of kontakttypen, one chronologically last Zustellkontakt for all given types
|
||||
* @return object
|
||||
*/
|
||||
public function getZustellKontakt($person_id, $kontakttypen)
|
||||
{
|
||||
if (is_string($kontakttypen))
|
||||
$kontakttypen = array($kontakttypen);
|
||||
|
||||
if (!isEmptyArray($kontakttypen))
|
||||
{
|
||||
$qry = "
|
||||
SELECT
|
||||
kontakt
|
||||
FROM
|
||||
public.tbl_kontakt
|
||||
WHERE person_id = ?
|
||||
AND kontakttyp IN ?
|
||||
ORDER BY zustellung DESC NULLS LAST, updateamum DESC, insertamum DESC
|
||||
LIMIT 1";
|
||||
|
||||
return $this->execQuery($qry, array($person_id, $kontakttypen));
|
||||
}
|
||||
else
|
||||
return success(array());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,9 +154,81 @@ class Notiz_model extends DB_Model
|
||||
{
|
||||
// Join with the table public.tbl_notizzuordnung using notiz_id
|
||||
$this->addJoin('public.tbl_notizzuordnung', 'notiz_id');
|
||||
$this->addOrder('insertamum', 'DESC');
|
||||
$this->addJoin('public.tbl_prestudent', 'prestudent_id', 'LEFT');
|
||||
$this->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT');
|
||||
$this->addOrder('public.tbl_notiz.insertamum', 'DESC');
|
||||
|
||||
return $this->loadWhere(array('person_id' => $person_id, 'titel LIKE' => $titel));
|
||||
return $this->loadWhere(array('public.tbl_notizzuordnung.person_id' => $person_id, 'titel LIKE' => $titel));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Notiz for a given Anrechnung
|
||||
* @param $anrechnung_id
|
||||
* @param $titel
|
||||
* @param $text
|
||||
* @param $verfasser_uid
|
||||
* @return array
|
||||
*/
|
||||
public function addNotizForAnrechnung($anrechnung_id, $titel, $text, $verfasser_uid)
|
||||
{
|
||||
// Loads model Notizzuordnung_model
|
||||
$this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel');
|
||||
|
||||
// Start DB transaction
|
||||
$this->db->trans_start(false);
|
||||
|
||||
$result = $this->insert(array(
|
||||
'titel' => $titel,
|
||||
'text' => $text,
|
||||
'erledigt' => true,
|
||||
'verfasser_uid' => $verfasser_uid,
|
||||
"insertvon" => $verfasser_uid
|
||||
));
|
||||
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$notiz_id = $result->retval;
|
||||
$result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, 'anrechnung_id' => $anrechnung_id));
|
||||
}
|
||||
|
||||
// Transaction complete!
|
||||
$this->db->trans_complete();
|
||||
|
||||
// Check if everything went ok during the transaction
|
||||
if ($this->db->trans_status() === false || isError($result))
|
||||
{
|
||||
$this->db->trans_rollback();
|
||||
$result = error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->trans_commit();
|
||||
$result = success($notiz_id);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Notizen by Anrechnung and title ordered last first
|
||||
*
|
||||
* @param $anrechnung_id
|
||||
* @return array
|
||||
*/
|
||||
public function getNotizByAnrechnung($anrechnung_id, $titel = null)
|
||||
{
|
||||
$this->addJoin('public.tbl_notizzuordnung', 'notiz_id');
|
||||
$this->addOrder('insertamum', 'DESC');
|
||||
|
||||
if (is_string($titel))
|
||||
{
|
||||
return $this->loadWhere(array(
|
||||
'anrechnung_id' => $anrechnung_id,
|
||||
'titel' => $titel
|
||||
));
|
||||
}
|
||||
|
||||
return $this->loadWhere(array('anrechnung_id' => $anrechnung_id));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ class Person_model extends DB_Model
|
||||
*/
|
||||
public function getByUid($uid)
|
||||
{
|
||||
$this->addSelect('vorname, nachname, gebdatum, person_id');
|
||||
$this->addSelect('vorname, nachname, gebdatum, person_id, bpk, matr_nr');
|
||||
$this->addJoin('tbl_benutzer', 'person_id');
|
||||
|
||||
return $this->loadWhere(array('uid' => $uid));
|
||||
@@ -248,4 +248,19 @@ class Person_model extends DB_Model
|
||||
|
||||
return $this->execQuery($qry, $parametersArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full name of given uid. (Vorname Nachname)
|
||||
* @param $uid
|
||||
* @return array
|
||||
*/
|
||||
public function getFullName($uid)
|
||||
{
|
||||
if (!$result = getData($this->getByUid($uid))[0])
|
||||
{
|
||||
show_error('Failed loading person');
|
||||
}
|
||||
|
||||
return success($result->vorname. ' '. $result->nachname);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Betriebsmittelperson_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -11,4 +10,45 @@ class Betriebsmittelperson_model extends DB_Model
|
||||
$this->dbTable = 'wawi.tbl_betriebsmittelperson';
|
||||
$this->pk = 'betriebsmittelperson_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Betriebsmittel by person.
|
||||
* @param string $person_id
|
||||
* @param string $betriebsmitteltyp
|
||||
* @param bool $isRetourniert False to retrieve only active Betriebsmittel.
|
||||
* @return array|bool
|
||||
*/
|
||||
public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null)
|
||||
{
|
||||
if (!is_numeric($person_id))
|
||||
{
|
||||
$this->errormsg = 'Person_id type is not valid.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id');
|
||||
|
||||
$condition = '
|
||||
person_id = '. $this->escape($person_id). '
|
||||
';
|
||||
|
||||
if (is_string($betriebsmitteltyp)) {
|
||||
$condition .= '
|
||||
AND betriebsmitteltyp = ' . $this->escape($betriebsmitteltyp);
|
||||
}
|
||||
|
||||
if ($isRetourniert === true) {
|
||||
$condition .= '
|
||||
AND retouram IS NOT NULL'; // return date is given
|
||||
}
|
||||
elseif ($isRetourniert === false)
|
||||
{
|
||||
$condition .= '
|
||||
AND retouram IS NULL'; // default
|
||||
}
|
||||
|
||||
$this->addOrder('ausgegebenam', 'DESC'); // default
|
||||
|
||||
return $this->loadWhere($condition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,4 +40,166 @@ class Mitarbeiter_model extends DB_Model
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt das Personal
|
||||
*
|
||||
* @param $aktiv wenn true werden nur aktive geladen, wenn false dann nur inaktve, wenn null dann alle
|
||||
* @param $fix wenn true werden nur fixangestellte geladen
|
||||
* @param $verwendung wenn true werden alle geladen die eine BIS-Verwendung eingetragen haben
|
||||
* @param $personaccount wenn true werden alle geladen die personalnr >= 0 haben, also "echte" Personaccounts
|
||||
* @return array
|
||||
*/
|
||||
public function getPersonal($aktiv, $fix, $verwendung, $personaccount = null, $uids = null)
|
||||
{
|
||||
$qry = "SELECT DISTINCT ON(mitarbeiter_uid) staatsbuergerschaft, geburtsnation, sprache, anrede, titelpost, titelpre,
|
||||
nachname, vorname, vornamen, gebdatum, gebort, gebzeit, tbl_person.anmerkung AS person_anmerkung, homepage, svnr, ersatzkennzeichen, familienstand,
|
||||
geschlecht, anzahlkinder, tbl_person.insertamum AS person_insertamum, tbl_person.updateamum as person_updateamum,
|
||||
tbl_person.updatevon AS person_updatevon, kompetenzen, kurzbeschreibung, zugangscode, zugangscode_timestamp, bpk,
|
||||
tbl_benutzer.*, tbl_mitarbeiter.*, akt_funk.oe_kurzbz AS funktionale_zuordnung, akt_funk.wochenstunden
|
||||
FROM ((public.tbl_mitarbeiter JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid))
|
||||
JOIN public.tbl_person USING(person_id))
|
||||
LEFT JOIN public.tbl_benutzerfunktion USING(uid)
|
||||
LEFT JOIN public.tbl_benutzerfunktion akt_funk ON tbl_mitarbeiter.mitarbeiter_uid = akt_funk.uid AND akt_funk.funktion_kurzbz = 'fachzuordnung'
|
||||
AND (akt_funk.datum_von IS NULL OR akt_funk.datum_von <= now()) AND (akt_funk.datum_bis IS NULL OR akt_funk.datum_bis >= now())
|
||||
WHERE true";
|
||||
|
||||
if ($fix === true)
|
||||
$qry .= " AND fixangestellt=true";
|
||||
elseif ($fix === false)
|
||||
$qry .= " AND fixangestellt=false";
|
||||
|
||||
if ($aktiv === true)
|
||||
$qry .= " AND tbl_benutzer.aktiv=true";
|
||||
elseif ($aktiv === false)
|
||||
$qry .= " AND tbl_benutzer.aktiv=false";
|
||||
|
||||
if ($verwendung === true)
|
||||
{
|
||||
$qry.=" AND EXISTS(SELECT * FROM bis.tbl_bisverwendung WHERE (ende>now() or ende is null) AND tbl_bisverwendung.mitarbeiter_uid=tbl_mitarbeiter.mitarbeiter_uid)";
|
||||
}
|
||||
elseif ($verwendung === false)
|
||||
{
|
||||
$qry.=" AND NOT EXISTS(SELECT * FROM bis.tbl_bisverwendung WHERE (ende>now() or ende is null) AND tbl_bisverwendung.mitarbeiter_uid=tbl_mitarbeiter.mitarbeiter_uid)";
|
||||
}
|
||||
|
||||
if ($personaccount === true)
|
||||
$qry .= " AND tbl_mitarbeiter.personalnummer >= 0";
|
||||
elseif ($personaccount === false)
|
||||
$qry .= " AND tbl_mitarbeiter.personalnummer < 0";
|
||||
|
||||
$params = array();
|
||||
if (!isEmptyArray($uids))
|
||||
{
|
||||
$qry .= " AND tbl_mitarbeiter.mitarbeiter_uid IN ?";
|
||||
$params[] = $uids;
|
||||
}
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt ein Array mit den UIDs der Vorgesetzten zurück
|
||||
* @return object
|
||||
*/
|
||||
public function getVorgesetzte($uid, $datum_von = null, $datum_bis = null)
|
||||
{
|
||||
$datum_von_var = isset($datum_von) ? '?' : 'now()';
|
||||
$datum_bis_var = isset($datum_bis) ? '?' : 'now()';
|
||||
$qry = "SELECT
|
||||
DISTINCT uid as vorgesetzter
|
||||
FROM
|
||||
public.tbl_benutzerfunktion
|
||||
WHERE
|
||||
funktion_kurzbz='Leitung' AND
|
||||
(datum_von is null OR datum_von<=%s) AND
|
||||
(datum_bis is null OR datum_bis>=%s) AND
|
||||
oe_kurzbz in (SELECT oe_kurzbz
|
||||
FROM public.tbl_benutzerfunktion
|
||||
WHERE
|
||||
funktion_kurzbz='oezuordnung' AND uid=? AND
|
||||
(datum_von is null OR datum_von<=%s) AND
|
||||
(datum_bis is null OR datum_bis>=%s)
|
||||
);";
|
||||
|
||||
$qry = sprintf($qry, $datum_von_var, $datum_bis_var, $datum_von_var, $datum_bis_var);
|
||||
|
||||
$params = array();
|
||||
if (isset($datum_von))
|
||||
$params[] = $datum_von;
|
||||
if (isset($datum_bis))
|
||||
$params[] = $datum_bis;
|
||||
|
||||
$params[] = $uid;
|
||||
|
||||
if (isset($datum_von))
|
||||
$params[] = $datum_von;
|
||||
if (isset($datum_bis))
|
||||
$params[] = $datum_bis;
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if alias exists
|
||||
* @param $kurzbz
|
||||
*/
|
||||
public function kurzbzExists($kurzbz)
|
||||
{
|
||||
$this->addSelect('1');
|
||||
$result = $this->loadWhere(array('kurzbz' => $kurzbz));
|
||||
|
||||
if (isSuccess($result))
|
||||
{
|
||||
if (hasData($result))
|
||||
{
|
||||
$result = success(array(true));
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = success(array(false));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates alias for a uid.
|
||||
* @param $uid
|
||||
* @return array the alias if newly generated
|
||||
*/
|
||||
public function generateKurzbz($uid)
|
||||
{
|
||||
$kurzbz = '';
|
||||
$this->addLimit(1);
|
||||
$this->addSelect('vorname, nachname');
|
||||
$this->addJoin('public.tbl_benutzer', 'tbl_mitarbeiter.mitarbeiter_uid = tbl_benutzer.uid');
|
||||
$this->addJoin('public.tbl_person', 'person_id');
|
||||
$nameresult = $this->loadWhere(array('uid' => $uid));
|
||||
|
||||
if (hasData($nameresult))
|
||||
{
|
||||
$kurzbzdata = getData($nameresult);
|
||||
$nachname_clean = sanitizeProblemChars($kurzbzdata[0]->nachname);
|
||||
$vorname_clean = sanitizeProblemChars($kurzbzdata[0]->vorname);
|
||||
|
||||
for ($nn = 6, $vn = 2; $nn != 0; $nn--, $vn++)
|
||||
{
|
||||
$kurzbz = mb_substr($nachname_clean, 0, $nn);
|
||||
$kurzbz .= mb_substr($vorname_clean, 0, $vn);
|
||||
|
||||
$kurzbzexists = $this->kurzbzExists($kurzbz);
|
||||
|
||||
if (hasData($kurzbzexists) && !getData($kurzbzexists)[0])
|
||||
break;
|
||||
}
|
||||
|
||||
$kurzbzexists = $this->kurzbzExists($kurzbz);
|
||||
|
||||
if (hasData($kurzbzexists) && getData($kurzbzexists)[0])
|
||||
return error('No Kurzbezeichnung could be generated');
|
||||
}
|
||||
return success($kurzbz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,14 @@ class Zeitaufzeichnung_model extends DB_Model
|
||||
$this->dbTable = 'campus.tbl_zeitaufzeichnung';
|
||||
$this->pk = 'zeitaufzeichnung_id';
|
||||
}
|
||||
|
||||
public function deleteEntriesForCurrentDay()
|
||||
{
|
||||
$today = date('Y-m-d');
|
||||
$qry = "DELETE FROM " . $this->dbTable . "
|
||||
WHERE start >= '" . $today . " 00:00:00'
|
||||
AND start <= '" . $today . " 23:59:59';";
|
||||
|
||||
return $this->execQuery($qry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,13 @@ class Zeitsperre_model extends DB_Model
|
||||
$this->dbTable = 'campus.tbl_zeitsperre';
|
||||
$this->pk = 'zeitsperre_id';
|
||||
}
|
||||
|
||||
public function deleteEntriesForCurrentDay()
|
||||
{
|
||||
$today = date('Y-m-d');
|
||||
$qry = "DELETE FROM " . $this->dbTable . "
|
||||
WHERE vondatum = '" . $today . "';";
|
||||
|
||||
return $this->execQuery($qry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
<?php
|
||||
|
||||
class FAS_UDF_model extends DB_Model
|
||||
{
|
||||
// String values of booleans
|
||||
const STRING_NULL = 'null';
|
||||
const STRING_TRUE = 'true';
|
||||
const STRING_FALSE = 'false';
|
||||
|
||||
const UDF_DROPDOWN_TYPE = 'dropdown';
|
||||
const UDF_MULTIPLEDROPDOWN_TYPE = 'multipledropdown';
|
||||
|
||||
/**
|
||||
* Methods to save data from FAS
|
||||
*/
|
||||
public function saveUDFs($udfs)
|
||||
{
|
||||
$result = error('No way man!');
|
||||
$resultPerson = success('person');
|
||||
$resultPrestudent = success('prestudent');
|
||||
|
||||
$person_id = null;
|
||||
if (isset($udfs['person_id'])) $person_id = $udfs['person_id'];
|
||||
unset($udfs['person_id']);
|
||||
|
||||
$prestudent_id = null;
|
||||
if (isset($udfs['prestudent_id'])) $prestudent_id = $udfs['prestudent_id'];
|
||||
unset($udfs['prestudent_id']);
|
||||
|
||||
$jsons = array();
|
||||
|
||||
//
|
||||
if (isset($person_id))
|
||||
{
|
||||
// Load model Person_model
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
$result = $this->load(array('public', 'tbl_person'));
|
||||
if (isSuccess($result) && count($result->retval) == 1)
|
||||
{
|
||||
$jsons = json_decode($result->retval[0]->jsons);
|
||||
}
|
||||
|
||||
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
|
||||
|
||||
$resultPerson = $this->PersonModel->update($person_id, $udfs);
|
||||
}
|
||||
|
||||
//
|
||||
if (isset($prestudent_id))
|
||||
{
|
||||
// Load model Prestudent_model
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$result = $this->load(array('public', 'tbl_prestudent'));
|
||||
if (isSuccess($result) && count($result->retval) == 1)
|
||||
{
|
||||
$jsons = json_decode($result->retval[0]->jsons);
|
||||
}
|
||||
|
||||
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
|
||||
|
||||
$resultPrestudent = $this->PrestudentModel->update($prestudent_id, $udfs);
|
||||
}
|
||||
|
||||
if (isSuccess($resultPerson) && isSuccess($resultPrestudent))
|
||||
{
|
||||
$result = success(array($resultPerson->retval, $resultPrestudent->retval));
|
||||
}
|
||||
else if(isError($resultPerson))
|
||||
{
|
||||
$result = $resultPerson;
|
||||
}
|
||||
else if(isError($resultPrestudent))
|
||||
{
|
||||
$result = $resultPrestudent;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _fillMissingChkboxUDF($udfs, $jsons)
|
||||
{
|
||||
$_fillMissingChkboxUDF = $udfs;
|
||||
|
||||
foreach($jsons as $udfDescription)
|
||||
{
|
||||
if ($udfDescription->{UDFLib::TYPE} == UDFLib::CHKBOX_TYPE)
|
||||
{
|
||||
if (!isset($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}]))
|
||||
{
|
||||
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_FALSE)
|
||||
{
|
||||
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = false;
|
||||
}
|
||||
else if ($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_TRUE)
|
||||
{
|
||||
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_fillMissingChkboxUDF;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _fillMissingDropdownUDF($udfs, $jsons)
|
||||
{
|
||||
$_fillMissingDropdownUDF = $udfs;
|
||||
|
||||
foreach($jsons as $udfDescription)
|
||||
{
|
||||
if ($udfDescription->{UDFLib::TYPE} == UDF_model::UDF_DROPDOWN_TYPE
|
||||
|| $udfDescription->{UDFLib::TYPE} == UDF_model::UDF_MULTIPLEDROPDOWN_TYPE)
|
||||
{
|
||||
if (!isset($_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}]))
|
||||
{
|
||||
$_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
else if($_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_NULL)
|
||||
{
|
||||
$_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_fillMissingDropdownUDF;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _fillMissingTextUDF($udfs, $jsons)
|
||||
{
|
||||
$_fillMissingTextUDF = $udfs;
|
||||
|
||||
foreach($jsons as $udfDescription)
|
||||
{
|
||||
if ($udfDescription->{UDFLib::TYPE} == 'textarea'
|
||||
|| $udfDescription->{UDFLib::TYPE} == 'textfield')
|
||||
{
|
||||
if (!isset($_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}]))
|
||||
{
|
||||
$_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
else if(trim($_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}]) == '')
|
||||
{
|
||||
$_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_fillMissingTextUDF;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class JobStatuses_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->dbTable = 'system.tbl_jobstatuses';
|
||||
$this->pk = 'status';
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
class JobTriggers_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->dbTable = 'system.tbl_jobtriggers';
|
||||
$this->pk = array('type', 'status', 'followingType');
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getJobtriggersByTypeStatuses($type, $triggeredStatuses)
|
||||
{
|
||||
$query = 'SELECT jt.type,
|
||||
jt.status,
|
||||
jt.following_type
|
||||
FROM system.tbl_jobtriggers jt
|
||||
WHERE jt.type = ?
|
||||
AND jt.status IN ?
|
||||
ORDER BY jt.type, jt.status';
|
||||
|
||||
return $this->execQuery($query, array($type, $triggeredStatuses));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class JobTypes_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->dbTable = 'system.tbl_jobtypes';
|
||||
$this->pk = 'type';
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class JobsQueue_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->dbTable = 'system.tbl_jobsqueue';
|
||||
$this->pk = 'jobid';
|
||||
}
|
||||
}
|
||||
@@ -171,6 +171,23 @@ class Message_model extends DB_Model
|
||||
return error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get message variables for logged in user
|
||||
*/
|
||||
public function getMsgVarsLoggedInUser()
|
||||
{
|
||||
$result = $this->db->query('SELECT * FROM public.vw_msg_vars_user WHERE 0 = 1');
|
||||
|
||||
if ($result)
|
||||
{
|
||||
return success($result->list_fields());
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getMsgVarsDataByPrestudentId
|
||||
@@ -191,4 +208,26 @@ class Message_model extends DB_Model
|
||||
|
||||
return $this->execQuery(sprintf($query, is_array($person_id) ? 'IN' : '='), array($person_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get message vars data for logged in user
|
||||
* @param string uid The UID should ONLY be passed if this method is called by a cronjob.
|
||||
* This is to enable jobs to use templates which use logged-in-user fields ('Eigene Felder').
|
||||
* @return array|null
|
||||
*/
|
||||
public function getMsgVarsDataByLoggedInUser($uid = null)
|
||||
{
|
||||
if (is_string($uid))
|
||||
{
|
||||
$params = array($uid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$params = array(getAuthUID());
|
||||
}
|
||||
|
||||
$query = 'SELECT * FROM public.vw_msg_vars_user WHERE my_uid = ?';
|
||||
|
||||
return $this->execQuery($query, $params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@ class Variablenname_model extends DB_Model
|
||||
ORDER BY studienjahr_kurzbz, start
|
||||
) sem
|
||||
WHERE start > now()
|
||||
LIMIT 1;'
|
||||
LIMIT 1;',
|
||||
'infocenter_studiensgangtyp' => 'SELECT infocenter_studiensgangtyp FROM public.tbl_variablenname LIMIT 1'
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,359 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => $this->p->t('anrechnung', 'anrechnungenGenehmigen'),
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'phrases' => array(
|
||||
'global' => array(
|
||||
'anerkennungNachgewiesenerKenntnisse',
|
||||
'antragStellen'
|
||||
),
|
||||
'ui' => array(
|
||||
'hilfeZuDieserSeite',
|
||||
'hochladen',
|
||||
'nichtSelektierbarAufgrundVon',
|
||||
'nichtSelektierbarAufgrundVon',
|
||||
'systemfehler',
|
||||
'bitteMindEinenAntragWaehlen',
|
||||
'bitteBegruendungAngeben',
|
||||
'empfehlungWurdeAngefordert',
|
||||
'anrechnungenWurdenGenehmigt',
|
||||
'anrechnungenWurdenAbgelehnt'
|
||||
),
|
||||
'person' => array(
|
||||
'student',
|
||||
'personenkennzeichen'
|
||||
),
|
||||
'lehre' => array(
|
||||
'studiensemester',
|
||||
'studiengang',
|
||||
'lehrveranstaltung',
|
||||
'ects',
|
||||
'lektor',
|
||||
)
|
||||
),
|
||||
'customCSSs' => array(
|
||||
'public/css/Tabulator.css'
|
||||
),
|
||||
'customJSs' => array(
|
||||
'public/js/bootstrapper.js',
|
||||
'public/js/lehre/anrechnung/approveAnrechnungDetail.js'
|
||||
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<!-- title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 page-header">
|
||||
<h3>
|
||||
<?php echo $this->p->t('anrechnung', 'anrechnungenGenehmigen'); ?>
|
||||
<small>| <?php echo $this->p->t('global', 'detailsicht'); ?></small>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
||||
<!-- Antragsdaten -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<span class="text-uppercase"><b><?php echo $this->p->t('anrechnung', 'antrag'); ?></b></span> 
|
||||
<span class="approveAnrechnungDetail-anrechnungInfoTooltip"
|
||||
data-toggle="tooltip" data-placement="right"
|
||||
title="<?php echo $this->p->t('anrechnung', 'anrechnungInfoTooltipText'); ?>">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="pull-right"><?php echo $this->p->t('anrechnung', 'antragdatum'); ?>: <span
|
||||
id="approveAnrechnung-status"><?php echo !empty($anrechnungData->anrechnung_id) ? $anrechnungData->insertamum : '-' ?></span></span>
|
||||
</div>
|
||||
<table class="panel-body table table-bordered table-condensed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><?php echo ucfirst($this->p->t('person', 'student')); ?></td>
|
||||
<td><?php echo $antragData->vorname . ' ' . $antragData->nachname; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('person', 'personenkennzeichen'); ?></td>
|
||||
<td><?php echo $antragData->matrikelnr ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo ucfirst($this->p->t('lehre', 'studiensemester')); ?></td>
|
||||
<td><?php echo $antragData->studiensemester_kurzbz ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo ucfirst($this->p->t('lehre', 'studiengang')); ?></td>
|
||||
<td><?php echo $antragData->stg_bezeichnung ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('lehre', 'lehrveranstaltung'); ?></td>
|
||||
<td><?php echo $antragData->lv_bezeichnung ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('lehre', 'ects'); ?></td>
|
||||
<td><?php echo $antragData->ects ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('lehre', 'lektorInnen'); ?></td>
|
||||
<td>
|
||||
<?php $len = count($antragData->lektoren) - 1 ?>
|
||||
<?php foreach ($antragData->lektoren as $key => $lektor): ?>
|
||||
<?php echo $lektor->vorname . ' ' . $lektor->nachname;
|
||||
echo $key === $len ? '' : ', ' ?>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('anrechnung', 'herkunftDerKenntnisse'); ?></td>
|
||||
<td><?php echo $anrechnungData->anmerkung ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('anrechnung', 'nachweisdokumente'); ?></td>
|
||||
<td>
|
||||
<a href="<?php echo current_url() . '/download?dms_id=' . $anrechnungData->dms_id; ?>"
|
||||
target="_blank"><?php echo htmlentities($anrechnungData->dokumentname) ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Empfehlungsdaten -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form>
|
||||
<input type="hidden" name="anrechnung_id"
|
||||
value="<?php echo $anrechnungData->anrechnung_id ?>">
|
||||
<div class="panel panel-default" id="test">
|
||||
|
||||
<div class="panel-heading">
|
||||
<span class="text-uppercase"><b><?php echo $this->p->t('anrechnung', 'empfehlung'); ?></b></span> 
|
||||
<!-- <span class="approveAnrechnungDetail-empfehlungInfoTooltip"-->
|
||||
<!-- data-toggle="tooltip" data-placement="right"-->
|
||||
<!-- title="--><?php //echo $this->p->t('anrechnung', 'empfehlungInfoTooltipText'); ?><!--">-->
|
||||
<!-- <i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>-->
|
||||
<!-- </span>-->
|
||||
<div class="pull-right">
|
||||
<?php echo $this->p->t('anrechnung', 'empfehlungVon'); ?>:
|
||||
<span id="approveAnrechnungDetail-empfehlungVon"><?php echo $empfehlungData->empfehlung_von ?></span>
|
||||
 | 
|
||||
<?php echo $this->p->t('anrechnung', 'empfehlungdatum'); ?>:
|
||||
<span id="approveAnrechnungDetail-empfehlungAm"><?php echo $empfehlungData->empfehlung_am ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body" id="approveAnrechnungDetail-empfehlungDetail">
|
||||
|
||||
<div class="panel panel-default panel-body
|
||||
<?php echo is_null($empfehlungData->empfehlung) && $anrechnungData->status_kurzbz != 'inProgressLektor' ? '' : 'hidden' ?>"
|
||||
id="approveAnrechnungDetail-empfehlungDetail-empfehlungIsNull">
|
||||
<?php echo $this->p->t('anrechnung', 'keineEmpfehlungAngefordert'); ?>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default panel-body <?php echo
|
||||
is_null($empfehlungData->empfehlung) && $anrechnungData->status_kurzbz == 'inProgressLektor'
|
||||
? '' : 'hidden' ?>"
|
||||
id="approveAnrechnungDetail-empfehlungDetail-empfehlungIsAngefordert">
|
||||
<?php echo $this->p->t('anrechnung', 'empfehlungAngefordertNochKeineEmpfehlung'); ?>
|
||||
<span id="approveAnrechnungDetail-empfehlungDetail-empfehlungAngefordertAm">
|
||||
<?php echo $empfehlungData->empfehlung_angefordert_am ?>
|
||||
</span>.
|
||||
</div>
|
||||
|
||||
<div class="alert alert-success <?php echo $empfehlungData->empfehlung === true ? '' : 'hidden' ?>"
|
||||
id="approveAnrechnungDetail-empfehlungDetail-empfehlungIsTrue">
|
||||
<b><?php echo $this->p->t('anrechnung', 'empfehlungPositivConfirmed'); ?></b>
|
||||
</div>
|
||||
|
||||
<div class="<?php echo $empfehlungData->empfehlung === false ? '' : 'hidden' ?>"
|
||||
id="approveAnrechnungDetail-empfehlungDetail-empfehlungIsFalse">
|
||||
<div class="alert alert-danger">
|
||||
<b><?php echo $this->p->t('anrechnung', 'empfehlungNegativConfirmed'); ?></b>
|
||||
</div>
|
||||
<div class="well"><b><?php echo $this->p->t('global', 'begruendung'); ?>
|
||||
: </b>
|
||||
<span id="approveAnrechnungDetail-empfehlungDetail-begruendung"><?php echo htmlentities($empfehlungData->notiz) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="pull-right">
|
||||
<button id="approveAnrechnungDetail-request-recommendation" class="btn btn-primary btn-w200"
|
||||
<?php echo is_null($empfehlungData->empfehlung) && $anrechnungData->status_kurzbz == 'inProgressDP' ? '' : 'disabled' ?>>
|
||||
<?php echo ucfirst($this->p->t('anrechnung', 'empfehlungAnfordern')); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br><br>
|
||||
<!-- Genehmigungssdaten -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="panel panel-default">
|
||||
|
||||
<div class="panel-heading">
|
||||
<span class="text-uppercase"><b><?php echo $this->p->t('anrechnung', 'genehmigung'); ?></b></span> 
|
||||
<!-- <span class="approveAnrechnungDetail-genehmigungInfoTooltip"-->
|
||||
<!-- data-toggle="tooltip" data-placement="right"-->
|
||||
<!-- title="--><?php //echo $this->p->t('anrechnung', 'genehmigungInfoTooltipText'); ?><!--">-->
|
||||
<!-- <i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>-->
|
||||
<!-- </span>-->
|
||||
<div class="pull-right">
|
||||
<?php echo $this->p->t('anrechnung', 'abgeschlossenVon'); ?>:
|
||||
<span id="approveAnrechnungDetail-abgeschlossenVon"><?php echo $genehmigungData->abgeschlossen_von ?></span>
|
||||
 | 
|
||||
<?php echo $this->p->t('anrechnung', 'abschlussdatum'); ?>:
|
||||
<span id="approveAnrechnungDetail-abgeschlossenAm"><?php echo $genehmigungData->abgeschlossen_am ?></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body" id="approveAnrechnungDetail-genehmigungDetail">
|
||||
|
||||
<div class="panel panel-default panel-body <?php echo is_null($genehmigungData->genehmigung) ? '' : 'hidden' ?>"
|
||||
id="approveAnrechnungDetail-genehmigungDetail-genehmigungIsNull">
|
||||
<?php echo $this->p->t('anrechnung', 'nochKeineGenehmigung'); ?>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-success <?php echo $genehmigungData->genehmigung === true ? '' : 'hidden' ?>"
|
||||
id="approveAnrechnungDetail-genehmigungDetail-genehmigungIsPositiv">
|
||||
<b><?php echo $this->p->t('anrechnung', 'genehmigungPositiv'); ?></b>
|
||||
</div>
|
||||
|
||||
<div class="<?php echo $genehmigungData->genehmigung === false ? '' : 'hidden' ?>"
|
||||
id="approveAnrechnungDetail-genehmigungDetail-genehmigungIsNegativ">
|
||||
<div class="alert alert-danger">
|
||||
<b><?php echo $this->p->t('anrechnung', 'genehmigungNegativ'); ?></b>
|
||||
</div>
|
||||
<div class="well"><b><?php echo $this->p->t('global', 'begruendung'); ?>
|
||||
: </b>
|
||||
<span id="approveAnrechnungDetail-genehmigungDetail-begruendung"><?php echo htmlentities($genehmigungData->notiz) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form>
|
||||
<input type="hidden" name="anrechnung_id"
|
||||
value="<?php echo $anrechnungData->anrechnung_id ?>">
|
||||
<div class="panel panel-default panel-body" style="display: none"
|
||||
id="approveAnrechnungDetail-begruendung-panel">
|
||||
<div>
|
||||
<h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'genehmigungNegativQuestion'); ?></h4>
|
||||
<b> <?php echo $this->p->t('anrechnung', 'bitteBegruendungAngeben'); ?></b><br><br>
|
||||
<ul>
|
||||
<li>
|
||||
<span><?php echo $this->p->t('anrechnung', 'genehmigungNegativPruefungNichtMoeglich'); ?></span>
|
||||
<span class="btn-copyIntoTextarea" data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
|
||||
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span><?php echo $this->p->t('anrechnung', 'genehmigungNegativKenntnisseNichtGleichwertig'); ?></span>
|
||||
<span class="btn-copyIntoTextarea" data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
|
||||
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</span>
|
||||
</li>
|
||||
<li><?php echo $this->p->t('anrechnung', 'andereBegruendung'); ?></li>
|
||||
</ul>
|
||||
<br>
|
||||
<textarea class="form-control" name="begruendung"
|
||||
id="approveAnrechnungDetail-begruendung"
|
||||
rows="2" required></textarea>
|
||||
</div>
|
||||
<br>
|
||||
<!-- Action Button 'Abbrechen'-->
|
||||
<div class="pull-right">
|
||||
<button id="approveAnrechnungDetail-begruendung-abbrechen"
|
||||
class="btn btn-default btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'abbrechen')); ?>
|
||||
</button>
|
||||
<button id="approveAnrechnungDetail-reject-anrechnung-confirm"
|
||||
class="btn btn-primary btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'bestaetigen')); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default panel-body" style="display: none"
|
||||
id="approveAnrechnungDetail-genehmigung-panel">
|
||||
<div>
|
||||
<h4 class="panel panel-body panel-success text-success"><?php echo $this->p->t('anrechnung', 'genehmigungPositivQuestion'); ?></h4>
|
||||
 <?php echo $this->p->t('anrechnung', 'genehmigungPositivSubquestion'); ?>
|
||||
<br><br>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<!-- Action Button 'Abbrechen'-->
|
||||
<div class="pull-right">
|
||||
<button id="approveAnrechnungDetail-genehmigung-abbrechen"
|
||||
class="btn btn-default btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'abbrechen')); ?>
|
||||
</button>
|
||||
<button id="approveAnrechnungDetail-approve-anrechnung-confirm"
|
||||
class="btn btn-primary btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'bestaetigen')); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<button id="approveAnrechnungDetail-reject-anrechnung-ask" class="btn btn-danger btn-w200"
|
||||
<?php echo $anrechnungData->status_kurzbz == 'inProgressDP' ? '' : 'disabled' ?>>
|
||||
<?php echo ucfirst($this->p->t('global', 'ablehnen')); ?>
|
||||
</button>
|
||||
<button id="approveAnrechnungDetail-approve-anrechnung-ask" class="btn btn-primary btn-w200"
|
||||
<?php echo $anrechnungData->status_kurzbz == 'inProgressDP' ? '' : 'disabled' ?>>
|
||||
<?php echo ucfirst($this->p->t('global', 'genehmigen')); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-xs-4">
|
||||
<div class="alert text-center">
|
||||
Status:
|
||||
<b><span class="text-uppercase" id="approveAnrechnungDetail-status_kurzbz"
|
||||
data-status_kurzbz="<?php echo $anrechnungData->status_kurzbz ?>">
|
||||
<?php echo $anrechnungData->status; ?>
|
||||
</span></b>
|
||||
</div>
|
||||
<br>
|
||||
<?php $this->load->view('lehre/anrechnung/reviewAnrechnungInfo'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => $this->p->t('anrechnung', 'anrechnungenGenehmigen'),
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'tabulator' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'tablewidget' => true,
|
||||
'phrases' => array(
|
||||
'global' => array(
|
||||
'begruendung'
|
||||
),
|
||||
'anrechnung' => array(
|
||||
'nachweisdokumente',
|
||||
'empfehlung',
|
||||
'confirmTextAntragHatBereitsEmpfehlung',
|
||||
'herkunft'
|
||||
),
|
||||
'ui' => array(
|
||||
'anzeigen',
|
||||
'alleAnzeigen',
|
||||
'hilfeZuDieserSeite',
|
||||
'hochladen',
|
||||
'spaltenEinstellen',
|
||||
'hilfeZuDieserSeite',
|
||||
'alleAuswaehlen',
|
||||
'alleAbwaehlen',
|
||||
'ausgewaehlteZeilen',
|
||||
'hilfe',
|
||||
'tabelleneinstellungen',
|
||||
'keineDatenVorhanden',
|
||||
'spaltenEinstellen',
|
||||
'ja',
|
||||
'nein',
|
||||
'nichtSelektierbarAufgrundVon',
|
||||
'nichtSelektierbarAufgrundVon',
|
||||
'systemfehler',
|
||||
'bitteMindEinenAntragWaehlen',
|
||||
'bitteBegruendungAngeben',
|
||||
'empfehlungWurdeAngefordert',
|
||||
'anrechnungenWurdenGenehmigt',
|
||||
'anrechnungenWurdenAbgelehnt'
|
||||
),
|
||||
'person' => array(
|
||||
'student',
|
||||
'personenkennzeichen',
|
||||
'vorname',
|
||||
'nachname'
|
||||
),
|
||||
'lehre' => array(
|
||||
'studiensemester',
|
||||
'studiengang',
|
||||
'lehrveranstaltung',
|
||||
'ects',
|
||||
'lektor',
|
||||
),
|
||||
'table' => array(
|
||||
'spaltenEinAusblenden',
|
||||
'spaltenEinAusblendenMitKlickOeffnen',
|
||||
'spaltenEinAusblendenAufEinstellungenKlicken',
|
||||
'spaltenEinAusblendenMitKlickAktivieren',
|
||||
'spaltenEinAusblendenMitKlickSchliessen',
|
||||
'spaltenbreiteVeraendern',
|
||||
'spaltenbreiteVeraendernText',
|
||||
'spaltenbreiteVeraendernInfotext',
|
||||
'zeilenAuswaehlen',
|
||||
'zeilenAuswaehlenEinzeln',
|
||||
'zeilenAuswaehlenBereich',
|
||||
'zeilenAuswaehlenAlle'
|
||||
)
|
||||
),
|
||||
'customJSs' => array(
|
||||
'public/js/bootstrapper.js',
|
||||
'public/js/lehre/anrechnung/approveAnrechnungUebersicht.js'
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<!-- title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 page-header">
|
||||
<h3>
|
||||
<?php echo $this->p->t('anrechnung', 'anrechnungenGenehmigen'); ?>
|
||||
<small>| <?php echo ucfirst($this->p->t('global', 'uebersicht')); ?></small>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<!-- dropdown studiensemester -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="formApproveAnrechnungUebersicht" class="form-inline" action="" method="get">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Studiensemester_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $studiensemester_selected
|
||||
),
|
||||
array(
|
||||
'name' => 'studiensemester',
|
||||
'id' => 'studiensemester'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="btn btn-default form-group"><?php echo ucfirst($this->p->t('ui', 'anzeigen')); ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Tabelle -->
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<?php $this->load->view('lehre/anrechnung/approveAnrechnungUebersichtData.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Genehmigen / Ablehnen Panel -->
|
||||
<div class="row">
|
||||
<div class="panel panel-default panel-body" style="display: none"
|
||||
id="approveAnrechnungUebersicht-begruendung-panel">
|
||||
<div>
|
||||
<h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'genehmigungenNegativQuestion'); ?></h4>
|
||||
<b><?php echo $this->p->t('anrechnung', 'bitteBegruendungAngeben'); ?></b><br><br>
|
||||
<ol>
|
||||
<li><?php echo $this->p->t('anrechnung', 'genehmigungNegativPruefungNichtMoeglich'); ?>
|
||||
<span class="btn-copyIntoTextarea" data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
|
||||
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</span>
|
||||
</li>
|
||||
<li><?php echo $this->p->t('anrechnung', 'genehmigungNegativKenntnisseNichtGleichwertig'); ?>
|
||||
<span class="btn-copyIntoTextarea" data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
|
||||
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</span>
|
||||
</li>
|
||||
<li><?php echo $this->p->t('anrechnung', 'andereBegruendung'); ?></li>
|
||||
</ol>
|
||||
<br>
|
||||
<span class="text-danger">
|
||||
<?php echo $this->p->t('anrechnung', 'begruendungWirdFuerAlleUebernommen'); ?>
|
||||
</span><br><br>
|
||||
<textarea class="form-control" name="begruendung" id="approveAnrechnungUebersicht-begruendung"
|
||||
rows="2" required></textarea>
|
||||
</div>
|
||||
<br>
|
||||
<!-- Action Button 'Abbrechen'-->
|
||||
<div class="pull-right">
|
||||
<button id="approveAnrechnungUebersicht-begruendung-abbrechen" class="btn btn-default btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'abbrechen')); ?>
|
||||
</button>
|
||||
<button id="approveAnrechnungUebersicht-reject-anrechnungen-confirm"
|
||||
class="btn btn-primary btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'bestaetigen')); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default panel-body" style="display: none"
|
||||
id="approveAnrechnungUebersicht-genehmigung-panel">
|
||||
<div>
|
||||
<h4 class="panel panel-body panel-success text-success"><?php echo $this->p->t('anrechnung', 'genehmigungenPositivQuestion'); ?></h4>
|
||||
 <?php echo $this->p->t('anrechnung', 'genehmigungenPositiv'); ?><br><br>
|
||||
</div>
|
||||
<br>
|
||||
<!-- Action Button 'Abbrechen'-->
|
||||
<div class="pull-right">
|
||||
<button id="approveAnrechnungUebersicht-empfehlung-abbrechen" class="btn btn-default btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'abbrechen')); ?>
|
||||
</button>
|
||||
<button id="approveAnrechnungUebersicht-approve-anrechnungen-confirm"
|
||||
class="btn btn-primary btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'bestaetigen')); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Filter buttons / Submit buttons-->
|
||||
<div class="row">
|
||||
<!-- Filter buttons -->
|
||||
<div class="col-xs-3">
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<div class="btn-group" role="group">
|
||||
<button id="show-inProgressDP" class="btn btn-default btn-clearfilter" type="button"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'alleInBearbeitungSTGL'); ?>">
|
||||
<i class='fa fa-eye'></i>
|
||||
</button>
|
||||
<button id="show-recommended" class="btn btn-default btn-clearfilter" type="button"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'nurEmpfohleneAnzeigen'); ?>"><i
|
||||
class='fa fa-thumbs-o-up'></i>
|
||||
</button>
|
||||
<button id="show-not-recommended" class="btn btn-default btn-clearfilter" type="button"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'nurNichtEmpfohleneAnzeigen'); ?>"><i
|
||||
class='fa fa-thumbs-o-down'></i>
|
||||
</button>
|
||||
<button id="show-approved" class="btn btn-default btn-clearfilter" type="button"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'nurGenehmigteAnzeigen'); ?>"><i
|
||||
class='fa fa-check'></i>
|
||||
</button>
|
||||
<button id="show-rejected" class="btn btn-default btn-clearfilter" type="button"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'nurAbgelehnteAnzeigen'); ?>"><i
|
||||
class='fa fa-times'></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Action Buttons 'Genehmigen', Ablehnen, 'Empfehlung anfordern'-->
|
||||
<div class="col-xs-9">
|
||||
<div class="pull-right">
|
||||
<button id="approveAnrechnungUebersicht-request-recommendation"
|
||||
class="btn btn-default btn-w200 btn-mr50"><?php echo ucfirst($this->p->t('anrechnung', 'empfehlungAnfordern')); ?></button>
|
||||
<button id="approveAnrechnungUebersicht-reject-anrechnungen-ask"
|
||||
class="btn btn-danger btn-w200"><?php echo ucfirst($this->p->t('global', 'ablehnen')); ?></button>
|
||||
<button id="approveAnrechnungUebersicht-approve-anrechnungen-ask"
|
||||
class="btn btn-primary btn-w200"><?php echo ucfirst($this->p->t('global', 'genehmigen')); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
$STUDIENSEMESTER = $studiensemester_selected;
|
||||
$STUDIENGAENGE_ENTITLED = implode(', ', $studiengaenge_entitled);
|
||||
$LANGUAGE_INDEX = getUserLanguage() == 'German' ? '0' : '1';
|
||||
|
||||
$query = '
|
||||
WITH anrechnungen AS
|
||||
(
|
||||
SELECT DISTINCT
|
||||
anrechnung.anrechnung_id,
|
||||
anrechnung.lehrveranstaltung_id,
|
||||
anrechnung.begruendung_id,
|
||||
anrechnung.dms_id,
|
||||
anrechnung.studiensemester_kurzbz,
|
||||
stg.studiengang_kz,
|
||||
stg.bezeichnung AS "stg_bezeichnung",
|
||||
lv.bezeichnung AS "lv_bezeichnung",
|
||||
lv.ects,
|
||||
(person.nachname || \' \' || person.vorname) AS "student",
|
||||
begruendung.bezeichnung AS "begruendung",
|
||||
dmsversion.name AS "dokument_bezeichnung",
|
||||
anrechnung.anmerkung_student,
|
||||
empfehlung_anrechnung,
|
||||
(SELECT status_kurzbz
|
||||
FROM lehre.tbl_anrechnungstatus
|
||||
JOIN lehre.tbl_anrechnung_anrechnungstatus USING (status_kurzbz)
|
||||
WHERE anrechnung_id = anrechnung.anrechnung_id
|
||||
ORDER BY insertamum DESC
|
||||
LIMIT 1
|
||||
) AS status_kurzbz
|
||||
FROM lehre.tbl_anrechnung AS anrechnung
|
||||
JOIN public.tbl_prestudent USING (prestudent_id)
|
||||
JOIN public.tbl_person AS person USING (person_id)
|
||||
JOIN public.tbl_studiengang AS stg USING (studiengang_kz)
|
||||
JOIN lehre.tbl_lehrveranstaltung AS lv USING (lehrveranstaltung_id)
|
||||
JOIN campus.tbl_dms_version AS dmsversion USING (dms_id)
|
||||
JOIN lehre.tbl_anrechnung_anrechnungstatus USING (anrechnung_id)
|
||||
JOIN lehre.tbl_anrechnung_begruendung AS begruendung USING (begruendung_id)
|
||||
)
|
||||
|
||||
SELECT anrechnungen.*,
|
||||
array_to_json(anrechnungstatus.bezeichnung_mehrsprachig::varchar[])->>' . $LANGUAGE_INDEX . ' AS "status_bezeichnung"
|
||||
FROM anrechnungen
|
||||
JOIN lehre.tbl_anrechnungstatus as anrechnungstatus ON (anrechnungstatus.status_kurzbz = anrechnungen.status_kurzbz)
|
||||
WHERE studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
|
||||
AND studiengang_kz IN (' . $STUDIENGAENGE_ENTITLED . ')
|
||||
';
|
||||
|
||||
$filterWidgetArray = array(
|
||||
'query' => $query,
|
||||
'tableUniqueId' => 'approveAnrechnungUebersicht',
|
||||
'requiredPermissions' => 'lehre/anrechnung_genehmigen',
|
||||
'datasetRepresentation' => 'tabulator',
|
||||
'columnsAliases' => array(
|
||||
'anrechnung_id',
|
||||
'lehrveranstaltung_id',
|
||||
'begruendung_id',
|
||||
'dms_id',
|
||||
'studiensemester_kurzbz',
|
||||
'studiengang_kz',
|
||||
ucfirst($this->p->t('lehre', 'studiengang')),
|
||||
ucfirst($this->p->t('lehre', 'lehrveranstaltung')),
|
||||
'ECTS',
|
||||
ucfirst($this->p->t('person', 'studentIn')),
|
||||
ucfirst($this->p->t('global', 'begruendung')),
|
||||
ucfirst($this->p->t('anrechnung', 'nachweisdokumente')),
|
||||
ucfirst($this->p->t('anrechnung', 'herkunft')),
|
||||
ucfirst($this->p->t('anrechnung', 'empfehlung')),
|
||||
'status_kurzbz',
|
||||
'Status'
|
||||
),
|
||||
'datasetRepOptions' => '{
|
||||
height: func_height(this),
|
||||
layout: "fitColumns", // fit columns to width of table
|
||||
persistentLayout:true,
|
||||
persistentSort:true,
|
||||
autoResize: false, // prevent auto resizing of table (false to allow adapting table size when cols are (de-)activated
|
||||
headerFilterPlaceholder: " ",
|
||||
index: "anrechnung_id", // assign specific column as unique id (important for row indexing)
|
||||
selectable: true, // allow row selection
|
||||
selectableRangeMode: "click", // allow range selection using shift end click on end of range
|
||||
selectablePersistence:false, // deselect previously selected rows when table is filtered, sorted or paginated
|
||||
tableBuilt: function(){
|
||||
func_tableBuilt(this);
|
||||
},
|
||||
tableWidgetFooter: {
|
||||
selectButtons: true
|
||||
},
|
||||
selectableCheck: function(row){
|
||||
return func_selectableCheck(row);
|
||||
},
|
||||
rowFormatter:function(row){
|
||||
func_rowFormatter(row);
|
||||
},
|
||||
rowUpdated:function(row){
|
||||
func_rowUpdated(row);
|
||||
},
|
||||
tooltips: function(cell){
|
||||
return func_tooltips(cell);
|
||||
}
|
||||
}', // tabulator properties
|
||||
'datasetRepFieldsDefs' => '{
|
||||
anrechnung_id: {visible: false},
|
||||
lehrveranstaltung_id: {visible: false},
|
||||
begruendung_id: {visible: false},
|
||||
dms_id: {visible: false},
|
||||
studiensemester_kurzbz: {visible: false},
|
||||
studiengang_kz: {visible: false},
|
||||
stg_bezeichnung: {headerFilter:"input"},
|
||||
lv_bezeichnung: {headerFilter:"input"},
|
||||
ects: {headerFilter:"input", align:"center"},
|
||||
student: {headerFilter:"input"},
|
||||
begruendung: {headerFilter:"input"},
|
||||
dokument_bezeichnung: {headerFilter:"input", formatter:"link", formatterParams:{
|
||||
labelField:"dokument_bezeichnung",
|
||||
url:function(cell){return "'. current_url() .'/download?dms_id=" + cell.getData().dms_id},
|
||||
target:"_blank"
|
||||
}},
|
||||
anmerkung_student: {headerFilter:"input"},
|
||||
empfehlung_anrechnung: {headerFilter:"input", align:"center", formatter: format_empfehlung_anrechnung, headerFilterFunc: hf_filterTrueFalse},
|
||||
status_kurzbz: {visible: false},
|
||||
status_bezeichnung: {headerFilter:"input"}
|
||||
}', // col properties
|
||||
);
|
||||
|
||||
echo $this->widgetlib->widget('TableWidget', $filterWidgetArray);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,242 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => $this->p->t('anrechnung', 'antragStellen'),
|
||||
'jquery' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'phrases' => array(
|
||||
'global' => array(
|
||||
'anerkennungNachgewiesenerKenntnisse',
|
||||
'antragStellen'
|
||||
),
|
||||
'ui' => array(
|
||||
'hilfeZuDieserSeite',
|
||||
'hochladen'
|
||||
),
|
||||
'person' => array(
|
||||
'student',
|
||||
'personenkennzeichen'
|
||||
),
|
||||
'lehre' => array(
|
||||
'studiensemester',
|
||||
'studiengang',
|
||||
'lehrveranstaltung',
|
||||
'ects',
|
||||
'lektor',
|
||||
)
|
||||
),
|
||||
'customJSs' => array(
|
||||
'public/js/bootstrapper.js',
|
||||
'public/js/lehre/anrechnung/requestAnrechnung.js'
|
||||
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<style>
|
||||
.tooltip-inner {
|
||||
width:300px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<!-- title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 page-header">
|
||||
<h3>
|
||||
<?php echo $this->p->t('anrechnung', 'anerkennungNachgewiesenerKenntnisse'); ?>
|
||||
<small>| <?php echo $this->p->t('anrechnung', 'antragStellen'); ?></small>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo form_open_multipart(current_url() . '/apply',
|
||||
['id' => 'requestAnrechnung-form'],
|
||||
['lv_id' => $antragData->lv_id, 'studiensemester' => $antragData->studiensemester_kurzbz]
|
||||
); ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<!-- Antragsdaten, Dokument Upload, Notiz-->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<!-- Antragsdaten -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<span class="text-uppercase"><b><?php echo $this->p->t('anrechnung', 'antrag'); ?></b></span> 
|
||||
<span class="requestAnrechnung-anrechnungInfoTooltip" data-toggle="tooltip" data-placement="right"
|
||||
title="<?php echo $this->p->t('anrechnung', 'anrechnungInfoTooltipText'); ?>">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="pull-right"><?php echo $this->p->t('anrechnung', 'antragdatum'); ?>: <span
|
||||
id="requestAnrechnung-status"><?php echo !empty($anrechnungData->anrechnung_id) ? $anrechnungData->insertamum : '-' ?></span></span>
|
||||
</div>
|
||||
<table class="panel-body table table-bordered table-condensed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><?php echo ucfirst($this->p->t('person', 'student')); ?></td>
|
||||
<td><?php echo $antragData->vorname . ' ' . $antragData->nachname; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('person', 'personenkennzeichen'); ?></td>
|
||||
<td><?php echo $antragData->matrikelnr ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo ucfirst($this->p->t('lehre', 'studiensemester')); ?></td>
|
||||
<td><?php echo $antragData->studiensemester_kurzbz ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo ucfirst($this->p->t('lehre', 'studiengang')); ?></td>
|
||||
<td><?php echo $antragData->stg_bezeichnung ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('lehre', 'lehrveranstaltung'); ?></td>
|
||||
<td><?php echo $antragData->lv_bezeichnung ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('lehre', 'ects'); ?></td>
|
||||
<td><?php echo $antragData->ects ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo ucfirst($this->p->t('lehre', 'lektor')); ?></td>
|
||||
<td>
|
||||
<?php $len = count($antragData->lektoren) - 1 ?>
|
||||
<?php foreach ($antragData->lektoren as $key => $lektor): ?>
|
||||
<?php echo $lektor->vorname . ' ' . $lektor->nachname;
|
||||
echo $key === $len ? '' : ', ' ?>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Antrag mit Checkboxen -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="well" style="border:solid black 3px">
|
||||
<span><?php echo $this->p->t('anrechnung', 'antragStellenText'); ?></span> 
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="radio" name="begruendung" value="1" required
|
||||
<?php echo $anrechnungData->begruendung_id == '1' ? 'checked' : ''; ?>
|
||||
<?php echo $disabled; ?>>
|
||||
<?php echo $this->p->t('anrechnung', 'antragStellenWegenZeugnis'); ?> 
|
||||
<span id="requestAnrechnung-anrechnungGrundZeugnisTooltip" data-toggle="tooltip" data-placement="right"
|
||||
title="<?php echo $this->p->t('anrechnung', 'anrechnungGrundZeugnisTooltipText'); ?>">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="radio" name="begruendung" value="4" required
|
||||
<?php echo $anrechnungData->begruendung_id == '4' ? 'checked' : ''; ?>
|
||||
<?php echo $disabled; ?>>
|
||||
<?php echo $this->p->t('anrechnung', 'antragStellenWegenPraxis'); ?> 
|
||||
<span id="requestAnrechnung-anrechnungGrundBerufTooltip" data-toggle="tooltip" data-placement="right"
|
||||
title="<?php echo $this->p->t('anrechnung', 'anrechnungGrundBerufTooltipText'); ?>">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Dokument Upload-->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<b><?php echo $this->p->t('anrechnung', 'nachweisdokumente'); ?></b> 
|
||||
<span class="requestAnrechnung-anrechnungInfoTooltip" data-toggle="tooltip" data-placement="right"
|
||||
title="<?php echo $this->p->t('anrechnung', 'anrechnungGrundAllgemeinTooltipText'); ?>">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-inline panel-body">
|
||||
<div class="form-group">
|
||||
<input type="file" id="requestAnrechnung-uploadfile"
|
||||
name="uploadfile" accept=".pdf" size="50"
|
||||
required <?php echo $disabled; ?>>
|
||||
</div>
|
||||
<span id="requestAnrechnung-uploadTooltip" data-toggle="tooltip" data-placement="right"
|
||||
title="<?php echo $this->p->t('ui', 'uploadTooltipText'); ?>">
|
||||
<i class="fa fa-lg fa-question-circle-o" aria-hidden="true"></i>
|
||||
</span>
|
||||
<?php if (!empty($anrechnungData->dms_id)): ?>
|
||||
<a class="pull-right"
|
||||
href="<?php echo current_url() . '/download?dms_id=' . $anrechnungData->dms_id; ?>"
|
||||
target="_blank"><?php echo htmlentities($anrechnungData->dokumentname) ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Notiz -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<b><?php echo $this->p->t('anrechnung', 'herkunftDerKenntnisse'); ?></b> 
|
||||
<span class="requestAnrechnung-anrechnungInfoTooltip" data-toggle="tooltip" data-placement="right"
|
||||
title="<?php echo $this->p->t('anrechnung', 'anrechnungInfoTooltipText'); ?>">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<textarea class="form-control" name="anmerkung" rows="2"
|
||||
required <?php echo $disabled; ?>><?php echo $anrechnungData->anmerkung; ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Submit button 'Anrechnung beantragen'-->
|
||||
<div class="pull-right">
|
||||
<input type="submit" id="requestAnrechnung-submit" class="btn btn-primary"
|
||||
value="<?php echo $this->p->t('anrechnung', 'anrechnungBeantragen'); ?>" <?php echo $disabled; ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<div class="alert text-center">
|
||||
Status:
|
||||
<b><span class="text-uppercase" id="requestAnrechnung-status_kurzbz"
|
||||
data-status_kurzbz="<?php echo $anrechnungData->status_kurzbz ?>">
|
||||
<?php echo $anrechnungData->status; ?>
|
||||
</span></b>
|
||||
</div>
|
||||
<?php if ($is_expired): ?>
|
||||
<div class="alert alert-warning">
|
||||
<?php echo $this->p->t('global', 'bearbeitungGesperrt'); ?>
|
||||
<?php echo $is_expired && empty($antragData->anrechnung_id) ? ': ' . $this->p->t('anrechnung', 'deadlineUeberschritten') : ''; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
<?php $this->load->view('lehre/anrechnung/requestAnrechnungImportant'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,53 @@
|
||||
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
|
||||
<!-- Beantragung: Fristen panel -->
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading" role="tab" id="headingOne">
|
||||
<h4 class="panel-title">
|
||||
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne"
|
||||
aria-expanded="true" aria-controls="collapseOne">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i> 
|
||||
<?php echo $this->p->t('anrechnung', 'requestAnrechnungInfoFristenTitle'); ?>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
|
||||
<div class="panel-body">
|
||||
<?php echo $this->p->t('anrechnung', 'requestAnrechnungInfoFristenBody'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Nachweisdokumente: Voraussetzung panel -->
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading" role="tab" id="headingTwo">
|
||||
<h4 class="panel-title">
|
||||
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo"
|
||||
aria-expanded="false" aria-controls="collapseTwo">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i> 
|
||||
<?php echo $this->p->t('anrechnung', 'requestAnrechnungInfoNachweisdokumenteTitle'); ?>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
|
||||
<div class="panel-body">
|
||||
<?php echo $this->p->t('anrechnung', 'requestAnrechnungInfoNachweisdokumenteBody'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Herkunft der Kenntnisse: Angaben panel -->
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading" role="tab" id="headingThree">
|
||||
<h4 class="panel-title">
|
||||
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree"
|
||||
aria-expanded="false" aria-controls="collapseThree">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i> 
|
||||
<?php echo $this->p->t('anrechnung', 'requestAnrechnungInfoHerkunftKenntnisseTitle'); ?>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
|
||||
<div class="panel-body">
|
||||
<?php echo $this->p->t('anrechnung', 'requestAnrechnungInfoHerkunftKenntnisseBody'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => $this->p->t('anrechnung', 'anrechnungenPruefen'),
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'phrases' => array(
|
||||
'global' => array(
|
||||
'anerkennungNachgewiesenerKenntnisse',
|
||||
'antragStellen'
|
||||
),
|
||||
'ui' => array(
|
||||
'hilfeZuDieserSeite',
|
||||
'hochladen',
|
||||
'nichtSelektierbarAufgrundVon',
|
||||
'systemfehler',
|
||||
'bitteMindEinenAntragWaehlen',
|
||||
'bitteBegruendungAngeben',
|
||||
'anrechnungenWurdenEmpfohlen',
|
||||
'anrechnungenWurdenNichtEmpfohlen'
|
||||
),
|
||||
'person' => array(
|
||||
'student',
|
||||
'personenkennzeichen'
|
||||
),
|
||||
'lehre' => array(
|
||||
'studiensemester',
|
||||
'studiengang',
|
||||
'lehrveranstaltung',
|
||||
'ects',
|
||||
'lektor',
|
||||
)
|
||||
),
|
||||
'customCSSs' => array(
|
||||
'public/css/Tabulator.css'
|
||||
),
|
||||
'customJSs' => array(
|
||||
'public/js/bootstrapper.js',
|
||||
'public/js/lehre/anrechnung/reviewAnrechnungDetail.js'
|
||||
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<!-- title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 page-header">
|
||||
<h3>
|
||||
<?php echo $this->p->t('anrechnung', 'anrechnungenPruefen'); ?>
|
||||
<small>| <?php echo $this->p->t('global', 'detailsicht'); ?></small>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
||||
<!-- Antragsdaten -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<span class="text-uppercase"><b><?php echo $this->p->t('anrechnung', 'antrag'); ?></b></span>
|
||||
</span> 
|
||||
<span class="reviewAnrechnungDetail-anrechnungInfoTooltip" data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="<?php echo $this->p->t('anrechnung', 'anrechnungInfoTooltipText'); ?>">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="pull-right"><?php echo $this->p->t('anrechnung', 'antragdatum'); ?>: <span
|
||||
id="reviewAnrechnung-status"><?php echo !empty($anrechnungData->anrechnung_id) ? $anrechnungData->insertamum : '-' ?></span></span>
|
||||
</div>
|
||||
<table class="panel-body table table-bordered table-condensed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><?php echo ucfirst($this->p->t('person', 'student')); ?></td>
|
||||
<td><?php echo $antragData->vorname . ' ' . $antragData->nachname; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('person', 'personenkennzeichen'); ?></td>
|
||||
<td><?php echo $antragData->matrikelnr ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo ucfirst($this->p->t('lehre', 'studiensemester')); ?></td>
|
||||
<td><?php echo $antragData->studiensemester_kurzbz ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo ucfirst($this->p->t('lehre', 'studiengang')); ?></td>
|
||||
<td><?php echo $antragData->stg_bezeichnung ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('lehre', 'lehrveranstaltung'); ?></td>
|
||||
<td><?php echo $antragData->lv_bezeichnung ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('lehre', 'ects'); ?></td>
|
||||
<td><?php echo $antragData->ects ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('lehre', 'lektorInnen'); ?></td>
|
||||
<td>
|
||||
<?php $len = count($antragData->lektoren) - 1 ?>
|
||||
<?php foreach ($antragData->lektoren as $key => $lektor): ?>
|
||||
<?php echo $lektor->vorname . ' ' . $lektor->nachname;
|
||||
echo $key === $len ? '' : ', ' ?>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('anrechnung', 'herkunftDerKenntnisse'); ?></td>
|
||||
<td><?php echo $anrechnungData->anmerkung ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->p->t('anrechnung', 'nachweisdokumente'); ?></td>
|
||||
<td>
|
||||
<a href="<?php echo current_url() . '/download?dms_id=' . $anrechnungData->dms_id; ?>"
|
||||
target="_blank"><?php echo htmlentities($anrechnungData->dokumentname) ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Empfehlungsdaten -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<span class="text-uppercase"><b><?php echo $this->p->t('anrechnung', 'empfehlung'); ?></b></span>
|
||||
<div class="pull-right">
|
||||
<?php echo $this->p->t('anrechnung', 'empfehlungVon'); ?>:
|
||||
<span id="reviewAnrechnungDetail-empfehlungVon"><?php echo $empfehlungData->empfehlung_von ?></span>
|
||||
 | 
|
||||
<?php echo $this->p->t('anrechnung', 'empfehlungdatum'); ?>:
|
||||
<span id="reviewAnrechnungDetail-empfehlungAm"><?php echo $empfehlungData->empfehlung_am ?></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body" id="reviewAnrechnungDetail-empfehlungDetail">
|
||||
|
||||
<div class="panel panel-default panel-body <?php echo is_null($empfehlungData->empfehlung) ? '' : 'hidden' ?>"
|
||||
id="reviewAnrechnungDetail-empfehlungDetail-empfehlungIsNull">
|
||||
<?php echo $this->p->t('anrechnung', 'nochKeineEmpfehlung'); ?>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-success <?php echo $empfehlungData->empfehlung === true ? '' : 'hidden' ?>"
|
||||
id="reviewAnrechnungDetail-empfehlungDetail-empfehlungIsTrue">
|
||||
<b><?php echo $this->p->t('anrechnung', 'empfehlungPositivConfirmed'); ?></b>
|
||||
</div>
|
||||
|
||||
<div class="<?php echo $empfehlungData->empfehlung === false ? '' : 'hidden' ?>"
|
||||
id="reviewAnrechnungDetail-empfehlungDetail-empfehlungIsFalse">
|
||||
<div class="alert alert-danger">
|
||||
<b><?php echo $this->p->t('anrechnung', 'empfehlungNegativConfirmed'); ?></b>
|
||||
</div>
|
||||
<div class="well"><b><?php echo $this->p->t('global', 'begruendung'); ?>
|
||||
: </b>
|
||||
<span id="reviewAnrechnungDetail-empfehlungDetail-begruendung"><?php echo htmlentities($empfehlungData->notiz) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form>
|
||||
<input type="hidden" name="anrechnung_id"
|
||||
value="<?php echo $anrechnungData->anrechnung_id ?>">
|
||||
<div class="panel panel-default panel-body" style="display: none"
|
||||
id="reviewAnrechnungDetail-begruendung-panel">
|
||||
<div>
|
||||
<h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'empfehlungNegativQuestion'); ?></h4>
|
||||
 
|
||||
<b> <?php echo $this->p->t('anrechnung', 'bitteBegruendungAngeben'); ?></b><br><br>
|
||||
<ul>
|
||||
<li>
|
||||
<span><?php echo $this->p->t('anrechnung', 'empfehlungNegativPruefungNichtMoeglich'); ?></span> 
|
||||
<span class="btn-copyIntoTextarea" data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
|
||||
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span><?php echo $this->p->t('anrechnung', 'empfehlungNegativKenntnisseNichtGleichwertig'); ?></span> 
|
||||
<span class="btn-copyIntoTextarea" data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
|
||||
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</span>
|
||||
</li>
|
||||
<li><?php echo $this->p->t('anrechnung', 'andereBegruendung'); ?></li>
|
||||
</ul>
|
||||
<br>
|
||||
<textarea class="form-control" name="begruendung"
|
||||
id="reviewAnrechnungDetail-begruendung"
|
||||
rows="2" required></textarea>
|
||||
</div>
|
||||
<br>
|
||||
<!-- Action Button Abbrechen & Bestaetigen-->
|
||||
<div class="pull-right">
|
||||
<button id="reviewAnrechnungDetail-begruendung-abbrechen"
|
||||
class="btn btn-default btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'abbrechen')); ?>
|
||||
</button>
|
||||
<button id="reviewAnrechnungDetail-dont-recommend-anrechnung-confirm"
|
||||
class="btn btn-primary btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'bestaetigen')); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default panel-body" style="display: none"
|
||||
id="reviewAnrechnungDetail-empfehlung-panel">
|
||||
<div>
|
||||
<h4 class="panel panel-body panel-success text-success"><?php echo $this->p->t('anrechnung', 'empfehlungPositivQuestion'); ?></h4>
|
||||
 <?php echo $this->p->t('anrechnung', 'empfehlungPositivSubquestion'); ?>
|
||||
<br><br>
|
||||
</div>
|
||||
<br>
|
||||
<!-- Action Button Abbrechen & Bestaetigen-->
|
||||
<div class="pull-right">
|
||||
<button id="reviewAnrechnungDetail-empfehlung-abbrechen"
|
||||
class="btn btn-default btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'abbrechen')); ?>
|
||||
</button>
|
||||
<button id="reviewAnrechnungDetail-recommend-anrechnung-confirm"
|
||||
class="btn btn-primary btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'bestaetigen')); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<button id="reviewAnrechnungDetail-dont-recommend-anrechnung-ask" class="btn btn-danger btn-w200"
|
||||
<?php echo is_null($empfehlungData->empfehlung) ? '' : 'disabled' ?>>
|
||||
<?php echo ucfirst($this->p->t('anrechnung', 'nichtEmpfehlen')); ?>
|
||||
</button>
|
||||
<button id="reviewAnrechnungDetail-recommend-anrechnung-ask" class="btn btn-primary btn-w200"
|
||||
<?php echo is_null($empfehlungData->empfehlung) ? '' : 'disabled' ?>>
|
||||
<?php echo ucfirst($this->p->t('anrechnung', 'empfehlen')); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-4">
|
||||
<div class="alert text-center">
|
||||
Status:
|
||||
<b><span class="text-uppercase" id="reviewAnrechnungDetail-status_kurzbz"
|
||||
data-status_kurzbz="<?php echo $anrechnungData->status_kurzbz ?>">
|
||||
<?php echo $anrechnungData->status; ?>
|
||||
</span></b>
|
||||
</div>
|
||||
<br>
|
||||
<?php $this->load->view('lehre/anrechnung/reviewAnrechnungInfo'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,66 @@
|
||||
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading" role="tab" id="headingOne">
|
||||
<h4 class="panel-title">
|
||||
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne"
|
||||
aria-expanded="true" aria-controls="collapseOne">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i> 
|
||||
<?php echo $this->p->t('anrechnung', 'reviewAnrechnungInfoFristenTitle'); ?>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
|
||||
<div class="panel-body">
|
||||
<?php echo $this->p->t('anrechnung', 'reviewAnrechnungInfoFristenBody'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading" role="tab" id="headingZero">
|
||||
<h4 class="panel-title">
|
||||
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseZero"
|
||||
aria-expanded="true" aria-controls="collapseZero">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i> 
|
||||
<?php echo $this->p->t('anrechnung', 'reviewAnrechnungInfoAntragVoraussetungenTitle'); ?>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseZero" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingZero">
|
||||
<div class="panel-body">
|
||||
<?php echo $this->p->t('anrechnung', 'reviewAnrechnungInfoAntragVoraussetungenBody'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading" role="tab" id="headingTwo">
|
||||
<h4 class="panel-title">
|
||||
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo"
|
||||
aria-expanded="false" aria-controls="collapseTwo">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i> 
|
||||
<?php echo $this->p->t('anrechnung', 'reviewAnrechnungInfoNachweisdokumenteTitle'); ?>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
|
||||
<div class="panel-body">
|
||||
<?php echo $this->p->t('anrechnung', 'reviewAnrechnungInfoNachweisdokumenteBody'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading" role="tab" id="headingThree">
|
||||
<h4 class="panel-title">
|
||||
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree"
|
||||
aria-expanded="false" aria-controls="collapseThree">
|
||||
<i class="fa fa-lg fa-info-circle" aria-hidden="true"></i> 
|
||||
<?php echo $this->p->t('anrechnung', 'reviewAnrechnungInfoHerkunftKenntnisseTitle'); ?>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
|
||||
<div class="panel-body">
|
||||
<?php echo $this->p->t('anrechnung', 'reviewAnrechnungInfoHerkunftKenntnisseBody'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => $this->p->t('anrechnung', 'anrechnungenPruefen'),
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'tabulator' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'tablewidget' => true,
|
||||
'phrases' => array(
|
||||
'global' => array(
|
||||
'begruendung'
|
||||
),
|
||||
'anrechnung' => array(
|
||||
'nachweisdokumente',
|
||||
'empfehlung',
|
||||
'herkunft'
|
||||
),
|
||||
'ui' => array(
|
||||
'anzeigen',
|
||||
'alleAnzeigen',
|
||||
'hilfeZuDieserSeite',
|
||||
'hochladen',
|
||||
'spaltenEinstellen',
|
||||
'hilfeZuDieserSeite',
|
||||
'alleAuswaehlen',
|
||||
'alleAbwaehlen',
|
||||
'ausgewaehlteZeilen',
|
||||
'hilfe',
|
||||
'tabelleneinstellungen',
|
||||
'keineDatenVorhanden',
|
||||
'spaltenEinstellen',
|
||||
'ja',
|
||||
'nein',
|
||||
'nichtSelektierbarAufgrundVon',
|
||||
'systemfehler',
|
||||
'bitteMindEinenAntragWaehlen',
|
||||
'bitteBegruendungAngeben',
|
||||
'anrechnungenWurdenEmpfohlen',
|
||||
'anrechnungenWurdenNichtEmpfohlen'
|
||||
),
|
||||
'person' => array(
|
||||
'student',
|
||||
'personenkennzeichen',
|
||||
'vorname',
|
||||
'nachname'
|
||||
),
|
||||
'lehre' => array(
|
||||
'studiensemester',
|
||||
'studiengang',
|
||||
'lehrveranstaltung',
|
||||
'ects',
|
||||
'lektor',
|
||||
),
|
||||
'table' => array(
|
||||
'spaltenEinAusblenden',
|
||||
'spaltenEinAusblendenMitKlickOeffnen',
|
||||
'spaltenEinAusblendenAufEinstellungenKlicken',
|
||||
'spaltenEinAusblendenMitKlickAktivieren',
|
||||
'spaltenEinAusblendenMitKlickSchliessen',
|
||||
'spaltenbreiteVeraendern',
|
||||
'spaltenbreiteVeraendernText',
|
||||
'spaltenbreiteVeraendernInfotext',
|
||||
'zeilenAuswaehlen',
|
||||
'zeilenAuswaehlenEinzeln',
|
||||
'zeilenAuswaehlenBereich',
|
||||
'zeilenAuswaehlenAlle'
|
||||
)
|
||||
),
|
||||
'customJSs' => array(
|
||||
'public/js/bootstrapper.js',
|
||||
'public/js/lehre/anrechnung/reviewAnrechnungUebersicht.js'
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<!-- title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 page-header">
|
||||
<h3>
|
||||
<?php echo $this->p->t('anrechnung', 'anrechnungenPruefen'); ?>
|
||||
<small>| <?php echo ucfirst($this->p->t('global', 'uebersicht')); ?></small>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<!-- dropdown studiensemester -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="formApproveAnrechnungUebersicht" class="form-inline" action="" method="get">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Studiensemester_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $studiensemester_selected
|
||||
),
|
||||
array(
|
||||
'name' => 'studiensemester',
|
||||
'id' => 'studiensemester'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="btn btn-default form-group"><?php echo ucfirst($this->p->t('ui', 'anzeigen')); ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Tabelle -->
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<?php $this->load->view('lehre/anrechnung/reviewAnrechnungUebersichtData.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Empfehlung / Nicht Empfehlung Panel -->
|
||||
<div class="row">
|
||||
<div class="panel panel-default panel-body" style="display: none"
|
||||
id="reviewAnrechnungUebersicht-begruendung-panel">
|
||||
<div>
|
||||
<h4 class="panel panel-body panel-danger text-danger"><?php echo $this->p->t('anrechnung', 'empfehlungenNegativQuestion'); ?></h4>
|
||||
<b> <?php echo $this->p->t('anrechnung', 'bitteBegruendungAngeben'); ?></b><br><br>
|
||||
<ul>
|
||||
<li>
|
||||
<span><?php echo $this->p->t('anrechnung', 'empfehlungNegativPruefungNichtMoeglich'); ?></span>
|
||||
<span class="btn-copyIntoTextarea" data-toggle="tooltip" data-placement="right"
|
||||
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
|
||||
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span><?php echo $this->p->t('anrechnung', 'empfehlungNegativKenntnisseNichtGleichwertig'); ?></span>
|
||||
<span class="btn-copyIntoTextarea" data-toggle="tooltip" data-placement="right"
|
||||
title="<?php echo $this->p->t('ui', 'textUebernehmen'); ?>">
|
||||
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</span>
|
||||
</li>
|
||||
<li><?php echo $this->p->t('anrechnung', 'andereBegruendung'); ?></li>
|
||||
</ul>
|
||||
<br>
|
||||
<span class="text-danger">
|
||||
<?php echo $this->p->t('anrechnung', 'begruendungWirdFuerAlleUebernommen'); ?>
|
||||
</span><br><br>
|
||||
<textarea class="form-control" name="begruendung" id="reviewAnrechnungUebersicht-begruendung"
|
||||
rows="2" required></textarea>
|
||||
</div>
|
||||
<br>
|
||||
<!-- Action Button Abbrechen & Bestaetigen-->
|
||||
<div class="pull-right">
|
||||
<button id="reviewAnrechnungUebersicht-begruendung-abbrechen" class="btn btn-default btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'abbrechen')); ?>
|
||||
</button>
|
||||
<button id="reviewAnrechnungUebersicht-dont-recommend-anrechnungen-confirm"
|
||||
class="btn btn-primary btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'bestaetigen')); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default panel-body" style="display: none"
|
||||
id="reviewAnrechnungUebersicht-empfehlung-panel">
|
||||
<div>
|
||||
<h4 class="panel panel-body panel-success text-success"><?php echo $this->p->t('anrechnung', 'empfehlungenPositivQuestion'); ?></h4>
|
||||
 <?php echo $this->p->t('anrechnung', 'empfehlungenPositiv'); ?><br><br>
|
||||
</div>
|
||||
<br>
|
||||
<!-- Action Button 'Abbrechen'-->
|
||||
<div class="pull-right">
|
||||
<button id="reviewAnrechnungUebersicht-empfehlung-abbrechen" class="btn btn-default btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'abbrechen')); ?>
|
||||
</button>
|
||||
<button id="reviewAnrechnungUebersicht-recommend-anrechnungen-confirm"
|
||||
class="btn btn-primary btn-w200">
|
||||
<?php echo ucfirst($this->p->t('ui', 'bestaetigen')); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<!-- Filter buttons -->
|
||||
<div class="col-xs-3">
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<div class="btn-group" role="group">
|
||||
<button id="show-need-recommendation" class="btn btn-default btn-clearfilter" type="button"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'nurFehlendeEmpfehlungenAnzeigen'); ?>"><i
|
||||
class='fa fa-eye'></i>
|
||||
</button>
|
||||
<button id="show-recommended" class="btn btn-default btn-clearfilter" type="button"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'nurEmpfohleneAnzeigen'); ?>"><i
|
||||
class='fa fa-thumbs-o-up'></i>
|
||||
</button>
|
||||
<button id="show-not-recommended" class="btn btn-default btn-clearfilter" type="button"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'nurNichtEmpfohleneAnzeigen'); ?>"><i
|
||||
class='fa fa-thumbs-o-down'></i>
|
||||
</button>
|
||||
<button id="show-approved" class="btn btn-default btn-clearfilter" type="button"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'nurGenehmigteAnzeigen'); ?>"><i
|
||||
class='fa fa-check'></i>
|
||||
</button>
|
||||
<button id="show-rejected" class="btn btn-default btn-clearfilter" type="button"
|
||||
data-toggle="tooltip" data-placement="left"
|
||||
title="<?php echo $this->p->t('ui', 'nurAbgelehnteAnzeigen'); ?>"><i
|
||||
class='fa fa-times'></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Action Buttons 'Empfehlen', 'Nicht empfehlen'-->
|
||||
<div class="col-xs-9">
|
||||
<div class="pull-right">
|
||||
<button id="reviewAnrechnungUebersicht-dont-recommend-anrechnungen-ask"
|
||||
class="btn btn-danger btn-w200"><?php echo ucfirst($this->p->t('anrechnung', 'nichtEmpfehlen')); ?></button>
|
||||
<button id="reviewAnrechnungUebersicht-recommend-anrechnungen-ask"
|
||||
class="btn btn-primary btn-w200"><?php echo ucfirst($this->p->t('anrechnung', 'empfehlen')); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
$STUDIENSEMESTER = $studiensemester_selected;
|
||||
$LEKTOR_UID = getAuthUID();
|
||||
$LANGUAGE_INDEX = getUserLanguage() == 'German' ? '0' : '1';
|
||||
|
||||
$query = '
|
||||
WITH anrechnungen AS
|
||||
(
|
||||
SELECT DISTINCT
|
||||
anrechnung.anrechnung_id,
|
||||
anrechnung.lehrveranstaltung_id,
|
||||
anrechnung.begruendung_id,
|
||||
anrechnung.dms_id,
|
||||
anrechnung.studiensemester_kurzbz,
|
||||
stg.studiengang_kz,
|
||||
stg.bezeichnung AS "stg_bezeichnung",
|
||||
lv.bezeichnung AS "lv_bezeichnung",
|
||||
lv.ects,
|
||||
(person.nachname || \' \' || person.vorname) AS "student",
|
||||
begruendung.bezeichnung AS "begruendung",
|
||||
dmsversion.name AS "dokument_bezeichnung",
|
||||
anrechnung.anmerkung_student,
|
||||
empfehlung_anrechnung,
|
||||
(SELECT status_kurzbz
|
||||
FROM lehre.tbl_anrechnungstatus
|
||||
JOIN lehre.tbl_anrechnung_anrechnungstatus USING (status_kurzbz)
|
||||
WHERE anrechnung_id = anrechnung.anrechnung_id
|
||||
ORDER BY insertamum DESC
|
||||
LIMIT 1
|
||||
) AS status_kurzbz
|
||||
FROM lehre.tbl_anrechnung AS anrechnung
|
||||
JOIN public.tbl_prestudent USING (prestudent_id)
|
||||
JOIN public.tbl_person AS person USING (person_id)
|
||||
JOIN public.tbl_studiengang AS stg USING (studiengang_kz)
|
||||
JOIN lehre.tbl_lehrveranstaltung AS lv USING (lehrveranstaltung_id)
|
||||
JOIN campus.tbl_dms_version AS dmsversion USING (dms_id)
|
||||
JOIN lehre.tbl_anrechnung_anrechnungstatus USING (anrechnung_id)
|
||||
JOIN lehre.tbl_anrechnung_begruendung AS begruendung USING (begruendung_id)
|
||||
)
|
||||
|
||||
SELECT DISTINCT ON (anrechnungen.*, lema.mitarbeiter_uid) anrechnungen.*,
|
||||
array_to_json(anrechnungstatus.bezeichnung_mehrsprachig::varchar[])->>' . $LANGUAGE_INDEX . ' AS "status_bezeichnung"
|
||||
FROM anrechnungen
|
||||
JOIN lehre.tbl_anrechnungstatus as anrechnungstatus ON (anrechnungstatus.status_kurzbz = anrechnungen.status_kurzbz)
|
||||
JOIN lehre.tbl_lehreinheit le USING (lehrveranstaltung_id)
|
||||
JOIN lehre.tbl_lehreinheitmitarbeiter lema USING (lehreinheit_id)
|
||||
WHERE anrechnungen.studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
|
||||
AND le.studiensemester_kurzbz = anrechnungen.studiensemester_kurzbz
|
||||
AND lema.mitarbeiter_uid = \'' . $LEKTOR_UID . '\'
|
||||
AND le.lehre = TRUE
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM lehre.tbl_anrechnung_anrechnungstatus
|
||||
WHERE anrechnung_id = anrechnungen.anrechnung_id
|
||||
AND status_kurzbz=\'inProgressLektor\'
|
||||
)
|
||||
';
|
||||
|
||||
$filterWidgetArray = array(
|
||||
'query' => $query,
|
||||
'tableUniqueId' => 'approveAnrechnungUebersicht',
|
||||
'requiredPermissions' => 'lehre/anrechnung_empfehlen',
|
||||
'datasetRepresentation' => 'tabulator',
|
||||
'columnsAliases' => array(
|
||||
'anrechnung_id',
|
||||
'lehrveranstaltung_id',
|
||||
'begruendung_id',
|
||||
'dms_id',
|
||||
'studiensemester_kurzbz',
|
||||
'studiengang_kz',
|
||||
ucfirst($this->p->t('lehre', 'studiengang')),
|
||||
ucfirst($this->p->t('lehre', 'lehrveranstaltung')),
|
||||
'ECTS',
|
||||
ucfirst($this->p->t('person', 'studentIn')),
|
||||
ucfirst($this->p->t('global', 'begruendung')),
|
||||
ucfirst($this->p->t('anrechnung', 'nachweisdokumente')),
|
||||
ucfirst($this->p->t('anrechnung', 'herkunft')),
|
||||
ucfirst($this->p->t('anrechnung', 'empfehlung')),
|
||||
'status_kurzbz',
|
||||
'Status'
|
||||
),
|
||||
'datasetRepOptions' => '{
|
||||
height: func_height(this),
|
||||
layout: "fitColumns", // fit columns to width of table
|
||||
persistentLayout:true,
|
||||
persistentSort:true,
|
||||
autoResize: false, // prevent auto resizing of table (false to allow adapting table size when cols are (de-)activated
|
||||
headerFilterPlaceholder: " ",
|
||||
index: "anrechnung_id", // assign specific column as unique id (important for row indexing)
|
||||
selectable: true, // allow row selection
|
||||
selectableRangeMode: "click", // allow range selection using shift end click on end of range
|
||||
selectablePersistence:false, // deselect previously selected rows when table is filtered, sorted or paginated
|
||||
tableBuilt: function(){
|
||||
func_tableBuilt(this);
|
||||
},
|
||||
tableWidgetFooter: {
|
||||
selectButtons: true
|
||||
},
|
||||
selectableCheck: function(row){
|
||||
return func_selectableCheck(row);
|
||||
},
|
||||
rowFormatter:function(row){
|
||||
func_rowFormatter(row);
|
||||
},
|
||||
rowUpdated:function(row){
|
||||
func_rowUpdated(row);
|
||||
},
|
||||
tooltips: function(cell){
|
||||
return func_tooltips(cell);
|
||||
}
|
||||
}', // tabulator properties
|
||||
'datasetRepFieldsDefs' => '{
|
||||
anrechnung_id: {visible: false},
|
||||
lehrveranstaltung_id: {visible: false},
|
||||
begruendung_id: {visible: false},
|
||||
dms_id: {visible: false},
|
||||
studiensemester_kurzbz: {visible: false},
|
||||
studiengang_kz: {visible: false},
|
||||
stg_bezeichnung: {headerFilter:"input"},
|
||||
lv_bezeichnung: {headerFilter:"input"},
|
||||
ects: {headerFilter:"input", align:"center"},
|
||||
student: {headerFilter:"input"},
|
||||
begruendung: {headerFilter:"input"},
|
||||
dokument_bezeichnung: {headerFilter:"input", formatter:"link", formatterParams:{
|
||||
labelField:"dokument_bezeichnung",
|
||||
url:function(cell){return "'. current_url() .'/download?dms_id=" + cell.getData().dms_id},
|
||||
target:"_blank"
|
||||
}},
|
||||
anmerkung_student: {headerFilter:"input"},
|
||||
empfehlung_anrechnung: {headerFilter:"input", align:"center", formatter: format_empfehlung_anrechnung, headerFilterFunc: hf_filterTrueFalse},
|
||||
status_kurzbz: {visible: false},
|
||||
status_bezeichnung: {headerFilter:"input"}
|
||||
}', // col properties
|
||||
);
|
||||
|
||||
echo $this->widgetlib->widget('TableWidget', $filterWidgetArray);
|
||||
|
||||
?>
|
||||
@@ -1,180 +1,202 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'Lehrauftrag annehmen',
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'jquerycheckboxes' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => false,
|
||||
'tabulator' => true,
|
||||
'momentjs' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'tablewidget' => true,
|
||||
'phrases' => array(
|
||||
'global' => array('lehrauftraegeAnnehmen'),
|
||||
),
|
||||
'customJSs' => array(
|
||||
'public/js/bootstrapper.js',
|
||||
'public/js/lehre/lehrauftrag/acceptLehrauftrag.js')
|
||||
)
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'Lehrauftrag annehmen',
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'jquerycheckboxes' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => false,
|
||||
'tabulator' => true,
|
||||
'momentjs' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'tablewidget' => true,
|
||||
'phrases' => array(
|
||||
'global' => array(
|
||||
'lehrauftraegeAnnehmen',
|
||||
'dokumentePDF',
|
||||
'PDFLehrauftraegeFH',
|
||||
'PDFLehrauftraegeLehrgaenge'
|
||||
),
|
||||
'ui' => array(
|
||||
'anzeigen',
|
||||
'alleAnzeigen',
|
||||
'nurBestellteAnzeigen',
|
||||
'nurErteilteAnzeigen',
|
||||
'nurAngenommeneAnzeigen',
|
||||
'nurStornierteAnzeigen',
|
||||
'hilfeZuDieserSeite',
|
||||
'alleAuswaehlen',
|
||||
'alleAbwaehlen',
|
||||
'ausgewaehlteZeilen',
|
||||
'hilfe',
|
||||
'tabelleneinstellungen',
|
||||
'keineDatenVorhanden',
|
||||
'spaltenEinstellen',
|
||||
'bestelltVon',
|
||||
'erteiltVon',
|
||||
'angenommenVon',
|
||||
'storniertVon',
|
||||
'lehrauftragInBearbeitung',
|
||||
'wartetAufErteilung',
|
||||
'wartetAufErneuteErteilung',
|
||||
'letzterStatusBestellt',
|
||||
'letzterStatusErteilt',
|
||||
'letzterStatusAngenommen',
|
||||
'vertragWurdeStorniert',
|
||||
),
|
||||
'password' => array('password'),
|
||||
'dms' => array('informationsblattExterneLehrende'),
|
||||
'table' => array(
|
||||
'spaltenEinAusblenden',
|
||||
'spaltenEinAusblendenMitKlickOeffnen',
|
||||
'spaltenEinAusblendenAufEinstellungenKlicken',
|
||||
'spaltenEinAusblendenMitKlickAktivieren',
|
||||
'spaltenEinAusblendenMitKlickSchliessen',
|
||||
'spaltenbreiteVeraendern',
|
||||
'spaltenbreiteVeraendernText',
|
||||
'spaltenbreiteVeraendernInfotext',
|
||||
'zeilenAuswaehlen',
|
||||
'zeilenAuswaehlenEinzeln',
|
||||
'zeilenAuswaehlenBereich',
|
||||
'zeilenAuswaehlenAlle'
|
||||
),
|
||||
'lehre' => array(
|
||||
'lehrauftraegeAnnehmen',
|
||||
'lehrauftraegeAnnehmenText',
|
||||
'lehrauftraegeAnnehmenKlickStatusicon',
|
||||
'lehrauftraegeAnnehmenLehrauftraegeWaehlen',
|
||||
'lehrauftraegeAnnehmenMitKlickAnnehmen',
|
||||
'lehrauftraegeNichtAuswaehlbar',
|
||||
'lehrauftraegeNichtAuswaehlbarTextBeiAnnahme',
|
||||
'filterAlleBeiAnnahme',
|
||||
'filterErteiltBeiAnnahme',
|
||||
'filterAngenommen'
|
||||
)
|
||||
),
|
||||
'customJSs' => array(
|
||||
'public/js/bootstrapper.js',
|
||||
'public/js/lehre/lehrauftrag/acceptLehrauftrag.js')
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- title & helper link -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 page-header">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 page-header">
|
||||
<a class="pull-right" data-toggle="collapse" href="#collapseHelp" aria-expanded="false" aria-controls="collapseExample">
|
||||
Hilfe zu dieser Seite
|
||||
<?php echo $this->p->t('ui', 'hilfeZuDieserSeite'); ?>
|
||||
</a>
|
||||
<h3>
|
||||
<?php echo ucfirst($this->p->t('global', 'lehrauftraegeAnnehmen')); ?>
|
||||
</h3>
|
||||
<?php echo ucfirst($this->p->t('global', 'lehrauftraegeAnnehmen')); ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- helper collapse module -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 collapse" id="collapseHelp">
|
||||
<div class="well">
|
||||
<h4>Wie nehme ich Lehraufträge an?</h4>
|
||||
<div class="panel panel-body">
|
||||
Sobald Ihnen ein oder mehrere Lehraufträge erteilt wurden, können Sie diese annehmen.
|
||||
<ol>
|
||||
<li>Klicken Sie unten auf das Status-Icon 'Nur erteilte anzeigen' oder 'Alle anzeigen'</li>
|
||||
<li>Wählen Sie die Lehraufträge, die Sie annehmen möchten, selbst oder alle über den Button 'Alle auswählen'.</li>
|
||||
<li>Geben Sie Ihr CIS-Passwort ein und klicken auf Lehrauftrag annehmen.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Warum kann ich manche Lehraufträge nicht auswählen?</h4>
|
||||
<div class="panel panel-body">
|
||||
Nur Lehraufträge mit dem Status 'erteilt' können gewählt werden.<br>
|
||||
Angenommene Lehraufträge oder Lehraufträge in Bearbeitung werden nur zu Ihrer Information angezeigt.
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Filter</h4>
|
||||
<div class="panel panel-body">
|
||||
<div class="col-xs-12 col-md-8 col-lg-6">
|
||||
<table class="table table-bordered">
|
||||
<tr class="text-center">
|
||||
<td class="col-xs-1"><i class='fa fa-users'></i></td>
|
||||
<td class="col-xs-1"><img src="../../../public/images/icons/fa-user-tag.png" style="height: 30px; width: 30px;"></td>
|
||||
<td class="col-xs-1"><img src="../../../public/images/icons/fa-user-check.png" style="height: 30px; width: 30px;"></td>
|
||||
<td class="col-xs-1"><i class='fa fa-handshake-o'></i></td>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td><b>Alle</b><br>Alle Lehraufträge mit jedem Status</td>
|
||||
<td><b>Bestellt</b><br>Nur bestellte UND bestellte Lehraufträge, die in Bearbeitung sind</td>
|
||||
<td><b>Erteilt</b><br>Nur erteilte UND geänderte Lehraufträge, die in Bearbeitung sind</td>
|
||||
<td><b>Angenommen</b><br>Nur von Ihnen angenommene Lehraufträge</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Auswahl</h4>
|
||||
<div class="panel panel-body">
|
||||
<ul>
|
||||
<li>Einzeln auswählen: <kbd>Strg</kbd> + Klick auf einzelne Zeile(n)</li>
|
||||
<li>Bereich auswählen: <kbd>Shift</kbd> + Klick auf Anfangs- und Endzeile</li>
|
||||
<li>Alle auswählen: Button 'Alle auswählen'</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Ansicht</h4>
|
||||
<div class="panel panel-body">
|
||||
<b>Spaltenbreite verändern</b>
|
||||
<p>
|
||||
Um die Spaltenbreite zu verändern, fährt man im Spaltenkopf langsam mit dem Mauszeiger auf
|
||||
den rechten Rand der entprechenden Spalte. <br>
|
||||
Sobald sich der Mauszeiger in einen Doppelpfeil verwandelt, wird die Maustaste geklickt und
|
||||
mit gedrückter Maustaste die Spalte nach rechts erweitert oder nach links verkleinert.
|
||||
</p>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
<?php $this->load->view('lehre/lehrauftrag/acceptLehrauftragHelp') ?>
|
||||
</div> <!--./well-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- dropdown widgets -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="formLehrauftrag" class="form-inline" action="" method="get">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Studiensemester_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $studiensemester_selected
|
||||
),
|
||||
array(
|
||||
'name' => 'studiensemester',
|
||||
'id' => 'studiensemester'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<button type="submit" name="submit" value="anzeigen" class="btn btn-default form-group">Anzeigen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="formLehrauftrag" class="form-inline" action="" method="get">
|
||||
<input type="hidden" id="uid" name="uid" value="<?php echo getAuthUID(); ?>">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Studiensemester_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $studiensemester_selected
|
||||
),
|
||||
array(
|
||||
'name' => 'studiensemester',
|
||||
'id' => 'studiensemester'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<button type="submit" name="submit" value="anzeigen" class="btn btn-default form-group"><?php echo ucfirst($this->p->t('ui', 'anzeigen')); ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- tabulator data table 'Lehrauftraege annehmen'-->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<?php $this->load->view('lehre/lehrauftrag/acceptLehrauftragData.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<?php $this->load->view('lehre/lehrauftrag/acceptLehrauftragData.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!-- filter buttons & password field & akzeptieren-button -->
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<div class="btn-group" role="group">
|
||||
<button id="show-all" class="btn btn-default btn-lehrauftrag active focus" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="Alle anzeigen"><i class='fa fa-users'></i>
|
||||
<!-- link for external lectors 'Informationsblatt fuer externe Lehrende'. Show only for external lecturers -->
|
||||
<?php if ($is_external_lector): ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<span class="pull-right"><?php echo $this->p->t('dms' , 'informationsblattExterneLehrende'); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- filter buttons & PDF downloads & password field & akzeptieren-button -->
|
||||
<div class="row">
|
||||
<div class="col-xs-5 col-md-4">
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<div class="btn-group" role="group">
|
||||
<button id="show-all" class="btn btn-default btn-lehrauftrag active focus" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="<?php echo $this->p->t('ui', 'alleAnzeigen'); ?>"><i class='fa fa-users'></i>
|
||||
</button>
|
||||
<button id="show-ordered" class="btn btn-default btn-lehrauftrag" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="Nur bestellte anzeigen">
|
||||
<button id="show-approved" class="btn btn-default btn-lehrauftrag" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="<?php echo $this->p->t('ui', 'nurErteilteAnzeigen'); ?>">
|
||||
</button><!-- png img set in javascript -->
|
||||
<button id="show-approved" class="btn btn-default btn-lehrauftrag" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="Nur erteilte anzeigen">
|
||||
</button><!-- png img set in javascript -->
|
||||
<button id="show-accepted" class="btn btn-default btn-lehrauftrag" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="Nur angenommene anzeigen"><i class='fa fa-handshake-o'></i>
|
||||
<button id="show-accepted" class="btn btn-default btn-lehrauftrag" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="<?php echo $this->p->t('ui', 'nurAngenommeneAnzeigen'); ?>"><i class='fa fa-handshake-o'></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="show-cancelled" class="btn btn-default btn-lehrauftrag" type="button" style="margin-left: 20px;"
|
||||
data-toggle="collapse" data-placement="left" title="Stornierte anzeigen"
|
||||
data-toggle="collapse" data-placement="left" title="<?php echo $this->p->t('ui', 'nurStornierteAnzeigen'); ?>"
|
||||
data-target ="#collapseCancelledLehrauftraege" aria-expanded="false" aria-controls="collapseExample">
|
||||
</button><!-- png img set in javascript -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-offset-2 col-md-4 col-xs-6">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-xs-3 col-md-offset-2 col-md-2">
|
||||
<div class="btn-group dropup pull-right">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<?php echo $this->p->t('global', 'dokumentePDF'); ?> <i class="fa fa-arrow-down"></i> <span class="caret"></span>
|
||||
</button>
|
||||
<ul id="ul-download-pdf" class="dropdown-menu">
|
||||
<li value="etw"><a href="#"><?php echo $this->p->t('global', 'PDFLehrauftraegeFH'); ?></a></li>
|
||||
<li value="lehrgang"><a href="#"><?php echo $this->p->t('global', 'PDFLehrauftraegeLehrgaenge'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-4 col-md-offset-0 col-md-4">
|
||||
<div class="input-group">
|
||||
<input id="username" type="hidden" value=""><!-- this is to prevent Chrome autofilling a random input field with the username-->
|
||||
<input id="password" type="password" autocomplete="new-password" class="form-control" placeholder="CIS-Passwort">
|
||||
<input id="username" autocomplete="username" style="position: absolute; opacity: 0;"><!-- this is to prevent Chrome autofilling a random input field with the username-->
|
||||
<input id="password" type="password" autocomplete="new-password" class="form-control" placeholder="CIS-<?php echo ucfirst($this->p->t('password', 'password')); ?>">
|
||||
<span class="input-group-btn">
|
||||
<button id="accept-lehrauftraege" class="btn btn-primary pull-right">Lehrauftrag annehmen</button>
|
||||
<button id="accept-lehrauftraege" class="btn btn-primary pull-right"><?php echo ucfirst($this->p->t('global', 'lehrauftraegeAnnehmen')); ?></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
@@ -196,8 +218,8 @@ $this->load->view(
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end container -->
|
||||
</div>
|
||||
</div><!-- end container -->
|
||||
</div><!-- end page-wrapper -->
|
||||
<br>
|
||||
</body>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user