mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
Merge branch 'master' into feature-5491/UDFWidget_add_new_features
This commit is contained in:
@@ -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 (months)
|
||||
* - 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, $months, $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 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() - \''.$months.' months\'::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');
|
||||
}
|
||||
}
|
||||
@@ -1378,7 +1378,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])
|
||||
@@ -1392,23 +1392,37 @@ 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->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);
|
||||
}
|
||||
}
|
||||
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');
|
||||
|
||||
$zgvpruefungen[] = $zgvpruefung;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
$zgvpruefungen[] = $zgvpruefung;
|
||||
}
|
||||
|
||||
$this->_sortPrestudents($zgvpruefungen);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -91,6 +91,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,15 +284,10 @@ 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 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)
|
||||
&& !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).
|
||||
@@ -422,10 +434,10 @@ class Messages_model extends CI_Model
|
||||
|
||||
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,6 +445,15 @@ 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));
|
||||
@@ -454,12 +475,12 @@ class Messages_model extends CI_Model
|
||||
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;
|
||||
|
||||
@@ -185,6 +185,25 @@
|
||||
ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC
|
||||
LIMIT 1
|
||||
) AS "ReihungstestApplied",
|
||||
(
|
||||
SELECT rtp.datum
|
||||
FROM public.tbl_prestudentstatus pss
|
||||
JOIN public.tbl_prestudent ps USING(prestudent_id)
|
||||
LEFT JOIN (
|
||||
SELECT rtp.person_id,
|
||||
rt.studiensemester_kurzbz,
|
||||
rtp.teilgenommen,
|
||||
rt.datum
|
||||
FROM public.tbl_rt_person rtp
|
||||
JOIN tbl_reihungstest rt ON(rtp.rt_id = rt.reihungstest_id)
|
||||
WHERE rt.stufe = 1
|
||||
) rtp ON(rtp.person_id = ps.person_id AND rtp.studiensemester_kurzbz = pss.studiensemester_kurzbz)
|
||||
WHERE pss.status_kurzbz = '.$INTERESSENT_STATUS.'
|
||||
AND ps.person_id = p.person_id
|
||||
AND pss.studiensemester_kurzbz = '.$STUDIENSEMESTER.'
|
||||
ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC
|
||||
LIMIT 1
|
||||
) AS "ReihungstestDate",
|
||||
(
|
||||
SELECT ps.zgvnation
|
||||
FROM public.tbl_prestudent ps
|
||||
@@ -258,6 +277,7 @@
|
||||
'Statusgrund',
|
||||
'Reihungstest angetreten',
|
||||
'Reihungstest angemeldet',
|
||||
'Reihungstest date',
|
||||
'ZGV Nation'
|
||||
),
|
||||
'formatRow' => function($datasetRaw) {
|
||||
@@ -337,6 +357,16 @@
|
||||
{
|
||||
$datasetRaw->{'ReihungstestApplied'} = 'Nein';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'ReihungstestDate'} == null)
|
||||
{
|
||||
$datasetRaw->{'ReihungstestDate'} = '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
$datasetRaw->{'ReihungstestDate'} = date_format(date_create($datasetRaw->{'ReihungstestDate'}),'Y-m-d');
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'ZGVNation'} == null)
|
||||
{
|
||||
$datasetRaw->{'ZGVNation'} = '-';
|
||||
|
||||
@@ -34,12 +34,14 @@
|
||||
//set bootstrap columns for zgv form
|
||||
$columns = array(3, 3, 3, 3);
|
||||
|
||||
$headercolumns = array(7, 5);
|
||||
if (!$infoonly && isset($zgvpruefung->prestudentstatus->bewerbungsnachfrist) && isset($zgvpruefung->prestudentstatus->bewerbungstermin))
|
||||
{
|
||||
$headercolumns[0] = 4;
|
||||
$headercolumns[1] = 8;
|
||||
$headercolumns = $zgvpruefung->hasBewerber === true ? array(3, 5, 4) : array(4, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
$headercolumns = $zgvpruefung->hasBewerber === true ? array(4, 4, 4) : array(7, 5);
|
||||
}
|
||||
|
||||
if (!$first)
|
||||
echo '<br />';
|
||||
@@ -68,6 +70,11 @@
|
||||
?></a>
|
||||
</h4>
|
||||
</div>
|
||||
<?php if($zgvpruefung->hasBewerber === true): ?>
|
||||
<div class="col-xs-<?php echo $headercolumns[2]; ?> text-center text-danger">
|
||||
<?php echo $this->p->t('infocenter', 'rtErgebnisExistiert') ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
$changeup = isset($zgvpruefung->changeup) && $zgvpruefung->changeup === true;
|
||||
$changedown = isset($zgvpruefung->changedown) && $zgvpruefung->changedown === true;
|
||||
@@ -77,7 +84,7 @@
|
||||
<span<?php echo $changeup || $changedown ? ' class="zgvheaderbeforeprio"' : ''?>>
|
||||
<?php if ($infoonly): ?>
|
||||
<?php if (isset($zgvpruefung->prestudentstatus->bestaetigtam)): ?>
|
||||
<i class="fa fa-check" style="color: green"></i>
|
||||
<i class="fa fa-check text-success"></i>
|
||||
<?php if (isset($zgvpruefung->prestudentstatus->statusgrund_id))
|
||||
echo $this->p->t('global', 'anStudiengangFreigegeben').(isset($zgvpruefung->prestudentstatus->bezeichnung_statusgrund[0]) ? ' ('.$zgvpruefung->prestudentstatus->bezeichnung_statusgrund[0].')' : '');
|
||||
else
|
||||
@@ -85,9 +92,9 @@
|
||||
?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo ucfirst($this->p->t('infocenter', 'bewerbung')) . ' ' . $this->p->t('global', 'abgeschickt') . ': '.(isset($zgvpruefung->prestudentstatus->bewerbung_abgeschicktamum) ? '<i class="fa fa-check" style="color:green"></i>' : '<i class="fa fa-times" style="color:red"></i>'); ?>
|
||||
<?php echo (isset($zgvpruefung->prestudentstatus->bewerbungsnachfrist) ? ' | ' . $this->p->t('infocenter', 'nachfrist') . ': ' . date_format(date_create($zgvpruefung->prestudentstatus->bewerbungsnachfrist), 'd.m.Y') : ''); ?>
|
||||
<?php echo (isset($zgvpruefung->prestudentstatus->bewerbungstermin) ? ' | ' . $this->p->t('infocenter', 'bewerbungsfrist') . ': ' . date_format(date_create($zgvpruefung->prestudentstatus->bewerbungstermin), 'd.m.Y') : ''); ?>
|
||||
<?php echo ucfirst($this->p->t('infocenter', 'bewerbung')) . ' ' . $this->p->t('global', 'abgeschickt') . ': '.(isset($zgvpruefung->prestudentstatus->bewerbung_abgeschicktamum) ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'); ?>
|
||||
<?php echo (isset($zgvpruefung->prestudentstatus->bewerbungsnachfrist) ? ' | ' . $this->p->t('infocenter', 'nachfrist') . ': ' . date_format(date_create($zgvpruefung->prestudentstatus->bewerbungsnachfrist), 'd.m.Y') : ''); ?>
|
||||
<?php echo (isset($zgvpruefung->prestudentstatus->bewerbungstermin) ? ' | ' . $this->p->t('infocenter', 'bewerbungsfrist') . ': ' . date_format(date_create($zgvpruefung->prestudentstatus->bewerbungstermin), 'd.m.Y') : ''); ?>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
echo ' | ' . ucfirst($this->p->t('infocenter', 'priorisierung')) . ': ';
|
||||
@@ -488,10 +495,10 @@
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.panel-footer -->
|
||||
<?php elseif (isset($zgvpruefung->prestudentstatus->status_kurzbz) && $zgvpruefung->prestudentstatus->status_kurzbz === 'Interessent'): ?>
|
||||
<div class="panel-footer" style="border-top: 1px solid #ddd">
|
||||
<div class="panel-footer solidtop">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-left">
|
||||
<?php echo isset($zgvpruefung->prestudentstatus->bestaetigtam) ? '<i class="fa fa-check" style="color: green"></i>' : '<i class="fa fa-check" style="color: red"></i>' ?>
|
||||
<?php echo isset($zgvpruefung->prestudentstatus->bestaetigtam) ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-check text-danger"></i>' ?>
|
||||
<label>
|
||||
<?php if (isset($zgvpruefung->prestudentstatus->statusgrund_id))
|
||||
echo $this->p->t('global', 'anStudiengangFreigegeben').(isset($zgvpruefung->prestudentstatus->bezeichnung_statusgrund[0]) ? ' ('.$zgvpruefung->prestudentstatus->bezeichnung_statusgrund[0].')' : '');
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<span class="buttonsSpacer"></span>
|
||||
|
||||
<span>
|
||||
<input id="writeMessage" type="button" value="<?php echo $this->p->t('ui', 'nachrichtSenden'); ?>">
|
||||
<?php echo $writeButton; ?>
|
||||
|
||||
<input id="replyMessage" type="button" value="<?php echo $this->p->t('global', 'reply'); ?>">
|
||||
</span>
|
||||
|
||||
@@ -85,6 +85,12 @@
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-right">
|
||||
<button id="backButton" class="btn btn-default" type="button">
|
||||
|
||||
<?php echo $this->p->t('ui', 'backToReadWriteMessage'); ?>
|
||||
|
||||
</button>
|
||||
|
||||
<button id="sendButton" class="btn btn-default" type="button">
|
||||
|
||||
<?php echo $this->p->t('ui', 'senden'); ?>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
array(
|
||||
'name' => 'variables[]',
|
||||
'id' => 'variables',
|
||||
'size' => 27,
|
||||
'size' => count($variables),
|
||||
'multiple' => true
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user