示例#1
0
 function beforeRender()
 {
     parent::beforeRender();
     $this->set('parent_categories', ClassRegistry::init('Category')->getParentCategories());
     // Admin permissions
     if (!empty($this->request->params['prefix']) && $this->request->params['prefix'] == 'admin') {
         $this->loadModel('User');
         $this->set('permitted_controllers', $this->User->getWhitelist(AuthComponent::user('role')));
     }
     $this->set('overriden_response', $this->Session->read('response_replaced'));
     // Get number of modified services for currently logged in Facilitator
     if ($this->Auth->user('role') == 'f') {
         $facilitatorId = $this->Auth->user('id');
         // Get updated records
         $facilitatorChampions = $this->User->find('all', array('conditions' => array('facilitator_id' => $facilitatorId)));
         $this->loadModel('ServiceEdit');
         $modifiedServicesForFacilitator = 0;
         foreach ($facilitatorChampions as $key => $value) {
             $modifiedServicesForFacilitator += $this->ServiceEdit->find('count', array('conditions' => array('user_id' => $value['User']['id'], 'approved' => 0)));
         }
         $this->set(compact('modifiedServicesForFacilitator'));
     }
     // Disable login
     //$this->Auth->logout();
     //$this->Session->setFlash( '<strong>Login and registration is currently disabled while we undergo maintenance.</strong> Thanks for your patience.' );
 }
 public function beforeRender()
 {
     $this->_setDate();
     $this->set('bodyClass', sprintf('%s %s', strtolower($this->name), strtolower($this->name) . '-' . strtolower($this->action)));
     $this->set(array('isAdmin' => $this->isPrefix('admin'), 'title_for_layout' => $this->titleForLayout, 'currentUser' => $this->currentUser, 'estadosBrasil' => Configure::read('estadosBrasil')));
     return parent::beforeRender();
 }
示例#3
0
 protected function beforeRender($view)
 {
     if (!$this->module->embed) {
         $this->layout = '/layouts/wdcalendar';
     }
     return parent::beforeRender($view);
 }
示例#4
0
 public function beforeRender()
 {
     parent::beforeRender();
     if (isset($this->request->query['ajax'])) {
         unset($this->request->query['ajax']);
     }
 }
示例#5
0
 public function beforeRender()
 {
     parent::beforeRender();
     if ($this->name == 'CakeError') {
         $this->layout = 'default_error';
     }
 }
 /**
  * CakePHP's beforeRender callback.
  *
  * @return  void
  * @access  public
  */
 public function beforeRender()
 {
     parent::beforeRender();
     # Set a default page title so that the controller name isn't used
     # @see cake/libs/view/view.php line 480
     $this->set('title_for_layout', '');
 }
 public function beforeRender()
 {
     parent::beforeRender();
     if ($this->request->params['action'] == 'index') {
         $this->set('messageConfirmDelete', $this->Config['Messages']['delete.confirm']);
         $this->set('messagePaginatorDisplay', $this->Config['Messages']['paginator.display']);
     }
 }
 public function beforeRender()
 {
     parent::beforeRender();
     if (empty($this->bootSwatched)) {
         $this->bootSwatched = 'Default';
     }
     $this->set('bootSwatched', $this->bootSwatched);
 }
 public function beforeRender($view)
 {
     parent::beforeRender($view);
     Yii::app()->clientScript->registerPackage('bootstrap');
     Yii::app()->clientScript->registerPackage('font-awesome');
     Yii::app()->clientScript->registerPackage('jquery.formstyler');
     return true;
 }
 public function beforeRender()
 {
     //        $this->Auth->allow('read_index', 'read_view', 'search', 'signin', 'signup', 'resetcache', 'reset_cache', 'api_read');
     parent::beforeRender();
     if (isset($this->request->query['dev'])) {
         $this->layout = 'dev';
     }
 }
 public function beforeRender()
 {
     $this->layout = 'lay';
     if (isset($this->no_layout[$this->action]) && $this->no_layout[$this->action] == true) {
         $this->layout = '';
     }
     parent::beforeRender();
 }
