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


PHP Url::remember方法代码示例

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


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

示例1: actionDetails

 public function actionDetails($id)
 {
     // Нужен для возврата на страницу после логина
     // Возможно делается как-то проще
     Url::remember();
     $trainingMatch = TrainingMatch::find()->with('greenPlayers', 'purplePlayers', 'refusedPlayers')->with(['greenPlayers.playerStars' => function ($query) use($id) {
         $query->where(['training_match_id' => $id]);
     }, 'purplePlayers.playerStars' => function ($query) use($id) {
         $query->where(['training_match_id' => $id]);
     }])->where(['id' => $id])->orderBy('')->asArray()->one();
     // Merge all players
     // accepted or refused current match
     $players = array_merge($trainingMatch['greenPlayers'], $trainingMatch['purplePlayers'], $trainingMatch['refusedPlayers']);
     $playerIds = array_map(function ($player) {
         return $player['id'];
     }, $players);
     // Other players
     $otherPlayers = Player::find()->with('playerStatisticSummary')->where(['not in', 'id', $playerIds])->all();
     // Sort players by games count
     usort($otherPlayers, function ($a, $b) {
         return $b['playerStatisticSummary']['count_games'] - $a['playerStatisticSummary']['count_games'];
     });
     $matchTimestamp = strtotime($trainingMatch['date_time']);
     return $this->render('details', ['trainingMatch' => $trainingMatch, 'otherPlayers' => $otherPlayers, 'weather' => WeatherService::getWeather($matchTimestamp)]);
 }
开发者ID:kuznetsov0209,项目名称:mercdev-soccer-server,代码行数:25,代码来源:TrainingMatchController.php

