diff --git a/application/controllers/system/Users.php b/application/controllers/system/Users.php
index aeef474ff..db58980ea 100644
--- a/application/controllers/system/Users.php
+++ b/application/controllers/system/Users.php
@@ -100,16 +100,22 @@ class Users extends VileSci_Controller
// Load model PrestudentstatusModel
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
- $result = $this->PrestudentstatusModel->updateStufe($prestudentIdArray, $stufe);
+ $result = error("No valid parameters");
+ if (isset($stufe) && isset($prestudentIdArray) && is_array($prestudentIdArray) && count($prestudentIdArray) >0)
+ {
+ $result = $this->PrestudentstatusModel->updateStufe($prestudentIdArray, $stufe);
+ }
+
+ $this->output->set_header('Content-Type: application/json; charset=utf-8');
if (isSuccess($result))
{
$href = str_replace("/system/Users/linkToStufe", "/system/Users", $_SERVER["REQUEST_URI"]);
- echo "
Data correctly saved -
Back ";
+ echo '{"msg": "Data correctly saved"}';
}
else
{
- echo "Error occurred while saving data, please contact the administrator.
";
+ echo '{"msg": "Error occurred while saving data, please contact the administrator"}';
}
}
@@ -121,16 +127,20 @@ class Users extends VileSci_Controller
// Load model PrestudentstatusModel
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
- $result = $this->PrestudentModel->updateAufnahmegruppe($prestudentIdArray, $aufnahmegruppe);
+ $result = error("No valid parameters");
+ if (isset($aufnahmegruppe) && isset($prestudentIdArray) && is_array($prestudentIdArray) && count($prestudentIdArray) >0)
+ {
+ $result = $this->PrestudentModel->updateAufnahmegruppe($prestudentIdArray, $aufnahmegruppe);
+ }
if (isSuccess($result))
{
$href = str_replace("/system/Users/linkToAufnahmegruppe", "/system/Users", $_SERVER["REQUEST_URI"]);
- echo "Data correctly saved -
Back ";
+ echo '{"msg": "Data correctly saved"}';
}
else
{
- echo "Error occurred while saving data, please contact the administrator.
";
+ echo '{"msg": "Error occurred while saving data, please contact the administrator"}';
}
}
diff --git a/application/views/system/users.php b/application/views/system/users.php
index e93177081..5bda4f1b5 100644
--- a/application/views/system/users.php
+++ b/application/views/system/users.php
@@ -198,22 +198,38 @@
if ($("#linkToStufe"))
{
$("#linkToStufe").click(function() {
- if ($("#linkUsersForm"))
- {
- $("#linkUsersForm").attr("action", "");
- $("#linkUsersForm").submit();
- }
+ $.ajax({
+ type: "POST",
+ dataType: "json",
+ url: "",
+ data: $("#linkUsersForm").serialize(),
+ success: function(data, textStatus, jqXHR) {
+ alert(data.msg);
+ $("#usersFiltersForm").submit();
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
+ }
+ });
});
}
if ($("#linkToGruppe"))
{
$("#linkToGruppe").click(function() {
- if ($("#linkUsersForm"))
- {
- $("#linkUsersForm").attr("action", "");
- $("#linkUsersForm").submit();
- }
+ $.ajax({
+ type: "POST",
+ dataType: "json",
+ url: "",
+ data: $("#linkUsersForm").serialize(),
+ success: function(data, textStatus, jqXHR) {
+ alert(data.msg);
+ $("#usersFiltersForm").submit();
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
+ }
+ });
});
}