Пример #1
0
<?php

respond('/', function ($request, $response, $app) {
    $reservations = ReserveDatabaseAPI::by_wp_id($_SESSION['wp_id']);
    $app->tpl->assign('locations', ReserveDatabaseAPI::locations());
    $app->tpl->assign('reservations', $reservations);
    $app->tpl->display('history.tpl');
});
//end /
respond('/pending', function ($request, $response, $app) {
    $reservations = ReserveDatabaseAPI::by_wp_id_pending($_SESSION['wp_id']);
    $app->tpl->assign('locations', ReserveDatabaseAPI::locations());
    $app->tpl->assign('reservations', $reservations);
    $app->tpl->display('history-pending.tpl');
});
//end pending
respond('/search/id/[i:id]', function ($request, $response, $app) {
    $reservation_idx = (int) $request->id;
    $app->tpl->assign('locations', ReserveDatabaseAPI::locations());
    $app->tpl->assign('reservation_idx', $reservation_idx);
    $app->tpl->assign('reservation', ReserveDatabaseAPI::by_id($reservation_idx));
    $app->tpl->display('history-reservation.tpl');
});
//end reservation/search/
respond('/copy/[i:id]', function ($request, $response, $app) {
    $reservation_idx = (int) $request->id;
    $app->tpl->assign('locations', ReserveDatabaseAPI::locations());
    $app->tpl->assign('reservation_idx', $reservation_idx);
    $reserve = ReserveDatabaseAPI::by_id($reservation_idx);
    unset($_SESSION['cts']);
    $_SESSION['cts']['first_name'] = $reserve[$reservation_idx]['fname'];