mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 18:02:18 +00:00
Merge branch 'master' of https://github.com/FH-Complete/FHC-Core
This commit is contained in:
@@ -69,7 +69,6 @@ class InfoCenter extends VileSci_Controller
|
||||
// Loads libraries
|
||||
$this->load->library('DmsLib');
|
||||
$this->load->library('PersonLogLib');
|
||||
$this->load->library('MailLib');
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
@@ -195,6 +194,26 @@ class InfoCenter extends VileSci_Controller
|
||||
redirect(self::URL_PREFIX.'/showDetails/'.$person_id.'#DokPruef');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets prestudent that was last modified in json format, for ZGV übernehmen
|
||||
* @param $person_id
|
||||
*/
|
||||
public function getLastPrestudentWithZgvJson($person_id)
|
||||
{
|
||||
$prestudent = $this->PrestudentModel->getLastPrestudent($person_id, true);
|
||||
|
||||
if (isError($prestudent))
|
||||
{
|
||||
show_error($prestudent->retval);
|
||||
}
|
||||
|
||||
$jsonoutput = count($prestudent->retval) > 0 ? $prestudent->retval[0] : null;
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($jsonoutput));
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a zgv for a prestudent. includes Ort, Datum, Nation for bachelor and master.
|
||||
* @param $prestudent_id
|
||||
@@ -226,7 +245,8 @@ class InfoCenter extends VileSci_Controller
|
||||
'zgvmas_code' => $zgvmas_code,
|
||||
'zgvmaort' => $zgvmaort,
|
||||
'zgvmadatum' => $zgvmadatum,
|
||||
'zgvmanation' => $zgvmanation_code
|
||||
'zgvmanation' => $zgvmanation_code,
|
||||
'updateamum' => date('Y-m-d H:i:s')
|
||||
)
|
||||
);
|
||||
|
||||
@@ -250,7 +270,6 @@ class InfoCenter extends VileSci_Controller
|
||||
*/
|
||||
public function saveAbsage($prestudent_id)
|
||||
{
|
||||
//TODO email messaging
|
||||
$statusgrund = $this->input->post('statusgrund');
|
||||
|
||||
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
@@ -336,6 +355,8 @@ class InfoCenter extends VileSci_Controller
|
||||
show_error($result->retval);
|
||||
}
|
||||
|
||||
$this->_sendFreigabeMail($prestudent_id);
|
||||
|
||||
$logdata = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
|
||||
|
||||
$this->_log($logdata['person_id'], 'freigegeben', array($prestudent_id, $logdata['studiengang_kurzbz']));
|
||||
@@ -652,15 +673,18 @@ class InfoCenter extends VileSci_Controller
|
||||
$zgvpruefungen[] = $zgvpruefung;
|
||||
}
|
||||
|
||||
// Interessenten come first
|
||||
usort($zgvpruefungen, function ($a, $b)
|
||||
{
|
||||
// Interessenten come first, otherwise by bewerbungsdatum desc, then by prestudent_id desc
|
||||
usort($zgvpruefungen, function ($a, $b) {
|
||||
$bewdatesort = strcmp($b->prestudentstatus->bewerbung_abgeschicktamum, $a->prestudentstatus->bewerbung_abgeschicktamum);
|
||||
$defaultsort = $bewdatesort === 0 ? (int)$b->prestudent_id - (int)$a->prestudent_id : $bewdatesort;
|
||||
if (!isset($a->prestudentstatus->status_kurzbz) || !isset($b->prestudentstatus->status_kurzbz))
|
||||
return 0;
|
||||
return $defaultsort;
|
||||
elseif ($a->prestudentstatus->status_kurzbz === 'Interessent' && $b->prestudentstatus->status_kurzbz === 'Interessent')
|
||||
{
|
||||
//infoonly Interessenten come after new Interessenten
|
||||
if ($a->infoonly)
|
||||
if ($a->infoonly === $b->infoonly)
|
||||
return $defaultsort;
|
||||
elseif ($a->infoonly)
|
||||
return 1;
|
||||
elseif ($b->infoonly)
|
||||
return -1;
|
||||
@@ -670,7 +694,7 @@ class InfoCenter extends VileSci_Controller
|
||||
elseif ($b->prestudentstatus->status_kurzbz === 'Interessent')
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
return $defaultsort;
|
||||
});
|
||||
|
||||
$statusgruende = $this->StatusgrundModel->loadWhere(array('status_kurzbz' => 'Abgewiesener'))->retval;
|
||||
@@ -741,9 +765,86 @@ class InfoCenter extends VileSci_Controller
|
||||
$this->uid
|
||||
);
|
||||
}
|
||||
/*
|
||||
private function _sendFreigabeMail()
|
||||
|
||||
/**
|
||||
* Sends infomail with prestudent and person data when Prestudent is freigegeben
|
||||
* @param $prestudent_id
|
||||
*/
|
||||
private function _sendFreigabeMail($prestudent_id)
|
||||
{
|
||||
$this->maillib->send('alex@alex-ThinkCentre-M900', 'karpen_ko@hotmail.com', 'test', 'test');
|
||||
}*/
|
||||
//get data
|
||||
$prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id)->retval[0];
|
||||
$prestudentstatus = $prestudent->prestudentstatus;
|
||||
$person_id = $prestudent->person_id;
|
||||
$person = $this->PersonModel->getPersonStammdaten($person_id, true)->retval;
|
||||
|
||||
//fill mail variables
|
||||
$interessentbez = $person->geschlecht == 'm' ? 'Ein Interessent' : 'Eine Interessentin';
|
||||
$sprache = $prestudentstatus->sprachedetails->bezeichnung[0];
|
||||
$orgform = $prestudentstatus->orgform != '' ? ' ('.$prestudentstatus->orgform.')' : '';
|
||||
$geschlecht = $person->geschlecht == 'm' ? 'männlich' : 'weiblich';
|
||||
$geburtsdatum = date('d.m.Y', strtotime($person->gebdatum));
|
||||
|
||||
$notizenBewerbung = $this->NotizModel->getNotizByTitel($person_id, 'Anmerkung zur Bewerbung')->retval;
|
||||
|
||||
$notizentext = '';
|
||||
$lastElement = end($notizenBewerbung);
|
||||
foreach ($notizenBewerbung as $notiz)
|
||||
{
|
||||
$notizentext .= $notiz->text;
|
||||
if ($notiz != $lastElement)
|
||||
$notizentext .= ' | ';
|
||||
}
|
||||
|
||||
$mailadresse = '';
|
||||
foreach ($person->kontakte as $kontakt)
|
||||
{
|
||||
if ($kontakt->kontakttyp === 'email')
|
||||
{
|
||||
$mailadresse = $kontakt->kontakt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array
|
||||
(
|
||||
'interessentbez' => $interessentbez,
|
||||
'studiengangbez' => $prestudent->studiengangbezeichnung,
|
||||
'studiengangtypbez' => $prestudent->studiengangtyp_bez,
|
||||
'orgform' => $orgform,
|
||||
'studiensemester' => $prestudentstatus->studiensemester_kurzbz,
|
||||
'sprache' => $sprache,
|
||||
'geschlecht' => $geschlecht,
|
||||
'vorname' => $person->vorname,
|
||||
'nachname' => $person->nachname,
|
||||
'gebdatum' => $geburtsdatum,
|
||||
'mailadresse' => $mailadresse,
|
||||
'prestudentid' => $prestudent_id,
|
||||
'notizentext' => $notizentext
|
||||
);
|
||||
|
||||
$this->load->library('parser');
|
||||
$this->load->library('MailLib');
|
||||
$this->load->library('LogLib');
|
||||
|
||||
//parse freigabe html email template, wordwrap wraps text so no display errors
|
||||
$email = wordwrap($this->parser->parse('templates/mailtemplates/interessentFreigabe', $data, true), 70);
|
||||
|
||||
$subject = ($person->geschlecht == 'm' ? 'Interessent ' : 'Interessentin ').$person->vorname.' '.$person->nachname.' freigegeben';
|
||||
|
||||
$receiver = $prestudent->studiengangmail;
|
||||
|
||||
if (!empty($receiver))
|
||||
{
|
||||
//Freigabeinformationmail sent from default system mail to studiengang mail(s)
|
||||
$sent = $this->maillib->send('', $receiver, $subject, $email);
|
||||
|
||||
if (!$sent)
|
||||
$this->loglib->logError('Error when sending Freigabe mail');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->loglib->logError('Studiengang has no mail for sending Freigabe mail');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user