本文整理汇总了PHP中CDbCriteria::compare方法的典型用法代码示例。如果您正苦于以下问题:PHP CDbCriteria::compare方法的具体用法?PHP CDbCriteria::compare怎么用?PHP CDbCriteria::compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDbCriteria
的用法示例。
在下文中一共展示了CDbCriteria::compare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria = new CDbCriteria();
$criteria->compare('id', $this->id);
$criteria->compare('title', $this->title, true);
$criteria->compare('catalog_id', $this->catalog_id);
$criteria->compare('soft_icon', $this->soft_icon, true);
$criteria->compare('cover_image', $this->cover_image, true);
$criteria->compare('soft_file', $this->soft_file, true);
$criteria->compare('language', $this->language, true);
$criteria->compare('softtype', $this->softtype, true);
$criteria->compare('os', $this->os, true);
$criteria->compare('softrank', $this->softrank, true);
$criteria->compare('softsize', $this->softsize, true);
$criteria->compare('softlink', $this->softlink, true);
$criteria->compare('introduce', $this->introduce, true);
$criteria->compare('content', $this->content, true);
$criteria->compare('update_time', $this->update_time, true);
$criteria->compare('create_time', $this->create_time, true);
$criteria->compare('view_count', $this->view_count);
$criteria->compare('down_count', $this->down_count);
$criteria->compare('status', $this->status, true);
$criteria->compare('tags', $this->tags, true);
$criteria->compare('seo_title', $this->seo_title, true);
$criteria->compare('seo_description', $this->seo_description, true);
$criteria->compare('seo_keywords', $this->seo_keywords, true);
return new CActiveDataProvider('Soft', array('criteria' => $criteria));
}
示例2: search
public function search()
{
$criteria = new CDbCriteria();
$criteria->compare('id_tipo_riesgo', $this->id_tipo_riesgo);
$criteria->compare('nombre', $this->nombre, true);
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例3: search
/**
* @return CActiveDataProvider
*/
public function search()
{
$criteria = new CDbCriteria();
$criteria->compare('id', $this->id);
$criteria->compare('name', $this->name, true);
return new CActiveDataProvider($this, ['criteria' => $criteria]);
}
示例4: search
public function search()
{
$criteria = new CDbCriteria();
$criteria->compare('id', $this->id, true);
$criteria->compare('html', $this->html, true);
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例5: getListItems
/**
* getListItems - Phương thức dùng để lấy dữ liệu
*/
public function getListItems($category_id = null)
{
Yii::import('application.modules.products.models.ProductItem');
$model = new ProductItem('search');
$model->unsetAttributes();
$criteria = new CDbCriteria();
$criteria->order = 'created DESC';
if ($category_id) {
Yii::import('application.modules.products.models.ProductCategory');
$categories = ProductCategory::model()->findByPk($category_id);
if (!$categories) {
return null;
}
$this->__category = $categories;
$descendants = $categories->descendants()->findAll('is_active = 1');
$arrCat = array($category_id);
foreach ($descendants as $cat) {
$arrCat[] = $cat->id;
}
$criteria->with = array('categoryitem');
$criteria->together = true;
foreach ($arrCat as $cat) {
$criteria->compare('categoryitem.category_id', $cat, false, 'OR');
}
}
$criteria->compare('status', 1);
$search = new CActiveDataProvider($model, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->getModule('products')->entriesShow)));
$data = $search->getData();
$this->__pagination = $search->pagination;
return $data;
}
示例6: search2
public function search2()
{
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria = new CDbCriteria();
if (!empty($this->from_date) && empty($this->to_date)) {
$criteria->condition = "TGL_PENGADAAN>='{$this->from_date}'";
$criteria->compare('NAMA_TOKO', $this->NAMA_TOKO, true);
$criteria->compare('STATUS', $this->STATUS, true);
} else {
if (empty($this->from_date) && !empty($this->to_date)) {
$criteria->condition = "TGL_PENGADAAN<='{$this->to_date}'";
$criteria->compare('NAMA_TOKO', $this->NAMA_TOKO, true);
$criteria->compare('STATUS', $this->STATUS, true);
} else {
if (!empty($this->from_date) && !empty($this->to_date)) {
$criteria->condition = "TGL_PENGADAAN>='{$this->from_date}' and TGL_PENGADAAN<='{$this->to_date}'";
$criteria->compare('NAMA_TOKO', $this->NAMA_TOKO, true);
$criteria->compare('STATUS', $this->STATUS, true);
} else {
$criteria->compare('NAMA_TOKO', $this->NAMA_TOKO, true);
$criteria->compare('STATUS', $this->STATUS, true);
}
}
}
return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'TGL_PENGADAAN DESC'), 'pagination' => array('pageSize' => '10')));
}
示例7: 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->compare('user_id', $this->user_id);
$criteria->compare('firstname', $this->firstname, true);
$criteria->compare('lastname', $this->lastname, true);
$criteria->compare('telephone', $this->telephone, true);
$criteria->compare('company', $this->company, true);
$criteria->compare('tax_id', $this->tax_id, true);
$criteria->compare('address_1', $this->address_1, true);
$criteria->compare('address_2', $this->address_2, true);
$criteria->compare('city', $this->city, true);
$criteria->compare('postal_code', $this->postal_code, true);
$criteria->compare('country_id', $this->country_id);
$criteria->compare('zone_id', $this->zone_id);
$dorder = '';
if ($this->hasAttribute('sort_order')) {
$dorder = 't.sort_order ASC';
} else {
if ($this->hasAttribute('id')) {
$dorder = 't.id DESC';
}
}
return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => array('defaultOrder' => $dorder, 'attributes' => array('*')), 'pagination' => array('pageSize' => 100)));
}
示例8: get_data
private function get_data($filter = '', $limit = 5, $offset = 0)
{
$criteria = new CDbCriteria();
if (is_array($filter)) {
if (isset($filter['application_id'])) {
$criteria->compare('application_id', $filter['application_id']);
} else {
$criteria->addCondition('application_id IS NULL');
}
if (isset($filter['project_id'])) {
$criteria->compare('project_id', $filter['project_id']);
}
}
$count = Notes::model()->count($criteria);
$criteria->limit = $limit;
$criteria->offset = $offset;
$criteria->order = 'date_created DESC';
$model = Notes::model()->findAll($criteria);
$data = array();
//XSS Purifier here
// $p = new CHtmlPurifier();
// $p->options = array('URI.AllowedSchemes'=>array(
// 'http' => true,
// 'https' => true,
// ));
foreach ($model as $row) {
$data[] = array('note_id' => $row->note_id, 'project_id' => $row->project_id, 'application_id' => $row->application_id, 'notes' => str_replace('<', '<', $row->notes), 'date_created' => $row->date_created, 'date_updated' => $row->date_updated, 'created_by' => $row->created_by, 'updated_by' => $row->updated_by);
}
return array('data' => $data, 'data_count' => count($data), 'total_count' => $count);
}
示例9: 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('id', $this->id);
$criteria->compare('name', $this->name, true);
$criteria->compare('zindex', $this->zindex);
$criteria->compare('street', $this->street, true);
$criteria->compare('house', $this->house, true);
$criteria->compare('build', $this->build, true);
$criteria->compare('room', $this->room, true);
$criteria->compare('web', $this->web, true);
$criteria->compare('ogrn', $this->ogrn, true);
$criteria->compare('inn', $this->inn, true);
$criteria->compare('kpp', $this->kpp, true);
$criteria->compare('rschet', $this->rschet, true);
$criteria->compare('bank', $this->bank, true);
$criteria->compare('bik', $this->bik);
$criteria->compare('kschet', $this->kschet, true);
$criteria->compare('date', $this->date, true);
$criteria->compare('city_id', $this->city_id);
$criteria->compare('gindir', $this->gindir, true);
$criteria->compare('swift', $this->swift, true);
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例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($id = 1)
{
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria = new CDbCriteria();
$criteria->compare('user_id', $this->user_id);
$criteria->compare('user_name', trim($this->user_name), true);
$criteria->compare('user_image', $this->user_image, true);
$criteria->compare('user_email', trim($this->user_email), true);
$criteria->compare('user_password', $this->user_password, true);
$criteria->compare('user_status', $this->user_status, true);
$criteria->compare('user_role_type', $this->user_role_type);
$criteria->compare('user_department_id', $this->user_department_id);
$criteria->compare('user_created_by_id', $this->user_created_by_id);
$criteria->compare('user_last_login_time', $this->user_last_login_time, true);
$criteria->compare('user_last_logout_time', $this->user_last_logout_time, true);
$criteria->compare('user_ip_address', $this->user_ip_address, true);
$criteria->compare('created_date', $this->created_date, true);
$criteria->compare('updated_date', $this->updated_date, true);
$criteria->compare('phone', $this->phone, true);
$criteria->compare('skype', $this->skype, true);
if ($id == 1) {
if ($this->getAllUserbyCreated(Yii::app()->session['user_data']['user_id'])) {
$criteria->AddInCondition('user_created_by_id ', $this->all);
}
$criteria->AddCondition('user_role_type != 5');
} else {
if (in_array(Yii::app()->session['user_data']['user_role_type'], array(0, 1, 2))) {
$criteria->AddCondition('user_role_type ==5');
} else {
$criteria->AddCondition('user_id==0 ');
}
}
return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'user_id asc'), 'pagination' => array('pageSize' => 20)));
}
示例11: search
/**
* @return CActiveDataProvider
*/
public function search()
{
$criteria = new CDbCriteria();
$criteria->compare('intSentenceID', $this->intSentenceID, true);
$criteria->compare('varBody', $this->varBody, true);
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例12: 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('id', $this->id);
$criteria->compare('paciente_id', $this->paciente_id);
$criteria->compare('cita_id', $this->cita_id);
$criteria->compare('personal_id', $this->personal_id);
$criteria->compare('motivo_consulta', $this->motivo_consulta, true);
$criteria->compare('enfermedad_actual', $this->enfermedad_actual, true);
$criteria->compare('antecedente_patologico', $this->antecedente_patologico, true);
$criteria->compare('antecedente_quirurgico', $this->antecedente_quirurgico, true);
$criteria->compare('antecedente_alergico', $this->antecedente_alergico, true);
$criteria->compare('antecedente_traumatico', $this->antecedente_traumatico, true);
$criteria->compare('antecedente_medicamento', $this->antecedente_medicamento, true);
$criteria->compare('antecedente_ginecologico', $this->antecedente_ginecologico, true);
$criteria->compare('antecedente_fum', $this->antecedente_fum, true);
$criteria->compare('antecedente_habitos', $this->antecedente_habitos, true);
$criteria->compare('antecedente_familiares', $this->antecedente_familiares, true);
$criteria->compare('antecedente_nutricionales', $this->antecedente_nutricionales, true);
$criteria->compare('observaciones_paciente', $this->observaciones_paciente, true);
$criteria->compare('fecha', $this->fecha, true);
$criteria->compare('estado', $this->estado, true);
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例13: run
public function run()
{
if (is_null($this->model)) {
return;
}
$model = $this->model;
// Условия выборки
$criteria = new CDbCriteria();
if ($this->limit > 0) {
$criteria->limit = (int) $this->limit;
}
$criteria->order = 'RAND()';
$criteria->scopes['type'] = $model->type->id;
$criteria->compare('t.id', '<>' . $model->id);
if ($model->category->id == RealtyCategory::ELITE_CATEGORY_ID) {
$criteria->compare('::rooms_number::', $model->rooms_number);
$criteria->addInCondition('::district::', $model->district);
} elseif ($model->category->id == RealtyCategory::COUNTRY_CATEGORY_ID) {
$criteria->addInCondition('::direction::', $model->direction);
}
if ($model->category->id == RealtyCategory::COMMERCIAL_CATEGORY_ID) {
$criteria->addInCondition('::district::', $model->district);
}
// Выборка объектов
$models = RealtyItem::model()->withEavAttributes(true)->active()->with(['category', 'type', 'currency'])->findAll($criteria);
if (empty($models)) {
return;
}
$this->render($this->view, ['models' => $models]);
}
示例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('idPasarelaRespuesta', $this->idPasarelaRespuesta, true);
$criteria->compare('estadoPol', $this->estadoPol);
$criteria->compare('codigoRespuestaPol', $this->codigoRespuestaPol);
$criteria->compare('idCompra', $this->idCompra);
$criteria->compare('refPol', $this->refPol);
$criteria->compare('mensaje', $this->mensaje, true);
$criteria->compare('medioPago', $this->medioPago);
$criteria->compare('tipoMedioPago', $this->tipoMedioPago);
$criteria->compare('cuotas', $this->cuotas);
$criteria->compare('valor', $this->valor, true);
$criteria->compare('valorPesos', $this->valorPesos, true);
$criteria->compare('iva', $this->iva, true);
$criteria->compare('valorAdicional', $this->valorAdicional, true);
$criteria->compare('moneda', $this->moneda, true);
$criteria->compare('cus', $this->cus, true);
$criteria->compare('bancoPse', $this->bancoPse, true);
$criteria->compare('fechaTransaccion', $this->fechaTransaccion, true);
$criteria->compare('correoElectronico', $this->correoElectronico, true);
$criteria->compare('tipoRespuesta', $this->tipoRespuesta);
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例15: 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('product_id', $this->product_id, true);
$criteria->compare('product_code', $this->product_code, true);
$criteria->compare('product_name', $this->product_name, true);
$criteria->compare('product_desc', $this->product_desc, true);
$criteria->compare('product_img', $this->product_img, true);
$criteria->compare('inventory_num', $this->inventory_num);
$criteria->compare('sale_price', $this->sale_price);
$criteria->compare('standard_price', $this->standard_price);
$criteria->compare('category_code', $this->category_code, true);
$criteria->compare('cruise_id', $this->cruise_id);
$criteria->compare('shop_id', $this->shop_id);
$criteria->compare('brand_id', $this->brand_id);
$criteria->compare('sale_num', $this->sale_num);
$criteria->compare('comment_num', $this->comment_num);
$criteria->compare('sale_start_time', $this->sale_start_time, true);
$criteria->compare('sale_end_time', $this->sale_end_time, true);
$criteria->compare('creator_type', $this->creator_type);
$criteria->compare('created', $this->created, true);
$criteria->compare('creator', $this->creator, true);
$criteria->compare('creator_id', $this->creator_id);
$criteria->compare('status', $this->status);
$criteria->compare('origin', $this->origin, true);
$criteria->compare('is_rubbish', $this->is_rubbish);
return new CActiveDataProvider(get_class($this), array('criteria' => $criteria));
}