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