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


PHP View::className方法代碼示例

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


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

示例1: beforeAction

 public function beforeAction($action)
 {
     // 登錄全局View
     Event::on(View::className(), View::EVENT_BEFORE_RENDER, function () {
         $config = Config::get_config();
         Yii::$app->view->params['global_config'] = $config;
         Yii::$app->view->title = $config->site_title;
     });
     $this->trigger(WechatPlatform::EVENT_PLATFORM_DATA);
     return parent::beforeAction($action);
 }
開發者ID:songhongyu,項目名稱:datecenter,代碼行數:11,代碼來源:UserController.php

示例2: testOptions

 /**
  * @covers \opus\base\behaviors\JsVariablesBehavior::registerJsVariables
  * @covers \opus\base\behaviors\JsVariablesBehavior::outputJsVariables
  */
 public function testOptions()
 {
     $return = 'var _var = {"var":"val","0":"otherNamespace"};var _var=_var||{};_var.test="string";_var.testFloat=23.22;_var.testInt=3;_var.testNull=null;_var.testBool=false;_var.testArray={"nested1":"val1"};_var.testObject={"publicParam":"test"};';
     $behavior = new JsVariablesBehavior();
     $behavior->registerJsVariables($this->getTestData(), '_var', JSON_FORCE_OBJECT);
     $behavior->registerJsVariables(['var' => 'val', 'otherNamespace']);
     $view = $this->getMock(View::className(), ['registerJs']);
     $view->expects($this->once())->method('registerJs')->with($return, View::POS_HEAD);
     $event = new Event();
     $event->sender = $view;
     $behavior->outputJsVariables($event);
 }
開發者ID:opus-online,項目名稱:yii2-base,代碼行數:16,代碼來源:JsVariableBehaviorTest.php

示例3: bootstrap

 public function bootstrap($app)
 {
     $app->on(Application::EVENT_BEFORE_ACTION, function () use($app) {
         if ($app->requestedAction->controller instanceof BackendReviewController) {
             /**
              * Этот кусок отвечает за добавление пустого submission к отзыву,
              * когда отзыв создается в админке
              */
             Event::on(Review::className(), ActiveRecord::EVENT_INIT, [ReviewsBehavior::className(), 'handleInit']);
             BackendEntityEditFormEvent::on(View::className(), BackendReviewController::BACKEND_REVIEW_EDIT_FORM, [$this, 'renderEditForm']);
         }
     });
 }
開發者ID:DevGroup-ru,項目名稱:dotplant2-reviews-expansion-pack,代碼行數:13,代碼來源:Module.php

示例4: init

 /**
  * 初始化方法
  *
  * @return void
  * @author
  **/
 public function init()
 {
     $this->on('beforeAction', function ($event) {
         $deny_uri = ['login', 'js-config', 'registercode', 'findpasswordcode', 'findpasswordcode', 'get-area', 'find-pass'];
         if (Yii::$app->getUser()->isGuest) {
             $request = Yii::$app->getRequest();
             if (!($request->getIsAjax() || $this->_search_values($deny_uri, $request->getUrl()))) {
                 Yii::$app->getUser()->setReturnUrl($request->getUrl());
             }
         }
     });
     // View
     Event::on(View::className(), View::EVENT_BEFORE_RENDER, function () {
         Yii::setAlias('@staticRoot', YII_ENV_DEV ? "@web/static/promeet" : "@web/static/promeet");
         Yii::setAlias('@staticUrl', YII_ENV_DEV ? "@web/static/promeet" : "@web/static/promeet");
         Yii::$app->view->title = "創業服務平台";
     });
 }
開發者ID:songhongyu,項目名稱:datecenter,代碼行數:24,代碼來源:AppController.php

示例5: init

 /**
  * 初始化方法
  *
  * @return void
  * @author
  **/
 public function init()
 {
     $this->on('beforeAction', function ($event) {
         $deny_uri = ['login', 'js-config', 'registercode', 'findpasswordcode', 'findpasswordcode', 'get-area', 'find-pass'];
         if (Yii::$app->getUser()->isGuest) {
             $request = Yii::$app->getRequest();
             if (!($request->getIsAjax() || $this->_search_values($deny_uri, $request->getUrl()))) {
                 Yii::$app->getUser()->setReturnUrl($request->getUrl());
             }
         }
     });
     // View
     Event::on(View::className(), View::EVENT_BEFORE_RENDER, function () {
         Yii::$app->view->params['global_user'] = $this->get_user();
         Yii::$app->view->params['global_config'] = Config::get_config();
         Yii::$app->view->title = $this->config->site_title;
     });
 }
