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


PHP CHttpRequest::getQuery方法代码示例

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


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

示例1: parseUrl

 /**
  * Parses the user request.
  * @param CHttpRequest $request The request application component.
  * @return string The route (controllerID/actionID) and perhaps GET parameters in path format.
  */
 public function parseUrl($request)
 {
     $route = $request->getQuery('r');
     if (is_null($route)) {
         $route = $request->getPathInfo();
     }
     $app = Yii::app()->getModule('herbie')->application;
     try {
         $path = $app['urlMatcher']->match($route);
     } catch (Exception $ex) {
         // Don't catch exception
     }
     if (!empty($path)) {
         return 'herbie/page';
     }
     return parent::parseUrl($request);
 }
开发者ID:getherbie,项目名称:yii-module,代码行数:22,代码来源:UrlManager.php

示例2: getTypeAttributesForSearchFromQuery

 /**
  * @param CHttpRequest $request
  * @return array
  */
 public function getTypeAttributesForSearchFromQuery(CHttpRequest $request)
 {
     $attributes = Yii::app()->getCache()->get('Store::filter::attributes');
     if (false === $attributes) {
         $attributes = [];
         $models = Attribute::model()->findAll(['select' => ['name', 'id', 'type']]);
         foreach ($models as $model) {
             $attributes[$model->name] = $model;
         }
         Yii::app()->getCache()->set('Store::filter::attributes', $attributes);
     }
     $result = [];
     $attributeValue = new AttributeValue();
     foreach ($attributes as $name => $attribute) {
         $searchParams = $request->getQuery($attribute->name);
         //пропускаем пустые значения
         if (null === $searchParams) {
             continue;
         }
         if (is_array($searchParams)) {
             if (isset($searchParams['from']) && null == $searchParams['from']) {
                 unset($searchParams['from']);
             }
             if (isset($searchParams['to']) && null == $searchParams['to']) {
                 unset($searchParams['to']);
             }
             if (empty($searchParams)) {
                 continue;
             }
         }
         $result[$attribute->name] = ['value' => $searchParams, 'attribute_id' => (int) $attribute->id, 'column' => $attributeValue->column($attribute->type)];
     }
     return $result;
 }
开发者ID:alextravin,项目名称:yupe,代码行数:38,代码来源:AttributeFilter.php

示例3: getEavAttributesForSearchFromQuery

 /**
  * @param CHttpRequest $request
  * @return array
  */
 public function getEavAttributesForSearchFromQuery(CHttpRequest $request)
 {
     $result = $params = [];
     $attributes = Attribute::model()->cache(Yii::app()->getModule('yupe')->coreCacheTime)->findAll(['select' => ['name']]);
     foreach ($attributes as $attribute) {
         if ($request->getQuery($attribute->name)) {
             $searchParams = $request->getQuery($attribute->name);
             if (!is_array($searchParams)) {
                 $result[$attribute->name] = $searchParams;
                 continue;
             }
             $isFrom = array_key_exists('from', $searchParams);
             $isTo = array_key_exists('to', $searchParams);
             if (false === $isFrom && false === $isTo) {
                 $result[$attribute->name] = $searchParams;
                 continue;
             }
             if (true === $isFrom && !empty($searchParams['from'])) {
                 $result[] = ['>=', $attribute->name, (double) $searchParams['from']];
             }
             if (true === $isTo && !empty($searchParams['to'])) {
                 $result[] = ['<=', $attribute->name, (double) $searchParams['to']];
             }
         }
     }
     return $result;
 }
开发者ID:RonLab1987,项目名称:43berega,代码行数:31,代码来源:AttributeFilter.php

示例4: actionIndex

 public function actionIndex()
 {
     $this->render('index', array('callback' => SearchController::search(CHttpRequest::getQuery('text'))));
 }
开发者ID:unused,项目名称:yii-lmdb,代码行数:4,代码来源:SearchController.php

示例5: foreach

<div class="filter pager">
  <ul class="yiiPager">
    <?php 
foreach (range('A', 'Z') as $filter) {
    ?>
      <li class="page <?php 
    if ($filter === CHttpRequest::getQuery('filter')) {
        echo 'selected';
    }
    ?>
">
        <?php 
    echo CHtml::link($filter, $this->createUrl('', array_merge($_GET, array('filter' => $filter))));
    ?>
      </li>
    <?php 
}
?>
  </ul>
</div>
开发者ID:unused,项目名称:yii-lmdb,代码行数:20,代码来源:_filter.php

示例6: actionWishlist

 public function actionWishlist()
 {
     $criteria = new CDbCriteria();
     $criteria->alias = 'm';
     $criteria->select = 'm.*';
     $criteria->join = 'JOIN user2movie um ON m.id=um.movie_id';
     $criteria->join .= ' JOIN user u ON um.user_id=u.id';
     $username = CHttpRequest::getQuery('username', Yii::app()->user->name);
     $criteria->condition = 'u.username=:username';
     $criteria->params[':username'] = $username;
     $criteria->condition .= ' AND um.on_wishlist=1';
     $criteria->order = 'm.url_key ASC';
     $criteria->with = array('attributes', 'images');
     if ($filter = CHttpRequest::getQuery('filter')) {
         $criteria->condition .= ' AND url_key LIKE :filter';
         $criteria->params[':filter'] = "{$filter}%";
     }
     $dataProvider = new CActiveDataProvider('Movie', array('criteria' => $criteria, 'pagination' => array('pageSize' => 9)));
     $this->render('index', array('dataProvider' => $dataProvider));
 }
开发者ID:unused,项目名称:yii-lmdb,代码行数:20,代码来源:MovieController.php

示例7: array

<?php

$this->pageTitle = Yii::app()->name . ' - Movies';
$this->breadcrumbs = array('Movies');
$this->menu = array();
?>

<img src="/images/uploads/avatar/<?php 
echo CHttpRequest::getQuery('username', Yii::app()->user->name);
?>
.jpg" class="avatar"/>
<?php 
if ($username = CHttpRequest::getQuery('username')) {
    ?>
  <h1>Movie-Library of <?php 
    echo $username;
    ?>
</h1>
<?php 
} else {
    ?>
  <h1>Your Movie-Library</h1>
<?php 
}
?>

<?php 
$this->renderPartial('_filter');
?>

<br class="clear"/>
开发者ID:unused,项目名称:yii-lmdb,代码行数:31,代码来源:index.php


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