示例#12
0
 /**
  * Before render callback
  * @see controller::beforeRender
  * @return void
  */
 function beforeRender()
 {
     if ($this->name == 'CakeError') {
         $this->layout = 'error';
     }
     $this->Log->log();
     parent::beforeRender();
 }
示例#13
0
 public function beforeRender()
 {
     parent::beforeRender();
     $fullName = '';
     if ($this->Auth->user()) {
         $fullName = $this->Auth->user('name');
     }
     $this->set('fullName', $fullName);
 }
 public function beforeRender()
 {
     $ctl = $this;
     $auth = $ctl->Auth;
     $title = $ctl->title;
     $keywords = $ctl->keywords;
     $ctl->set(compact('auth', 'title', 'keywords'));
     return parent::beforeRender();
 }
示例#15
0
 public function beforeRender()
 {
     parent::beforeRender();
     if ($this->_needProjectMenuBar) {
         $this->loadModel('Deployment');
         $lastDeployment = $this->Deployment->find('first', array('conditions' => array('project_id' => $this->request->pass[0], 'status' => 'completed'), 'order' => array('id desc')));
         $this->set('LastDeployment', $lastDeployment);
     }
 }
示例#16
0
 public function beforeRender()
 {
     parent::beforeRender();
     if (isset($this->request->data['User']['password'])) {
         unset($this->request->data['User']['password']);
     }
     if (isset($this->request->data['User']['pwd'])) {
         unset($this->request->data['User']['pwd']);
     }
 }
示例#17
0
 public function beforeRender()
 {
     parent::beforeRender();
     $appName = Configure::read('APPLICATION_NAME');
     $loggedInUserId = $this->loggedInUserId = $this->loggedInUserId();
     $loggedInUserRole = $this->loggedInUserRole = $this->loggedInUserRole();
     $loggedInUserName = $this->loggedInUserName = $this->loggedInUserName();
     $loggedInUserFirstName = $this->loggedInUserFirstName = $this->loggedInUserFirstName();
     $loggedInUserLastName = $this->loggedInUserLastName = $this->loggedInUserLastName();
     $this->set(compact('appName', 'loggedInUserId', 'loggedInUserRole', 'loggedInUserLastName', 'loggedInUserFirstName', 'loggedInUserName'));
 }
