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