Skip to content

Commit

Permalink
Updated success parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
disc5 committed May 3, 2016
1 parent e518fb8 commit 86c2235
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
if ($authorizedUserId == $id || Libs\RESTilias::isAdmin($authorizedUserId)) { // only the user or the admin is allowed to access the data
$model = new Desktop\DesktopModel();
$data = $model->getPersonalDesktopItems($id);

$app->success($data);
$ret = array("content" => $data);
$app->success($ret);
}
else
$app->halt(401, Libs\OAuth2Middleware::MSG_NO_ADMIN, Libs\OAuth2Middleware::ID_NO_ADMIN);
Expand All @@ -44,7 +44,7 @@
$model = new Desktop\DesktopModel();
$model->removeItemFromDesktop($id, $ref_id);

$app->success("Removed item with ref_id=".$ref_id." from desktop.");
$app->success(array("msg"=>"Removed item with ref_id=".$ref_id." from desktop."));
} catch (\Exception $e) {
$app->halt(500, "Error: ".$e->getMessage(), -15);
}
Expand All @@ -61,7 +61,7 @@
$model = new Desktop\DesktopModel();
$model->addItemToDesktop($id, $ref_id);

$app->success("Added item with ref_id=".$ref_id." to the desktop.");
$app->success(array("msg"=>"Added item with ref_id=".$ref_id." to the desktop."));
} catch (\Exception $e) {
$app->halt(500, "Error: ".$e->getMessage(), -15);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

$app->success($soap_result);
} else {
$app->success("No Permission.");
$app->success(array("msg"=>"No Permission."));
}

});
Expand Down Expand Up @@ -153,9 +153,9 @@
}

if($mode == "by_login")
$app->success("Enrolled user $login to course with id $crs_ref_id");
$app->success(array("msg"=>"Enrolled user $login to course with id $crs_ref_id"));
else
$app->success("Enrolled user with id $user_id to course with id $crs_ref_id");
$app->success(array("msg"=>"Enrolled user with id $user_id to course with id $crs_ref_id"));
});

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$ref_id = $request->params("ref_id");
$model = new DesktopModel();
$model->removeItemFromDesktop($authorizedUserId, $ref_id);
$app->success("Removed item with ref_id=".$ref_id." from desktop.");
$app->success(array("msg"=>"Removed item with ref_id=".$ref_id." from desktop."));
} catch (Libs\DeleteFailed $e) {
$app->halt(401, "Error: ".$e->getFormatedMessage(), -15);
}
Expand All @@ -58,7 +58,7 @@
$ref_id = $request->params("ref_id");
$model = new DesktopModel();
$model->addItemToDesktop($authorizedUserId, $ref_id);
$app->success("Added item with ref_id=".$ref_id." to the desktop.");
$app->success(array("msg"=>"Added item with ref_id=".$ref_id." to the desktop."));
} catch (Libs\UpdateFailed $e) {
$app->halt(401, "Error: ".$e->getFormatedMessage(), -15);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
$model = new MobileFeedbackModel();
$hasCreated = $model->createMobileFeedbackDatabaseTable();
if ($hasCreated == true) {
$app->success("Created new feedback database.");
$app->success(array("msg"=>"Created new feedback database."));
} else {
$app->success("Feedback database already exists. Nothing changed.");
$app->success(array("msg"=>"Feedback database already exists. Nothing changed."));
}

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
if ($status == false) {
$app->halt(500, 'File could not be copied!');
} else {
$app->success("Moved item from personal file space to repository.");
$app->success(array("msg"=>"Moved item from personal file space to repository."));
}
} catch(Exceptions\MissingParameter $e) {
$app->halt(400, $e->getFormatedMessage(), $e::ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
}
}
}
$app->success('Empty result.');
$app->success(array("msg"=>"Empty result."));
});

/**
Expand Down Expand Up @@ -169,7 +169,7 @@
$status = $usr_model->deleteUser($user_id);

if ($status) {
$app->success(200,"User with id $user_id deleted.");
$app->success(array("msg"=>"User with id $user_id deleted."));
} else {
$app->halt(404, "Could not delete user " . $user_id . ".");
}
Expand Down

0 comments on commit 86c2235

Please sign in to comment.