Пример #1
0
    } elseif ($_SESSION['cts']['step'] == 1) {
        //if the user is not this far into the reservation process then kick them back to what process they are currently on
        $response->redirect($GLOBALS['BASE_URL'] . '/reserve/equipment');
    } else {
        $response->redirect($GLOBALS['BASE_URL'] . '/reserve/');
    }
});
//end confirm
respond('/equipment', function ($request, $response, $app) {
    //user page to display the equipment
    if ($_SESSION['cts']['step'] < 1) {
        $response->redirect($GLOBALS['BASE_URL'] . '/reserve/');
    }
    $equipment_id = (int) $request->param('equipment_id');
    if ($equipment_id || $equipment_id == 0) {
        $app->tpl->assign('description', ReserveDatabaseAPI::item_info($equipment_id));
    }
    //grab all of the neccessary information
    $app->tpl->assign('step', $_SESSION['cts']['step']);
    $app->tpl->assign('equipment_id', $equipment_id);
    $app->tpl->assign('categories', ReserveDatabaseAPI::categories());
    $app->tpl->assign('equipment', $_SESSION['cts']['equipment']);
    $app->tpl->display('equipment.tpl');
});
//end equipment
respond('/equipment/add', function ($request, $response, $app) {
    //when a piece of equipment is added by the user
    $equipment_id = (int) $request->equipment_id;
    if ($equipment_id || $equipment_id == 0) {
        $_SESSION['cts']['equipment'][] = $equipment_id;
    }