當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Controller::beforeRender方法代碼示例

本文整理匯總了PHP中Cake\Controller\Controller::beforeRender方法的典型用法代碼示例。如果您正苦於以下問題:PHP Controller::beforeRender方法的具體用法?PHP Controller::beforeRender怎麽用?PHP Controller::beforeRender使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cake\Controller\Controller的用法示例。


在下文中一共展示了Controller::beforeRender方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: beforeRender

 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     //        if (!empty($this->request->params['prefix']) && $this->request->params['prefix'] === 'admin') {
     //            $this->layout = 'dashboard';
     //        }
 }
開發者ID:ansidev,項目名稱:cakephp_blog,代碼行數:7,代碼來源:AppController.php

示例2: beforeRender

 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     if ($this->request->is('ajax')) {
         $this->layout = 'ajax';
     }
 }
開發者ID:andrej-griniuk,項目名稱:Neuron,代碼行數:7,代碼來源:AppController.php

示例3: beforeRender

 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     if ($this->Auth->user()) {
         $this->loadModel('Users');
         $user = $this->Users->get($this->Auth->user()['id']);
         $user->last_access = Time::now();
         $this->Users->save($user);
         /*
         $limitOnline = new Time('10 minutes ago');
         $onlineUsers = $this->Users->find()->where(['last_access >=' => $limitOnline, 'id <> '=>$this->Auth->user()['id']]); 
         $nonOnlineUsers = $this->Users->find()->where(['last_access <' => $limitOnline, 'id <> '=>$this->Auth->user()['id']]); 
         $newMessagesUsers = $this->Users->find()->select([
             'Users.id','Users.login',
         ])->join([
             'Chat' => [
                 'table' => 'chat',
                 'type' => 'INNER',
                 'conditions' => 'Chat.to_user_id = Users.id ',
             ]
         ])->where([
             'Chat.created > Users.last_access',
             'Users.id' => $this->Auth->user()['id']
         ]);
         */
     }
     /*
             $this->set('onlineUsers', $onlineUsers);
             $this->set('nonOnlineUsers', $nonOnlineUsers);
             $this->set('newMessagesUsers', $newMessagesUsers);
     */
 }
開發者ID:albertoneto,項目名稱:localhost,代碼行數:32,代碼來源:AppController.php

示例4: beforeRender

 /**
  * @param \Cake\Event\Event $event
  * @return \Cake\Network\Response|null|void
  */
 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     // Automatically shim $this->request->data = $this->Model->find() etc which used to be of type array
     if (!empty($this->request->data) && $this->request->data instanceof Entity) {
         $this->request->data = $this->request->data->toArray();
     }
 }
開發者ID:dereuromark,項目名稱:cakephp-shim,代碼行數:12,代碼來源:Controller.php

示例5: beforeRender

 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     $this->set('user', !is_null($this->Auth->user('id')) ? $this->Auth->user() : false);
     if (!array_key_exists('_serialize', $this->viewVars) && in_array($this->response->type(), ['application/json', 'application/xml'])) {
         $this->set('_serialize', true);
     }
 }
開發者ID:ThreeCMS,項目名稱:ThreeCMS,代碼行數:8,代碼來源:AppController.php

示例6: beforeRender

 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     //ALLOW CONTROLLER ACTIONS
     $this->Auth->allow('load_pages', 'home', 'article_view', 'rss', 'categories', 'contact', 'captcha_image');
     $this->loadModel('Navigation');
     $this->set('main_navigation', $main_navigation = $this->Navigation->find('all', array('order' => 'position ASC')));
     $this->loadModel('Sidebar');
     $this->set('main_sidebar', $main_sidebar = $this->Sidebar->find('all', array('order' => 'position ASC')));
     $this->loadModel('Categories');
     $this->set('sidebar_categories', $sidebar_categories = $this->Categories->find('all', array('order' => 'title ASC')));
 }
開發者ID:keremcankaya0,項目名稱:CakeBlog,代碼行數:12,代碼來源:AppController.php

