mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
Refactor Reihungstest-Jobs
- Link to Auswertung instead of Student-Table in E-Mail (Data security) - Params in function for degraee-program, bcc and from
This commit is contained in:
@@ -65,13 +65,35 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* runZentraleReihungstestAnmeldefristAssistenzJob
|
||||
*/
|
||||
public function runZentraleReihungstestAnmeldefristAssistenzJob()
|
||||
{
|
||||
// Get placement tests where registration date was yesterday
|
||||
$result = $this->ReihungstestModel->checkReachedRegistrationDate(11000);
|
||||
/*
|
||||
* Sends an email to all assistants of a placement test when an anmeldeschluss has been reached
|
||||
*
|
||||
* @param integer $degreeProgram. Kennzahl of Degree Program to check
|
||||
* @param string $bcc. Optional. BCC-Mailadress to send the Mails to
|
||||
* @param string $from. Optional. Sender-Mailadress shown to recipient
|
||||
*/
|
||||
public function runZentraleReihungstestAnmeldefristAssistenzJob($degreeProgram, $bcc = null, $from = null)
|
||||
{
|
||||
// Encode Params
|
||||
if ($bcc != '')
|
||||
{
|
||||
// $bcc can be given as null-string, so check that too
|
||||
if ($bcc == 'null')
|
||||
{
|
||||
$bcc = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$bcc = urldecode($bcc);
|
||||
}
|
||||
}
|
||||
if ($from != '')
|
||||
{
|
||||
$from = urldecode($from);
|
||||
}
|
||||
|
||||
// Get placement tests where registration date was yesterday
|
||||
$result = $this->ReihungstestModel->checkReachedRegistrationDate($degreeProgram);
|
||||
|
||||
$reachedRegistration_rt_arr = array();
|
||||
|
||||
@@ -99,8 +121,9 @@ class ReihungstestJob extends CLI_Controller
|
||||
show_error($applicants->error);
|
||||
}
|
||||
|
||||
// Get all Bachelor-Degree-Programs with Mailadress
|
||||
$bachelorStudiengeange = $this->StudiengangModel->loadStudiengaengeFromTyp('b');
|
||||
// Get all Bachelor-Degree-Programs with Mailadress
|
||||
$bachelorStudiengeange = $this->StudiengangModel->loadStudiengaengeFromTyp('b');
|
||||
$bachelorStudiengeange_arr = array();
|
||||
|
||||
if (hasData($bachelorStudiengeange))
|
||||
{
|
||||
@@ -116,87 +139,80 @@ class ReihungstestJob extends CLI_Controller
|
||||
foreach ($bachelorStudiengeange_arr as $bachelorStudiengang)
|
||||
{
|
||||
$studiengang_kuerzel = strtoupper($bachelorStudiengang->typ.$bachelorStudiengang->kurzbz);
|
||||
$applicants_list = '';
|
||||
$applicantCounter = 0;
|
||||
$rowstyle = 'style="background-color: #EEEEEE; padding: 4px;"';
|
||||
$mailReceipients = ''; // String with all mailadresses
|
||||
$mailcontent_data_arr = array();
|
||||
foreach ($applicants_arr as $applicant)
|
||||
{
|
||||
if ($bachelorStudiengang->studiengang_kz == $applicant->studiengang_kz)
|
||||
{
|
||||
$mailReceipients .= $applicant->email. ';';
|
||||
$applicantCounter ++;
|
||||
$applicants_list .= '
|
||||
<tr '.$rowstyle.'>
|
||||
<td>'. $applicant->orgform_kurzbz. '</td>
|
||||
<td>'. $applicant->ausbildungssemester. '</td>
|
||||
<td>'. $applicant->nachname. '</td>
|
||||
<td>'. $applicant->vorname. '</td>
|
||||
<td>'. $applicant->zgv_kurzbz. '</td>
|
||||
<td>'. $applicant->prioritaet. '</td>
|
||||
<td>'. $applicant->qualifikationskurs. '</td>
|
||||
<td><a href="mailto:'. $applicant->email. '">'. $applicant->email. '</a></td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
}
|
||||
if ($applicantCounter == 0)
|
||||
{
|
||||
$mailcontent = '<p style="font-family: verdana, sans-serif;">Der Anmeldeschluss für den zentralen Reihungstest am ' . date_format(date_create($reihungstest->datum), 'd.m.Y') . ' um ' . $reihungstest->uhrzeit . ' Uhr wurde gestern erreicht.</p>';
|
||||
$mailcontent .= '<p style="font-family: verdana, sans-serif;"><b>Für den Studiengang ' . $studiengang_kuerzel . ' nehmen keine InteressentInnen an diesem Reihungstest teil</b></p>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$headerstyle = 'style="background: #DCE4EF; border: 1px solid #FFF; padding: 4px; text-align: left;"';
|
||||
}
|
||||
}
|
||||
if ($applicantCounter == 0)
|
||||
{
|
||||
$mailcontent = '<p style="font-family: verdana, sans-serif;">Der Anmeldeschluss für den zentralen Reihungstest am ' . date_format(date_create($reihungstest->datum), 'd.m.Y') . ' um ' . $reihungstest->uhrzeit . ' Uhr wurde gestern erreicht.</p>';
|
||||
$mailcontent .= '<p style="font-family: verdana, sans-serif;"><b>Für den Studiengang '.$studiengang_kuerzel.' nehmen keine InteressentInnen an diesem Reihungstest teil</b></p>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailcontent = '<p style="font-family: verdana, sans-serif;">Der Anmeldeschluss für den zentralen Reihungstest am ' . date_format(date_create($reihungstest->datum), 'd.m.Y') . ' um ' . $reihungstest->uhrzeit . ' Uhr wurde gestern erreicht.</p>';
|
||||
$mailcontent .= '
|
||||
<p style="font-family: verdana, sans-serif;"><b>' . $applicantCounter . '</b> InteressentIn(nen) des Studiengangs ' . $studiengang_kuerzel . ' nehmen daran teil:</p>
|
||||
<p style="font-family: verdana, sans-serif;">
|
||||
<a href="'.APP_ROOT.'vilesci/stammdaten/auswertung_fhtw.php?reihungstest='.$reihungstest->reihungstest_id.'&studiengang='.$bachelorStudiengang->studiengang_kz.'" target="_blank">
|
||||
Liste der Anmeldungen
|
||||
</a>
|
||||
</p>';
|
||||
}
|
||||
$mailcontent_data_arr['table'] = $mailcontent;
|
||||
|
||||
$mailcontent = '<p style="font-family: verdana, sans-serif;">Der Anmeldeschluss für den zentralen Reihungstest am ' . date_format(date_create($reihungstest->datum), 'd.m.Y') . ' um ' . $reihungstest->uhrzeit . ' Uhr wurde gestern erreicht.</p>';
|
||||
$mailcontent .= '
|
||||
<p style="font-family: verdana, sans-serif;">Folgende ' . $applicantCounter . ' InteressentInnen des Studiengangs ' . $studiengang_kuerzel . ' nehmen daran teil:</p>
|
||||
<table width="100%" style="cellpadding: 3px; font-family: verdana, sans-serif; border: 1px solid #000000;">
|
||||
<thead>
|
||||
<th ' . $headerstyle . '>OrgForm</th>
|
||||
<th ' . $headerstyle . '>Semester</th>
|
||||
<th ' . $headerstyle . '>Nachname</th>
|
||||
<th ' . $headerstyle . '>Vorname</th>
|
||||
<th ' . $headerstyle . '>ZGV</th>
|
||||
<th ' . $headerstyle . '>Priorität</th>
|
||||
<th ' . $headerstyle . '>Qualikurs</th>
|
||||
<th ' . $headerstyle . '>E-Mail</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
';
|
||||
$mailcontent .= $applicants_list;
|
||||
$mailcontent .= '
|
||||
</tbody>
|
||||
</table>
|
||||
';
|
||||
$mailcontent .= '<p style="font-family: verdana, sans-serif;"><a href="mailto:?bcc=' . $mailReceipients . '">Mail an alle schicken</a></p>';
|
||||
}
|
||||
$mailcontent_data_arr['table'] = $mailcontent;
|
||||
// Send email in Sancho design
|
||||
if (!isEmptyString($mailcontent))
|
||||
{
|
||||
sendSanchoMail(
|
||||
'Sancho_ReihungstestteilnehmerJob',
|
||||
$mailcontent_data_arr,
|
||||
$bachelorStudiengang->email,
|
||||
'Anmeldeschluss Reihungstest ' . date_format(date_create($reihungstest->datum), 'd.m.Y') . ' ' . $reihungstest->uhrzeit . ' Uhr',
|
||||
'sancho_header_min_bw.jpg',
|
||||
'sancho_footer_min_bw.jpg',
|
||||
$from,
|
||||
'',
|
||||
$bcc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send email in Sancho design
|
||||
if (!isEmptyString($mailcontent))
|
||||
{
|
||||
sendSanchoMail(
|
||||
'Sancho_ReihungstestteilnehmerJob',
|
||||
$mailcontent_data_arr,
|
||||
array($bachelorStudiengang->email, 'kindlm@technikum-wien.at'),
|
||||
'Anmeldeschluss Reihungstest ' . date_format(date_create($reihungstest->datum), 'd.m.Y') . ' ' . $reihungstest->uhrzeit . ' Uhr',
|
||||
'sancho_header_min_bw.jpg',
|
||||
'sancho_footer_min_bw.jpg');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Checks, if an applicant was assigned to a test after Anmeldefrist and sends an email to all responsible assistants
|
||||
*
|
||||
* @param integer $degreeProgram. Kennzahl of Degree Program to check
|
||||
* @param string $bcc. Optional. BCC-Mailadress to send the Mails to
|
||||
* @param string $from. Optional. Sender-Mailadress shown to recipient
|
||||
*/
|
||||
public function runZentraleReihungstestNachtraeglichHinzugefuegtJob($degreeProgram, $bcc = null, $from = null)
|
||||
{
|
||||
// Encode Params
|
||||
if ($bcc != '')
|
||||
{
|
||||
// $bcc can be given as null-string, so check that too
|
||||
if ($bcc == 'null')
|
||||
{
|
||||
$bcc = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$bcc = urldecode($bcc);
|
||||
}
|
||||
}
|
||||
if ($from != '')
|
||||
{
|
||||
$from = urldecode($from);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, if an applicant was assigned to a test after Anmeldefrist
|
||||
*/
|
||||
public function runZentraleReihungstestNachtraeglichHinzugefuegtJob()
|
||||
{
|
||||
// Get applicants that have been added to a test after Anmeldefrist
|
||||
$result = $this->ReihungstestModel->getApplicantAssignedAfterDate(11000);
|
||||
// Get applicants that have been added to a test after Anmeldefrist
|
||||
$result = $this->ReihungstestModel->getApplicantAssignedAfterDate($degreeProgram);
|
||||
|
||||
$applicants_after_anmeldefrist_arr = array();
|
||||
|
||||
@@ -217,32 +233,39 @@ class ReihungstestJob extends CLI_Controller
|
||||
$mailcontent = '';
|
||||
$applicants_list = '';
|
||||
|
||||
if (count($applicants_after_anmeldefrist_arr) > 0)
|
||||
{
|
||||
foreach ($applicants_after_anmeldefrist_arr as $applicant)
|
||||
{
|
||||
if ($studiengang != $applicant->studiengang_kz)
|
||||
{
|
||||
if ($studiengang != '' && $studiengang != $applicant->studiengang_kz)
|
||||
{
|
||||
$bachelorStudiengang = $this->StudiengangModel->load($studiengang);
|
||||
$mailcontent .= $applicants_list;
|
||||
$mailcontent .= '</tbody></table>';
|
||||
$mailcontent .= '<p style="font-family: verdana, sans-serif;"><a href="mailto:?bcc=' . $mailReceipients . '">Mail an alle schicken</a></p>';
|
||||
$mailcontent_data_arr['table'] = $mailcontent;
|
||||
sendSanchoMail(
|
||||
'Sancho_ReihungstestteilnehmerJob',
|
||||
$mailcontent_data_arr,
|
||||
array($bachelorStudiengang->retval[0]->email, 'kindlm@technikum-wien.at'),
|
||||
'InteressentIn nach Reihungstest-Anmeldeschluss hinzugefügt',
|
||||
'sancho_header_min_bw.jpg',
|
||||
'sancho_footer_min_bw.jpg');
|
||||
$applicants_list = '';
|
||||
$mailcontent_data_arr = array();
|
||||
}
|
||||
if (count($applicants_after_anmeldefrist_arr) > 0)
|
||||
{
|
||||
foreach ($applicants_after_anmeldefrist_arr as $applicant)
|
||||
{
|
||||
if ($studiengang != $applicant->studiengang_kz)
|
||||
{
|
||||
if ($studiengang != '' && $studiengang != $applicant->studiengang_kz)
|
||||
{
|
||||
$bachelorStudiengang = $this->StudiengangModel->load($studiengang);
|
||||
$mailcontent .= $applicants_list;
|
||||
$mailcontent .= '</tbody></table>';
|
||||
$mailcontent .= '<p style="font-family: verdana, sans-serif;">
|
||||
<a href="'.APP_ROOT.'vilesci/stammdaten/auswertung_fhtw.php?reihungstest='.$applicant->reihungstest_id.'&studiengang='.$studiengang.'" target="_blank">
|
||||
Liste der Anmeldungen
|
||||
</a>
|
||||
</p>';
|
||||
$mailcontent_data_arr['table'] = $mailcontent;
|
||||
sendSanchoMail(
|
||||
'Sancho_ReihungstestteilnehmerJob',
|
||||
$mailcontent_data_arr,
|
||||
$bachelorStudiengang->retval[0]->email,
|
||||
'InteressentIn nach Reihungstest-Anmeldeschluss hinzugefügt',
|
||||
'sancho_header_min_bw.jpg',
|
||||
'sancho_footer_min_bw.jpg',
|
||||
$from,
|
||||
'',
|
||||
$bcc);
|
||||
$applicants_list = '';
|
||||
$mailcontent_data_arr = array();
|
||||
}
|
||||
|
||||
$mailcontent = '<p style="font-family: verdana, sans-serif;">Folgende InteressentInnen wurden <b>nach</b> der Anmeldefrist zu einem Reihungstest hinzugefügt.</p>';
|
||||
$mailcontent .= '
|
||||
$mailcontent = '<p style="font-family: verdana, sans-serif;">Folgende InteressentInnen wurden <b>nach</b> der Anmeldefrist zu einem Reihungstest hinzugefügt.<br>Details siehe Link</p>';
|
||||
$mailcontent .= '
|
||||
<table width="100%" style="cellpadding: 3px; font-family: verdana, sans-serif; border: 1px solid #000000;">
|
||||
<thead>
|
||||
<th ' . $headerstyle . '>Datum des Tests</th>
|
||||
@@ -251,10 +274,6 @@ class ReihungstestJob extends CLI_Controller
|
||||
<th ' . $headerstyle . '>Semester</th>
|
||||
<th ' . $headerstyle . '>Nachname</th>
|
||||
<th ' . $headerstyle . '>Vorname</th>
|
||||
<th ' . $headerstyle . '>ZGV</th>
|
||||
<th ' . $headerstyle . '>Priorität</th>
|
||||
<th ' . $headerstyle . '>Qualikurs</th>
|
||||
<th ' . $headerstyle . '>E-Mail</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
';
|
||||
@@ -270,50 +289,57 @@ class ReihungstestJob extends CLI_Controller
|
||||
<td>' . $applicant->ausbildungssemester . '</td>
|
||||
<td>' . $applicant->nachname . '</td>
|
||||
<td>' . $applicant->vorname . '</td>
|
||||
<td>' . $applicant->zgv_kurzbz . '</td>
|
||||
<td>' . $applicant->prioritaet . '</td>
|
||||
<td>' . $applicant->qualifikationskurs . '</td>
|
||||
<td><a href="mailto:' . $applicant->email . '">' . $applicant->email . '</a></td>
|
||||
</tr>
|
||||
';
|
||||
};
|
||||
$bachelorStudiengang = $this->StudiengangModel->load($studiengang);
|
||||
$mailcontent .= $applicants_list;
|
||||
$mailcontent .= '</tbody></table>';
|
||||
$mailcontent .= '<p style="font-family: verdana, sans-serif;"><a href="mailto:?bcc=' . $mailReceipients . '">Mail an alle schicken</a></p>';
|
||||
$mailcontent_data_arr['table'] = $mailcontent;
|
||||
sendSanchoMail(
|
||||
'Sancho_ReihungstestteilnehmerJob',
|
||||
$mailcontent_data_arr,
|
||||
array($bachelorStudiengang->retval[0]->email, 'kindlm@technikum-wien.at'),
|
||||
'InteressentIn nach Reihungstest-Anmeldeschluss hinzugefügt',
|
||||
'sancho_header_min_bw.jpg',
|
||||
'sancho_footer_min_bw.jpg');
|
||||
}
|
||||
}
|
||||
};
|
||||
$bachelorStudiengang = $this->StudiengangModel->load($studiengang);
|
||||
$mailcontent .= $applicants_list;
|
||||
$mailcontent .= '</tbody></table>';
|
||||
$mailcontent .= '<p style="font-family: verdana, sans-serif;">
|
||||
<a href="'.APP_ROOT.'vilesci/stammdaten/auswertung_fhtw.php?reihungstest='.$applicant->reihungstest_id.'&studiengang='.$studiengang.'" target="_blank">
|
||||
Liste der Anmeldungen
|
||||
</a>
|
||||
</p>';
|
||||
$mailcontent_data_arr['table'] = $mailcontent;
|
||||
sendSanchoMail(
|
||||
'Sancho_ReihungstestteilnehmerJob',
|
||||
$mailcontent_data_arr,
|
||||
$bachelorStudiengang->retval[0]->email,
|
||||
'InteressentIn nach Reihungstest-Anmeldeschluss hinzugefügt',
|
||||
'sancho_header_min_bw.jpg',
|
||||
'sancho_footer_min_bw.jpg',
|
||||
$from,
|
||||
'',
|
||||
$bcc);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Sends an email to all applicants of a placement test to remind them 3 working days before
|
||||
*
|
||||
* @param integer $degreeProgram. Kennzahl of Degree Program to check
|
||||
* @param string $bcc. Optional. BCC-Mailadress to send the Mails to
|
||||
* @param string $from. Optional. Sender-Mailadress shown to recipient
|
||||
*/
|
||||
public function remindApplicantsOfPlacementTest()
|
||||
{
|
||||
$degreeProgram = $this->input->get('degreeprogram');
|
||||
$bcc = $this->input->get('bcc');
|
||||
$from = $this->input->get('from');
|
||||
|
||||
// Encode Params
|
||||
if ($bcc != '')
|
||||
{
|
||||
$bcc = urldecode($bcc);
|
||||
}
|
||||
if ($from != '')
|
||||
{
|
||||
$from = urldecode($from);
|
||||
}
|
||||
/*
|
||||
* Sends an email to all applicants of a placement test to remind them 3 working days before
|
||||
*
|
||||
* @param integer $degreeProgram. Kennzahl of Degree Program to check
|
||||
* @param string $bcc. Optional. BCC-Mailadress to send the Mails to
|
||||
* @param string $from. Optional. Sender-Mailadress shown to recipient
|
||||
*/
|
||||
public function remindApplicantsOfPlacementTest($degreeProgram, $bcc = null, $from = null)
|
||||
{
|
||||
// Encode Params
|
||||
if ($bcc != '')
|
||||
{
|
||||
// $bcc can be given as null-string, so check that too
|
||||
if ($bcc == 'null')
|
||||
{
|
||||
$bcc = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$bcc = urldecode($bcc);
|
||||
}
|
||||
}
|
||||
if ($from != '')
|
||||
{
|
||||
$from = urldecode($from);
|
||||
}
|
||||
|
||||
// Get placement tests with testdate within the next 2 weeks
|
||||
$resultNextTestDates = $this->ReihungstestModel->getNextPlacementtests($degreeProgram, 14);
|
||||
@@ -376,16 +402,23 @@ class ReihungstestJob extends CLI_Controller
|
||||
show_error($applicants->error);
|
||||
}
|
||||
|
||||
foreach ($applicants_arr as $applicant)
|
||||
{
|
||||
$mailcontent_data_arr = array();
|
||||
$mailcontent_data_arr['anrede'] = $applicant->anrede;
|
||||
$mailcontent_data_arr['nachname'] = $applicant->nachname;
|
||||
$mailcontent_data_arr['vorname'] = $applicant->vorname;
|
||||
$mailcontent_data_arr['rt_datum'] = date_format(date_create($reihungstest->datum), 'd.m.Y');
|
||||
$mailcontent_data_arr['rt_uhrzeit'] = date_format(date_create($reihungstest->uhrzeit), 'H:i');
|
||||
$mailcontent_data_arr['rt_raum'] = $applicant->planbezeichnung;
|
||||
$mailcontent_data_arr['wegbeschreibung'] = $applicant->lageplan;
|
||||
foreach ($applicants_arr as $applicant)
|
||||
{
|
||||
$mailcontent_data_arr = array();
|
||||
$mailcontent_data_arr['anrede'] = $applicant->anrede;
|
||||
$mailcontent_data_arr['nachname'] = $applicant->nachname;
|
||||
$mailcontent_data_arr['vorname'] = $applicant->vorname;
|
||||
$mailcontent_data_arr['rt_datum'] = date_format(date_create($reihungstest->datum), 'd.m.Y');
|
||||
$mailcontent_data_arr['rt_uhrzeit'] = date_format(date_create($reihungstest->uhrzeit), 'H:i');
|
||||
$mailcontent_data_arr['rt_raum'] = $applicant->planbezeichnung;
|
||||
if ($applicant->lageplan == '')
|
||||
{
|
||||
$mailcontent_data_arr['wegbeschreibung'] = 'Für diesen Raum liegt noch keine Wegbeschreibung vor.<br><br>No directions were found for this room';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailcontent_data_arr['wegbeschreibung'] = $applicant->lageplan;
|
||||
}
|
||||
|
||||
sendSanchoMail(
|
||||
'Sancho_RemindApplicantsOfTest',
|
||||
|
||||
@@ -349,6 +349,7 @@ class Reihungstest_model extends DB_Model
|
||||
ps.prestudent_id,
|
||||
rt.datum,
|
||||
rt.uhrzeit,
|
||||
rt.reihungstest_id,
|
||||
tbl_studienplan.orgform_kurzbz,
|
||||
tbl_prestudentstatus.studienplan_id,
|
||||
tbl_prestudentstatus.ausbildungssemester,
|
||||
|
||||
Reference in New Issue
Block a user