示例#1
0
    } else {
        $_SESSION['errors'][] = 'This reservation does not exist.';
        $response->redirect($GLOBALS['BASE_URL'] . '/admin/reservation');
    }
});
//recurring reservation
respond('/reservation/id/[i:id]/setrecurring', function ($request, $response, $app) {
    $reservation_idx = $request->id;
    if (ReserveDatabaseAPI::check_reservation($reservation_idx)) {
        if (!isset($_POST['day'])) {
            $_SESSION['errors'][] = "Please select at least one day of the week.";
            $response->redirect($GLOBALS['BASE_URL'] . '/admin/reservation/id/' . $reservation_idx . '/recurring');
        } else {
            //if the reservation that is being set exists, do the math
            $app->tpl->init_all_reservation_info($reservation_idx);
            $dates = ReserveDatabaseAPI::recursive_dates($_POST);
            $count = ReserveDatabaseAPI::insert_loans_recursive($dates, $reservation_idx);
            $_SESSION['successes'][] = 'You have successfully added ' . $count . ' reservations.';
        }
        //grabs the recursive dates
        $response->redirect($GLOBALS['BASE_URL'] . '/admin/reservation/search/id/' . $reservation_idx);
    } else {
        $_SESSION['errors'][] = 'This reservation does not exist.';
        $response->redirect($GLOBALS['BASE_URL'] . '/admin/reservation');
    }
});
//setrecurring reservation
respond('/reservation/id/[i:id]/status', function ($request, $response, $app) {
    //when the staff member is trying to change the status of the loan
    $reservation_idx = $request->id;
    $status = $request->param('status');