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


PHP CDbCriteria::addSearchCondition方法代码示例

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


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

示例1: getSuggest

 public function getSuggest($q)
 {
     $c = new CDbCriteria();
     $c->addSearchCondition('username', $q, true, 'OR');
     $c->addSearchCondition('email', $q, true, 'OR');
     return $this->findAll($c);
 }
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:7,代码来源:User.php

示例2: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id);
     $criteria->compare('workflow_id', $this->workflow_id);
     $criteria->addSearchCondition('name', $this->name, true, 'AND', 'ILIKE');
     $criteria->addSearchCondition('label', $this->label, true, 'AND', 'ILIKE');
     $criteria->compare('value', $this->value, true);
     $criteria->compare('description', $this->description, true);
     if ($this->setting_group == 'ungroup') {
         $criteria->addCondition("setting_group IS NULL OR setting_group = ''");
     } else {
         $criteria->compare('setting_group', $this->setting_group, true);
     }
     if ($this->module == 'module_system') {
         $criteria->addCondition("module IS NULL OR module = ''");
     } else {
         $criteria->compare('module', $this->module, true);
     }
     $criteria->order = 'module, setting_group, ordering, name';
     $config = array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'module, setting_group, name'));
     //        if (empty($this->setting_group) === false && empty($this->module) === false) {
     $config['pagination'] = array('pageSize' => 1000);
     //        }
     return new CActiveDataProvider(get_class($this), $config);
 }
开发者ID:hung5s,项目名称:yap,代码行数:30,代码来源:SettingParam.php

示例3: run

 public function run()
 {
     $model = new MailLog();
     //条件
     $criteria = new CDbCriteria();
     $accept = trim(Yii::app()->request->getParam('accept'));
     //收件人
     $subject = trim(Yii::app()->request->getParam('subject'));
     //主题
     $start_time = Yii::app()->request->getParam('start_time');
     $end_time = Yii::app()->request->getParam('end_time');
     $accept && $criteria->addSearchCondition('accept', $accept);
     $subject && $criteria->addSearchCondition('subject', $subject);
     $start_time && $criteria->compare('sendtime', '>=' . strtotime($start_time));
     $end_time && $criteria->compare('sendtime', '<=' . strtotime($end_time));
     $criteria->order = 't.id DESC';
     $count = $model->count($criteria);
     //分页
     $pages = new CPagination($count);
     $pages->pageSize = 20;
     $pages->applyLimit($criteria);
     //查询
     $result = $model->findAll($criteria);
     $this->controller->render('index', array('model' => $model, 'datalist' => $result, 'pagebar' => $pages));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:25,代码来源:IndexAction.php

示例4: search

 /**
  * Настройки поиска
  * @return \CActiveDataProvider
  */
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('bhid', $this->bhid);
     $criteria->addSearchCondition('player_ip', $this->player_ip);
     $criteria->addSearchCondition('player_id', $this->player_id);
     $criteria->addSearchCondition('player_nick', $this->player_nick);
     $criteria->compare('admin_ip', $this->admin_ip, true);
     $criteria->compare('admin_id', $this->admin_id, true);
     if ($this->admin_nick) {
         $criteria->compare('admin_nick', $this->admin_nick, true);
     }
     $criteria->compare('ban_type', $this->ban_type, true);
     $criteria->addSearchCondition('ban_reason', $this->ban_reason, true);
     if ($this->ban_created) {
         $start = strtotime("{$this->ban_created} 00:00:00");
         $end = strtotime("{$this->ban_created} 23:59:59");
         $criteria->addBetweenCondition('ban_created', $start, $end);
     }
     $criteria->compare('ban_length', $this->ban_length);
     $criteria->compare('server_ip', $this->server_ip, true);
     $criteria->compare('server_name', $this->server_name, true);
     if ($this->unban_created) {
         $start = strtotime("{$this->unban_created} 00:00:00");
         $end = strtotime("{$this->unban_created} 23:59:59");
         $criteria->addBetweenCondition('unban_created', $start, $end);
     }
     $criteria->compare('unban_reason', $this->unban_reason, true);
     $criteria->compare('unban_admin_nick', $this->unban_admin_nick, true);
     $criteria->compare('map_name', $this->map_name, true);
     $criteria->order = '`bhid` DESC';
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->config->bans_per_page)));
 }
开发者ID:DmitriyS,项目名称:CS-Bans,代码行数:37,代码来源:History.php