示例#18
0
 public function beforeRender()
 {
     parent::beforeRender();
     if (isset($this->params['prefix']) && $this->params['prefix'] == 'admin') {
         $this->set('loggedAs', $this->loggedAs);
     } else {
         $this->LoadModel('Subpage');
         $nav = $this->_getSiteNav($this->Subpage->find('all', array('order' => 'lft ASC', 'fields' => array('title', 'url', 'type'), 'conditions' => array('in_menu' => 1))));
         $this->set(compact('nav'));
     }
 }
 function beforeRender()
 {
     parent::beforeRender();
     if (!defined("DEFAULT_URL")) {
         define("DEFAULT_URL", Router::url("/", true));
     }
     if (!isset($config)) {
         $this->loadModel('Configuracao');
         $config = $this->Configuracao->find('list', array('fields' => array('pin', 'conteudo')));
         $this->set('config', $config);
         //            $this->Session->write('Storage.config', $config);
     }
     if (isset($this->params['admin']) && $this->params['controller'] != 'wizard') {
         $this->layout = 'admin';
     } else {
         if ($config['mostrar_noticias_lateral'] && !isset($noticias_lateral)) {
             $this->loadModel('Noticia');
             $noticias = $this->Noticia->find('all', array('conditions' => array('Noticia.ativo' => 1), 'order' => 'Noticia.destaque ASC, Noticia.data DESC', 'limit' => !empty($config['qtde_noticias_lateral']) ? $config['qtde_noticias_lateral'] : 5));
             $this->set('noticias_lateral', $noticias);
         }
         if ($config['mostrar_produtos_lateral'] && !isset($produtos_lateral)) {
             $this->loadModel('Produto');
             $produtos = $this->Produto->find('all', array('conditions' => array('Produto.ativo' => 1), 'order' => 'Produto.destaque ASC', 'limit' => !empty($config['qtde_produtos_lateral']) ? $config['qtde_produtos_lateral'] : 5));
             $this->set('produtos_lateral', $produtos);
         }
         if (!isset($opcoes_menu)) {
             $this->loadModel('Pagina');
             $paginas = $this->Pagina->find('all', array('conditions' => array('Pagina.ativo' => 1), 'fields' => array('pin', 'titulo')));
             $this->set('opcoes_menu', $paginas);
         }
         if ($config['usa_produtos'] && !isset($itens_produto_categorias)) {
             $this->loadModel('ProdutoCategoria');
             $produto_categorias = $this->ProdutoCategoria->find('all', array('conditions' => array('ProdutoCategoria.ativo' => 1, 'ProdutoCategoria.parent_id' => null), 'order' => 'ProdutoCategoria.nome ASC', 'fields' => array('ProdutoCategoria.id', 'ProdutoCategoria.nome'), 'recursive' => 5, 'contain' => array('CategoriaFilha' => array('fields' => array('CategoriaFilha.id', 'CategoriaFilha.nome'), 'CategoriaFilha' => array('fields' => array('CategoriaFilha.id', 'CategoriaFilha.nome'), 'CategoriaFilha' => array('fields' => array('CategoriaFilha.id', 'CategoriaFilha.nome'), 'CategoriaFilha' => array('fields' => array('CategoriaFilha.id', 'CategoriaFilha.nome'), 'CategoriaFilha' => array('fields' => array('CategoriaFilha.id', 'CategoriaFilha.nome')))))))));
             //            $produto_categorias = $this->ProdutoCategoria->generateTreeList(array('ProdutoCategoria.ativo' => 1), null, null, '<ul><li>');
             $this->set('itens_produto_categorias', $produto_categorias);
         }
         if ($config['usa_noticias'] && !isset($itens_noticia_categorias)) {
             $this->loadModel('NoticiaCategoria');
             $noticia_categorias = $this->NoticiaCategoria->find('all', array('conditions' => array('NoticiaCategoria.ativo' => 1, 'NoticiaCategoria.parent_id' => null), 'order' => 'NoticiaCategoria.nome ASC', 'fields' => array('NoticiaCategoria.id', 'NoticiaCategoria.nome'), 'recursive' => 5, 'contain' => array('CategoriaFilha' => array('fields' => array('CategoriaFilha.id', 'CategoriaFilha.nome'), 'CategoriaFilha' => array('fields' => array('CategoriaFilha.id', 'CategoriaFilha.nome'), 'CategoriaFilha' => array('fields' => array('CategoriaFilha.id', 'CategoriaFilha.nome'), 'CategoriaFilha' => array('fields' => array('CategoriaFilha.id', 'CategoriaFilha.nome'), 'CategoriaFilha' => array('fields' => array('CategoriaFilha.id', 'CategoriaFilha.nome')))))))));
             //            $produto_categorias = $this->ProdutoCategoria->generateTreeList(array('ProdutoCategoria.ativo' => 1), null, null, '<ul><li>');
             $this->set('itens_noticia_categorias', $noticia_categorias);
         }
         $this->set('banners', $this->getBanners());
         //        $this->loadModel('Menu');
         //        $menu = $this->Menu->find('list', array(
         //            'fields' => array(
         //                'link',
         //                'nome'
         //            )
         //                ));
         //        $this->set('menu', $menu);
     }
 }
示例#20
0
 function beforeRender()
 {
     parent::beforeRender();
     /*
     		$data=explode(',',$_SERVER['HTTP_USER_AGENT']);
     		$userinfo=array();
     		foreach($data as $d){
     			$temp=explode(":",$d);
     			$userInfo[]=array($temp[0]=>$temp[1]);
     		}*/
     $userInfo = null;
     $this->set('userInfo', $userInfo);
 }
