当前位置: 首页>>代码示例>>PHP>>正文


PHP Component::beforeRender方法代码示例

本文整理汇总了PHP中Component::beforeRender方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::beforeRender方法的具体用法?PHP Component::beforeRender怎么用?PHP Component::beforeRender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Component的用法示例。


在下文中一共展示了Component::beforeRender方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeRender

 public function beforeRender(Controller $controller)
 {
     if (!in_array($controller->request->params['action'], (array) $this->settings['on'])) {
         return;
     }
     $this->Session->write('Feedback.RatingModels', $this->models);
     foreach ($this->models as $modelClass => $model) {
         $data = $this->readRatingCookie($modelClass);
         $this->Session->write('Feedback.' . $modelClass . 'Ratings', $data);
     }
     if (!in_array('Feedback.Ratings', $controller->helpers)) {
         $controller->helpers[] = 'Feedback.Ratings';
     }
     parent::beforeRender($controller);
 }
开发者ID:cepedag14,项目名称:phkondo,代码行数:15,代码来源:RatingsComponent.php

示例2: beforeRender

 public function beforeRender(Controller $controller)
 {
     parent::beforeRender($controller);
     $controller->set('_pannel', array_merge($this->settings, $this->data));
 }
开发者ID:andrecavallari,项目名称:pannel,代码行数:5,代码来源:PannelComponent.php

示例3: beforeRender

 public function beforeRender()
 {
     $this->controller->data->set('Lightbox', $this);
     return parent::beforeRender();
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:5,代码来源:Lightbox.php

示例4: beforeRender

 /**
  * Automatically create .installed file
  * after controller executes requested action
  * 
  * @param Controller $controller
  */
 public function beforeRender(Controller $controller)
 {
     parent::beforeRender($controller);
     $this->__afterModuleInstaller();
 }
开发者ID:simaostephanie,项目名称:Cloggy,代码行数:11,代码来源:CloggyModuleInstallerComponent.php

示例5: beforeRender

 function beforeRender()
 {
     parent::beforeRender($this);
 }
开发者ID:risman,项目名称:Massidea-CakePHP-2.0,代码行数:4,代码来源:TokenComponent.php

示例6: beforeRender

 /**
  * beforeRender callback
  * レスポンスの描画を行います。
  *
  * @param Controller $controller
  * @return void
  */
 public function beforeRender(Controller $controller)
 {
     if ($this->isApiRequest($controller->request)) {
         if (empty($this->_response)) {
             $this->failure(ApiError::NOT_IMPLEMENTED, 501);
         }
         if ($this->logDb && Configure::read('debug') >= $this->logDb) {
             $this->setResponse('dbLog', $this->_getDbLog());
         }
         $response = $this->getResponse();
         $controller->response->statusCode($response['code']);
         $controller->set(compact('response'));
         $controller->set('_serialize', 'response');
         if ($controller->viewClass === 'View') {
             $controller->viewClass = 'Json';
         }
     }
     return parent::beforeRender($controller);
 }
开发者ID:hiromi2424,项目名称:api,代码行数:26,代码来源:ApiComponent.php

示例7: beforeRender

 /**
  * Before render
  *
  * @param Controller $controller
  * @return void
  */
 public function beforeRender(Controller $controller)
 {
     parent::beforeRender($controller);
     if (BcUtil::isAdminSystem()) {
         $controller->set('contentsSettings', $this->settings['items']);
         // パンくずをセット
         array_unshift($controller->crumbs, array('name' => 'コンテンツ一覧', 'url' => array('plugin' => null, 'controller' => 'contents', 'action' => 'index')));
         if ($controller->subMenuElements && !in_array('contents', $controller->subMenuElements)) {
             array_unshift($controller->subMenuElements, 'contents');
         } else {
             $controller->subMenuElements = ['contents'];
         }
         if ($this->useForm && in_array($controller->request->action, [$this->editAction, 'admin_edit_alias']) && !empty($controller->request->data['Content'])) {
             // フォームをセット
             $this->settingForm($controller, $controller->request->data['Content']['site_id'], $controller->request->data['Content']['id']);
             // フォームを読み込む為のイベントを設定
             // 内部で useForm を参照できない為、ここに記述。
             // フォームの設定しかできないイベントになってしまっている。
             // TODO 改善要
             App::uses('BcContentsEventListener', 'Event');
             CakeEventManager::instance()->attach(new BcContentsEventListener());
         }
     } else {
         // ビューキャッシュ設定
         if (empty($controller->request->query['preview'])) {
             // @deprecated 5.0.0 since 4.0.0
             //	CakePHP3では、ビューキャッシュは廃止となる為、別の方法に移行する
             if ($this->useViewCache && !BcUtil::loginUser('admin') && !isConsole() && !empty($controller->request->params['Content'])) {
                 $controller->helpers[] = 'BcCache';
                 $controller->cacheAction = $controller->Content->getCacheTime($controller->request->params['Content']);
             }
         }
     }
 }
开发者ID:baserproject,项目名称:basercms,代码行数:40,代码来源:BcContentsComponent.php

示例8: beforeRender

 public function beforeRender(Controller $controller)
 {
     parent::beforeRender($controller);
     if ($controller->request->params['prefix'] == 'front') {
         $controller->request->params['prefix'] = '';
     }
 }
开发者ID:baserproject,项目名称:basercms,代码行数:7,代码来源:BcReplacePrefixComponent.php

示例9: beforeRender

 /**
  * beforeRender callback
  *
  * Is called after the controller executes the requested action’s logic, but before the controller’s renders views and layout.
  *
  * - Save the filter, sort and pagination params to the session.
  * - Can be later retrieved via FilterHelper::getBacklink($url)
  *
  * @param Controller $controller
  */
 public function beforeRender(Controller $controller)
 {
     $filterOptions = array();
     if ($this->slug) {
         $filterOptions['slug'] = $this->slug;
     }
     if (!empty($this->activeSort)) {
         foreach ($this->activeSort as $key => $val) {
             if (isset($this->defaultSort) && $this->defaultSort['field'] !== $key || isset($this->defaultSort) && $this->defaultSort['field'] === $key && $this->defaultSort['dir'] !== $val) {
                 $filterOptions['s'] = $key;
                 $filterOptions['d'] = $val;
             }
         }
     }
     if (!empty($this->paginationParams) && isset($this->paginationParams['page']) && $this->paginationParams['page'] != 1) {
         $filterOptions['p'] = $this->paginationParams['page'];
     }
     if ($this->activeLimit && $this->activeLimit !== $this->defaultLimit) {
         $filterOptions['l'] = $this->activeLimit;
     }
     $path = 'FILTER_' . join('.', array($controller->request->params['plugin'], $controller->request->params['controller'], $controller->request->params['action']));
     if (!empty($filterOptions)) {
         $this->Session->write($path, $filterOptions);
     } else {
         $this->Session->delete($path);
     }
     parent::beforeRender($controller);
 }
开发者ID:frankfoerster,项目名称:cakephp-filter,代码行数:38,代码来源:FilterComponent.php


注:本文中的Component::beforeRender方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。