示例5: actionIndex

 public function actionIndex()
 {
     $OrganID = Yii::app()->user->getOrganID();
     $criteria = new CDbCriteria();
     //表单提交查询
     $phone = Yii::app()->request->getParam('phone');
     $name = Yii::app()->request->getParam('name');
     if (!empty($phone)) {
         $criteria->addSearchCondition('t.Phone', "{$phone}", "AND");
     }
     if (!empty($name)) {
         $criteria->addSearchCondition('t.Name', "{$name}", "AND");
     }
     //$criteria->select = "t.ID as ID, t.CreateTime as CreateTime, t.Name as Name, car.LicensePlate as LicensePlate, t.Phone as Phone";
     //$criteria->join = " join jpd.jpd_service_car as car on t.id = car.OwnerID";
     $criteria->with = "car";
     $criteria->order = "t.UpdateTime DESC,t.ID DESC";
     //排序条件:t.CreateTime,t.ID倒叙
     $criteria->addCondition("t.OrganID = {$OrganID}", "AND");
     $criteria->addCondition("t.Status = 0", "AND");
     $dataProvider = new CActiveDataProvider('ServiceCarOwner', array('criteria' => $criteria, 'pagination' => array('pageSize' => '10')));
     $data = $dataProvider->getData();
     foreach ($data as $key => $val) {
         $LicensePlate = '';
         foreach ($val['car'] as $k => $v) {
             $LicensePlate .= $v['LicensePlate'] . ',';
         }
         $val['car'] = substr($LicensePlate, 0, -1);
     }
     $this->render('index', array('dataProvider' => $dataProvider, 'phone' => $phone, 'name' => $name));
 }
开发者ID:zwq,项目名称:unpei,代码行数:31,代码来源:ServiceownerController.php

示例6: actionQuotelist

 public function actionQuotelist()
 {
     $userID = Commonmodel::getOrganID();
     $criteria = new CDbCriteria();
     if ($_GET) {
         if ($_GET['num']) {
             $criteria->addSearchCondition('ItemNum', "{$_GET['num']}", "AND");
         }
         if ($_GET['name']) {
             $criteria->addSearchCondition('ItemName', "{$_GET['name']}", "AND");
         }
     }
     $criteria->order = "t.UpdateTime DESC,t.ID DESC";
     //排序条件:t.UpdateTime,t.ID倒叙
     $criteria->addCondition("t.OrganID = {$userID}");
     $criteria->addCondition("t.Status = 0");
     $count = ServiceItems::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = $_GET['rows'];
     $pages->applyLimit($criteria);
     $model = ServiceItems::model()->findAll($criteria);
     foreach ($model as $key => $value) {
         $data[$key] = $value->attributes;
         $data[$key]['ItemNums'] = F::msubstr($value['ItemNum']);
         $data[$key]['ItemNames'] = F::msubstr($value['ItemName']);
         $data[$key]['ItemExplan'] = F::msubstr($value['ItemIntro']);
     }
     $rs = array('total' => $count, 'rows' => $data ? $data : array());
     echo json_encode($rs);
 }
开发者ID:zwq,项目名称:unpei,代码行数:30,代码来源:ServicemaininfoController.php

