Add admin backend to edit Service/Sites
This commit is contained in:
@@ -8,6 +8,9 @@ if ( ! $auth->isAuthenticated() || ! $auth->hasPermission(StatusBoard_Permission
|
||||
throw new StatusBoard_Exception_NotAuthorised();
|
||||
}
|
||||
|
||||
$activity = null;
|
||||
$success = true;
|
||||
|
||||
$service_id = $request->get('id', 'Sihnon_Exception_InvalidParameters');
|
||||
$service = null;
|
||||
try {
|
||||
@@ -16,9 +19,43 @@ try {
|
||||
throw new StatusBoard_Exception_FileNotFound();
|
||||
}
|
||||
|
||||
if ($request->exists('do')) {
|
||||
$activity = $request->get('do');
|
||||
switch ($activity) {
|
||||
|
||||
case 'edit': {
|
||||
$name = StatusBoard_Main::issetelse($_POST['name'], 'Sihnon_Exception_InvalidParameters');
|
||||
$description = StatusBoard_Main::issetelse($_POST['description'], 'Sihnon_Exception_InvalidParameters');
|
||||
|
||||
if ($name) {
|
||||
$service->name = $name;
|
||||
}
|
||||
if ($description) {
|
||||
$service->description = $description;
|
||||
}
|
||||
if ($name || $description) {
|
||||
$service->save();
|
||||
$messages[] = array(
|
||||
'severity' => 'success',
|
||||
'content' => 'The service was updated succesfully.',
|
||||
);
|
||||
} else {
|
||||
$messages[] = 'No changes were necessary.';
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
default: {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sites = $service->sites();
|
||||
|
||||
$this->smarty->assign('service', $service);
|
||||
$this->smarty->assign('sites', $sites);
|
||||
$this->smarty->assign('messages', $messages);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user