} $reservation_idx = $request->id; ReserveDatabaseAPI::delete_reservation($reservation_idx); ReserveDatabaseAPI::delete_messages($reservation_idx); $response->redirect($GLOBALS['BASE_URL'] . '/admin/reservation'); } //delete }); //end reservation/searach/id respond('/reservation/addmessage/[i:id]', function ($request, $response, $app) { //adding a message to a loan $username = $_SESSION['username']; $message = $request->message; $message = filter_var($message, FILTER_SANITIZE_STRING); $reservation_idx = $request->id; ReserveDatabaseAPI::add_message($reservation_idx, $message, $username); $response->redirect($GLOBALS['BASE_URL'] . '/admin/reservation/search/id/' . $reservation_idx); }); //add message to reservation respond('/reservation/search/[a:action]', function ($request, $response, $app) { //searching the reservations by their specfic filters //send the data to the search function $data = ReserveDatabaseAPI::search($request); if ($data['redirect_url']) { //if there was a redirect url in the data, redirect the user there $response->redirect($data['redirect_url']); } //otherwise assign the title and reservations $app->tpl->assign('title', $data['title']); $app->tpl->assign('reservation', $data['reservations']); $app->tpl->display('reservation.tpl');