Exemplo n.º 1
0
})->bind('galeria');
/* Listar contatos */
$app->get('/contatos/', function (Silex\Application $app) {
    try {
        $contatos = $app['client']->query('contato.listar');
        return $app['twig']->render('contatos.twig', array('contatos' => $contatos));
    } catch (ApiException $e) {
        throw new NotFoundHttpException($e->getMessage(), $e, 404);
    }
})->bind('contatos');
/* Listar eventos */
$app->get('/eventos/', function (Silex\Application $app) {
    try {
        appendTitle($app, 'Calendário de Eventos');
        $eventos = $app['client']->query('evento.listar', 'thumb=s');
        $json = Helper::eventosToJson($eventos);
        $hodie = date("Y-m-d");
        return $app['twig']->render('eventos.twig', array('eventos' => $eventos, 'json' => $json, 'hodie' => $hodie));
    } catch (ApiException $e) {
        throw new NotFoundHttpException($e->getMessage(), $e, 404);
    }
})->bind('eventos');
/* Visualizar evento */
$app->get('/evento/{ano}/{mes}/{dia}/{slug}/', function (Silex\Application $app) {
    try {
        $evento = $app['client']->byUri($app['request']->getPathInfo());
        appendTitle($app, 'Eventos');
        appendTitle($app, $evento->titulo);
        $evento = Helper::normalizeEvento($evento);
        return $app['twig']->render('evento.twig', array('pagina' => $evento));
    } catch (ApiException $e) {
Exemplo n.º 2
0
})->bind('galeria');
/* Listar contatos */
$app->get('/contatos/', function (Silex\Application $app) {
    try {
        $contatos = $app['client']->query('contato.listar');
        return $app['twig']->render('contatos.twig', array('contatos' => $contatos));
    } catch (ApiException $e) {
        throw new NotFoundHttpException($e->getMessage(), $e, 404);
    }
})->bind('contatos');
/* Listar eventos */
$app->get('/eventos/', function (Silex\Application $app) {
    try {
        appendTitle($app, 'Calendário de Eventos');
        $eventos = $app['client']->query('evento.listar', 'thumb=s');
        $json = Helper::eventosToJson($eventos, $app);
        $hodie = date("Y-m-d");
        return $app['twig']->render('eventos.twig', array('eventos' => $eventos, 'json' => $json, 'hodie' => $hodie));
    } catch (ApiException $e) {
        throw new NotFoundHttpException($e->getMessage(), $e, 404);
    }
})->bind('eventos');
/* Visualizar evento */
$app->get('/evento/{ano}/{mes}/{dia}/{slug}/', function (Silex\Application $app) {
    try {
        $evento = $app['client']->byUri($app['request']->getPathInfo());
        appendTitle($app, 'Eventos');
        appendTitle($app, $evento->titulo);
        $evento = Helper::normalizeEvento($evento, $app);
        return $app['twig']->render('evento.twig', array('pagina' => $evento));
    } catch (ApiException $e) {