Example #1
0
 /**
  * Build SEO title
  *
  * @param string $pageTitle Title of the current item/page/posts...
  */
 function title($pageTitle = null)
 {
     if (!is_object($this->controller)) {
         return;
     }
     if (!$pageTitle) {
         $pageTitle = $this->controller->pageTitle;
     }
     if (!$pageTitle) {
         $pageTitle = ucwords($this->controller->params['controller']);
     }
     $description = Configure::read('AppSettings.description');
     $nameAndDescription = hsc(Configure::read('AppSettings.site_name'));
     if ($description) {
         $description = hsc($description);
         $nameAndDescription = "{$nameAndDescription} - {$description}";
     }
     if ($this->controller->isHome) {
         $this->controller->pageTitle = $nameAndDescription;
     } else {
         $this->controller->pageTitle = "{$pageTitle} • {$nameAndDescription}";
     }
     $this->controller->set('page_title_for_layout', $pageTitle);
     $this->controller->set('site_title_for_layout', $nameAndDescription);
 }
Example #2
0
 /**
  * 
  * @param AppController $class
  */
 protected function parametros(AppController $class)
 {
     $endereco = null;
     $modelEventos = new Evento();
     $meusEventos = $modelEventos->verificaEventosParaPromoter(Session::read('Usuario.pessoas_id'));
     if (Session::check('Empresa')) {
         $modelEndereco = new Endereco();
         $endereco = $modelEndereco->findEnderecosEmpresa(Session::read('Empresa.empresas_id'));
         $endereco = $endereco[0];
     }
     $class->set('title_layout', 'Painel Administrativo');
     $class->set('endereco', $endereco);
     $class->set('meusEventos', $meusEventos);
 }
Example #3
0
 protected function parametros(\AppController $class)
 {
     $clientes = 0;
     $funcionarios = 0;
     $class->addJs(array('js/chart-js/Chart', 'js/chartjs.init'));
     $endereco = null;
     if (Session::check('Empresa')) {
         $modelCliente = new Cliente();
         $modelFuncionario = new Funcionario();
         $clientes = $modelCliente->clientesProprietario(Session::read('Usuario.pessoas_id'), Session::read('Usuario.roles_id'));
         $clientes = count($clientes);
         $funcionarios = $modelFuncionario->find('all', array('empresas_id' => Session::read('Empresa.empresas_id')));
         $funcionarios = count($funcionarios);
         $endereco = $this->Endereco->findEnderecosEmpresa(Session::read('Empresa.empresas_id'));
         $endereco = $endereco[0];
     }
     $class->set('title_layout', 'Painel Administrativo');
     $class->set('endereco', $endereco);
     $class->set('clientes', $clientes);
     $class->set('funcionarios', $funcionarios);
 }
Example #4
0
 public function json($one, $two = null)
 {
     parent::set($one, $two);
     $this->jsonVars = $this->viewVars;
 }
Example #5
0
 /**
  * Renders a view with information about what caused this Exception. $info['type'] is used to determine what
  * view inside of views/exceptions/ is used. The default is 'unknown.ctp'.
  *
  * @return void
  * @access public
  */
 function render()
 {
     $info = am($this->where(), $this->info);
     $Controller = new AppController();
     $Controller->viewPath = 'exceptions';
     $Controller->layout = 'exception';
     $Dispatcher = new Dispatcher();
     $Controller->base = $Dispatcher->baseUrl();
     $Controller->webroot = $Dispatcher->webroot;
     $isException = true;
     $Controller->set(compact('info', 'isException'));
     $Controller->beforeRender();
     $View = new View($Controller);
     $view = @$info['type'];
     if (!file_exists(VIEWS . 'exceptions' . DS . $view . '.ctp')) {
         $view = 'unknown';
     }
     header("HTTP/1.0 500 Internal Server Error");
     echo $View->render($view);
     return;
 }