本文整理汇总了PHP中CDbCriteria类的典型用法代码示例。如果您正苦于以下问题:PHP CDbCriteria类的具体用法?PHP CDbCriteria怎么用?PHP CDbCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDbCriteria类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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]);
}
示例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: displayDataset
public function displayDataset($ids)
{
$criteria = new CDbCriteria();
$criteria->addInCondition("id", $ids);
$datasets = Dataset::model()->findAll($criteria);
$this->generateFeed($datasets);
}
示例4: actionIndex
/**
* 生成首页
*
*/
public function actionIndex()
{
//print_r(Yii::app()->user->getState('username'));
//先获取当前是否有页码信息
$pages['pageNum'] = Yii::app()->getRequest()->getParam("pageNum", 1);
//当前页
$pages['countPage'] = Yii::app()->getRequest()->getParam("countPage", 0);
//总共多少记录
$pages['numPerPage'] = Yii::app()->getRequest()->getParam("numPerPage", 50);
//每页多少条数据
$pages['tmstart'] = Yii::app()->getRequest()->getParam("tmstart", date('Ym'));
//开始月份
$pages['tmstop'] = Yii::app()->getRequest()->getParam("tmstop", date('Ym'));
//结束月份
$pages['srh_service'] = Yii::app()->getRequest()->getParam("srh_service", "");
//按餐厅名称查询
$criteria = new CDbCriteria();
!empty($pages['srh_service']) && $criteria->addCondition('type=' . $pages['srh_service']);
$criteria->addCondition('`month`>=' . $pages['tmstart']);
$criteria->addCondition('`month`<=' . $pages['tmstop']);
$pages['countPage'] = AppBsMoney::model()->count($criteria);
$criteria->limit = $pages['numPerPage'];
$criteria->offset = $pages['numPerPage'] * ($pages['pageNum'] - 1);
$allList = AppBsMoney::model()->findAll($criteria);
$this->renderPartial('index', array('models' => $allList, 'pages' => $pages), false, true);
}
示例5: run
public function run()
{
$params = array();
$criteria = new CDbCriteria();
// $criteria->select = array('id,username,fullname,phone,address,status');
$criteria->select = '*';
if (isset($this->team_lear_id) and $this->team_lear_id != '') {
$criteria->addCondition('team_lear_id=' . $this->team_lear_id);
}
$criteria->params = $params;
$total = ATrainingTeam::model()->count($criteria);
$offset = $this->limit * ($this->page - 1);
$criteria->limit = $this->limit;
$criteria->offset = $offset;
$data = ATrainingTeam::model()->findAll($criteria);
$listTrainee = array();
if (!empty($data)) {
foreach ($data as $item) {
$listTrainee[] = CJSON::decode(CJSON::encode($item->pls_user));
}
}
$data = $listTrainee;
$pages = new CPagination($total);
$pages->pageSize = $this->limit;
$pages->applyLimit($criteria);
$this->render($this->view, array('data' => $data, 'pages' => $pages));
}
示例6: 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));
}
示例7: 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));
}
示例8: 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('name', $this->name, true);
$criteria->compare('name_en', $this->name_en, true);
$criteria->compare('non_utf8_name', $this->non_utf8_name, true);
$criteria->compare('parentid', $this->parentid);
$criteria->compare('description', $this->description, true);
$criteria->compare('description_en', $this->description_en, true);
$criteria->compare('order', $this->order);
$criteria->compare('active', $this->active);
$criteria->compare('metadescription', $this->metadescription, true);
$criteria->compare('metakeywords', $this->metakeywords, true);
//$criteria->compare('delete',$this->delete);
$criteria->addCondition("t.delete=0");
$criteria->compare('createdby', $this->createdby);
$criteria->compare('createdatetime', $this->createdatetime, true);
$criteria->compare('lastmodifiedby', $this->lastmodifiedby);
$criteria->compare('lastupdatedatetime', $this->lastupdatedatetime, true);
//$criteria->order = 't.createdatetime DESC';
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例9: search_cabecera
public function search_cabecera($id)
{
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria = new CDbCriteria();
$criteria->compare('id', $this->id);
$criteria->compare('hidfactura', $this->hidfactura, true);
$criteria->compare('item', $this->item, true);
$criteria->compare('hidkardex', $this->hidkardex, true);
$criteria->compare('iduser', $this->iduser);
$criteria->compare('fechacrea', $this->fechacrea, true);
$criteria->compare('hidalentrega', $this->hidalentrega, true);
$criteria->compare('identrega', $this->identrega, true);
$criteria->compare('iddetcompra', $this->iddetcompra, true);
$criteria->compare('cant', $this->cant);
$criteria->compare('fechaentrega', $this->fechaentrega, true);
$criteria->compare('idkardex', $this->idkardex, true);
$criteria->compare('punitentrega', $this->punitentrega);
$criteria->compare('codart', $this->codart, true);
$criteria->compare('cantcompras', $this->cantcompras);
$criteria->compare('punitcompra', $this->punitcompra);
$criteria->compare('itemcompra', $this->itemcompra, true);
$criteria->compare('descri', $this->descri, true);
$criteria->compare('codentro', $this->codentro, true);
$criteria->addCondition("hidfactura=:identidad");
$criteria->params = array(":identidad" => (int) $id);
$criteria->order = "itemcompra ASC ";
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例10: 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);
}
示例11: 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('Ext', $this->Ext, true);
$criteria->compare('Line', $this->Line, true);
$criteria->compare('Hreg', $this->Hreg, true);
$criteria->compare('HN', $this->HN, true);
$criteria->compare('SessNo', $this->SessNo, true);
$criteria->compare('BegHd', $this->BegHd, true);
$criteria->compare('HdMode', $this->HdMode, true);
$criteria->compare('ClaimAcc', $this->ClaimAcc, true);
$criteria->compare('Payers', $this->Payers, true);
$criteria->compare('DlzNew', $this->DlzNew, true);
$criteria->compare('EpoTn', $this->EpoTn, true);
$criteria->compare('Epounit', $this->Epounit, true);
$criteria->compare('Hct', $this->Hct, true);
$criteria->compare('Paychk', $this->Paychk, true);
$criteria->compare('Amount', $this->Amount, true);
$criteria->compare('HDCharge', $this->HDCharge, true);
$criteria->compare('Payrate', $this->Payrate, true);
$criteria->compare('AddiPay', $this->AddiPay, true);
$criteria->compare('Payable', $this->Payable, true);
$criteria->compare('EHS', $this->EHS, true);
$criteria->compare('BF', $this->BF, true);
$criteria->compare('CheckCode', $this->CheckCode, true);
$criteria->compare('Flag', $this->Flag, true);
$criteria->compare('D_update', $this->D_update, true);
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例12: search
public function search()
{
$criteria = new CDbCriteria();
$criteria->order = 'id DESC';
$criteria->compare('apartment_id', $this->apartment_id, true);
return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => param('adminPaginationPageSize', 20))));
}
示例13: 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('type', $this->type, true);
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例14: search
public function search()
{
$criteria = new CDbCriteria();
$criteria->compare('LoginID', $this->LoginID);
$criteria->compare('User', $this->User, true);
$criteria->compare('Pass', $this->Pass, true);
$criteria->compare('State', $this->State);
$criteria->compare('Type', $this->Type);
$criteria->compare('AreaID', $this->AreaID);
$criteria->compare('Param', $this->Param);
$criteria->compare('Comment', $this->Comment, true);
$criteria->compare('TechComment', $this->TechComment, true);
$criteria->compare('AddTime', $this->AddTime, true);
$criteria->compare('LastTime', $this->LastTime, true);
$criteria->compare('SendInt', $this->SendInt);
$criteria->compare('Version', $this->Version, true);
$criteria->compare('AppType', $this->AppType);
$criteria->compare('AppVer', $this->AppVer, true);
$criteria->compare('UpdTime', $this->UpdTime, true);
$criteria->compare('AreaAdmin', $this->AreaAdmin);
$criteria->compare('PersistCon', $this->PersistCon);
$criteria->compare('LangID', $this->LangID);
$criteria->compare('Email', $this->Email, true);
$criteria->compare('MaxSessions', $this->MaxSessions);
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例15: 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')));
}