示例7: actionGetAllResult

 public function actionGetAllResult()
 {
     $columns = array(0 => 'id', 1 => 'patient_name', 2 => 'service', 3 => 'time', 4 => 'status', 5 => 'created_at', 6 => 'action');
     $request = Yii::app()->request;
     $start = $_REQUEST['start'];
     $length = $_REQUEST['length'];
     $column = $_REQUEST['order'][0]['column'];
     $order = $_REQUEST['order'][0]['dir'];
     $where = null;
     $criteria = new CDbCriteria();
     $criteria->order = "{$columns[$column]} {$order}";
     if (!empty($_REQUEST['search']['value'])) {
         $criteria->addSearchCondition("patient_name", $_REQUEST['search']['value'], 'true', 'OR');
         $criteria->addSearchCondition("service", $_REQUEST['search']['value'], 'true', 'OR');
         $criteria->addSearchCondition("time", $_REQUEST['search']['value'], 'true', 'OR');
         $criteria->addSearchCondition("status", $_REQUEST['search']['value'], 'true', 'OR');
         $where = true;
     }
     if (!empty(Yii::app()->session['provider_id'])) {
         $criteria->condition = "status >= 1 AND provider_id = " . Yii::app()->session['provider_id'];
     }
     $count = ResultMedlatec::model()->count($criteria);
     $criteria->limit = $length;
     $criteria->offset = $start;
     //  $criteria->condition = "provider_id = " . Yii::app()->session['provider_id'];
     $data = ResultMedlatec::model()->findAll($criteria);
     $returnArr = array();
     $service_name = null;
     $patient_name = null;
     foreach ($data as $item) {
         $order = OrderMedlatec::model()->findByPk($item->order_id);
         if ($order) {
             $service = ServiceMedlatec::model()->findByPk($order->service_id);
             if ($service) {
                 $service_name = $service->service_name;
             }
             $patient_name = $order->name;
         }
         $itemArr = array();
         $itemArr['id'] = $item->id;
         $itemArr['patient_name'] = $patient_name;
         $itemArr['service'] = $service_name;
         $itemArr['time'] = Date('d-m-Y', $item->time);
         $itemArr['status'] = Util::getStatusLabel($item->status);
         $itemArr['created_at'] = Date('d-m-Y', $item->created_at);
         if (empty(Yii::app()->session['provider_id'])) {
             $itemArr['provider_name'] = Provider::model()->getProviderName($item->provider_id);
         }
         $edit_url = Yii::app()->createUrl('result/edit', array('result_id' => $item->id));
         $order_url = Yii::app()->createUrl('result/order', array('oid' => $item->order_id));
         $action = '<a data-toggle="modal" href="' . $edit_url . '" data-target="#edit-order-modal" onclick="loadInfoResult(' . $item->id . ')"><span class="label label-primary">Sửa</span></a>';
         $action .= ' <a data-toggle="modal" href="' . $order_url . '" data-target="#edit-order-modal" onclick="loadInfo(' . $item->order_id . ')"><span class="label label-info">Xem order</span></a>';
         $itemArr['action'] = $action;
         $returnArr[] = $itemArr;
     }
     //$all  = ResultMedlatec::model()->findAll();
     echo json_encode(array('data' => $returnArr, "recordsTotal" => $count, "recordsFiltered" => count($data)));
 }
开发者ID:huynt57,项目名称:medlatec,代码行数:58,代码来源:ResultController.php

示例8: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->addSearchCondition('rule_name', $this->rule_name, true, 'OR');
     $criteria->addSearchCondition('point', $this->rule_name, true, 'OR');
     $criteria->order = 'id_rule DESC';
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
开发者ID:nicovicz,项目名称:reward-point,代码行数:21,代码来源:Rule.php

示例9: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id);
     $criteria->addSearchCondition('user_id', $this->user_id, true, 'AND', 'ILIKE');
     $criteria->addSearchCondition('param_name', $this->param_name, true, 'AND', 'ILIKE');
     $criteria->addSearchCondition('value', $this->value, true, 'AND', 'ILIKE');
     return new CActiveDataProvider(get_class($this), array('criteria' => $criteria, 'pagination' => array('pageSize' => defined('SETTINGS_BO_PAGE_SIZE') ? SETTINGS_BO_PAGE_SIZE : 50)));
 }
开发者ID:hung5s,项目名称:yap,代码行数:15,代码来源:UserSettingBase.php

示例10: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->addSearchCondition('voucher_name', $this->voucher_name, true, 'OR');
     $criteria->addSearchCondition('start_date', $this->voucher_name, true, 'OR');
     $criteria->addSearchCondition('end_date', $this->voucher_name, true, 'OR');
     $criteria->addSearchCondition('point_required', $this->voucher_name, true, 'OR');
     $criteria->order = 'DATEDIFF(end_date,now()) DESC,id_voucher DESC';
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
开发者ID:nicovicz,项目名称:reward-point,代码行数:23,代码来源:Voucher.php