示例#21
0
 function beforeRender()
 {
     parent::beforeRender();
     // Se cliente nao estiver logado
     if (!$this->Auth->loggedIn()) {
         /*
          * Altera o layout para todos os erros do Cake
          * http://groups.google.com/group/cake-php/browse_thread/thread/090eb7d3bbe179cb
          */
         if ($this->name === 'CakeError') {
             $this->layout = 'erro';
         }
     }
 }
示例#22
0
 public function beforeRender()
 {
     // only compile it on development mode
     if (Configure::read('debug') > 0) {
         // import the file to application
         App::import('Vendor', 'lessc');
         // set the LESS file location
         $less = ROOT . DS . APP_DIR . DS . 'webroot' . DS . 'less' . DS . 'main.less';
         // set the CSS file to be written
         $css = ROOT . DS . APP_DIR . DS . 'webroot' . DS . 'css' . DS . 'main.css';
         // compile the file
         lessc::ccompile($less, $css);
     }
     parent::beforeRender();
 }
示例#23
0
 function beforeRender()
 {
     parent::beforeRender();
     if ($this->layout == 'dashboard') {
         $this->loadModel('Project');
         $this->loadModel('Article');
         $this->loadModel('Event');
         $this->loadModel('Album');
         $this->Article->locale = $this->getConfig['default_language'];
         $this->Project->locale = $this->getConfig['default_language'];
         $this->Event->locale = $this->getConfig['default_language'];
         $this->Album->locale = $this->getConfig['default_language'];
         $defaultLogin = array('username' => $this->Auth->user('username'), 'articles' => $this->Article->find('count'), 'projects' => $this->Project->find('count'), 'discographies' => $this->Project->Discography->find('count'), 'nextEvents' => $this->Event->find('count', array('conditions' => array('OR' => array('start_date >=' => date('Y-m-d H:i:s'), 'end_date >=' => date('Y-m-d H:i:s'))))), 'albums' => $this->Album->find('count'), 'videos' => $this->Project->Video->find('count'));
         $this->set(compact('defaultLogin'));
     }
 }
示例#24
0
 /**
  * test beforeRender() method
  *
  * @test
  */
 public function beforeRender()
 {
     $this->generateComponent(['mocks' => ['Api' => ['isApiRequest', 'failure', 'setResponse', '_getDbLog', 'getResponse']], 'componentOptions' => ['logDb' => true]]);
     $this->Api->expects($this->once())->method('failure');
     $this->Api->expects($this->once())->method('isApiRequest')->will($this->returnValue(true));
     $this->Api->expects($this->once())->method('_getDbLog')->will($this->returnValue('testDbLog'));
     $this->Api->expects($this->once())->method('setResponse')->with('dbLog', 'testDbLog');
     $this->Api->expects($this->once())->method('getResponse')->will($this->returnValue(['code' => 401]));
     $this->Api->beforeRender($this->controller);
     $this->assertSame(401, $this->response->statusCode());
     $this->assertArrayHasKey('response', $this->controller->viewVars);
     $this->assertSame(['code' => 401], $this->controller->viewVars['response']);
     $this->assertArrayHasKey('_serialize', $this->controller->viewVars);
     $this->assertSame('response', $this->controller->viewVars['_serialize']);
     $this->assertSame('Json', $this->controller->viewClass);
 }
 function beforeRender()
 {
     if (!$this->layout) {
         if (Configure::read('Routing.admin') && !empty($this->params['admin'])) {
             $this->layout = 'admin_default';
         } elseif (!empty($this->params['prefix'])) {
             $this->layout = $this->params['prefix'] . '_default';
         } else {
             $this->layout = 'default';
         }
     }
     if ($this->layout == 'ajax') {
         Configure::write('debug', 0);
     } else {
         parent::beforeRender();
     }
 }
示例#26
0
 function beforeRender()
 {
     parent::beforeRender();
     //         if ($this->params['prefix'] === 'admin'):
     //            Configure::write('debug', 2);
     //        else:
     //            Configure::write('debug', 0);
     //        endif;
     if (isset($this->params['prefix']) && $this->params['prefix'] == 'admin' && !$this->params['isAjax']) {
         $this->layout = 'admin';
     } else {
         // Pour le layout public
         $this->set('categories', $this->Category->find('all', array('order' => array('Category.created DESC'))));
         $this->set('promoted', $this->Product->find('all', array('conditions' => array('Product.isPromoted' => true), 'order' => array('Product.created DESC'))));
         $this->layout = 'default';
     }
 }
