diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 4662fbc40..f16c4472e 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -74,6 +74,7 @@ class InfoCenter extends Auth_Controller 'saveFormalGeprueft' => 'infocenter:rw', 'getLastPrestudentWithZgvJson' => 'infocenter:r', 'getZgvInfoForPrestudent' => 'infocenter:r', + 'saveBewPriorisierung' => 'infocenter:rw', 'saveZgvPruefung' => 'infocenter:rw', 'saveAbsage' => 'infocenter:rw', 'saveFreigabe' => 'infocenter:rw', @@ -81,6 +82,7 @@ class InfoCenter extends Auth_Controller 'updateNotiz' => 'infocenter:rw', 'reloadNotizen' => 'infocenter:r', 'reloadLogs' => 'infocenter:r', + 'reloadZgvPruefungen' => 'infocenter:r', 'outputAkteContent' => 'infocenter:r', 'getParkedDate' => 'infocenter:r', 'park' => 'infocenter:rw', @@ -280,6 +282,22 @@ class InfoCenter extends Auth_Controller $this->load->view('system/infocenter/studiengangZgvInfo.php', $data); } + /** + * Saves application priority for a prestudent + */ + public function saveBewPriorisierung() + { + $prestudent_id = $this->input->post('prestudentid'); + $change = $this->input->post('change'); + + if (!is_numeric($change) || !is_numeric($prestudent_id)) + $result = error('Parameteres missing'); + else + $result = $this->PrestudentModel->changePrio($prestudent_id, intval($change)); + + $this->output->set_content_type('application/json')->set_output(json_encode($result)); + } + /** * Saves a ZGV for a prestudent, includes Ort, Datum, Nation for bachelor and master * @param $prestudent_id @@ -543,6 +561,19 @@ class InfoCenter extends Auth_Controller $this->load->view('system/infocenter/logs.php', array('logs' => $logs)); } + /** + * Loads Zgv Prüfung view for a person, helper for reloading after ajax request + * @param $person_id + */ + public function reloadZgvPruefungen($person_id) + { + $prestudentdata = $this->_loadPrestudentData($person_id); + + $prestudentdata[self::FHC_CONTROLLER_ID] = $this->getControllerId(); + + $this->load->view('system/infocenter/zgvpruefungen.php', $prestudentdata); + } + /** * Outputs content of an Akte, sends appropriate headers (so the document can be downloaded) * @param $akte_id @@ -1058,6 +1089,8 @@ class InfoCenter extends Auth_Controller show_error($prestudenten->retval); } + $interessentenCount = array(); + foreach ($prestudenten->retval as $prestudent) { $prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent->prestudent_id); @@ -1079,43 +1112,121 @@ class InfoCenter extends Auth_Controller //if prestudent is not interessent or is already bestaetigt, then show only as information, non-editable $zgvpruefung->infoonly = !isset($zgvpruefung->prestudentstatus) || isset($zgvpruefung->prestudentstatus->bestaetigtam) || $zgvpruefung->prestudentstatus->status_kurzbz != 'Interessent'; + //numeric application priority and arrows for changing + $zgvpruefung->changeup = false; + $zgvpruefung->changedown = false; + + if (isset($zgvpruefung->prestudentstatus->status_kurzbz) && $zgvpruefung->prestudentstatus->status_kurzbz == 'Interessent') + { + 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 (array_key_exists($studiensemester, $interessentenCount)) + $interessentenCount[$studiensemester]++; + else + $interessentenCount[$studiensemester] = 1; + } + } + $zgvpruefungen[] = $zgvpruefung; } - // Interessenten come first, otherwise by bewerbungsdatum desc, then by prestudent_id desc - usort($zgvpruefungen, function ($a, $b) { - $bewdatesort = isset($a->prestudentstatus) && isset($b->prestudentstatus) ? strcmp($b->prestudentstatus->bewerbung_abgeschicktamum, $a->prestudentstatus->bewerbung_abgeschicktamum) : 0; - $defaultsort = $bewdatesort === 0 ? (int)$b->prestudent_id - (int)$a->prestudent_id : $bewdatesort; - if (!isset($a->prestudentstatus->status_kurzbz) || !isset($b->prestudentstatus->status_kurzbz)) - return $defaultsort; - elseif ($a->prestudentstatus->status_kurzbz === 'Interessent' && $b->prestudentstatus->status_kurzbz === 'Interessent') - { - //infoonly Interessenten come after new Interessenten - if ($a->infoonly === $b->infoonly) - return $defaultsort; - elseif ($a->infoonly) - return 1; - elseif ($b->infoonly) - return -1; - } - elseif ($a->prestudentstatus->status_kurzbz === 'Interessent') - return -1; - elseif ($b->prestudentstatus->status_kurzbz === 'Interessent') - return 1; - else - return $defaultsort; - }); + $this->load->model('organisation/studiensemester_model', 'StudiensemesterModel'); + + $this->_sortPrestudents($zgvpruefungen); $statusgruende = $this->StatusgrundModel->loadWhere(array('status_kurzbz' => 'Abgewiesener'))->retval; $data = array ( 'zgvpruefungen' => $zgvpruefungen, + 'numberinteressenten' => $interessentenCount, 'statusgruende' => $statusgruende ); return $data; } + /** + * Helper function for sorting prestudents + * @param $zgvpruefungen + */ + private function _sortPrestudents(&$zgvpruefungen) + { + usort($zgvpruefungen, function ($a, $b) { + //sort: + // 1: Studiensemester + if (isset($a->prestudentstatus->studiensemester_kurzbz) || isset($b->prestudentstatus->studiensemester_kurzbz)) + { + if (!isset($a->prestudentstatus->studiensemester_kurzbz)) + return 1; + elseif(!isset($b->prestudentstatus->studiensemester_kurzbz)) + return -1; + + $starta = $this->StudiensemesterModel->load($a->prestudentstatus->studiensemester_kurzbz); + if (!hasData($starta)) + { + show_error($starta->retval); + } + + $startb = $this->StudiensemesterModel->load($b->prestudentstatus->studiensemester_kurzbz); + if (!hasData($startb)) + { + show_error($startb->retval); + } + + $starta = date_format(date_create($starta->retval[0]->start), 'Y-m-d'); + $startb = date_format(date_create($startb->retval[0]->start), 'Y-m-d'); + + if ($starta > $startb) + return -1; + elseif ($starta < $startb) + return 1; + } + // 2: Status + if ($a->prestudentstatus->status_kurzbz !== $b->prestudentstatus->status_kurzbz) + { + if ($a->prestudentstatus->status_kurzbz === 'Interessent') + return -1; + elseif ($b->prestudentstatus->status_kurzbz === 'Interessent') + return 1; + } + + // 3: Priorisierung, Nulls last + if (isset($a->priorisierung) || isset($b->priorisierung)) + { + if (!isset($a->priorisierung)) + return 1; + elseif (!isset($b->priorisierung)) + return -1; + elseif ($a->priorisierung > $b->priorisierung) + return 1; + elseif ($a->priorisierung < $b->priorisierung) + return -1; + } + + // 4: Bewerbungsdatum + $starta = isset($a->prestudentstatus->bewerbung_abgeschicktamum) ? $a->prestudentstatus->bewerbung_abgeschicktamum : null; + $startb = isset($b->prestudentstatus->bewerbung_abgeschicktamum) ? $b->prestudentstatus->bewerbung_abgeschicktamum : null; + + if (isset($starta) || isset($startb)) + { + if (!isset($starta)) + return 1; + elseif(!isset($startb)) + return -1; + elseif ($starta > $startb) + return -1; + elseif ($starta < $startb) + return 1; + } + + // 5: prestudentid + return (int)$b->prestudent_id - (int)$a->prestudent_id; + }); + } + /** * Helper function for redirecting to initial page for person from a prestudent-specific page * @param $prestudent_id diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index 4cfe08e9a..55215744e 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -278,4 +278,229 @@ class Prestudent_model extends DB_Model return $this->execQuery($qry, $parametersArray); } + + /** + * Returns a list with Bewerber (applicants) + * @param $person_id person who sent application(s) + * @param string $studiensemester_kurzbz + * @param bool $abgeschickt optional, wether application was filled out and sent + * @param bool $bestaetigt optional, wether application was confirmed by infocenter + * @return array with Bewerber + */ + public function getBewerber($person_id, $studiensemester_kurzbz = null, $abgeschickt = null, $bestaetigt = null) + { + $bewerber = array(); + $prestudents = $this->loadWhere(array('person_id' => $person_id)); + + if (!hasData($prestudents)) + return $bewerber; + + $this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel'); + + foreach ($prestudents->retval as $prestudent) + { + $lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent->prestudent_id, $studiensemester_kurzbz); + + if (!hasData($lastStatus)) + continue; + + $lastStatus = $lastStatus->retval[0]; + + if ($lastStatus->status_kurzbz !== 'Interessent') + continue; + + $bewerbung_abgeschicktamum = $lastStatus->bewerbung_abgeschicktamum; + $bestaetigtam = $lastStatus->bestaetigtam; + + $abgeschicktcond = true; + if (($abgeschickt === false && isset($bewerbung_abgeschicktamum)) || ($abgeschickt === true && !isset($bewerbung_abgeschicktamum))) + $abgeschicktcond = false; + + $bestaetigtcond = true; + if (($bestaetigt === false && isset($bestaetigtam)) || ($bestaetigt === true && !isset($bestaetigtam))) + $bestaetigtcond = false; + + if ($bestaetigtcond && $abgeschicktcond) + { + $prestudent->lastStatus = $lastStatus; + $bewerber[] = $prestudent; + } + } + + return $bewerber; + } + + /** + * Checks if application priority can be changed for a prestudent + * @param $prestudent_id + * @param $studiensemester Semester in which Prestudent applied + * @param $change increase priority (< 0) or decrease priority (> 0) + * @return bool wether priority can be changed + */ + public function checkPrioChange($prestudent_id, $studiensemester, $change) + { + if (!is_numeric($change)) + return false; + + $this->addSelect('person_id, priorisierung'); + $prestudent = $this->load($prestudent_id); + + if (!hasData($prestudent)) + return false; + + $person_id = $prestudent->retval[0]->person_id; + + $bewerberarr = $this->getBewerber($person_id, $studiensemester); + + if (count($bewerberarr) <= 1) + return false; + + if (!isset($prestudent->retval[0]->priorisierung)) + { + if ($change < 0) + return true; //null values can be changed to priority numbers, when there are other bewerber + else + return false; + } + + $priomin = 0; + $priomax = PHP_INT_MAX; + $currprio = intval($prestudent->retval[0]->priorisierung); + + foreach ($bewerberarr as $bewerber) + { + if (is_numeric($bewerber->priorisierung)) + { + $bewprio = intval($bewerber->priorisierung); + if ($bewprio < $priomax) + $priomax = $bewprio; + + if ($bewprio > $priomin) + $priomin = $bewprio; + } + } + + if (($currprio === $priomax && $change < 0)|| ($currprio === $priomin && $change > 0)) + { + return false; + } + + return true; + } + + /** + * Changes application priority for a prestudent + * Swaps priorities with nearest neighbour (nearest bewerber/prestudent) + * for the same studiensemester in order to move priority up/down + * @param $prestudent_id + * @param $change increase priority (< 0) or decrease priority (> 0) + * @return bool wether change of priority was sucessfull + */ + public function changePrio($prestudent_id, $change) + { + $this->addSelect('person_id, priorisierung'); + $prestudent = $this->load($prestudent_id); + + if (!hasData($prestudent)) + return false; + + $this->load->model('prestudentstatus_model', 'PrestudentstatusModel'); + $lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id, null, 'Interessent'); + + if (!hasData($lastStatus)) + return false; + + $studiensemester_kurzbz = $lastStatus->retval[0]->studiensemester_kurzbz; + + if (!$this->checkPrioChange($prestudent_id, $studiensemester_kurzbz, $change)) + return false; + + $person_id = $prestudent->retval[0]->person_id; + $currprio = intval($prestudent->retval[0]->priorisierung); + + $difftonext = PHP_INT_MAX; + $neighbour = null; + + $bewerberarr = $this->getBewerber($person_id, $studiensemester_kurzbz ); + + foreach ($bewerberarr as $bewerber) + { + if (is_numeric($bewerber->priorisierung)) + { + $bewprio = intval($bewerber->priorisierung); + + $diff = 0; + if ($change < 0 && ($bewprio < $currprio || is_null($prestudent->retval[0]->priorisierung))) //prio up + { + $diff = $currprio - $bewprio; + } + elseif ($change > 0 && $bewprio > $currprio) + { + $diff = $bewprio - $currprio; + } + + if ($diff !== 0 && $diff < $difftonext) + { + $difftonext = $diff; + $neighbour = $bewerber; + } + } + } + + if (is_null($prestudent->retval[0]->priorisierung)) + { + //if null value before, add lowest prio + $newprio = isset($neighbour->priorisierung) ? intval($neighbour->priorisierung) + 1 : 1; + + $result = $this->PrestudentModel->update( + $prestudent_id, + array( + 'priorisierung' => $newprio + ) + ); + + if (isError($result)) + { + return false; + } + else + { + return true; + } + } + else + { + $this->db->trans_start(false); + //prio swap + $resultFirst = $this->PrestudentModel->update( + $prestudent_id, + array( + 'priorisierung' => intval($neighbour->priorisierung) + ) + ); + + + $resultSecond = $this->PrestudentModel->update( + $neighbour->prestudent_id, + array( + 'priorisierung' => $currprio + ) + ); + + // Transaction complete! + $this->db->trans_complete(); + + // Check if everything went ok during the transaction + if ($this->db->trans_status() === false || isError($resultFirst) || isError($resultSecond)) + { + $this->db->trans_rollback(); + return false; + } + else + { + $this->db->trans_commit(); + return true; + } + } + } } diff --git a/application/models/crm/Prestudentstatus_model.php b/application/models/crm/Prestudentstatus_model.php index db98ddff6..946fe4e14 100644 --- a/application/models/crm/Prestudentstatus_model.php +++ b/application/models/crm/Prestudentstatus_model.php @@ -37,10 +37,11 @@ class Prestudentstatus_model extends DB_Model array_push($parametersArray, $studiensemester_kurzbz); $query .= ' AND studiensemester_kurzbz = ?'; } + if ($status_kurzbz != '') { array_push($parametersArray, $status_kurzbz); - $query .= ' AND status_kurzbz = ?'; + $query .= ' AND tbl_prestudentstatus.status_kurzbz = ?'; } $query .= ' ORDER BY datum DESC, insertamum DESC, ext_id DESC LIMIT 1'; diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index 2fbfa7987..b4c30c2c5 100755 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -71,6 +71,8 @@  p->t('ui', 'freigeben')) ?> + +   @@ -118,7 +120,7 @@ p->t('infocenter', 'zgv').' - '.ucfirst($this->p->t('lehre', 'pruefung'))?> -
+
load->view('system/infocenter/zgvpruefungen.php'); ?>
diff --git a/application/views/system/infocenter/zgvpruefungen.php b/application/views/system/infocenter/zgvpruefungen.php index b68ac5310..abef7e0be 100644 --- a/application/views/system/infocenter/zgvpruefungen.php +++ b/application/views/system/infocenter/zgvpruefungen.php @@ -1,17 +1,30 @@
infoonly; + $studiensemester = isset($zgvpruefung->prestudentstatus->studiensemester_kurzbz) ? $zgvpruefung->prestudentstatus->studiensemester_kurzbz : ''; //set bootstrap columns for zgv form $columns = array(4, 3, 2, 3); $headercolumns = array(7, 5); if (!$infoonly && isset($zgvpruefung->prestudentstatus->bewerbungsnachfrist) && isset($zgvpruefung->prestudentstatus->bewerbungstermin)) { - $headercolumns[0] = 5; - $headercolumns[1] = 7; + $headercolumns[0] = 4; + $headercolumns[1] = 8; } + + if (!$first) + echo '
'; + + if (!in_array($studiensemester, $unique_studsemester)): + $unique_studsemester[] = $studiensemester; + + if (!$first) + echo '
'; ?> -
+

+
@@ -22,22 +35,33 @@ ?>
- prestudentstatus->status_kurzbz) && $zgvpruefung->prestudentstatus->status_kurzbz === 'Interessent'/* && !$infoonly*/): ?> +
+ prestudentstatus->status_kurzbz) && $zgvpruefung->prestudentstatus->status_kurzbz === 'Interessent'): ?> prestudentstatus->bestaetigtam)): ?> -
p->t('global', 'anStudiengangFreigegeben') ?> -
-
- p->t('infocenter','bewerbung')) . ' ' . $this->p->t('global','abgeschickt') . ': '.(isset($zgvpruefung->prestudentstatus->bewerbung_abgeschicktamum) ? '' : ''); ?> + p->t('infocenter', 'bewerbung')) . ' ' . $this->p->t('global', 'abgeschickt') . ': '.(isset($zgvpruefung->prestudentstatus->bewerbung_abgeschicktamum) ? '' : ''); ?> prestudentstatus->bewerbungsnachfrist) ? ' | ' . $this->p->t('infocenter', 'nachfrist') . ': ' . date_format(date_create($zgvpruefung->prestudentstatus->bewerbungsnachfrist), 'd.m.Y') : ''); ?> prestudentstatus->bewerbungstermin) ? ' | ' . $this->p->t('infocenter', 'bewerbungsfrist') . ': ' . date_format(date_create($zgvpruefung->prestudentstatus->bewerbungstermin), 'd.m.Y') : ''); ?> -
+ changeup) && $zgvpruefung->changeup === true; + $changedown = isset($zgvpruefung->changedown) && $zgvpruefung->changedown === true; + if ($numberinteressenten[$studiensemester] > 1): + echo ' | ' . ucfirst($this->p->t('infocenter', 'priorisierung')) . ': '; + echo isset($zgvpruefung->priorisierung) ? $zgvpruefung->priorisierung : $this->p->t('global', 'nichtvorhanden'); + if ($changeup): ?> + + + + + + +
- + prestudentstatus->status_kurzbz)) { @@ -60,8 +84,8 @@
- - prestudentstatus->studiensemester_kurzbz) ? $zgvpruefung->prestudentstatus->studiensemester_kurzbz : '' ?> + +
@@ -73,7 +97,7 @@
- + prestudentstatus->orgform)) ? ', ' : ''; @@ -114,7 +138,7 @@
- + zgvort); else: @@ -127,7 +151,7 @@
- + zgvdatum) ? "" : date_format(date_create($zgvpruefung->zgvdatum), 'd.m.Y'); if ($infoonly): @@ -143,7 +167,7 @@
- + zgvnation_bez; else @@ -173,7 +197,7 @@
- + zgvmaort; else: @@ -186,7 +210,7 @@
- + zgvmadatum) ? "" : date_format(date_create($zgvpruefung->zgvmadatum), 'd.m.Y'); if ($infoonly): @@ -201,7 +225,7 @@
-
+
zgvmanation_bez; @@ -374,5 +398,8 @@ ?>
- +
diff --git a/public/css/sbadmin2/admintemplate.css b/public/css/sbadmin2/admintemplate.css index a0064e5c2..dfa6e8962 100644 --- a/public/css/sbadmin2/admintemplate.css +++ b/public/css/sbadmin2/admintemplate.css @@ -7,7 +7,31 @@ border-bottom: 1px solid #eee; } -/*change of panel colors (grey) */ +.headerrightform +{ + margin: 28px 0 20px -30px; + padding: 6.4px 0 9px; + border-bottom: 1px solid #eee; +} + +.headerrightform .form-group{ + margin-bottom: 0; + margin-left: 5px; +} + +.headerrightform .form-control{ + height: 32px; + font-size: 13px; +} + +/*heading with colored background*/ +.headercolorbg { + background-color: #dfdfdf; + padding: 3px 0; + border-radius: 5px; +} + +/*change of panel colors (to grey) */ .panel-primary > .panel-heading, .panel-primary > .panel-collapse > .panel-footer, .panel-primary > .panel-footer{ color: black; background-color: #dfdfdf; diff --git a/public/js/bootstrapper.js b/public/js/bootstrapper.js index 290749c11..5d1749e9a 100644 --- a/public/js/bootstrapper.js +++ b/public/js/bootstrapper.js @@ -3,8 +3,14 @@ * NOTE: avoid using this if possible */ $(document).ready(function() { + Bootstrapper.bootstraphtml(); +}); + +var Bootstrapper = { + bootstraphtml: function () + { $("input[type=text], select").addClass("form-control"); $("button, input[type=button]").addClass("btn btn-default"); $("table").addClass("table-condensed"); } -); +}; \ No newline at end of file diff --git a/public/js/infocenter/infocenterDetails.js b/public/js/infocenter/infocenterDetails.js index 64377ae1c..1f81430a1 100644 --- a/public/js/infocenter/infocenterDetails.js +++ b/public/js/infocenter/infocenterDetails.js @@ -16,21 +16,13 @@ $(document).ready(function () InfocenterDetails._formatNotizTable(); InfocenterDetails._formatLogTable(); - //initialise datepicker - $.datepicker.setDefaults($.datepicker.regional['de']); - $(".dateinput").datepicker({ - "dateFormat": "dd.mm.yy" - }); - var personid = $("#hiddenpersonid").val(); //add submit event to message send link - $("#sendmsglink").click( - function () - { - $("#sendmsgform").submit(); - } - ); + $("#sendmsglink").click(function () + { + $("#sendmsgform").submit(); + }); //add click events to "formal geprüft" checkboxes $(".prchbox").click(function () @@ -41,60 +33,8 @@ $(document).ready(function () InfocenterDetails.saveFormalGeprueft(personid, akteid, checked) }); - //zgv übernehmen - $(".zgvUebernehmen").click(function () - { - var btn = $(this); - var prestudentid = this.id.substr(this.id.indexOf("_") + 1); - $('#zgvUebernehmenNotice').remove(); - InfocenterDetails.zgvUebernehmen(personid, prestudentid, btn) - }); - - //zgv speichern - $(".zgvform").on('submit', function (e) - { - e.preventDefault(); - var formdata = $(this).serializeArray(); - - var data = {}; - - for (var i = 0; i < formdata.length; i++) - { - data[formdata[i].name] = formdata[i].value; - } - - InfocenterDetails.saveZgv(data); - } - ); - - //show popup with zgvinfo - $(".zgvinfo").click(function () - { - var prestudentid = this.id.substr(this.id.indexOf("_") + 1); - InfocenterDetails.openZgvInfoForPrestudent(prestudentid); - } - ); - - //prevent opening modal when Statusgrund not chosen - $(".absageModal").on('show.bs.modal', function (e) - { - var id = this.id.substr(this.id.indexOf("_") + 1); - var statusgrvalue = $("#statusgrselect_" + id + " select[name=statusgrund]").val(); - if (statusgrvalue === "null") - { - $("#statusgrselect_" + id).addClass("has-error"); - return e.preventDefault(); - } - } - ); - - //remove red mark when statusgrund is selected again - $("select[name=statusgrund]").change( - function () - { - $(this).parent().removeClass("has-error"); - } - ); + //add click events to zgv Prüfung section + InfocenterDetails._addZgvPruefungEvents(personid); //save notiz $("#notizform").on("submit", function (e) @@ -203,6 +143,26 @@ var InfocenterDetails = { } ); }, + saveBewPriorisierung: function(data) + { + FHC_AjaxClient.ajaxCallPost( + CALLED_PATH + '/saveBewPriorisierung', + data, + { + successCallback: function(data, textStatus, jqXHR) { + if (data === true) + { + InfocenterDetails._refreshZgv(); + } + else + { + alert("error when saving zgv Prio"); + } + }, + veilTimeout: 0 + } + ); + }, zgvUebernehmen: function(personid, prestudentid, btn) { FHC_AjaxClient.ajaxCallGet( @@ -399,6 +359,117 @@ var InfocenterDetails = { // ----------------------------------------------------------------------------------------------------------------- // (private) methods executed after ajax (refreshers) + + //adds JQuery events to ZGVprüfung section + _addZgvPruefungEvents: function(personid) + { + //add bootstrap to forms + Bootstrapper.bootstraphtml(); + + //initialise datepicker + $.datepicker.setDefaults($.datepicker.regional['de']); + $(".dateinput").datepicker({ + "dateFormat": "dd.mm.yy" + }); + + //up/down prioritize Bewerbungen + $(".prioup").click(function () + { + var prestudentid = this.id.substr(this.id.indexOf("_") + 1); + InfocenterDetails._savePrio(prestudentid, -1); + }); + $(".priodown").click(function () + { + var prestudentid = this.id.substr(this.id.indexOf("_") + 1); + InfocenterDetails._savePrio(prestudentid, 1); + }); + + //zgv übernehmen + $(".zgvUebernehmen").click(function () + { + var btn = $(this); + var prestudentid = this.id.substr(this.id.indexOf("_") + 1); + $('#zgvUebernehmenNotice').remove(); + InfocenterDetails.zgvUebernehmen(personid, prestudentid, btn); + }); + + //zgv speichern + $(".zgvform").on('submit', function (e) + { + e.preventDefault(); + var formdata = $(this).serializeArray(); + + var data = {}; + + for (var i = 0; i < formdata.length; i++) + { + data[formdata[i].name] = formdata[i].value; + } + + InfocenterDetails.saveZgv(data); + } + ); + + //show popup with zgvinfo + $(".zgvinfo").click(function () + { + var prestudentid = this.id.substr(this.id.indexOf("_") + 1); + InfocenterDetails.openZgvInfoForPrestudent(prestudentid); + } + ); + + //prevent opening modal when Statusgrund not chosen + $(".absageModal").on('show.bs.modal', function (e) + { + var id = this.id.substr(this.id.indexOf("_") + 1); + var statusgrvalue = $("#statusgrselect_" + id + " select[name=statusgrund]").val(); + if (statusgrvalue === "null") + { + $("#statusgrselect_" + id).addClass("has-error"); + return e.preventDefault(); + } + } + ); + + //remove red mark when statusgrund is selected again + $("select[name=statusgrund]").change( + function () + { + $(this).parent().removeClass("has-error"); + } + ); + + }, + _refreshZgv: function() + { + var personid = $("#hiddenpersonid").val(); + + var collapsed = {}; + + //save if panel is collapsed to preserve collapse state + $("#zgvpruefungen").find(".panel-collapse").each( + function() + { + var collapseid = $(this).prop("id"); + collapsed[collapseid] = !$(this).hasClass('collapse in'); + } + ); + + $("#zgvpruefungen").load( + CONTROLLER_URL + '/reloadZgvPruefungen/' + personid + '?fhc_controller_id=' + FHC_AjaxClient.getUrlParameter('fhc_controller_id'), + function() + { + InfocenterDetails._addZgvPruefungEvents(personid); + for (var i in collapsed) + { + if (collapsed[i]) + $("#"+i).removeClass("in"); + else + $("#"+i).addClass("in"); + } + } + ); + }, _refreshLog: function() { var personid = $("#hiddenpersonid").val(); @@ -491,5 +562,13 @@ var InfocenterDetails = { _errorSaveNotiz: function() { $("#notizmsg").text(FHC_PhrasesLib.t('ui', 'fehlerBeimSpeichern')); + }, + _savePrio: function(prestudentid, change) + { + var data = { + "prestudentid": prestudentid, + "change": change + }; + InfocenterDetails.saveBewPriorisierung(data); } }; diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index ab29ee6e2..37cb8c46b 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -970,8 +970,28 @@ $phrases = array( ) ) ), - - + + array( + 'app' => 'core', + 'category' => 'global', + 'phrase' => 'nichtvorhanden', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'n.v.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'n/a', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + //******************************* CORE/ui array( 'app' => 'core', @@ -2755,6 +2775,26 @@ $phrases = array( ) ) ), + array( + 'app' => 'infocenter', + 'category' => 'infocenter', + 'phrase' => 'priorisierung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'prio', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'prio', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'global',