当前位置: 首页>>代码示例>>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;未经允许,请勿转载。