當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。