示例7: beforeRender

 /**
  * 
  * @param Event $event
  */
 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     $this->Cookie->config(['expires' => '+10 days', 'path' => '/']);
     $this->current_lang = 'en_US';
     if (in_array($this->Cookie->read('lang'), array_keys(Configure::read('supported_lang')))) {
         I18n::locale($this->Cookie->read('lang'));
         $this->current_lang = $this->Cookie->read('lang');
     }
     $this->set('current_lang', $this->current_lang);
     /**
      * 
      * initialize the Google Client to verify the google Incomeing Stream
      */
     $client = new \Google_Client();
     $client->setClientId(Configure::read('GPLUS.client_id'));
     $client->setClientSecret(Configure::read('gplus.secret'));
     $client->setRedirectUri(Router::url(['controller' => 'users', 'action' => 'gpluslogin', '_full' => true]));
     $client->setScopes('email');
     $this->set('isFrontPage', $this->isFrontPage);
     $this->set('current_user', $this->current_user);
     $this->set('isUserLoggedIn', $this->isUserLoggedIn);
 }
開發者ID:hunnybohara,項目名稱:coin_bates,代碼行數:27,代碼來源:AppController.php

示例8: beforeRender

 /**
  * Configure the Helper and do automatic render setup if needed
  * 
  * @param Event $event
  */
 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     $this->helpers['CrudViews.Crud'] = ['_CrudData' => $this->_CrudData, 'actions' => ['_ModelActions' => $this->_ModelActions, '_AssociationActions' => $this->_AssociationActions, '_RecordActions' => $this->_RecordActions]];
 }
開發者ID:OrigamiStructures,項目名稱:CrudViews,代碼行數:10,代碼來源:AppController.php

示例9: beforeRender

 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     // Handling the breadcrumb
     $this->set('breadcrumb', $this->breadcrumb);
     $this->getView()->theme = 'AppUi';
 }
開發者ID:eripoll,項目名稱:webiplan,代碼行數:7,代碼來源:AppController.php

示例10: beforeRender

 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     $this->set('breadcrumbs', $this->breadcrumbs);
     $this->set('showBreadcrumb', $this->showBreadcrumb);
 }
開發者ID:hunnybohara,項目名稱:coin_bates,代碼行數:6,代碼來源:AppController.php

示例11: beforeRender

 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     if ($this->request->query('is_dialog')) {
         //TODO: convert popup dialog to a plugin
         $this->viewBuilder()->layout('admin_popup');
     }
 }
開發者ID:mohammadsaleh,項目名稱:spider,代碼行數:8,代碼來源:SpiderController.php

示例12: beforeRender

 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     $this->layout = 'admin';
 }
開發者ID:augustovs,項目名稱:l2_teste,代碼行數:5,代碼來源:AdminAppController.php

示例13: beforeRender

 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     $this->set('imageFields', $this->imageFields);
     $this->handleAjaxFormRequest();
     $this->set('titleLayout', $this->titleLayout);
 }
開發者ID:nguyennghiem1205,項目名稱:japan-circle,代碼行數:7,代碼來源:AppController.php

示例14: beforeRender

 /**
  * beforeRender hook method.
  *
  * @param Event $event The beforeRender event that was fired.
  *
  * @return void
  */
 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     if ($this->components()->has('Auth')) {
         $builder = $this->viewBuilder();
         $builder->helpers(['Acl' => $this->Auth->config('authorize')['Acl.Actions']]);
     }
 }
開發者ID:Xety,項目名稱:Xeta,代碼行數:15,代碼來源:AppController.php

示例15: beforeRender

 /**
  * Before render callback.
  *
  * @param \Cake\Event\Event $event The beforeRender event.
  * @return void
  */
 public function beforeRender(Event $event)
 {
     parent::beforeRender($event);
     $isRest = in_array($this->response->type(), ['application/json', 'application/xml']);
     if (!array_key_exists('_serialize', $this->viewVars) && $isRest) {
         $this->set('_serialize', true);
     }
 }
開發者ID:josegonzalez,項目名稱:app,代碼行數:14,代碼來源:AppController.php


注:本文中的Cake\Controller\Controller::beforeRender方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。