diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php
index 7fab61736..b63bae0ac 100644
--- a/application/controllers/system/infocenter/InfoCenter.php
+++ b/application/controllers/system/infocenter/InfoCenter.php
@@ -155,7 +155,7 @@ class InfoCenter extends FHC_Controller
}
/**
- * unlocks page from edit by a person, redirects to overview filter page
+ * Unlocks page from edit by a person, redirects to overview filter page
* @param $person_id
*/
public function unlockPerson($person_id)
@@ -169,7 +169,7 @@ class InfoCenter extends FHC_Controller
}
/**
- * Saves if a document has been formal geprueft. saves current timestamp if checked as geprueft, or null if not.
+ * Saves if a document has been formal geprueft. Saves current timestamp if checked as geprueft, or null if not.
* @param $person_id
*/
public function saveFormalGeprueft($person_id)
@@ -177,37 +177,36 @@ class InfoCenter extends FHC_Controller
$akte_id = $this->input->post('akte_id');
$formalgeprueft = $this->input->post('formal_geprueft');
- if (!isset($akte_id) || !isset($formalgeprueft) || !isset($person_id))
- show_error('Parameters not set!');
+ $json = false;
- $akte = $this->AkteModel->load($akte_id);
-
- if (isError($akte))
+ if (isset($akte_id) && isset($formalgeprueft) && isset($person_id))
{
- show_error($akte->retval);
+ $akte = $this->AkteModel->load($akte_id);
+
+ if (hasData($akte))
+ {
+ $timestamp = ($formalgeprueft === 'true') ? date('Y-m-d H:i:s') : null;
+ $result = $this->AkteModel->update($akte_id, array('formal_geprueft_amum' => $timestamp));
+
+ if (isSuccess($result))
+ {
+ $json = $timestamp;
+
+ $this->_log(
+ $person_id,
+ 'saveformalgep',
+ array(
+ empty($akte->retval[0]->titel) ? $akte->retval[0]->bezeichnung : $akte->retval[0]->titel,
+ is_null($timestamp) ? 'NULL' : $timestamp
+ )
+ );
+ }
+ }
}
- $timestamp = ($formalgeprueft === 'true') ? date('Y-m-d H:i:s') : null;
- $result = $this->AkteModel->update($akte_id, array('formal_geprueft_amum' => $timestamp));
-
- if (isError($result))
- {
- show_error($result->retval);
- }
-
- //write person log
- $this->_log(
- $person_id,
- 'saveformalgep',
- array(
- empty($akte->retval[0]->titel) ? $akte->retval[0]->bezeichnung : $akte->retval[0]->titel,
- is_null($timestamp) ? 'NULL' : $timestamp
- )
- );
-
$this->output
->set_content_type('application/json')
- ->set_output(json_encode($timestamp));
+ ->set_output(json_encode($json));
}
/**
@@ -218,20 +217,13 @@ class InfoCenter extends FHC_Controller
{
$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));
+ ->set_output(json_encode($prestudent));
}
/**
- * Gets Zugangsvoraussetzungen for a prestudents as a description text
+ * Gets Zugangsvoraussetzungen for a prestudent as a description text and shows them in a view
* @param $prestudent_id
*/
public function getZgvInfoForPrestudent($prestudent_id)
@@ -242,7 +234,11 @@ class InfoCenter extends FHC_Controller
$studiengangkurzbz = $prestudentdata['studiengang_kurzbz'];
$studiengangbezeichnung = $prestudentdata['studiengang_bezeichnung'];
- $data = array('studiengang_bezeichnung' => $studiengangbezeichnung, 'studiengang_kurzbz' => $studiengangkurzbz, 'data' => null);
+ $data = array(
+ 'studiengang_bezeichnung' => $studiengangbezeichnung,
+ 'studiengang_kurzbz' => $studiengangkurzbz,
+ 'data' => null
+ );
if (hasData($studienordnung))
{
@@ -255,54 +251,58 @@ class InfoCenter extends FHC_Controller
}
/**
- * Saves a zgv for a prestudent. includes Ort, Datum, Nation for bachelor and master.
+ * Saves a ZGV for a prestudent, includes Ort, Datum, Nation for bachelor and master
* @param $prestudent_id
*/
- public function saveZgvPruefung($prestudent_id)
+ public function saveZgvPruefung()
{
- // zgvdata
- // Check for string null, in case dropdown changed to default value
- $zgv_code = $this->input->post('zgv') === 'null' ? null : $this->input->post('zgv');
- $zgvort = $this->input->post('zgvort');
- $zgvdatum = $this->input->post('zgvdatum');
- $zgvdatum = empty($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d');
- $zgvnation_code = $this->input->post('zgvnation') === 'null' ? null : $this->input->post('zgvnation');
+ $prestudent_id = $this->input->post('prestudentid');
- //zgvmasterdata
- $zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas');
- $zgvmaort = $this->input->post('zgvmaort');
- $zgvmadatum = $this->input->post('zgvmadatum');
- $zgvmadatum = empty($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
- $zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation');
-
- $result = $this->PrestudentModel->update(
- $prestudent_id,
- array(
- 'zgv_code' => $zgv_code,
- 'zgvort' => $zgvort,
- 'zgvdatum' => $zgvdatum,
- 'zgvnation' => $zgvnation_code,
- 'zgvmas_code' => $zgvmas_code,
- 'zgvmaort' => $zgvmaort,
- 'zgvmadatum' => $zgvmadatum,
- 'zgvmanation' => $zgvmanation_code,
- 'updateamum' => date('Y-m-d H:i:s')
- )
- );
-
- if (isError($result))
+ if (empty($prestudent_id))
+ $result = error('Prestudentid missing');
+ else
{
- show_error($result->retval);
+ // zgvdata
+ // Check for string null, in case dropdown changed to default value
+ $zgv_code = $this->input->post('zgv') === 'null' ? null : $this->input->post('zgv');
+ $zgvort = $this->input->post('zgvort');
+ $zgvdatum = $this->input->post('zgvdatum');
+ $zgvdatum = empty($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d');
+ $zgvnation_code = $this->input->post('zgvnation') === 'null' ? null : $this->input->post('zgvnation');
+
+ //zgvmasterdata
+ $zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas');
+ $zgvmaort = $this->input->post('zgvmaort');
+ $zgvmadatum = $this->input->post('zgvmadatum');
+ $zgvmadatum = empty($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
+ $zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation');
+
+ $result = $this->PrestudentModel->update(
+ $prestudent_id,
+ array(
+ 'zgv_code' => $zgv_code,
+ 'zgvort' => $zgvort,
+ 'zgvdatum' => $zgvdatum,
+ 'zgvnation' => $zgvnation_code,
+ 'zgvmas_code' => $zgvmas_code,
+ 'zgvmaort' => $zgvmaort,
+ 'zgvmadatum' => $zgvmadatum,
+ 'zgvmanation' => $zgvmanation_code,
+ 'updateamum' => date('Y-m-d H:i:s')
+ )
+ );
+
+ if (isSuccess($result))
+ {
+ //get extended Prestudent data for logging
+ $logdata = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
+
+ $this->_log($logdata['person_id'], 'savezgv', array($logdata['studiengang_kurzbz'], $prestudent_id));
+ }
}
-
- //get extended Prestudent data for logging
- $logdata = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
-
- $this->_log($logdata['person_id'], 'savezgv', array($logdata['studiengang_kurzbz'], $prestudent_id));
-
$this->output
->set_content_type('application/json')
- ->set_output(json_encode($result->retval));
+ ->set_output(json_encode($result));
}
/**
@@ -450,16 +450,14 @@ class InfoCenter extends FHC_Controller
$result = $this->NotizModel->addNotizForPerson($person_id, $titel, $text, $erledigt, $this->uid);
- if (isError($result))
+ if (isSuccess($result))
{
- show_error($result->retval);
+ $this->_log($person_id, 'savenotiz', array($titel));
}
- $this->_log($person_id, 'savenotiz', array($titel));
-
$this->output
->set_content_type('application/json')
- ->set_output(json_encode($result->retval));
+ ->set_output(json_encode($result));
}
/**
@@ -484,19 +482,15 @@ class InfoCenter extends FHC_Controller
)
);
- $json = false;
-
if (isSuccess($result))
{
- $json = true;
-
//set log "Notiz updated"
$this->_log($person_id, 'updatenotiz', array($titel));
}
$this->output
->set_content_type('application/json')
- ->set_output(json_encode($json));
+ ->set_output(json_encode($result));
}
/**
@@ -567,14 +561,18 @@ class InfoCenter extends FHC_Controller
}
/**
- * Initializes parking of a person, i.e. a person is not expected to do any actions while it is parked
+ * Initializes parking of a person, i.e. a person is not expected to do any actions while parked
*/
public function park()
{
$person_id = $this->input->post('person_id');
$date = $this->input->post('parkdate');
- $this->personloglib->park($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->uid);
+ $result = $this->personloglib->park($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->uid);
+
+ $this->output
+ ->set_content_type('application/json')
+ ->set_output(json_encode($result));
}
/**
@@ -584,7 +582,11 @@ class InfoCenter extends FHC_Controller
{
$person_id = $this->input->post('person_id');
- $this->personloglib->unPark($person_id);
+ $result = $this->personloglib->unPark($person_id);
+
+ $this->output
+ ->set_content_type('application/json')
+ ->set_output(json_encode($result));
}
/**
diff --git a/application/libraries/PersonLogLib.php b/application/libraries/PersonLogLib.php
index 8145b88ac..e933f532e 100644
--- a/application/libraries/PersonLogLib.php
+++ b/application/libraries/PersonLogLib.php
@@ -91,7 +91,7 @@ class PersonLogLib
* @param string $app
* @param null $oe_kurzbz
* @param null $user
- * @return bool wether parking was successfull
+ * @return insert object
*/
public function park($person_id, $date, $taetigkeit_kurzbz, $app = 'core', $oe_kurzbz = null, $user = null)
{
@@ -110,16 +110,13 @@ class PersonLogLib
'insertvon' => $user
);
- $result = $this->ci->PersonLogModel->insert($data);
- if (isSuccess($result))
- return true;
- else
- show_error($result->retval);
+ return $this->ci->PersonLogModel->insert($data);
}
/**
* Unparks a person, i.e. removes all log entries in the future
* @param $person_id
+ * @return array with deleted logids
*/
public function unPark($person_id)
{
@@ -127,24 +124,21 @@ class PersonLogLib
$deleted = array();
- if (isSuccess($result))
+ if (hasData($result))
{
- if (count($result->retval) > 0)
+ foreach ($result->retval as $log)
{
- foreach ($result->retval as $log)
+ $logdata = json_decode($log->logdata);
+ if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME)
{
- $logdata = json_decode($log->logdata);
- if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME)
- {
- $delresult = $this->ci->PersonLogModel->deleteLog($log->log_id);
- if (isSuccess($delresult))
- $deleted[] = $log->log_id;
- }
+ $delresult = $this->ci->PersonLogModel->deleteLog($log->log_id);
+ if (isSuccess($delresult))
+ $deleted[] = $log->log_id;
}
}
}
- else
- show_error($result->retval);
+
+ return $deleted;
}
/**
@@ -158,23 +152,18 @@ class PersonLogLib
$parkeddate = null;
- if (isSuccess($result))
+ if (hasData($result))
{
- if (count($result->retval) > 0)
+ foreach ($result->retval as $log)
{
- foreach ($result->retval as $log)
+ $logdata = json_decode($log->logdata);
+ if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME)
{
- $logdata = json_decode($log->logdata);
- if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME)
- {
- $parkeddate = $log->zeitpunkt;
- break;
- }
+ $parkeddate = $log->zeitpunkt;
+ break;
}
}
}
- else
- show_error($result->retval);
return $parkeddate;
}
diff --git a/application/views/system/infocenter/addNotiz.php b/application/views/system/infocenter/addNotiz.php
index bec09e62b..56bccbfaf 100644
--- a/application/views/system/infocenter/addNotiz.php
+++ b/application/views/system/infocenter/addNotiz.php
@@ -21,6 +21,7 @@
+
diff --git a/public/js/infocenter/infocenterDetails.js b/public/js/infocenter/infocenterDetails.js
index 445e667cd..60b461bc1 100644
--- a/public/js/infocenter/infocenterDetails.js
+++ b/public/js/infocenter/infocenterDetails.js
@@ -1,6 +1,7 @@
var fhc_controller_id = FHC_AjaxClient.getUrlParameter('fhc_controller_id');
const CONTROLLER_URL = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/"+FHC_JS_DATA_STORAGE_OBJECT.called_path;
+const CALLED_PATH = FHC_JS_DATA_STORAGE_OBJECT.called_path;
/**
* javascript file for infocenterDetails page
@@ -9,13 +10,13 @@ $(document).ready(
function ()
{
//initialise table sorter
- addTablesorter("doctable", [[2, 1], [1, 0]], ["zebra"]);
- addTablesorter("nachgdoctable", [[2, 0], [1, 1]], ["zebra"]);
- addTablesorter("msgtable", [[0, 1], [2, 0]], ["zebra", "filter"], 2);
- tablesortAddPager("msgtable", "msgpager", 14);
+ Tablesort.addTablesorter("doctable", [[2, 1], [1, 0]], ["zebra"]);
+ Tablesort.addTablesorter("nachgdoctable", [[2, 0], [1, 1]], ["zebra"]);
+ Tablesort.addTablesorter("msgtable", [[0, 1], [2, 0]], ["zebra", "filter"], 2);
+ Tablesort.tablesortAddPager("msgtable", "msgpager", 14);
- formatNotizTable();
- formatLogTable();
+ InfocenterDetails._formatNotizTable();
+ InfocenterDetails._formatLogTable();
//initialise datepicker
$.datepicker.setDefaults($.datepicker.regional['de']);
@@ -39,7 +40,7 @@ $(document).ready(
var boxid = this.id;
var akteid = boxid.substr(boxid.indexOf("_") + 1);
var checked = this.checked;
- saveFormalGeprueft(personid, akteid, checked)
+ InfocenterDetails.saveFormalGeprueft(personid, akteid, checked)
});
//zgv übernehmen
@@ -48,15 +49,23 @@ $(document).ready(
var btn = $(this);
var prestudentid = this.id.substr(this.id.indexOf("_") + 1);
$('#zgvUebernehmenNotice').remove();
- zgvUebernehmen(personid, prestudentid, btn)
+ InfocenterDetails.zgvUebernehmen(personid, prestudentid, btn)
});
//zgv speichern
$(".zgvform").on('submit', function (e)
{
e.preventDefault();
- var data = $(this).serializeArray();
- saveZgv(data);
+ var formdata = $(this).serializeArray();
+
+ var data = {};
+
+ for (var i = 0; i < formdata.length; i++)
+ {
+ data[formdata[i].name] = formdata[i].value;
+ }
+
+ InfocenterDetails.saveZgv(data);
}
);
@@ -64,7 +73,7 @@ $(document).ready(
$(".zgvinfo").click(function ()
{
var prestudentid = this.id.substr(this.id.indexOf("_") + 1);
- openZgvInfoForPrestudent(prestudentid);
+ InfocenterDetails.openZgvInfoForPrestudent(prestudentid);
}
);
@@ -93,17 +102,24 @@ $(document).ready(
$("#notizform").on("submit", function (e)
{
e.preventDefault();
- var personId = $("#hiddenpersonid").val();
var notizId = $("#notizform :input[name='hiddenNotizId']").val();
- var data = $(this).serializeArray();
+ var formdata = $(this).serializeArray();
+ var data = {};
+
+ for (var i = 0; i < formdata.length; i++)
+ {
+ data[formdata[i].name] = formdata[i].value;
+ }
+
+ $("#notizmsg").empty();
if (notizId !== '')
{
- updateNotiz(notizId, personid, data);
+ InfocenterDetails.updateNotiz(notizId, personid, data);
}
else
{
- saveNotiz(personid, data);
+ InfocenterDetails.saveNotiz(personid, data);
}
}
);
@@ -111,6 +127,8 @@ $(document).ready(
//update notiz - autofill notizform
$(document).on("click", "#notiztable tbody tr", function ()
{
+ $("#notizmsg").empty();
+
var notizId = $(this).find("td:eq(3)").html();
var notizTitle = $(this).find("td:eq(1)").text();
var notizContent = this.title;
@@ -127,330 +145,357 @@ $(document).ready(
//update notiz - abbrechen-button: reset styles
$("#notizform :input[type='reset']").click(function ()
{
- resetNotizFields();
+ InfocenterDetails._resetNotizFields();
}
);
//check if person is parked and display it
- getParkedDateAjax(personid);
+ InfocenterDetails.getParkedDate(personid);
});
-function openZgvInfoForPrestudent(prestudent_id)
-{
- var screenwidth = screen.width;
- var popupwidth = 760;
- var marginleft = screenwidth - popupwidth;
- window.open("../getZgvInfoForPrestudent/" + prestudent_id, "_blank","resizable=yes,scrollbars=yes,width="+popupwidth+",height="+screen.height+",left="+marginleft);
-}
+var InfocenterDetails = {
-// -----------------------------------------------------------------------------------------------------------------
-// ajax calls
+ genericSaveError: function() {
+ alert("error when saving");
+ },
+ openZgvInfoForPrestudent: function(prestudent_id)
+ {
+ var screenwidth = screen.width;
+ var popupwidth = 760;
+ var marginleft = screenwidth - popupwidth;
+ window.open(CONTROLLER_URL + "/getZgvInfoForPrestudent/" + encodeURIComponent(prestudent_id), "_blank","resizable=yes,scrollbars=yes,width="+popupwidth+",height="+screen.height+",left="+marginleft);
+ },
-function saveFormalGeprueft(personid, akteid, checked)
-{
- $.ajax({
- type: "POST",
- dataType: "json",
- url: CONTROLLER_URL+"/saveFormalGeprueft/" + personid + '?fhc_controller_id=' + fhc_controller_id,
- data: {"akte_id": akteid, "formal_geprueft": checked},
- success: function (data, textStatus, jqXHR)
- {
- if (data === null)
+ // -----------------------------------------------------------------------------------------------------------------
+ // ajax calls
+ saveFormalGeprueft: function(personid, akteid, checked)
+ {
+ FHC_AjaxClient.ajaxCallPost(
+ CALLED_PATH + '/saveFormalGeprueft/' + encodeURIComponent(personid),
{
- $("#formalgeprueftam_" + akteid).text("");
+ akte_id: akteid,
+ formal_geprueft: checked
+ },
+ {
+ successCallback: function(data, textStatus, jqXHR) {
+ if (data !== false)
+ {
+ if (data === null)
+ {
+ $("#formalgeprueftam_" + akteid).text("");
+ }
+ else
+ {
+ var fgdatum = $.datepicker.parseDate("yy-mm-dd", data);
+ var gerfgdatum = $.datepicker.formatDate("dd.mm.yy", fgdatum);
+ $("#formalgeprueftam_" + akteid).text(gerfgdatum);
+ }
+ //refresh doctable tablesorter, formal geprueft changed!
+ $("#doctable").trigger("update");
+ InfocenterDetails._refreshLog();
+ }
+ else
+ {
+ InfocenterDetails.genericSaveError();
+ }
+ },
+ errorCallback: InfocenterDetails.genericSaveError,
+ veilTimeout: 0
}
- else
+ );
+ },
+ zgvUebernehmen: function(personid, prestudentid, btn)
+ {
+ FHC_AjaxClient.ajaxCallGet(
+ CALLED_PATH + "/getLastPrestudentWithZgvJson/" + encodeURIComponent(personid),
{
- fgdatum = $.datepicker.parseDate("yy-mm-dd", data);
- gerfgdatum = $.datepicker.formatDate("dd.mm.yy", fgdatum);
- $("#formalgeprueftam_" + akteid).text(gerfgdatum);
+ },
+ {
+ successCallback: function(data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.hasData(data))
+ {
+ var prestudent = data.retval[0];
+ var zgvcode = prestudent.zgv_code !== null ? prestudent.zgv_code : "null";
+ var zgvort = prestudent.zgvort !== null ? prestudent.zgvort : "";
+ var zgvdatum = prestudent.zgvdatum;
+ var gerzgvdatum = "";
+ if (zgvdatum !== null)
+ {
+ zgvdatum = $.datepicker.parseDate("yy-mm-dd", prestudent.zgvdatum);
+ gerzgvdatum = $.datepicker.formatDate("dd.mm.yy", zgvdatum);
+ }
+ var zgvnation = prestudent.zgvnation !== null ? prestudent.zgvnation : "null";
+ $("#zgv_" + prestudentid).val(zgvcode);
+ $("#zgvort_" + prestudentid).val(zgvort);
+ $("#zgvdatum_" + prestudentid).val(gerzgvdatum);
+ $("#zgvnation_" + prestudentid).val(zgvnation);
+ }
+ else
+ {
+ btn.after(" keine ZGV vorhanden");
+ }
+ },
+ veilTimeout: 0
}
- //refresh doctable tablesorter, formal geprueft changed!
- $("#doctable").trigger("update");
- refreshLog();
- },
- error: function (jqXHR, textStatus, errorThrown)
- {
- alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
- }
- });
-}
+ );
+ },
+ saveZgv: function (data)
+ {
+ var zgvError = function(){
+ $("#zgvSpeichern_" + prestudentid).before("Fehler beim Speichern der ZGV! ");
+ };
-function zgvUebernehmen(personid, prestudentid, btn)
-{
- $.ajax({
- type: "GET",
- dataType: "json",
- url: CONTROLLER_URL+"/getLastPrestudentWithZgvJson/" + personid + '?fhc_controller_id=' + fhc_controller_id,
- success: function (data, textStatus, jqXHR)
- {
- if (data !== null)
+ var prestudentid = data.prestudentid;
+ $("#zgvSpeichernNotice").remove();
+
+ FHC_AjaxClient.ajaxCallPost(
+ CALLED_PATH + '/saveZgvPruefung',
+ data,
{
- var zgvcode = data.zgv_code !== null ? data.zgv_code : "null";
- var zgvort = data.zgvort !== null ? data.zgvort : "";
- var zgvdatum = data.zgvdatum;
- var gerzgvdatum = "";
- if (zgvdatum !== null)
+ successCallback: function(data, textStatus, jqXHR) {
+
+ if (FHC_AjaxClient.hasData(data))
+ {
+ InfocenterDetails._refreshLog();
+ $("#zgvSpeichern_" + prestudentid).before("ZGV erfolgreich gespeichert! ");
+ }
+ else
+ {
+ zgvError();
+ }
+ },
+ errorCallback: zgvError,
+ veilTimeout: 0
+ }
+ );
+ },
+ saveNotiz: function (personid, data)
+ {
+ FHC_AjaxClient.ajaxCallPost(
+ CALLED_PATH + '/saveNotiz/' + encodeURIComponent(personid),
+ data,
+ {
+ successCallback: function(data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.hasData(data))
+ {
+ InfocenterDetails._refreshNotizen();
+ InfocenterDetails._refreshLog();
+ }
+ else
+ {
+ InfocenterDetails._errorSaveNotiz();
+ }
+ },
+ errorCallback: InfocenterDetails._errorSaveNotiz,
+ veilTimeout: 0
+ }
+ );
+ },
+ updateNotiz: function (notizId, personId, data)
+ {
+ FHC_AjaxClient.ajaxCallPost(
+ CALLED_PATH + '/updateNotiz/' + encodeURIComponent(notizId) + "/" + encodeURIComponent(personId),
+ data,
+ {
+ successCallback: function(data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.hasData(data))
+ {
+ InfocenterDetails._refreshNotizen();
+ InfocenterDetails._refreshLog();
+ InfocenterDetails._resetNotizFields();
+ }
+ else
+ {
+ InfocenterDetails._errorSaveNotiz();
+ }
+ },
+ errorCallback: InfocenterDetails._errorSaveNotiz,
+ veilTimeout: 0
+ }
+ );
+ },
+ getStudienjahrEnd: function()
+ {
+ FHC_AjaxClient.ajaxCallGet(
+ CALLED_PATH + "/getStudienjahrEnd",
+ {
+ },
+ {
+ successCallback: function(data, textStatus, jqXHR) {
+ if (data)
+ {
+ console.log("studienjahr end executed");
+ var engdate = $.datepicker.parseDate("yy-mm-dd", data);
+ var gerdate = $.datepicker.formatDate("dd.mm.yy", engdate);
+ $("#parkdate").val(gerdate);
+ }
+ },
+ veilTimeout: 0
+ }
+ );
+ },
+ getParkedDate: function(personid)
+ {
+ FHC_AjaxClient.ajaxCallGet(
+ CALLED_PATH + "/getParkedDate/"+encodeURIComponent(personid),
+ {
+ },
+ {
+ successCallback: function(data, textStatus, jqXHR) {
+ InfocenterDetails._refreshParking(data);
+ InfocenterDetails._refreshLog();
+ if (data === null)
+ InfocenterDetails.getStudienjahrEnd();
+ },
+ veilTimeout: 0
+ }
+ );
+ },
+ parkPerson: function(personid, date)
+ {
+ var parkError = function(){
+ $("#parkmsg").text(" Fehler beim Parken!");
+ };
+
+ FHC_AjaxClient.ajaxCallPost(
+ CALLED_PATH + '/park',
+ {
+ "person_id": personid,
+ "parkdate": date
+ },
+ {
+ successCallback: function(data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.hasData(data))
+ InfocenterDetails.getParkedDate(personid);
+ else
+ {
+ parkError();
+ }
+ },
+ errorCallback: parkError,
+ veilTimeout: 0
+ }
+ );
+ },
+ unparkPerson: function(personid)
+ {
+ FHC_AjaxClient.ajaxCallPost(
+ CALLED_PATH + '/unpark',
+ {
+ "person_id": personid
+ },
+ {
+ successCallback: function(data, textStatus, jqXHR) {
+ if (Array.isArray(data))
+ {
+ if (data.length > 0)
+ InfocenterDetails.getParkedDate(personid);
+ else
+ $("#unparkmsg").removeClass().addClass("text-warning").text(" Nichts zum Ausparken.");
+ }
+ },
+ errorCallback: function(){
+ $("#unparkmsg").removeClass().addClass("text-danger").text(" Fehler beim Ausparken!");
+ },
+ veilTimeout: 0
+ }
+ );
+ },
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // (private) methods executed after ajax (refreshers)
+ _refreshLog: function()
+ {
+ var personid = $("#hiddenpersonid").val();
+ $("#logs").load(CONTROLLER_URL + '/reloadLogs/' + personid + '?fhc_controller_id=' + fhc_controller_id,
+ function ()
+ {
+ //readd tablesorter
+ InfocenterDetails._formatLogTable()
+ }
+ );
+ },
+ _formatLogTable: function()
+ {
+ Tablesort.addTablesorter("logtable", [[0, 1]], ["filter"], 2);
+ Tablesort.tablesortAddPager("logtable", "logpager", 22);
+ $("#logtable").addClass("table-condensed");
+ },
+ _refreshNotizen: function()
+ {
+ $("#notizform").find("input[type=text], textarea").val("");
+ var personid = $("#hiddenpersonid").val();
+ $("#notizen").load(CONTROLLER_URL + '/reloadNotizen/' + personid,
+ function ()
+ {
+ //readd tablesorter
+ InfocenterDetails._formatNotizTable()
+ }
+ );
+ },
+ _refreshParking: function(date)
+ {
+ if (date === null)
+ {
+ $("#parking").html(
+ ''+
+ ' '+
+ 'bis '+
+ ' '+
+ ''+
+ '
');
+
+ $("#parkdate").datepicker({
+ "dateFormat": "dd.mm.yy",
+ "minDate": 0
+ });
+
+ $("#parklink").click(
+
+ function ()
{
- zgvdatum = $.datepicker.parseDate("yy-mm-dd", data.zgvdatum);
- gerzgvdatum = $.datepicker.formatDate("dd.mm.yy", zgvdatum);
+ var personid = $("#hiddenpersonid").val();
+ var date = $("#parkdate").val();
+
+ InfocenterDetails.parkPerson(personid, date);
}
- var zgvnation = data.zgvnation !== null ? data.zgvnation : "null";
- $("#zgv_" + prestudentid).val(zgvcode);
- $("#zgvort_" + prestudentid).val(zgvort);
- $("#zgvdatum_" + prestudentid).val(gerzgvdatum);
- $("#zgvnation_" + prestudentid).val(zgvnation);
- }
- else
- {
- btn.after(" keine ZGV vorhanden");
- }
- },
- error: function (jqXHR, textStatus, errorThrown)
- {
- alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
+ );
}
- });
-}
+ else
+ {
+ var parkdate = $.datepicker.parseDate("yy-mm-dd", date);
+ var gerparkdate = $.datepicker.formatDate("dd.mm.yy", parkdate);
+ $("#parking").html(
+ 'BewerberIn geparkt bis '+gerparkdate+' '+
+ ' '+
+ ''
+ );
-function saveZgv(data)
-{
- var prestudentid = data[0].value;
- $("#zgvSpeichernNotice").remove();
- $.ajax({
- type: "POST",
- dataType: "json",
- data: data,
- url: CONTROLLER_URL+"/saveZgvPruefung/" + prestudentid + '?fhc_controller_id=' + fhc_controller_id,
- success: function (data, textStatus, jqXHR)
- {
- if (data === prestudentid)
- {
- refreshLog();
- $("#zgvSpeichern_" + prestudentid).before("ZGV erfolgreich gespeichert! ");
- }
- else
- {
- $("#zgvSpeichern_" + prestudentid).before("Fehler beim Speichern der ZGV! ");
- }
- },
- error: function (jqXHR, textStatus, errorThrown)
- {
- alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
+ $("#unparklink").click(
+ function ()
+ {
+ var personid = $("#hiddenpersonid").val();
+ InfocenterDetails.unparkPerson(personid, date);
+ }
+ );
}
- });
-}
-
-function saveNotiz(personid, data)
-{
- $.ajax({
- type: "POST",
- dataType: "json",
- data: data,
- url: CONTROLLER_URL+"/saveNotiz/" + personid + '?fhc_controller_id=' + fhc_controller_id,
- success: function (data, textStatus, jqXHR)
- {
- refreshNotizen();
- refreshLog();
- },
- error: function (jqXHR, textStatus, errorThrown)
- {
- alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
- }
- });
-}
-
-function updateNotiz(notizId, personId, data)
-{
- $.ajax({
- type: "POST",
- dataType: "json",
- data: data,
- url: CONTROLLER_URL+"/updateNotiz/" + notizId + "/" + personId + '?fhc_controller_id=' + fhc_controller_id,
- success: function (data, textStatus, jqXHR)
- {
- if (data)
- {
- refreshNotizen();
- refreshLog();
- resetNotizFields();
- }
- },
- error: function (jqXHR, textStatus, errorThrown)
- {
- alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
- }
- });
-}
-
-function getStudienjahrEndAjax()
-{
- $.ajax({
- url: CONTROLLER_URL+"/getStudienjahrEnd?fhc_controller_id="+fhc_controller_id,
- method: "GET",
- success: function(data, textStatus, jqXHR)
- {
- //var gerdate = data.substring(8, 10) + "."+data.substring(5, 7) + "." + data.substring(0, 4);
- var engdate = $.datepicker.parseDate("yy-mm-dd", data);
- var gerdate = $.datepicker.formatDate("dd.mm.yy", engdate);
- $("#parkdate").val(gerdate);
- },
- error: function (jqXHR, textStatus, errorThrown)
- {
- alert(textStatus);
- }
- });
-}
-
-function getParkedDateAjax(personid)
-{
- $.ajax({
- url: CONTROLLER_URL+"/getParkedDate/"+personid+"?fhc_controller_id="+fhc_controller_id,
- method: "GET",
- success: function(data, textStatus, jqXHR)
- {
- refreshParking(data);
- refreshLog();
- getStudienjahrEndAjax();
- },
- error: function (jqXHR, textStatus, errorThrown)
- {
- alert(textStatus);
- }
- });
-}
-
-function parkPersonAjax(personid, date)
-{
- $.ajax({
- url: CONTROLLER_URL+"/park?fhc_controller_id="+fhc_controller_id,
- method: "POST",
- data:
- {
- "person_id": personid,
- "parkdate": date
- },
- success: function(data, textStatus, jqXHR)
- {
- getParkedDateAjax(personid);
- },
- error: function (jqXHR, textStatus, errorThrown)
- {
- alert(textStatus);
- }
- });
-}
-
-function unparkPersonAjax(personid)
-{
- $.ajax({
- url: CONTROLLER_URL+"/unpark?fhc_controller_id="+fhc_controller_id,
- method: "POST",
- data:
- {
- "person_id": personid
- },
- success: function(data, textStatus, jqXHR)
- {
- getParkedDateAjax(personid);
- },
- error: function (jqXHR, textStatus, errorThrown)
- {
- alert(textStatus);
- }
- });
-}
-
-// -----------------------------------------------------------------------------------------------------------------
-// methods executed after ajax (refreshers)
-
-function refreshLog()
-{
- var personid = $("#hiddenpersonid").val();
- $("#logs").load('../reloadLogs/' + personid + '?fhc_controller_id=' + fhc_controller_id,
- function ()
- {
- //readd tablesorter
- formatLogTable()
- }
- );
-}
-
-function formatLogTable()
-{
- addTablesorter("logtable", [[0, 1]], ["filter"], 2);
- tablesortAddPager("logtable", "logpager", 22);
- $("#logtable").addClass("table-condensed");
-}
-
-function refreshNotizen()
-{
- $("#notizform").find("input[type=text], textarea").val("");
- var personid = $("#hiddenpersonid").val();
- $("#notizen").load('../reloadNotizen/' + personid,
- function ()
- {
- //readd tablesorter
- formatNotizTable()
- }
- );
-}
-
-function refreshParking(date)
-{
- if (date === null)
+ },
+ _formatNotizTable: function()
{
- $("#parking").html(
- ''+
- ' '+
- 'bis '+
- ''+
- '
');
-
- $("#parkdate").datepicker({
- "dateFormat": "dd.mm.yy",
- "minDate": 0
- });
-
- $("#parklink").click(
- function ()
- {
- var personid = $("#hiddenpersonid").val();
- var date = $("#parkdate").val();
-
- parkPersonAjax(personid, date);
- }
- );
- }
- else
+ Tablesort.addTablesorter("notiztable", [[0, 1]], ["filter"], 2);
+ Tablesort.tablesortAddPager("notiztable", "notizpager", 11);
+ $("#notiztable").addClass("table-condensed");
+ },
+ _resetNotizFields: function()
{
- var parkdate = $.datepicker.parseDate("yy-mm-dd", date);
- var gerparkdate = $.datepicker.formatDate("dd.mm.yy", parkdate);
- $("#parking").html(
- 'BewerberIn geparkt bis '+gerparkdate+' '+
- ' ');
-
- $("#unparklink").click(
- function ()
- {
- var personid = $("#hiddenpersonid").val();
- unparkPersonAjax(personid, date);
- }
- );
+ $("#notizmsg").empty();
+ $("#notizform :input[name='hiddenNotizId']").val("");
+ $("#notizform label:first").text("Notiz hinzufügen").css("color", "black");
+ $("#notizform :input[type='reset']").css("display", "none");
+ },
+ _errorSaveNotiz: function()
+ {
+ $("#notizmsg").text("Fehler beim Speichern der Notiz! ");
}
-}
-
-function formatNotizTable()
-{
- addTablesorter("notiztable", [[0, 1]], ["filter"], 2);
- tablesortAddPager("notiztable", "notizpager", 11);
- $("#notiztable").addClass("table-condensed");
-}
-
-function resetNotizFields()
-{
- $("#notizform :input[name='hiddenNotizId']").val("");
- $("#notizform label:first").text("Notiz hinzufügen").css("color", "black");
- $("#notizform :input[type='reset']").css("display", "none");
-}
+};
diff --git a/public/js/infocenter/infocenterPersonDataset.js b/public/js/infocenter/infocenterPersonDataset.js
index 2c063ac4d..4146edc9b 100644
--- a/public/js/infocenter/infocenterPersonDataset.js
+++ b/public/js/infocenter/infocenterPersonDataset.js
@@ -56,9 +56,9 @@ function appendTableActionsHtml()
$("#datasetActionsTop, #datasetActionsBottom").append(
""+
- "
" + selectAllHtml + " " + actionHtml + "
"+
- "
" + legendHtml + "
"+
- "
" + countHtml + "
"+
+ "
" + selectAllHtml + " " + actionHtml + "
"+
+ "
" + legendHtml + "
"+
+ "
" + countHtml + "
"+
"
"+
"
"
);
diff --git a/public/js/tablesort/tablesort.js b/public/js/tablesort/tablesort.js
index ee386bb7d..f45b55ca7 100644
--- a/public/js/tablesort/tablesort.js
+++ b/public/js/tablesort/tablesort.js
@@ -1,67 +1,69 @@
-/**
- * adds tablesorter to specified tableid, german date format, default theme
- * @param tableid
- * @param sortList columns to sort by, as array of arrays (each array contains column number and 1/0 for asc/desc order)
- * @param widgets optional widgets like zebra or filter
- * @param minrows optional minimal amount of rows for filter row to be shown (only relevant for filter widget)
- */
-function addTablesorter(tableid, sortList, widgets, minrows)
-{
- $("#" + tableid).tablesorter(
- {
- theme: "default",
- dateFormat: "ddmmyyyy",
- sortList: sortList,
- widgets: widgets
- }
- );
-
- if($("#" + tableid + " tr.tablesorter-filter-row").length)
+var Tablesort = {
+ /**
+ * adds tablesorter to specified tableid, german date format, default theme
+ * @param tableid
+ * @param sortList columns to sort by, as array of arrays (each array contains column number and 1/0 for asc/desc order)
+ * @param widgets optional widgets like zebra or filter
+ * @param minrows optional minimal amount of rows for filter row to be shown (only relevant for filter widget)
+ */
+ addTablesorter: function (tableid, sortList, widgets, minrows)
{
- //hide filters if less than n datarows (+ 2 for headings and filter row itself), default 0
- var minrows = minrows || 0;
- if ($("#" + tableid + " tr").length < minrows + 2)
- {
- $("#" + tableid + " tr.tablesorter-filter-row").hide();
- }
- }
-}
-
-/**
- * adds pager for specified tableid. Assumes bootstap icons are available!
- * @param tableid
- * @param pagerid
- * @param size number of rows for each page
- */
-function tablesortAddPager(tableid, pagerid, size)
-{
- var html =
- '';
-
- var rowcount = $("#" + tableid + " tbody tr").length;
-
- //not show pager if only one table page
- if (rowcount > size)
- {
- var table = $("#" + tableid);
- table.after(html);
-
- table.tablesorterPager(
+ $("#" + tableid).tablesorter(
{
- container: $("#" + pagerid),
- size: size,
- cssDisabled: 'disabled',
- savePages: false,
- output: '{startRow} – {endRow} / {totalRows} Zeilen'
+ theme: "default",
+ dateFormat: "ddmmyyyy",
+ sortList: sortList,
+ widgets: widgets
}
);
+
+ if ($("#" + tableid + " tr.tablesorter-filter-row").length)
+ {
+ //hide filters if less than n datarows (+ 2 for headings and filter row itself), default 0
+ var minrows = minrows || 0;
+ if ($("#" + tableid + " tr").length < minrows + 2)
+ {
+ $("#" + tableid + " tr.tablesorter-filter-row").hide();
+ }
+ }
+ },
+
+ /**
+ * adds pager for specified tableid. Assumes bootstap icons are available!
+ * @param tableid
+ * @param pagerid
+ * @param size number of rows for each page
+ */
+ tablesortAddPager: function (tableid, pagerid, size)
+ {
+ var html =
+ '';
+
+ var rowcount = $("#" + tableid + " tbody tr").length;
+
+ //not show pager if only one table page
+ if (rowcount > size)
+ {
+ var table = $("#" + tableid);
+ table.after(html);
+
+ table.tablesorterPager(
+ {
+ container: $("#" + pagerid),
+ size: size,
+ cssDisabled: 'disabled',
+ savePages: false,
+ output: '{startRow} – {endRow} / {totalRows} Zeilen'
+ }
+ );
+ }
}
-}
\ No newline at end of file
+};
\ No newline at end of file