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


PHP CActiveDataProvider::setCriteria方法代码示例

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


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

示例1: getDataProvider

 /**
  *
  * 改进:使用延迟绑定,将这个函数写在父类里面
  *返回某个用户所发布的所有计划列表
  * @return CActiveDataProvider $dataProvider  返回CActiveDataProvider对象
  * 使用attach的好处是随时绑定,不一定在初始化的时候绑定
  */
 public function getDataProvider(CFormModel &$condition)
 {
     $this->attachBehaviors(array('NearScopeBehavior' => array('class' => 'ext.behavior.NearScopeBehavior', 'latitude' => $condition->latitude, 'longitude' => $condition->longitude)));
     $dataProvider = new CActiveDataProvider(Plan::model()->unexpired()->near()->with('user'), array('pagination' => array('pageSize' => 20)));
     $dataProvider->setCriteria($this->addCondition($condition));
     return $dataProvider;
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:14,代码来源:Plan.php

示例2: actionIndex

 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $relationComponent = new RelationComponent();
     $friends = $relationComponent->getfriends();
     $criteria->addInCondition('userId', $friends);
     $criteria->order = 'photoId DESC';
     $dataProvider = new CActiveDataProvider('Photo', array('pagination' => array('pageSize' => 20)));
     $dataProvider->setCriteria($criteria);
     $this->page($dataProvider);
     $this->render('index');
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:12,代码来源:DefaultController.php

示例3: actionAdmin

 public function actionAdmin()
 {
     $title = Yii::app()->request->getParam('title', false);
     $criteria = new CDbCriteria();
     $criteria->order = 'id desc';
     if ($title) {
         $criteria->compare('title', $title, true);
     }
     $dataProvider = new CActiveDataProvider('DreamApp');
     $dataProvider->setCriteria($criteria);
     $this->render('admin', array('title' => $title, 'dataProvider' => $dataProvider));
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:12,代码来源:DreamAppController.php

示例4: getList

 /**
  * 返回某个关系的列表。应该按照用户名的大小写来排序,但是这里暂时成了按照注册日期来排序的!
  * @param  $type  填写四个:friends,follows,fans,blacks
  * @return CActiveDataProvider  返回CActiveDataProvider对象
  */
 public function getList($type)
 {
     $relationComponent = new RelationComponent();
     $function = 'get' . $type;
     $list = $relationComponent->{$function}();
     $criteria = new CDbCriteria();
     $criteria->addInCondition('t.userId', $list);
     $criteria->order = 't.userId desc';
     $dataProvider = new CActiveDataProvider(User::model(), array('pagination' => array('pageSize' => 20)));
     $dataProvider->setCriteria($criteria);
     return $dataProvider;
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:17,代码来源:Relation.php

示例5: actionAdmin

 public function actionAdmin()
 {
     $type = Yii::app()->request->getParam('type', false);
     $title = Yii::app()->request->getParam('title', false);
     $criteria = new CDbCriteria();
     $criteria->with = 'task';
     $criteria->order = 't.id desc';
     if ($type) {
         $criteria->condition = 'push_type =:push_type';
         $criteria->params = array(':push_type' => $type);
     }
     if ($title) {
         $criteria->compare('task.app_name', $title, true);
     }
     $dataProvider = new CActiveDataProvider('DreamPushTask');
     $dataProvider->setCriteria($criteria);
     $this->render('admin', array('type' => $type, 'title' => $title, 'dataProvider' => $dataProvider));
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:18,代码来源:DreamPushTaskController.php

示例6: actionDialogUser

 function actionDialogUser()
 {
     $model = new CActiveDataProvider('User', array('pagination' => array('pageSize' => 20)));
     if (!empty($_POST)) {
         $search = Util::input($_POST['search']);
         $criteria = new CDbCriteria();
         $criteria->compare('user_name', $search, true, 'OR');
         $criteria->compare('user_tel', $search, true, 'OR');
         $model->setCriteria($criteria);
     }
     $this->render('//Dialog/DialogUser', array('model' => $model));
 }
开发者ID:adsavin,项目名称:air,代码行数:12,代码来源:DialogController.php

示例7: actionAdmin

 public function actionAdmin()
 {
     $title = Yii::app()->request->getParam('title', false);
     $criteria = new CDbCriteria();
     $criteria->order = 'id desc';
     if ($title) {
         $criteria->compare('app_name', $title, true);
     } else {
         $criteria->condition = 'show_flag != :show_flag';
         $criteria->params = array(':show_flag' => 0);
     }
     $dataProvider = new CActiveDataProvider('DreamAdPackage');
     $dataProvider->setCriteria($criteria);
     $this->render('admin', array('title' => $title, 'dataProvider' => $dataProvider));
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:15,代码来源:DreamAdPackageController.php

示例8: actionRepair

 public function actionRepair()
 {
     $this->checkLogin();
     $params = @$_POST;
     if (!empty($_POST)) {
         // search
         $search = Util::input($_POST['search_code']);
         if (empty($search)) {
             $search = Util::input($_GET['serial_code']);
         }
         // productSerial
         $productSerial = ProductSerial::model()->findByAttributes(array('serial_no' => $search));
         if (!empty($productSerial)) {
             $product = Product::model()->findByAttributes(array('product_code' => $productSerial->product_code));
             $params['product'] = $product;
             $params['productSerial'] = $productSerial;
         }
         // repair history
         $criteria = new CDbCriteria();
         $criteria->compare('serial_no', Util::input($_POST['search_code']));
         $criteria->order = 'repair_id DESC';
         $repairs = new CActiveDataProvider('Repair');
         $repairs->setCriteria($criteria);
         $params['repairs'] = $repairs;
     }
     $this->render('//Basic/Repair', $params);
 }
开发者ID:adsavin,项目名称:app,代码行数:27,代码来源:BasicController.php

示例9: getDataProvider

 /**
  *
  * 改进:使用延迟绑定,将这个函数写在父类里面
  *返回某个用户所发布的所有计划列表
  *
  * @return CActiveDataProvider $dataProvider  返回CActiveDataProvider对象
  */
 public function getDataProvider(CFormModel &$condition)
 {
     $dataProvider = new CActiveDataProvider(User::model()->near(), array('pagination' => array('pageSize' => 20)));
     $dataProvider->setCriteria($this->addCondition($condition));
     return $dataProvider;
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:13,代码来源:User.php

示例10: getDataProvider

 /**
  *
  * 改进:使用延迟绑定,将这个函数写在父类里面
  *返回某个用户所发布的所有计划列表
  *          主页默认显示的是只在本地的。
  *
  *
  * @return CActiveDataProvider $dataProvider  返回CActiveDataProvider对象
  */
 public function getDataProvider(CFormModel &$condition)
 {
     //      $e=  array_filter($condition->attributes);
     $model = Plan::model()->unexpired()->near();
     if (empty($condition->location)) {
         $model = $model->local()->with(array('user', 'state'));
     } else {
         $model = $model->startThis()->with(array('user', 'state'));
     }
     $model = $model->with(array('user', 'state'));
     $dataProvider = new CActiveDataProvider($model, array('pagination' => array('pageSize' => 20)));
     $dataProvider->setCriteria($this->search($condition));
     return $dataProvider;
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:23,代码来源:Plan.php

示例11: array

                            CHtml::link($data->refersTo->public_id(),
                                    array("useCase/view","id"=>$data->refers_to))
                        : null'), array('class' => 'CDataColumn', 'name' => 'Primary Actor', 'type' => 'html', 'value' => '$data->primaryActor->description'), 'order', array('class' => 'CButtonColumn', 'buttons' => array('view' => array('url' => '$this->grid->controller->createUrl("/useCaseEvent/view/$data->primaryKey")'), 'update' => array('url' => '$this->grid->controller->createUrl("/useCaseEvent/update/$data->primaryKey")'), 'delete' => array('url' => '$this->grid->controller->createUrl("/useCaseEvent/delete/$data->primaryKey")'))))));
echo "<h3>Inlude</h3>";
echo CHtml::link("Add new Event to Include Scenario", array("useCaseEvent/create", "uc" => $model->id_use_case, "cat" => "4"));
$criteria = new CDbCriteria();
$criteria->condition = "use_case = {$model->id_use_case} AND category = 4";
$criteria->order = "`order`";
$events = UseCaseEvent::model()->with('category0', 'useCase', 'primaryActor')->findAll($criteria);
$dataProvider = new CActiveDataProvider('UseCaseEvent', array('pagination' => array('pageSize' => 20)));
$dataProvider->setCriteria($criteria);
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'columns' => array('id_event', array('class' => 'CDataColumn', 'name' => 'category', 'type' => 'html', 'value' => '$data->category0->name'), 'description', array('class' => 'CDataColumn', 'name' => 'Refers To', 'type' => 'html', 'value' => 'isset($data->refersTo) ?
                            CHtml::link($data->refersTo->public_id(),
                                    array("useCase/view","id"=>$data->refers_to))
                        : null'), array('class' => 'CDataColumn', 'name' => 'Primary Actor', 'type' => 'html', 'value' => '$data->primaryActor->description'), 'order', array('class' => 'CButtonColumn', 'buttons' => array('view' => array('url' => '$this->grid->controller->createUrl("/useCaseEvent/view/$data->primaryKey")'), 'update' => array('url' => '$this->grid->controller->createUrl("/useCaseEvent/update/$data->primaryKey")'), 'delete' => array('url' => '$this->grid->controller->createUrl("/useCaseEvent/delete/$data->primaryKey")'))))));
echo "<h3>Alternate</h3>";
echo CHtml::link("Add new Event to Alternate Scenario", array("useCaseEvent/create", "uc" => $model->id_use_case, "cat" => "2"));
$criteria = new CDbCriteria();
$criteria->condition = "use_case = {$model->id_use_case} AND category = 2";
$criteria->order = "`order`";
$events = UseCaseEvent::model()->with('category0', 'useCase', 'primaryActor')->findAll($criteria);
$dataProvider = new CActiveDataProvider('UseCaseEvent', array('pagination' => array('pageSize' => 20)));
$dataProvider->setCriteria($criteria);
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'columns' => array('id_event', array('class' => 'CDataColumn', 'name' => 'category', 'type' => 'html', 'value' => '$data->category0->name'), 'description', array('class' => 'CDataColumn', 'name' => 'Refers To', 'type' => 'html', 'value' => 'isset($data->refersTo) ?
                            CHtml::link($data->refersTo->public_id(),
                                    array("useCase/view","id"=>$data->refers_to))
                        : null'), array('class' => 'CDataColumn', 'name' => 'Primary Actor', 'type' => 'html', 'value' => '$data->primaryActor->description'), 'order', array('class' => 'CButtonColumn', 'buttons' => array('view' => array('url' => '$this->grid->controller->createUrl("/useCaseEvent/view/$data->primaryKey")'), 'update' => array('url' => '$this->grid->controller->createUrl("/useCaseEvent/update/$data->primaryKey")'), 'delete' => array('url' => '$this->grid->controller->createUrl("/useCaseEvent/delete/$data->primaryKey")'))))));
echo CHtml::image(CHtml::normalizeUrl(array('imagesvg', 'id' => $model->id_use_case)), '');
?>
 
开发者ID:black2279,项目名称:Tracy-openshift,代码行数:29,代码来源:view.php

示例12: actionIndex

 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $dataProvider = new CActiveDataProvider('Pedido');
     if (Yii::app()->user->checkAccess('cliente')) {
         $dataProvider->setCriteria(array('condition' => 'IdCliente=:id', 'params' => array(':id' => Yii::app()->user->id)));
     }
     $this->render('index', array('dataProvider' => $dataProvider));
 }
开发者ID:EPSZ-DAW2,项目名称:daw2-2014-libreria,代码行数:11,代码来源:PedidoController.php


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