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


PHP CActiveDataProvider::getCriteria方法代码示例

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


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

示例1: actionFindUser

 public function actionFindUser($group, $term)
 {
     $dataProvider = new CActiveDataProvider('User', array('criteria' => array('select' => array('id', 'email')), 'pagination' => array('pageSize' => 500)));
     $criteria = $dataProvider->getCriteria();
     $criteria->compare('email', $term, true);
     $result = CHtml::listData($dataProvider->getData(), 'id', 'email');
     $members = Yii::app()->db->createCommand()->select('userid')->from(AuthAssignment::model()->tableName())->where('itemname=:group', array(':group' => $group))->queryColumn();
     echo CJSON::encode(array_diff_key($result, array_flip($members)));
     Yii::app()->end();
 }
开发者ID:apa-narola,项目名称:yiimoduledemo,代码行数:10,代码来源:GroupsController.php

示例2: getCriteria

 public function getCriteria()
 {
     $criteria = parent::getCriteria();
     $meta = CActiveRecord::model($this->modelClass)->meta();
     //        if (isset($meta['lang']))
     //        {
     //            $criteria->addCondition("lang = '" . Yii::app()->language . "'");
     //        }
     return $criteria;
 }
开发者ID:nizsheanez,项目名称:alp.ru,代码行数:10,代码来源:ActiveDataProvider.php

示例3: getCriteria

 public function getCriteria()
 {
     $criteria = parent::getCriteria();
     $class = $this->modelClass;
     $model = $class::model();
     $meta = $model->meta();
     if (isset($meta['lang'])) {
         $criteria->addCondition("lang = '" . Yii::app()->language . "'");
     }
     return $criteria;
 }
开发者ID:nizsheanez,项目名称:documentation,代码行数:11,代码来源:ActiveDataProvider.php

示例4: actionIndex

 public function actionIndex()
 {
     $model = $this->loadModel();
     $model->resetScope();
     $dataProvider = new CActiveDataProvider($model, array('criteria' => array('with' => array('societe' => array())), 'pagination' => array('pageSize' => 50), 'sort' => array('defaultOrder' => 'societe.name', 'attributes' => array('societe_name' => array('asc' => 'societe.name', 'desc' => 'societe.name DESC'), '*'))));
     if (null !== ($formData = Yii::app()->request->getParam(get_class($model)))) {
         Yii::app()->session->offsetSet($this->id . '__filter', $formData);
         $this->redirect('index');
     }
     $model->setAttributes(Yii::app()->session->offsetGet($this->id . '__filter', array()));
     $criteria = $dataProvider->getCriteria();
     foreach ($model->attributes as $attribute => $value) {
         if (empty($value)) {
             continue;
         }
         $criteria->compare($attribute, $value);
     }
     $this->render('index', array('dataProvider' => $dataProvider, 'model' => $model));
 }
开发者ID:apa-narola,项目名称:yiimoduledemo,代码行数:19,代码来源:BankController.php


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