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
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_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');
+ }
+ }
+
+ public function runRemindApplicantsOfPlacementTestJob()
+ {
+ // Get placement tests with testdate within 3 working days
+
+ // Check if today +3 days is working day
+ $todayPlus3 = date('Y-m-d', strtotime("+3 days"));
+
+ if (getWorkingDays($todayPlus3, $todayPlus3) == 0)
+ {
+ // If not increase counting days till next working day
+ for ($i = 3; $i < 100; $i++)
+ {
+ $dateToCheck = date('Y-m-d', strtotime("+".$i." days"));
+ if (getWorkingDays($dateToCheck, $dateToCheck) == 1)
+ {
+ $nextWorkingDay = $dateToCheck;
+ break;
+ }
+ }
+ }
+ else
+ {
+ $nextWorkingDay = date('Y-m-d', strtotime("+3 days"));
+ }
+
+ // Check if a placement test happens on $nextWorkingDay
+ $result = $this->ReihungstestModel->getTestsOnDate($nextWorkingDay, 11000);
+
+ $testsOndate = array();
+
+ if (hasData($result))
+ {
+ $testsOndate = $result->retval;
+ }
+ elseif (isError($result))
+ {
+ show_error($result->error);
+ }
+
+ $applicants_arr = array();
+
+ foreach ($testsOndate as $reihungstest)
+ {
+ // Loads applicants of a test
+ $applicants = $this->ReihungstestModel->getApplicantsOfPlacementTest($reihungstest->reihungstest_id);
+
+ if (hasData($applicants))
+ {
+ $applicants_arr = $applicants->retval;
+ }
+ elseif (isError($applicants))
+ {
+ 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;
+
+ sendSanchoMail(
+ 'Sancho_RemindApplicantsOfTest',
+ $mailcontent_data_arr,
+ array($applicant->email,'kindlm@technikum-wien.at'),
+ 'Ihre Anmeldung zum Reihungstest - Reminder / Your registration for the placement test - Reminder');
+ }
+ }
+ }
+
// ------------------------------------------------------------------------
// Private methods
/**
@@ -118,7 +417,8 @@ class ReihungstestJob extends FHC_Controller
// Prepare HTML table with study plans that have no placement tests yet
if (!empty($missing_rt_arr))
{
- $studienplan_list = '
+ $studienplan_list
+ = '
';
diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php
index 2a8b238fe..343d4ec11 100644
--- a/application/controllers/system/infocenter/InfoCenter.php
+++ b/application/controllers/system/infocenter/InfoCenter.php
@@ -527,7 +527,7 @@ class InfoCenter extends Auth_Controller
$logparams = array($prestudent_id, $logdata['studiengang_kurzbz'], '');
- if (isset($statusgrund_id))
+ if (isset($statusgrund_id) && is_numeric($statusgrund_id))
{
$this->StatusgrundModel->addSelect('bezeichnung_mehrsprachig');
$statusgrund_kurzbz = $this->StatusgrundModel->load($statusgrund_id);
diff --git a/application/helpers/hlp_common_helper.php b/application/helpers/hlp_common_helper.php
index 425b40e3f..9ff72fb91 100644
--- a/application/helpers/hlp_common_helper.php
+++ b/application/helpers/hlp_common_helper.php
@@ -167,3 +167,100 @@ function isEmptyArray($array)
{
return ($array == null) || ($array != null && !is_array($array) || (is_array($array) && count($array) == 0));
}
+
+/**
+ * The function returns the number of business days between two dates and it skips the (static) holidays
+ * @param string $startDate Date (YYYY-MM-DD) to start counting from (included)
+ * @param string $endDate Date (YYYY-MM-DD) to end counting (included)
+ * @param array $dynamic_holidays Optional. Static holidays that have the same date every year are included automatically.
+ * You can give an array with dates (YYYY-MM-DD) that should be included furthermore
+ * @return integer Number of working days between $startDate and $endDate
+ */
+function getWorkingDays($startDate, $endDate, $dynamic_holidays = array())
+{
+ //Get year of $startDate
+ $startYear = substr($startDate, 0, 4);
+ //Get year of $endDate
+ $endYear = substr($endDate, 0, 4);
+
+ $datediff = $endYear - $startYear;
+ $austrian_holidays = array();
+ for ($i = 0; $i <= $datediff; $i++)
+ {
+ $austrian_holidays[] = $startYear.'-01-01'; // Neujahr
+ $austrian_holidays[] = $startYear.'-01-06'; // 3 Könige
+ $austrian_holidays[] = $startYear.'-05-01'; // Staatsfeiertag
+ $austrian_holidays[] = $startYear.'-08-15'; // Maria Himmelfahrt
+ $austrian_holidays[] = $startYear.'-10-26'; // Nationalfeiertag
+ $austrian_holidays[] = $startYear.'-11-01'; // Allerheiligen
+ $austrian_holidays[] = $startYear.'-12-08'; // Maria Empfängnis
+ $austrian_holidays[] = $startYear.'-12-25'; // Weihnachten
+ $austrian_holidays[] = $startYear.'-12-26'; // Stefanitag
+ $startYear++;
+ }
+ if (count($dynamic_holidays) > 0)
+ {
+ $austrian_holidays = array_merge($austrian_holidays, $dynamic_holidays);
+ }
+ // do strtotime calculations just once
+ $endDate = strtotime($endDate);
+ $startDate = strtotime($startDate);
+
+ //The total number of days between the two dates. We compute the no. of seconds and divide it to 60*60*24
+ //We add one to inlude both dates in the interval.
+ $days = ($endDate - $startDate) / 86400 + 1;
+
+ $no_full_weeks = floor($days / 7);
+ $no_remaining_days = fmod($days, 7);
+
+ //It will return 1 if it's Monday,.. ,7 for Sunday
+ $the_first_day_of_week = date("N", $startDate);
+ $the_last_day_of_week = date("N", $endDate);
+
+ //---->The two can be equal in leap years when february has 29 days, the equal sign is added here
+ //In the first case the whole interval is within a week, in the second case the interval falls in two weeks.
+ if ($the_first_day_of_week <= $the_last_day_of_week)
+ {
+ if ($the_first_day_of_week <= 6 && 6 <= $the_last_day_of_week) $no_remaining_days--;
+ if ($the_first_day_of_week <= 7 && 7 <= $the_last_day_of_week) $no_remaining_days--;
+ }
+ else {
+ // (edit by Tokes to fix an edge case where the start day was a Sunday
+ // and the end day was NOT a Saturday)
+
+ // the day of the week for start is later than the day of the week for end
+ if ($the_first_day_of_week == 7) {
+ // if the start date is a Sunday, then we definitely subtract 1 day
+ $no_remaining_days--;
+
+ if ($the_last_day_of_week == 6) {
+ // if the end date is a Saturday, then we subtract another day
+ $no_remaining_days--;
+ }
+ }
+ else {
+ // the start date was a Saturday (or earlier), and the end date was (Mon..Fri)
+ // so we skip an entire weekend and subtract 2 days
+ $no_remaining_days -= 2;
+ }
+ }
+
+ //The no. of business days is: (number of weeks between the two dates) * (5 working days) + the remainder
+ //---->february in none leap years gave a remainder of 0 but still calculated weekends between first and last day, this is one way to fix it
+ $workingDays = $no_full_weeks * 5;
+ if ($no_remaining_days > 0 )
+ {
+ $workingDays += $no_remaining_days;
+ }
+
+ //We subtract the holidays
+ foreach($austrian_holidays as $key=>$value)
+ {
+ $time_stamp=strtotime($value);
+ //If the holiday doesn't fall in weekend
+ if ($startDate <= $time_stamp && $time_stamp <= $endDate && date("N",$time_stamp) != 6 && date("N",$time_stamp) != 7)
+ $workingDays--;
+ }
+
+ return $workingDays;
+}
\ No newline at end of file
diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php
index 6e311897f..204b17f11 100644
--- a/application/helpers/hlp_sancho_helper.php
+++ b/application/helpers/hlp_sancho_helper.php
@@ -29,7 +29,7 @@ const DEFAULT_SANCHO_FOOTER_IMG = 'sancho_footer_DEFAULT.jpg';
/**
* Send single Mail with Sancho Design and Layout.
* @param string $vorlage_kurzbz Name of the template for specific mail content.
- * @param array $vorlage_data Associative array with specific mail content varibales
+ * @param array $vorlage_data Associative array with specific mail content variables
* to be replaced in the content template.
* @param string $to Email-adress.
* @param string $subject Subject of mail.
diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php
index 89ab2623d..4a9b23ec9 100644
--- a/application/models/crm/Prestudent_model.php
+++ b/application/models/crm/Prestudent_model.php
@@ -204,8 +204,8 @@ class Prestudent_model extends DB_Model
$this->addJoin('bis.tbl_nation zgvmanat', 'zgvmanation = zgvmanat.nation_code', 'LEFT');
$prestudent = $this->load($prestudent_id);
- if($prestudent->error)
- return error($prestudent->retval);
+ if (!hasData($prestudent))
+ return error('prestudent could not be loaded');
//Prestudentstatus
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
@@ -225,6 +225,7 @@ class Prestudent_model extends DB_Model
if (count($studienordnung->retval) > 0)
{
+ $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;
@@ -233,6 +234,7 @@ class Prestudent_model extends DB_Model
//get Sprache
$this->load->model('system/sprache_model', 'SpracheModel');
+ $this->SpracheModel->addSelect('sprache, locale, bezeichnung');
$language = $this->SpracheModel->load($lastStatus->retval[0]->sprache);
if ($language->error)
diff --git a/application/models/crm/Reihungstest_model.php b/application/models/crm/Reihungstest_model.php
index 9614c2e38..d0efb8bc8 100644
--- a/application/models/crm/Reihungstest_model.php
+++ b/application/models/crm/Reihungstest_model.php
@@ -224,4 +224,270 @@ class Reihungstest_model extends DB_Model
return $this->execQuery($query);
}
+
+ /**
+ * Checks if a registration date (Anmeldefrist) of a placement test has been reached yesterday.
+ * @param integer $studiengang_kz Optional. Kennzahl of degree program whose registration date should be checked.
+ * @return array Returns object array with reihungstest_ids whose registration date has been reached yesterday.
+ */
+ public function checkReachedRegistrationDate($studiengang_kz = null)
+ {
+ $query = '
+ SELECT *
+ FROM PUBLIC.tbl_reihungstest
+ WHERE anmeldefrist = (
+ SELECT CURRENT_DATE - 1
+ )
+ ';
+
+ $parametersArray = array();
+
+ if (!isEmptyString($studiengang_kz))
+ {
+ $query .= ' AND studiengang_kz = ?';
+ array_push($parametersArray, $studiengang_kz);
+ }
+
+ return $this->execQuery($query, $parametersArray);
+ }
+
+ /**
+ * Loads all applicants of a placement test for runZentraleReihungstestAnmeldefristAssistenzJob
+ * @param integer $reihungstest_id ID of placement test
+ * @return array Returns object array with data of applicants.
+ */
+ public function getApplicantsOfPlacementTestForCronjob($reihungstest_id)
+ {
+ $query = '
+ SELECT tbl_rt_person.person_id,
+ ps.prestudent_id,
+ tbl_studienplan.orgform_kurzbz,
+ tbl_prestudentstatus.studienplan_id,
+ tbl_prestudentstatus.ausbildungssemester,
+ nachname,
+ vorname,
+ tbl_zgv.zgv_kurzbz,
+ ps.studiengang_kz,
+ CASE WHEN tbl_prestudentstatus.statusgrund_id=9
+ THEN \'Ja\'
+ ELSE \'Nein\'
+ END AS "qualifikationskurs",
+ (
+ SELECT count(*) AS prio_relativ
+ FROM (
+ SELECT *,
+ (
+ SELECT status_kurzbz
+ FROM PUBLIC.tbl_prestudentstatus
+ WHERE prestudent_id = pst.prestudent_id
+ ORDER BY datum DESC,
+ tbl_prestudentstatus.insertamum DESC LIMIT 1
+ ) AS laststatus
+ FROM PUBLIC.tbl_prestudent pst
+ JOIN PUBLIC.tbl_prestudentstatus USING (prestudent_id)
+ WHERE person_id = (
+ SELECT person_id
+ FROM PUBLIC.tbl_prestudent
+ WHERE prestudent_id = ps.prestudent_id
+ )
+ AND studiensemester_kurzbz = (
+ SELECT studiensemester_kurzbz
+ FROM PUBLIC.tbl_prestudentstatus
+ WHERE prestudent_id = ps.prestudent_id
+ AND status_kurzbz = \'Interessent\' LIMIT 1
+ )
+ AND status_kurzbz = \'Interessent\'
+ ) prest
+ WHERE laststatus NOT IN (\'Abbrecher\', \'Abgewiesener\', \'Absolvent\')
+ AND priorisierung <= (
+ SELECT priorisierung
+ FROM PUBLIC.tbl_prestudent
+ WHERE prestudent_id = ps.prestudent_id
+ )
+ ) AS "prioritaet",
+ (
+ SELECT kontakt
+ FROM PUBLIC.tbl_kontakt
+ WHERE kontakttyp = \'email\'
+ AND zustellung = true
+ AND person_id = tbl_rt_person.person_id
+ ORDER BY insertamum DESC,
+ updateamum DESC LIMIT 1
+ ) AS "email"
+ FROM PUBLIC.tbl_rt_person
+ JOIN PUBLIC.tbl_person ON (tbl_rt_person.person_id = tbl_person.person_id)
+ JOIN PUBLIC.tbl_reihungstest rt ON (rt_id = reihungstest_id)
+ JOIN PUBLIC.tbl_prestudent ps ON (ps.person_id = tbl_rt_person.person_id)
+ JOIN PUBLIC.tbl_prestudentstatus USING (prestudent_id)
+ JOIN lehre.tbl_studienplan ON (tbl_prestudentstatus.studienplan_id = tbl_studienplan.studienplan_id)
+ LEFT JOIN bis.tbl_zgv ON (ps.zgv_code = tbl_zgv.zgv_code)
+ WHERE rt_id = ?
+ AND get_rolle_prestudent(prestudent_id, rt.studiensemester_kurzbz) = \'Interessent\'
+ AND tbl_prestudentstatus.studiensemester_kurzbz = rt.studiensemester_kurzbz
+ AND bewerbung_abgeschicktamum IS NOT NULL
+ AND bestaetigtam IS NOT NULL
+ ORDER BY studiengang_kz,
+ orgform_kurzbz,
+ prioritaet,
+ nachname,
+ vorname,
+ person_id
+ ';
+
+ return $this->execQuery($query, array($reihungstest_id));
+ }
+
+ /**
+ * Checks if an Applicant was assigned to a plament test after Anmeldefrist and before Test-Date
+ * @param integer $studiengang_kz Kennzahl of degree program those tests should be checked
+ * @return array Returns object array with data of applicants.
+ */
+ public function getApplicantAssignedAfterDate($studiengang_kz)
+ {
+ $query = '
+ SELECT tbl_rt_person.person_id,
+ ps.prestudent_id,
+ rt.datum,
+ rt.uhrzeit,
+ tbl_studienplan.orgform_kurzbz,
+ tbl_prestudentstatus.studienplan_id,
+ tbl_prestudentstatus.ausbildungssemester,
+ nachname,
+ vorname,
+ tbl_zgv.zgv_kurzbz,
+ ps.studiengang_kz,
+ CASE WHEN tbl_prestudentstatus.statusgrund_id=9
+ THEN \'Ja\'
+ ELSE \'Nein\'
+ END AS "qualifikationskurs",
+ (
+ SELECT count(*) AS prio_relativ
+ FROM (
+ SELECT *,
+ (
+ SELECT status_kurzbz
+ FROM PUBLIC.tbl_prestudentstatus
+ WHERE prestudent_id = pst.prestudent_id
+ ORDER BY datum DESC,
+ tbl_prestudentstatus.insertamum DESC LIMIT 1
+ ) AS laststatus
+ FROM PUBLIC.tbl_prestudent pst
+ JOIN PUBLIC.tbl_prestudentstatus USING (prestudent_id)
+ WHERE person_id = (
+ SELECT person_id
+ FROM PUBLIC.tbl_prestudent
+ WHERE prestudent_id = ps.prestudent_id
+ )
+ AND studiensemester_kurzbz = (
+ SELECT studiensemester_kurzbz
+ FROM PUBLIC.tbl_prestudentstatus
+ WHERE prestudent_id = ps.prestudent_id
+ AND status_kurzbz = \'Interessent\' LIMIT 1
+ )
+ AND status_kurzbz = \'Interessent\'
+ ) prest
+ WHERE laststatus NOT IN (\'Abbrecher\', \'Abgewiesener\', \'Absolvent\')
+ AND priorisierung <= (
+ SELECT priorisierung
+ FROM PUBLIC.tbl_prestudent
+ WHERE prestudent_id = ps.prestudent_id
+ )
+ ) AS "prioritaet",
+ (
+ SELECT kontakt
+ FROM PUBLIC.tbl_kontakt
+ WHERE kontakttyp = \'email\'
+ AND zustellung = true
+ AND person_id = tbl_rt_person.person_id
+ ORDER BY insertamum DESC,
+ updateamum DESC LIMIT 1
+ ) AS "email"
+ FROM PUBLIC.tbl_rt_person
+ JOIN PUBLIC.tbl_person ON (tbl_rt_person.person_id = tbl_person.person_id)
+ JOIN PUBLIC.tbl_reihungstest rt ON (rt_id = reihungstest_id)
+ JOIN PUBLIC.tbl_prestudent ps ON (ps.person_id = tbl_rt_person.person_id)
+ JOIN PUBLIC.tbl_prestudentstatus USING (prestudent_id)
+ JOIN lehre.tbl_studienplan ON (tbl_prestudentstatus.studienplan_id = tbl_studienplan.studienplan_id)
+ LEFT JOIN bis.tbl_zgv ON (ps.zgv_code = tbl_zgv.zgv_code)
+ WHERE rt.studiengang_kz = ?
+ AND get_rolle_prestudent(prestudent_id, rt.studiensemester_kurzbz) = \'Interessent\'
+ AND tbl_prestudentstatus.studiensemester_kurzbz = rt.studiensemester_kurzbz
+ AND bewerbung_abgeschicktamum IS NOT NULL
+ AND bestaetigtam IS NOT NULL
+ AND anmeldefrist < (SELECT CURRENT_DATE)
+ AND rt.datum > (SELECT CURRENT_DATE)
+ --AND tbl_rt_person.insertamum > anmeldefrist
+ --AND tbl_rt_person.insertamum < rt.datum
+ AND tbl_rt_person.insertamum::date = (SELECT CURRENT_DATE -1)
+ ORDER BY studiengang_kz,
+ orgform_kurzbz,
+ prioritaet,
+ nachname,
+ vorname,
+ person_id
+ ';
+
+ return $this->execQuery($query, array($studiengang_kz));
+ }
+
+ /**
+ * Loads all applicants of a placement test
+ * @param integer $reihungstest_id ID of placement test
+ * @return array Returns object array with data of applicants.
+ */
+ public function getApplicantsOfPlacementTest($reihungstest_id)
+ {
+ $query = '
+ SELECT DISTINCT tbl_rt_person.person_id,
+ anrede,
+ nachname,
+ vorname,
+ (
+ SELECT kontakt
+ FROM PUBLIC.tbl_kontakt
+ WHERE kontakttyp = \'email\'
+ AND zustellung = true
+ AND person_id = tbl_rt_person.person_id
+ ORDER BY insertamum DESC,
+ updateamum DESC LIMIT 1
+ ) AS "email",
+ tbl_ort.planbezeichnung,
+ tbl_ort.lageplan
+ FROM PUBLIC.tbl_rt_person
+ JOIN PUBLIC.tbl_person ON (tbl_rt_person.person_id = tbl_person.person_id)
+ JOIN PUBLIC.tbl_reihungstest rt ON (rt_id = reihungstest_id)
+ JOIN PUBLIC.tbl_prestudent ps ON (ps.person_id = tbl_rt_person.person_id)
+ JOIN PUBLIC.tbl_prestudentstatus USING (prestudent_id)
+ LEFT JOIN bis.tbl_zgv ON (ps.zgv_code = tbl_zgv.zgv_code)
+ LEFT JOIN PUBLIC.tbl_ort ON (tbl_rt_person.ort_kurzbz = tbl_ort.ort_kurzbz)
+ WHERE rt_id = ?
+ AND get_rolle_prestudent(prestudent_id, rt.studiensemester_kurzbz) = \'Interessent\'
+ AND tbl_prestudentstatus.studiensemester_kurzbz = rt.studiensemester_kurzbz
+ AND bewerbung_abgeschicktamum IS NOT NULL
+ AND bestaetigtam IS NOT NULL
+ ORDER BY nachname,
+ vorname,
+ person_id
+ ';
+
+ return $this->execQuery($query, array($reihungstest_id));
+ }
+
+ /**
+ * Loads all placement tests of the given day and optional degree program
+ * @param string $date Date of the tests to be loaded (YYYY-MM-DD)
+ * @param integer $studiengang_kz Optional. Kennzahl of degree program to load
+ * @return array Returns object array with data of applicants.
+ */
+ public function getTestsOnDate($date, $studiengang_kz = null)
+ {
+ $query = '
+ SELECT *
+ FROM PUBLIC.tbl_reihungstest
+ WHERE datum = ?
+ AND studiengang_kz = ?
+ ';
+
+ return $this->execQuery($query, array($date, $studiengang_kz));
+ }
}
\ No newline at end of file
diff --git a/application/models/education/Lehreinheitgruppe_model.php b/application/models/education/Lehreinheitgruppe_model.php
index cfd59f937..8390d41c5 100644
--- a/application/models/education/Lehreinheitgruppe_model.php
+++ b/application/models/education/Lehreinheitgruppe_model.php
@@ -11,4 +11,14 @@ class Lehreinheitgruppe_model extends DB_Model
$this->dbTable = 'lehre.tbl_lehreinheitgruppe';
$this->pk = 'lehreinheitgruppe_id';
}
+
+ public function getDirectGroup($lehreinheit_id)
+ {
+ $this->addJoin('public.tbl_gruppe', 'gruppe_kurzbz');
+ return $this->loadWhere(array(
+ 'tbl_gruppe.direktinskription' => true,
+ 'lehreinheit_id' => $lehreinheit_id
+ )
+ );
+ }
}
diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php
index 78c81836f..1c9c6e944 100644
--- a/application/models/organisation/Studiengang_model.php
+++ b/application/models/organisation/Studiengang_model.php
@@ -429,4 +429,23 @@ class Studiengang_model extends DB_Model
return $this->execQuery($query, array($studiensemester_kurzbz));
}
+
+ /**
+ * Loads degree programs of the given type
+ * @param string $typ Type of degree programs to be loaded
+ * @return array
+ */
+ public function loadStudiengaengeFromTyp($typ)
+ {
+ $query = "SELECT
+ distinct tbl_studiengang.*
+ FROM
+ public.tbl_studiengang
+ WHERE
+ tbl_studiengang.typ=?
+ ORDER BY
+ kurzbz";
+
+ return $this->execQuery($query, array($typ));
+ }
}
diff --git a/application/models/organisation/Studiensemester_model.php b/application/models/organisation/Studiensemester_model.php
index ff48708dd..9248b241d 100644
--- a/application/models/organisation/Studiensemester_model.php
+++ b/application/models/organisation/Studiensemester_model.php
@@ -109,7 +109,7 @@ class Studiensemester_model extends DB_Model
*/
public function getAusbildungssemesterByStudiensemesterAndStudiengang($studiensemester_kurzbz, $studiengang_kz)
{
- $query = "SELECT DISTINCT semester
+ $query = "SELECT DISTINCT semester
FROM lehre.tbl_studienplan
JOIN lehre.tbl_studienordnung USING(studienordnung_id)
JOIN lehre.tbl_studienplan_semester USING(studienplan_id)
@@ -131,9 +131,9 @@ class Studiensemester_model extends DB_Model
if (date_format(date_create($from), 'Y-m-d') > (date_format(date_create($to), 'Y-m-d')))
return success(array());
- $query = "SELECT *
+ $query = "SELECT *
FROM public.tbl_studiensemester
- WHERE
+ WHERE
(ende > ?::date AND start < ?::date)
OR start = ?::date
OR ende = ?::date
@@ -141,4 +141,19 @@ class Studiensemester_model extends DB_Model
return $this->execQuery($query, array($from, $to, $from, $to));
}
+
+ /**
+ * Liefert das Studiensemester das aktuell am naehesten zu $studiensemester_kurzbz liegt
+ *
+ * @param $studiensemester_kurzbz
+ * @return array | null
+ */
+ public function getNearestFrom($studiensemester_kurzbz)
+ {
+ $query = "SELECT studiensemester_kurzbz, start, ende FROM public.vw_studiensemester
+ WHERE studiensemester_kurzbz <> ?
+ ORDER BY delta LIMIT 1";
+
+ return $this->execQuery($query, array($studiensemester_kurzbz));
+ }
}
diff --git a/application/models/ressource/Stundenplandev_model.php b/application/models/ressource/Stundenplandev_model.php
index 9d737e3ec..9fa92ae5e 100644
--- a/application/models/ressource/Stundenplandev_model.php
+++ b/application/models/ressource/Stundenplandev_model.php
@@ -11,4 +11,54 @@ class Stundenplandev_model extends DB_Model
$this->dbTable = 'lehre.tbl_stundenplandev';
$this->pk = 'stundenplandev_id';
}
+
+ public function getMissingDirectGroups($studiensemester_kurzbz = null)
+ {
+ $qry = "
+ SELECT
+ distinct lehreinheit_id, datum, stunde, mitarbeiter_uid, ort_kurzbz
+ FROM
+ lehre.tbl_stundenplandev stpl
+ WHERE
+ lehreinheit_id IN(
+ SELECT
+ lehreinheit_id
+ FROM
+ lehre.tbl_lehreinheit
+ JOIN lehre.tbl_lehreinheitgruppe USING(lehreinheit_id)
+ JOIN public.tbl_gruppe USING(gruppe_kurzbz)
+ WHERE
+ tbl_gruppe.direktinskription = true
+ ";
+
+ $parametersArray = array();
+
+ if (!is_null($studiensemester_kurzbz))
+ {
+ $parametersArray[] = $studiensemester_kurzbz;
+ $qry .= ' AND tbl_lehreinheit.studiensemester_kurzbz = ?';
+ }
+ $qry .= ")
+ AND NOT EXISTS(
+ SELECT
+ 1
+ FROM
+ lehre.tbl_stundenplandev
+ WHERE
+ datum=stpl.datum
+ AND stunde=stpl.stunde
+ AND lehreinheit_id=stpl.lehreinheit_id
+ AND gruppe_kurzbz=(SELECT
+ gruppe_kurzbz
+ FROM
+ lehre.tbl_lehreinheitgruppe
+ JOIN public.tbl_gruppe USING(gruppe_kurzbz)
+ WHERE
+ lehreinheit_id=stpl.lehreinheit_id
+ AND tbl_gruppe.direktinskription = true
+ )
+ )";
+
+ return $this->execQuery($qry, $parametersArray);
+ }
}
diff --git a/application/views/home.php b/application/views/home.php
index 598413c32..d00b98f81 100644
--- a/application/views/home.php
+++ b/application/views/home.php
@@ -7,6 +7,7 @@ $this->load->view('templates/FHC-Header',
'fontawesome' => true,
'sbadmintemplate' => true,
'ajaxlib' => true,
+ 'addons' => true,
'navigationwidget' => true
)
);
@@ -23,102 +24,8 @@ $this->load->view('templates/FHC-Header',