示例#27
0
 public function beforeRender()
 {
     // Error layout 変更
     if ($this->name == 'CakeError') {
         $this->layout = 'messages';
     }
     // only compile it on development mode
     if (Configure::read('debug') > 0) {
         // import the file to application
         App::import('Vendor', 'lessc');
         // set the LESS file location
         $less = ROOT . DS . APP_DIR . DS . 'webroot' . DS . 'css' . DS . 'style.less';
         // set the CSS file to be written
         $css = ROOT . DS . APP_DIR . DS . 'webroot' . DS . 'css' . DS . 'style.css';
         // compile the file
         lessc::ccompile($less, $css);
     }
     parent::beforeRender();
 }
示例#28
0
 /**
  * Before Render method
  *
  * sets a few variables needed for all views
  */
 public function beforeRender()
 {
     // trying to find a bot that is spamming analytics (but it seems to kill real error log reporting - fyi)
     // CakeLog::write('error', $_SERVER['REMOTE_ADDR']);
     // CakeLog::write('error', $_SERVER['HTTP_USER_AGENT']);
     // CakeLog::write('error', $_SERVER['REQUEST_URI']);
     // CakeLog::write('error', $_SERVER['REQUEST_URI']);
     // CakeLog::write('error', '...
     // ...
     // ...
     // ...
     // ');
     //CakeLog::write('error', print_r($_SERVER, true));
     parent::beforeRender();
     $this->set('referer', $this->referer());
     // used for back button links, could be useful for breadcrumbs possibly
     $this->set('_serialize', array_keys($this->viewVars));
     $this->set('_view', $this->view);
     // do a final permission check on the user field
     $modelName = Inflector::singularize($this->name);
     if (!empty($this->{$modelName})) {
         $this->set('_layout', $this->{$modelName}->theme);
         // set in the themeable behavior
         $this->Acl->check(array('permission' => true), $this->{$modelName}->permissionData);
     }
     // order is important for these automatic view vars
     $this->set('page_title_for_layout', $this->_pageTitleForLayout());
     $alias = ZuhaSet::find_key($this->viewVars, 'Alias');
     $alias = end($alias);
     $this->set('title_for_layout', !empty($alias['title']) ? $alias['title'] : $this->_titleForLayout());
     $this->set('keywords_for_layout', !empty($alias['keywords']) ? $alias['keywords'] : null);
     $this->set('description_for_layout', !empty($alias['description']) ? $alias['description'] : $this->_descriptionForLayout());
 }
示例#29
0
 public function beforeRender()
 {
     parent::beforeRender();
     $this->paramToData();
 }
示例#30
0
 /**
  * beforeRender
  *
  * @return	void
  * @access	public
  */
 function beforeRender()
 {
     parent::beforeRender();
     // モバイルでは、mobileHelper::afterLayout をフックしてSJISへの変換が必要だが、
     // エラーが発生した場合には、afterLayoutでは、エラー用のビューを持ったviewクラスを取得できない。
     // 原因は、エラーが発生する前のcontrollerがviewを登録してしまっている為。
     // エラー時のview登録にフックする場所はここしかないのでここでviewの登録を削除する
     if ($this->name == 'CakeError') {
         ClassRegistry::removeObject('view');
     }
     $this->__loadDataToView();
     $this->set('isSSL', $this->RequestHandler->isSSL());
     $this->set('safeModeOn', ini_get('safe_mode'));
     $this->set('contentsTitle', $this->contentsTitle);
     $this->set('baserVersion', $this->getBaserVersion());
     $this->set('siteConfig', $this->siteConfigs);
     if (isset($this->siteConfigs['widget_area'])) {
         $this->set('widgetArea', $this->siteConfigs['widget_area']);
     }
 }