Пример #1
0
    //when a piece of equipment is removed by the user
    $equipment_id = (int) $request->id;
    if ($equipment_id || $equipment_id == 0) {
        //make sure that they aren't removing something that doesn't exist
        unset($_SESSION['cts']['equipment'][$equipment_id]);
    }
    $app->tpl->assign('equipment', $_SESSION['cts']['equipment']);
    $response->redirect($GLOBALS['BASE_URL'] . '/reserve/equipment');
});
//end equipment remove
respond('POST', '/event', function ($request, $response, $app) {
    //this is where the information for the event page is inserted into the session
    //grab all of the neccessary parameters
    //first check to make sure that they accepted the agreement
    $agreement = $request->param('agreement');
    $data = ReserveDatabaseAPI::reservation_sanitize($request);
    $reserve = $data['reserve'];
    $app->tpl->assign('reserve', $reserve);
    if (!$agreement) {
        $_SESSION['errors'][] = 'You did not accept the agreement.';
        $app->tpl->display('event.tpl');
        //$response->redirect( $GLOBALS['BASE_URL'] . '/reserve/' );
    } else {
        if ($data['complete'] == false) {
            //if the number of errors is > 0
            $reserve = $data['reserve'];
            $app->tpl->assign('reserve', $reserve);
            $app->tpl->display('event.tpl');
            //$response->redirect( $GLOBALS['BASE_URL'] . '/reserve/' );
        } else {
            //otherwise add all of the information from the request into the session