示例2: actionIndex

 /**
  * Lists all Book models.
  * @return mixed
  */
 public function actionIndex()
 {
     Url::remember(Url::current(), 'books');
     $searchModel = new BookSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
开发者ID:tdimdimich,项目名称:tt_yii2,代码行数:11,代码来源:BookController.php

示例3: actionList

 /**
  * @return string
  */
 public function actionList()
 {
     Url::remember(Url::current(), self::REMEMBER_NAME);
     $this->getView()->addBread('List');
     $searchPrice = new SearchPrice();
     return $this->render('list', ['searchPrice' => $searchPrice]);
 }
开发者ID:Sywooch,项目名称:EVE-Manager-Yii-2.x,代码行数:10,代码来源:IndexController.php

示例4: actionUpdateProfile

 public function actionUpdateProfile($id)
 {
     \yii\helpers\Url::remember('', 'actions-redirect');
     $user = $this->findModel($id);
     $profile = \backend\models\Profile::findOne(['user_id' => $user->id]);
     if ($profile == null) {
         $profile = Yii::createObject(\backend\models\Profile::className());
         $profile->link('user', $user);
     }
     $this->performAjaxValidation($profile);
     if ($profile->load(Yii::$app->request->post())) {
         $profile->fileProfile = \yii\web\UploadedFile::getInstance($profile, 'fileProfile');
         $save_fileProfile = '';
         if ($profile->fileProfile) {
             $imagepath = 'uploads/profile/';
             // Create folder under web/uploads/logo
             $profile->image_profile = $imagepath . rand(10, 100) . '-' . $profile->fileProfile->name;
             $save_fileProfile = 1;
         }
         if ($profile->save()) {
             if ($save_fileProfile) {
                 $profile->fileProfile->saveAs($profile->image_profile);
             } else {
                 echo 'ada yang salah';
             }
             Yii::$app->getSession()->setFlash('success', Yii::t('user', 'Profile details have been updated'));
             return $this->refresh();
         }
     }
     return $this->render('_profile', ['user' => $user, 'profile' => $profile]);
 }
开发者ID:deviardn,项目名称:diadoo,代码行数:31,代码来源:AdminController.php

示例5: actionIndex

 /**
  * Lists all Employee models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new EmployeeSearch();
     $dataProvider = $searchModel->search(isset($_GET['q']) ? $_GET['q'] : null);
     Url::remember();
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
开发者ID:johnitvn,项目名称:mg075hynlo5793r5gt,代码行数:11,代码来源:EmployeeController.php

示例6: run

 public function run()
 {
     Url::remember('', $this->generateKey());
     // create temporary file
     $model = $this->_model;
     $twigCode = $model ? $model->value : null;
     $tmpFile = \Yii::getAlias('@runtime') . '/' . md5($twigCode);
     file_put_contents($tmpFile, $twigCode);
     $render = new ViewRenderer();
     try {
         $html = $render->render('renderer.twig', $tmpFile, []);
     } catch (\Twig_Error $e) {
         \Yii::$app->session->addFlash('warning', $e->getMessage());
         $html = '';
     }
     if (\Yii::$app->user->can(self::ACCESS_ROLE)) {
         $link = Html::a('prototype module', $model ? $this->generateEditRoute($model->id) : $this->generateCreateRoute());
         if ($this->enableFlash) {
             \Yii::$app->session->addFlash($html ? 'success' : 'info', "Edit contents in {$link}, key: <code>{$this->generateKey()}</code>");
         }
         if (!$model && $this->renderEmpty) {
             $html = $this->renderEmpty();
         }
     }
     \Yii::trace('Twig widget rendered', __METHOD__);
     return $html;
 }
开发者ID:dmstr,项目名称:yii2-prototype-module,代码行数:27,代码来源:TwigWidget.php

示例7: actionIndex

 public function actionIndex()
 {
     Url::remember('', 'actions-redirect');
     $searchModel = Yii::createObject(UserSearch::className());
     $dataProvider = $searchModel->search(Yii::$app->request->get());
     return $this->render('index', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]);
 }
开发者ID:babejsza,项目名称:kurslowiecki,代码行数:7,代码来源:AdminController.php

示例8: actionPage

 /**
  * renders a page view from the database
  *
  * @param $id
  * @param null $pageName
  * @param null $parentLeave
  *
  * @return string
  * @throws HttpException
  */
 public function actionPage($id, $pageName = null, $parentLeave = null)
 {
     Url::remember();
     \Yii::$app->session['__crudReturnUrl'] = null;
     // Set layout
     $this->layout = '@app/views/layouts/main';
     // Get active Tree object, allow access to invisible pages
     // @todo: improve handling, using also roles
     $pageQuery = Tree::find()->where([Tree::ATTR_ID => $id, Tree::ATTR_ACTIVE => Tree::ACTIVE, Tree::ATTR_ACCESS_DOMAIN => \Yii::$app->language]);
     // Show disabled pages for admins
     if (!\Yii::$app->user->can('pages')) {
         $pageQuery->andWhere([Tree::ATTR_DISABLED => Tree::NOT_DISABLED]);
     }
     // get page
     $page = $pageQuery->one();
     if ($page !== null) {
         // Set page title
         $this->view->title = $page->page_title;
         // Register default SEO meta tags
         $this->view->registerMetaTag(['name' => 'keywords', 'content' => $page->default_meta_keywords]);
         $this->view->registerMetaTag(['name' => 'description', 'content' => $page->default_meta_description]);
         if (\Yii::$app->user->isGuest) {
             Yii::$app->response->headers->set('Expires', gmdate('D, d M Y H:i:s \\G\\M\\T', time() + (getenv("HTTP_EXPIRES") !== null ? getenv("HTTP_EXPIRES") : 0)));
         }
         // Render view
         return $this->render($page->view, ['page' => $page]);
     } else {
         throw new HttpException(404, \Yii::t('app', 'Page not found.') . ' [ID: ' . $id . ']');
     }
 }
开发者ID:rochdi80tn,项目名称:yii2-pages-module,代码行数:40,代码来源:DefaultController.php

示例9: run

 public function run()
 {
     $model = new Comments();
     if (!is_string($this->model)) {
         $model->post_id = $this->model->getPrimaryKey();
         $model->module = get_class($this->model);
         $order = '';
     } else {
         $model->post_id = 0;
         $model->module = $this->model;
         $order = 'DESC';
     }
     //  Получаем комментарии этого модуля и пост айди
     $models = Comments::getComments($model->module, $model->post_id, $order);
     //  Получаем кол-во страниц комментариев для редиректа
     $page = $models['pages']->totalCount / $models['pages']->pageSize + 1;
     if ($model->load(Yii::$app->request->post())) {
         if ($model->save()) {
             Url::remember(Url::current());
             Yii::$app->getSession()->setFlash('success', '<i class="fa fa-check fa-1x"></i> Good! ');
             if (!is_string($this->model)) {
                 return Yii::$app->getResponse()->redirect('/post/' . $this->model->slug . '/' . $model->post_id . '?page=' . round($page) . '#' . $model->id);
             } else {
                 return Yii::$app->getResponse()->refresh();
             }
         }
     }
     return $this->render('widgetComment', ['model' => $model, 'models' => $models['models'], 'pages' => $models['pages'], 'options' => $this->options]);
 }
开发者ID:psych88,项目名称:fifa,代码行数:29,代码来源:CommentWidget.php

示例10: actionIndex

 /**
  * Lists all User models.
  * @return mixed
  */
 public function actionIndex()
 {
     Url::remember(Yii::$app->getRequest()->getUrl());
     $searchModel = new UserSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
开发者ID:hiscaler,项目名称:yii2-app-basic-skeleton,代码行数:11,代码来源:UsersController.php

示例11: actionIndex

 /**
  * Lists all RedirectUrl models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new RedirectUrlSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     Url::remember();
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
开发者ID:quyettvq,项目名称:luspel,代码行数:11,代码来源:RedirectUrlController.php

示例12: actionIndex

 /**
  * Lists all Model models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new Search();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     Url::remember(Url::to(''), static::FILTERED_LINK_KEY);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'authorsAssoc' => \app\models\authors\Model::getAllAsAssoc()]);
 }
开发者ID:n82786603,项目名称:something,代码行数:11,代码来源:BooksController.php

示例13: actionView

 /**
  * Shows information about Payment.
  *
  * @param int $id
  *
  * @return string
  */
 public function actionView($id)
 {
     Url::remember('', 'actions-redirect');
     $payment = $this->findModel($id);
     $itemsDp = new ActiveDataProvider(['query' => $payment->getItems()]);
     return $this->render('view', ['model' => $payment, 'itemsDp' => $itemsDp]);
 }
开发者ID:anek77713,项目名称:yii2-account-billing,代码行数:14,代码来源:AdminPaymentController.php

示例14: actionMatrix

 public function actionMatrix()
 {
     $this->sidebar = ['parent' => 'sidebar-identity', 'child' => 'matrix'];
     // Remember return url for crud
     Url::remember(['permission/matrix'], 'roles');
     return parent::actionMatrix(CoreGlobal::TYPE_SYSTEM);
 }
开发者ID:cmsgears,项目名称:module-core,代码行数:7,代码来源:PermissionController.php

示例15: actionPage

 /**
  * renders a page view from the database.
  *
  * @param $pageId
  * @param null $pageName
  * @param null $parentLeave
  *
  * @return string
  *
  * @throws HttpException
  */
 public function actionPage($pageId, $pageName = null, $parentLeave = null)
 {
     Url::remember();
     \Yii::$app->session['__crudReturnUrl'] = null;
     // Set layout
     $this->layout = '@app/views/layouts/main';
     // Get active Tree object, allow access to invisible pages
     // @todo: improve handling, using also roles
     $pageQuery = Tree::find()->where([Tree::ATTR_ID => $pageId, Tree::ATTR_ACTIVE => Tree::ACTIVE, Tree::ATTR_ACCESS_DOMAIN => \Yii::$app->language]);
     // Show disabled pages for admins
     if (!\Yii::$app->user->can('pages')) {
         $pageQuery->andWhere([Tree::ATTR_DISABLED => Tree::NOT_DISABLED]);
     }
     // get page
     $page = $pageQuery->one();
     if ($page !== null) {
         // Set page title, use name as fallback
         $this->view->title = $page->page_title ?: $page->name;
         // Register default SEO meta tags
         $this->view->registerMetaTag(['name' => 'keywords', 'content' => $page->default_meta_keywords]);
         $this->view->registerMetaTag(['name' => 'description', 'content' => $page->default_meta_description]);
         // Render view
         return $this->render($page->view, ['page' => $page]);
     } else {
         if ($fallbackPage = $this->resolveFallbackPage($pageId)) {
             \Yii::trace('Resolved fallback URL for ' . $fallbackPage->id, __METHOD__);
             return $this->redirect($fallbackPage->createUrl(['language' => $fallbackPage->access_domain]));
         } else {
             throw new HttpException(404, \Yii::t('pages', 'Page not found.') . ' [ID: ' . $pageId . ']');
         }
     }
 }
开发者ID:dmstr,项目名称:yii2-pages-module,代码行数:43,代码来源:DefaultController.php


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