diff --git a/application/controllers/jobs/ReihungstestJob.php b/application/controllers/jobs/ReihungstestJob.php index e0c2c8336..5aa355b5f 100644 --- a/application/controllers/jobs/ReihungstestJob.php +++ b/application/controllers/jobs/ReihungstestJob.php @@ -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 .= ' - - '. $applicant->orgform_kurzbz. ' - '. $applicant->ausbildungssemester. ' - '. $applicant->nachname. ' - '. $applicant->vorname. ' - '. $applicant->zgv_kurzbz. ' - '. $applicant->prioritaet. ' - '. $applicant->qualifikationskurs. ' - '. $applicant->email. ' - - '; - } - } - if ($applicantCounter == 0) - { - $mailcontent = '

Der Anmeldeschluss für den zentralen Reihungstest am ' . date_format(date_create($reihungstest->datum), 'd.m.Y') . ' um ' . $reihungstest->uhrzeit . ' Uhr wurde gestern erreicht.

'; - $mailcontent .= '

Für den Studiengang ' . $studiengang_kuerzel . ' nehmen keine InteressentInnen an diesem Reihungstest teil

'; - } - else - { - $headerstyle = 'style="background: #DCE4EF; border: 1px solid #FFF; padding: 4px; text-align: left;"'; + } + } + if ($applicantCounter == 0) + { + $mailcontent = '

Der Anmeldeschluss für den zentralen Reihungstest am ' . date_format(date_create($reihungstest->datum), 'd.m.Y') . ' um ' . $reihungstest->uhrzeit . ' Uhr wurde gestern erreicht.

'; + $mailcontent .= '

Für den Studiengang '.$studiengang_kuerzel.' nehmen keine InteressentInnen an diesem Reihungstest teil

'; + } + else + { + $mailcontent = '

Der Anmeldeschluss für den zentralen Reihungstest am ' . date_format(date_create($reihungstest->datum), 'd.m.Y') . ' um ' . $reihungstest->uhrzeit . ' Uhr wurde gestern erreicht.

'; + $mailcontent .= ' +

' . $applicantCounter . ' InteressentIn(nen) des Studiengangs ' . $studiengang_kuerzel . ' nehmen daran teil:

+

+ + Liste der Anmeldungen + +

'; + } + $mailcontent_data_arr['table'] = $mailcontent; - $mailcontent = '

Der Anmeldeschluss für den zentralen Reihungstest am ' . date_format(date_create($reihungstest->datum), 'd.m.Y') . ' um ' . $reihungstest->uhrzeit . ' Uhr wurde gestern erreicht.

'; - $mailcontent .= ' -

Folgende ' . $applicantCounter . ' InteressentInnen des Studiengangs ' . $studiengang_kuerzel . ' nehmen daran teil:

- - - - - - - - - - - - - '; - $mailcontent .= $applicants_list; - $mailcontent .= ' - -
OrgFormSemesterNachnameVornameZGVPrioritätQualikursE-Mail
- '; - $mailcontent .= '

Mail an alle schicken

'; - } - $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 .= ''; - $mailcontent .= '

Mail an alle schicken

'; - $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 .= ''; + $mailcontent .= '

+ + Liste der Anmeldungen + +

'; + $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 = '

Folgende InteressentInnen wurden nach der Anmeldefrist zu einem Reihungstest hinzugefügt.

'; - $mailcontent .= ' + $mailcontent = '

Folgende InteressentInnen wurden nach der Anmeldefrist zu einem Reihungstest hinzugefügt.
Details siehe Link

'; + $mailcontent .= ' @@ -251,10 +274,6 @@ class ReihungstestJob extends CLI_Controller - - - - '; @@ -270,50 +289,57 @@ class ReihungstestJob extends CLI_Controller - - - - '; - }; - $bachelorStudiengang = $this->StudiengangModel->load($studiengang); - $mailcontent .= $applicants_list; - $mailcontent .= '
Datum des TestsSemester Nachname VornameZGVPrioritätQualikursE-Mail
' . $applicant->ausbildungssemester . ' ' . $applicant->nachname . ' ' . $applicant->vorname . '' . $applicant->zgv_kurzbz . '' . $applicant->prioritaet . '' . $applicant->qualifikationskurs . '' . $applicant->email . '
'; - $mailcontent .= '

Mail an alle schicken

'; - $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 .= ''; + $mailcontent .= '

+ + Liste der Anmeldungen + +

'; + $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.

No directions were found for this room'; + } + else + { + $mailcontent_data_arr['wegbeschreibung'] = $applicant->lageplan; + } sendSanchoMail( 'Sancho_RemindApplicantsOfTest', diff --git a/application/models/crm/Reihungstest_model.php b/application/models/crm/Reihungstest_model.php index 6068c246f..ec1982ea6 100644 --- a/application/models/crm/Reihungstest_model.php +++ b/application/models/crm/Reihungstest_model.php @@ -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,