示例11: actionSelfquestion

 public function actionSelfquestion()
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'ID DESC';
     $criteria->addCondition("Promoter = '" . Yii::app()->user->getOrganID() . "'");
     //接收表单数据(查询条件)
     $title = Yii::app()->request->getParam("Title");
     $organName = Yii::app()->request->getParam("OrganName");
     $state = Yii::app()->request->getParam("State");
     if (!empty($title)) {
         $criteria->addSearchCondition("Title", "{$title}");
     }
     if (!empty($organName)) {
         $criteria->addSearchCondition("OrganName", "{$organName}");
     }
     if (!empty($state)) {
         $criteria->addCondition("State = {$state}");
     }
     $dataProvider = new CActiveDataProvider('Question', array('criteria' => $criteria, 'pagination' => array('pageSize' => '15')));
     $data = $dataProvider->getData();
     foreach ($data as $key => $val) {
         $val['SubmitTime'] = date("Y-m-d h:i:s", $val['SubmitTime']);
         //状态
         if ($val['State'] == 1) {
             $val['State'] = "待分配";
         } elseif ($val['State'] == 2) {
             $val['State'] = "待解答";
         } elseif ($val['State'] == 3) {
             $val['State'] = "待反馈";
         } elseif ($val['State'] == 4) {
             $val['State'] = "完结";
         } elseif ($val['State'] == 5) {
             $val['State'] = "重新开启";
         } elseif ($val['State'] == 6) {
             $val['State'] = "待回访";
         }
         //类型
         if ($val['Type'] == 1) {
             $val['Type'] = "账号问题";
         } elseif ($val['Type'] == 2) {
             $val['Type'] = "交易问题";
         } elseif ($val['Type'] == 3) {
             $val['Type'] = "商品问题";
         } elseif ($val['Type'] == 4) {
             $val['Type'] = "数据问题";
         } elseif ($val['Type'] == 5) {
             $val['Type'] = "意见和建议";
         } elseif ($val['Type'] == 6) {
             $val['Type'] = "其他";
         }
     }
     $this->render("selfquestion", array('dataProvider' => $dataProvider, 'title' => $title, 'organName' => $organName, 'state' => $state));
 }
开发者ID:zwq,项目名称:unpei,代码行数:53,代码来源:CustomerController.php

示例12: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('t.id', $this->id, true);
     $criteria->with = array('Brand', 'EquipmentType');
     $criteria->addSearchCondition('LOWER(Brand.name)', strtolower($this->brand_id));
     $criteria->addSearchCondition('LOWER(EquipmentType.type)', strtolower($this->equipment_type_id));
     $criteria->compare('t.name', $this->name, true);
     $criteria->compare('t.active', $this->active);
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']))));
 }
开发者ID:rodespsan,项目名称:LMEC,代码行数:17,代码来源:Modelo.php

示例13: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $criteria->addSearchCondition('name', $this->name, true, 'AND', 'ILIKE');
     $criteria->compare('type', $this->type);
     $criteria->addSearchCondition('description', $this->description, true, 'AND', 'ILIKE');
     $criteria->addSearchCondition('bizrule', $this->bizrule, true, 'AND', 'ILIKE');
     $criteria->addSearchCondition('data', $this->data, true, 'AND', 'ILIKE');
     $criteria->compare('is_system', $this->is_system);
     return new CActiveDataProvider(get_class($this), array('criteria' => $criteria, 'pagination' => array('pageSize' => defined('SETTINGS_BO_PAGE_SIZE') ? SETTINGS_BO_PAGE_SIZE : 50)));
 }
开发者ID:hung5s,项目名称:yap,代码行数:17,代码来源:AuthItemBase.php

示例14: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('t.id', $this->id, true);
     $criteria->with = array('serviceType', 'equipmentType');
     $criteria->addSearchCondition('LOWER(ServiceType.name)', strtolower($this->service_type_id));
     $criteria->addSearchCondition('LOWER(EquipmentType.type)', strtolower($this->equipment_type_id));
     //
     $criteria->compare('t.activity', $this->activity, true);
     $criteria->compare('t.description', $this->description, true);
     $criteria->compare('t.active', $this->active);
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']))));
 }
开发者ID:rodespsan,项目名称:LMEC,代码行数:26,代码来源:ActivityVerification.php

示例15: actionStep2

 public function actionStep2()
 {
     if (isFrontUserLoggedIn()) {
         $solicitor_name = Yii::app()->session['solicitor_name'];
         $criteria = new CDbCriteria();
         $criteria->addSearchCondition('first_name', $solicitor_name, true, 'OR');
         $criteria->addSearchCondition('last_name', $solicitor_name, true, 'OR');
         $sol_list = Solicitor::model()->findAll($criteria);
         //pre($sol_list,true);
         $this->render('step2', array('sol_list' => $sol_list));
     } else {
         $this->redirect(array("/user"));
     }
 }
开发者ID:priyranjansingh,项目名称:donation,代码行数:14,代码来源:SearchController.php


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