$ctrl = new \Novosga\Controller\HomeController($app); $response = $ctrl->unidade($app->getContext()); echo $response->toJson(); }); $app->any('/profile', function () use($app) { $ctrl = new \Novosga\Controller\HomeController($app); $ctrl->perfil($app->getContext()); echo $app->render('profile.html.twig'); }); $app->post('/profile/password', function () use($app) { $ctrl = new \Novosga\Controller\HomeController($app); $response = $ctrl->alterar_senha($app->getContext()); echo $response->toJson(); }); $app->get('/print/:id/:hash', function ($id, $hash) use($app) { $ctrl = new \Novosga\Controller\TicketController($app); $template = $ctrl->printAction($app->getContext(), $id, $hash); echo $app->render($template); }); $app->any('/modules/:moduleKey(/:action+)', function ($moduleKey, $action = 'index') use($app, $loader) { define('MODULE', $moduleKey); if (!$app->getAcessoService()->checkAccess($app->getContext(), $moduleKey, $action)) { $app->gotoHome(); } $args = array($app->getContext()); if (is_array($action)) { $args = array_merge($args, array_slice($action, 1)); $action = $action[0]; } // prefixo do nome do controlador do modulo $tokens = explode('.', $moduleKey);
public function imprimir(Context $context) { $id = (int) $context->request()->get('id'); $ctrl = new \Novosga\Controller\TicketController($this->app()); return $ctrl->printTicket($ctrl->getAtendimento($id)); }