開發者ID:songhongyu,項目名稱:datecenter,代碼行數:24,代碼來源:SubappController.php

示例6: createView

 /**
  * Creates view instance from given configuration.
  * @param array $config view configuration.
  * @return View view instance.
  */
 protected function createView(array $config)
 {
     if (!array_key_exists('class', $config)) {
         $config['class'] = View::className();
     }
     return Yii::createObject($config);
 }
開發者ID:phaniapsr,項目名稱:yiicomm,代碼行數:12,代碼來源:BaseMailer.php

示例7: actionManage

 /**
  * View, create, or update a tree node via ajax
  *
  * @return string json encoded response
  */
 public function actionManage()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     static::checkValidRequest();
     $parentKey = $action = null;
     $modelClass = '\\kartik\\tree\\models\\Tree';
     $isAdmin = $softDelete = $showFormButtons = $showIDAttribute = false;
     $currUrl = $nodeView = $formOptions = $formAction = $breadCrumbs = '';
     $iconsList = $nodeAddlViews = [];
     extract(static::getPostData());
     /**
      * @var Tree $modelClass
      * @var Tree $node
      */
     if (!isset($id) || empty($id)) {
         $node = new $modelClass();
         $node->initDefaults();
     } else {
         $node = $modelClass::findOne($id);
     }
     $module = TreeView::module();
     $params = $module->treeStructure + $module->dataStructure + ['node' => $node, 'parentKey' => $parentKey, 'action' => $formAction, 'formOptions' => empty($formOptions) ? [] : $formOptions, 'modelClass' => $modelClass, 'currUrl' => $currUrl, 'isAdmin' => $isAdmin, 'iconsList' => $iconsList, 'softDelete' => $softDelete, 'showFormButtons' => $showFormButtons, 'showIDAttribute' => $showIDAttribute, 'nodeView' => $nodeView, 'nodeAddlViews' => $nodeAddlViews, 'breadcrumbs' => empty($breadcrumbs) ? [] : $breadcrumbs];
     if (!empty($module->unsetAjaxBundles)) {
         Event::on(View::className(), View::EVENT_AFTER_RENDER, function ($e) use($module) {
             foreach ($module->unsetAjaxBundles as $bundle) {
                 unset($e->sender->assetBundles[$bundle]);
             }
         });
     }
     $callback = function () use($nodeView, $params) {
         return $this->renderAjax($nodeView, ['params' => $params]);
     };
     return self::process($callback, Yii::t('kvtree', 'Error while viewing the node. Please try again later.'), null);
 }
開發者ID:tqsq2005,項目名稱:yii2-tree-manager,代碼行數:39,代碼來源:NodeController.php

示例8: renderView

 public static function renderView($view, $params)
 {
     /** @var View $viewObj */
     $viewObj = Yii::createObject(['class' => View::className()]);
     return $viewObj->render($view, $params);
 }
開發者ID:rcjusto,項目名稱:simplestore,代碼行數:6,代碼來源:StoreUtils.php

示例9: turnOffAssetBundles

 public static function turnOffAssetBundles()
 {
     \yii\base\Event::on(\yii\web\View::className(), \yii\web\View::EVENT_AFTER_RENDER, function ($e) {
         $e->sender->assetBundles = [];
     });
 }
開發者ID:albertborsos,項目名稱:yii2-lib,代碼行數:6,代碼來源:View.php

示例10: makePageTitle

 private function makePageTitle()
 {
     Event::on(View::className(), View::EVENT_AFTER_RENDER, function ($event) {
         $this->application->view->title = implode(' - ', [$this->application->view->title, \Yii::$app->name]);
     });
 }
開發者ID:atoumus,項目名稱:yii2-rss-reader-example,代碼行數:6,代碼來源:Bootstrap.php


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