case 'delete_POST': $errors = User::Delete($_REQUEST['id']); if ($errors) { $model = User::Get($_REQUEST['id']); $view = "users/delete.php"; } else { if ($format == 'json') { header("Location: ?action=edit&format=json&id={$_REQUEST['id']}"); } else { header("Location: ?sub_action={$sub_action}&id={$_REQUEST['id']}"); } //header("Location: ?sub_action=$sub_action&id=$_REQUEST[id]"); } break; case 'search_GET': $model = User::Search($_REQUEST['q']); $view = 'users/index.php'; break; case 'index_GET': default: $model = User::Get(); $view = 'users/index.php'; break; } switch ($format) { case 'json': echo json_encode($model); break; case 'plain': include __DIR__ . "/../Views/{$view}"; break;