本文整理汇总了PHP中XUtils::buildCondition方法的典型用法代码示例。如果您正苦于以下问题:PHP XUtils::buildCondition方法的具体用法?PHP XUtils::buildCondition怎么用?PHP XUtils::buildCondition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XUtils
的用法示例。
在下文中一共展示了XUtils::buildCondition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _catalogList
/**
* 获取栏目内容数据
*
* @param array $params
* @return array 数组
*/
protected function _catalogList($params = array())
{
$postModel = new Post();
$postCriteria = new CDbCriteria();
$condition = '1';
if ($params['catalog']) {
$condition .= ' AND t.catalog_id=:catalogId';
$criteriaParams[':catalogId'] = intval($params['catalog']);
}
if ($params['keyword']) {
$condition .= ' AND t.title=:title';
$criteriaParams[':title'] = CHtml::encode(strip_tags($params['keyword']));
}
$condition .= " AND t.status_is='Y'";
$postCriteria->condition = $condition;
$postCriteria->params = $criteriaParams;
$postCriteria->order = 't.id DESC';
$postCriteria->with = 'catalog';
$count = $postModel->count($postCriteria);
$postPages = new CPagination($count);
$postPages->pageSize = $params['pageSize'] > 0 ? $params['pageSize'] : 20;
$pageParams = XUtils::buildCondition($_GET, array('catalog', 'keyword'));
$postPages->params = is_array($pageParams) ? $pageParams : array();
$postCriteria->limit = $postPages->pageSize;
$postCriteria->offset = $postPages->currentPage * $postPages->pageSize;
$bagecmsDataList = $postModel->findAll($postCriteria);
$catalogArr = Catalog::item($params['catalog'], $this->_catalog);
if ($catalogArr) {
$this->_seoTitle = empty($catalogArr['catalog_name']) ? $this->_seoTitle : $catalogArr['catalog_name'];
$bagecmsCatalogData = $catalogArr;
$this->_seoKeywords = empty($catalogArr['seo_keywords']) ? $this->_seoKeywords : $catalogArr['seo_keywords'];
$this->_seoDescription = empty($catalogArr['seo_description']) ? $this->_seoDescription : $catalogArr['seo_description'];
}
return array('bagecmsDataList' => $bagecmsDataList, 'bagecmsPagebar' => $postPages, 'bagecmsCatalogData' => $bagecmsCatalogData);
}
示例2: actionIndex
public function actionIndex()
{
static $static_adminId;
static $static_catalog;
parent::_acl('admin_logger');
$model = new AdminLogger();
$criteria = new CDbCriteria();
$condition = '1';
$adminId = $this->_gets->getParam('adminId', $static_adminId);
$catalog = $this->_gets->getParam('catalog', $static_catalog);
print_r($catalog);
if ($static_adminId != $adminId) {
$static_adminId = $adminId;
}
if ($static_catalog != $catalog) {
$static_catalog = $catalog;
}
print_r($static_catalog);
$adminId && ($condition .= ' AND user_id=' . $adminId);
$catalog && ($condition .= ' AND catalog= \'' . $catalog . '\'');
$criteria->condition = $condition;
$criteria->order = 'id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 40;
$pageParams = XUtils::buildCondition($_GET, array('username', 'catalog'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('admin_logger', array('datalist' => $result, 'pagebar' => $pages));
}
示例3: actionShow
/**
* 查看专题
*/
public function actionShow($name)
{
$specialModel = Special::model()->find('title_alias=:titleAlias', array('titleAlias' => CHtml::encode(strip_tags($name))));
if (false == $specialModel) {
throw new CHttpException(404, '专题不存在');
}
//更新浏览次数
$specialModel->updateCounters(array('view_count' => 1), 'id=:id', array('id' => $specialModel->id));
$specialPostModel = new Post();
$criteria = new CDbCriteria();
$criteria->addCondition('t.status_is=:status AND special_id=:specialId');
$criteria->params = array('status' => 'Y', 'specialId' => $specialModel->id);
$criteria->order = 't.id DESC';
$bagecmsSpecialCount = $specialPostModel->count($criteria);
$postPage = new CPagination($bagecmsSpecialCount);
$postPage->pageSize = 10;
$postPageParams = XUtils::buildCondition($_GET, array());
$postPageParams['#'] = 'list';
$postPage->params = is_array($postPageParams) ? $postPageParams : array();
$criteria->limit = $postPage->pageSize;
$criteria->offset = $postPage->currentPage * $postPage->pageSize;
$specialPostList = $specialPostModel->findAll($criteria);
$this->_seoTitle = empty($specialModel->seo_title) ? $specialModel->title . ' - ' . $this->_conf['site_name'] : $specialModel->seo_title;
$tpl = empty($specialModel->tpl) ? 'show' : $specialModel->tpl;
$data = array('specialShow' => $specialModel, 'specialPostList' => $specialPostList, 'bagecmsPagebar' => $postPage);
$this->render($tpl, $data);
}
示例4: actionIndex
/**
* 首页
*
*/
public function actionIndex()
{
parent::_acl('house_index');
$model = new House();
$criteria = new CDbCriteria();
$condition = '1';
$city_id = $this->_gets->getParam('city_id');
$district_id = $this->_gets->getParam('district_id');
//$investType_id = $this->_gets->getParam( 'investType_id' );
$propertyType_id = $this->_gets->getParam('propertyType_id');
$h_name = trim($this->_gets->getParam('h_name'));
$is_recommend = $this->_gets->getParam('is_recommend');
$city_id && ($condition .= ' AND city_id= ' . $city_id);
$district_id && ($condition .= ' AND district_id= ' . $district_id);
//$investType_id && $condition .= ' AND investType_id= ' . $investType_id;
if ($propertyType_id == 1) {
$propertyType_id && ($condition .= ' AND type_own1_out="Detached" ');
} elseif ($propertyType_id == 2) {
$propertyType_id && ($condition .= ' AND type_own1_out="Townhouse" or type_own1_out="Att∕Row∕Twnhouse" or type_own1_out="Triplex" or type_own1_out="Fourplex" or type_own1_out="Multiplex"');
} elseif ($propertyType_id == 3) {
$propertyType_id && ($condition .= ' AND lp_dol>3000000');
} elseif ($propertyType_id == 4) {
$propertyType_id && ($condition .= ' AND type_own1_out="Semi-Detached" or type_own1_out="Link" or type_own1_out="Duplex"');
} elseif ($propertyType_id == 5) {
$propertyType_id && ($condition .= ' AND type_own1_out="Cottage" or type_own1_out="Rural Resid"');
} elseif ($propertyType_id == 6) {
$propertyType_id && ($condition .= ' AND type_own1_out="Farm"');
} elseif ($propertyType_id == 7) {
$propertyType_id && ($condition .= ' AND type_own1_out="Vacant Land"');
} elseif ($propertyType_id == 8) {
$propertyType_id && ($condition .= ' AND type_own1_out="Mobile/Trailer" or type_own1_out="Det W/Com Elements" or type_own1_out="Store W/Apt/offc"');
}
$h_name && ($condition .= ' AND addr LIKE \'%' . $h_name . '%\' or ml_num LIKE \'%' . $h_name . '%\'');
$is_recommend && ($condition .= ' AND recommend= ' . $is_recommend);
$criteria->condition = $condition;
$criteria->order = 't.id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 10;
$pageParams = XUtils::buildCondition($_GET, array('city_id, district_id, type_own1_out, addr, recommend'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->subject_list = parent::_groupList('subject');
$this->city_list = parent::_groupList('city');
$this->district_list = parent::_groupList('district');
$this->investType_list = parent::_groupList('investType');
$this->propertyType_list = parent::_groupList('propertyType');
$this->render('index', array('datalist' => $result, 'pagebar' => $pages));
}
示例5: actionIndex
/**
* 首页
*
*/
public function actionIndex()
{
parent::_acl();
$model = new Position();
$criteria = new CDbCriteria();
$condition = '1';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 10;
$pageParams = XUtils::buildCondition($_GET, array('type'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('index', array('datalist' => $result, 'pagebar' => $pages));
}
示例6: actionIndex
/**
* 首页
*/
public function actionIndex()
{
$bagecmsQuestionModel = new Question();
$bagecmsQuestionCriteria = new CDbCriteria();
$bagecmsQuestionCriteria->condition = 'status_is=:status';
$bagecmsQuestionCriteria->params = array('status' => 'Y');
$bagecmsQuestionCriteria->order = 't.id DESC';
$bagecmsQuestionCount = $bagecmsQuestionModel->count($bagecmsQuestionCriteria);
$bagecmsQuestionPages = new CPagination($bagecmsQuestionCount);
$bagecmsQuestionPages->pageSize = 10;
$bagecmsQuestionPageParams = XUtils::buildCondition($_GET, array());
$bagecmsQuestionPageParams['#'] = 'list';
$bagecmsQuestionPages->params = is_array($bagecmsQuestionPageParams) ? $bagecmsQuestionPageParams : array();
$bagecmsQuestionCriteria->limit = $bagecmsQuestionPages->pageSize;
$bagecmsQuestionCriteria->offset = $bagecmsQuestionPages->currentPage * $bagecmsQuestionPages->pageSize;
$bagecmsQuestionList = $bagecmsQuestionModel->findAll($bagecmsQuestionCriteria);
$this->_seoTitle = '留言咨询 - ' . $this->_conf['site_name'];
$this->render('index', array('bagecmsQuestionList' => $bagecmsQuestionList, 'pages' => $bagecmsQuestionPages));
}
示例7: actionIndex
/**
* 首页
*
*/
public function actionIndex($id = 0)
{
parent::_acl('layout_index');
$model = new Layout();
$criteria = new CDbCriteria();
$condition = '1';
$house_id = $this->_gets->getParam('house_id');
$house_id && ($condition .= ' AND house_id= ' . $house_id);
$criteria->condition = $condition;
$criteria->order = 't.id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 10;
$pageParams = XUtils::buildCondition($_GET, array('house_id'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->house_list = parent::_groupList('house');
$this->render('index', array('datalist' => $result, 'pagebar' => $pages, 'house_id' => $id));
}
示例8: actionIndex
/**
* 首页
*
*/
public function actionIndex()
{
parent::_acl('evaluate_index');
$model = new Evaluate();
$criteria = new CDbCriteria();
$condition = '1';
$isHandle = $this->_gets->getParam('is_handle');
$noHandle = $this->_gets->getParam('no_handle');
$isHandle && ($condition .= ' AND status= ' . $isHandle);
$noHandle && ($condition .= ' AND status= ' . $noHandle);
$criteria->condition = $condition;
$criteria->order = 't.id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 10;
$pageParams = XUtils::buildCondition($_GET, array('status'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('index', array('datalist' => $result, 'pagebar' => $pages));
}
示例9: actionIndex
public function actionIndex()
{
parent::_acl();
$model = new Page();
$criteria = new CDbCriteria();
$condition = '1';
$title = $this->_gets->getParam('title');
$titleAlias = $this->_gets->getParam('titleAlias');
$title && ($condition .= ' AND title LIKE \'%' . $title . '%\'');
$titleAlias && ($condition .= ' AND title_alias LIKE \'%' . $titleAlias . '%\'');
$criteria->condition = $condition;
$criteria->order = 't.id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 13;
$pageParams = XUtils::buildCondition($_GET, array('page_name_alias', 'page_name'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('index', array('datalist' => $result, 'pagebar' => $pages));
}
示例10: actionIndex
/**
* 首页
*/
public function actionIndex()
{
parent::_acl();
$model = new Question();
$criteria = new CDbCriteria();
$condition = '1';
$realname = trim($this->_gets->getParam('realname'));
$question = trim($this->_gets->getParam('question'));
$question && ($condition .= ' AND question LIKE \'%' . $question . '%\'');
$realname && ($condition .= ' AND realname LIKE \'%' . $realname . '%\'');
$criteria->condition = $condition;
$criteria->order = 't.id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 13;
$pageParams = XUtils::buildCondition($_GET, array('site_name'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('index', array('datalist' => $result, 'pagebar' => $pages));
}
示例11: actionIndex
/**
* 首页
*/
public function actionIndex()
{
$keyword = CHtml::encode(strip_tags(trim($this->_gets->getParam('keyword'))));
$postModel = new Post();
$postCriteria = new CDbCriteria();
if ($keyword) {
$postCriteria->addSearchCondition('t.title', $keyword);
}
$postCriteria->addCondition('t.status_is=:status');
$postCriteria->params[':status'] = 'Y';
$postCriteria->with = 'catalog';
$postCriteria->order = 't.id DESC';
$bagecmsQuestionCount = $postModel->count($postCriteria);
$postPages = new CPagination($bagecmsQuestionCount);
$postPages->pageSize = 15;
$postPageParams = XUtils::buildCondition($_GET, array('keyword'));
$postPageParams['#'] = 'list';
$postPages->params = is_array($postPageParams) ? $postPageParams : array();
$postCriteria->limit = $postPages->pageSize;
$postCriteria->offset = $postPages->currentPage * $postPages->pageSize;
$postList = $postModel->findAll($postCriteria);
$this->render('index', array('bagecmsDataList' => $postList, 'bagecmsPagebar' => $postPages));
}
示例12: actionAttach
/**
* 附件管理
*/
public function actionAttach()
{
parent::_acl('attach_index');
$model = new Upload();
$criteria = new CDbCriteria();
$condition = '1';
$realname = trim($this->_gets->getParam('realname'));
$filename = trim($this->_gets->getParam('file'));
$realname && ($condition .= ' AND t.real_name LIKE \'%' . $realname . '%\'');
$filename && ($condition .= ' AND t.file_name LIKE \'%' . $filename . '%\'');
$criteria->condition = $condition;
// $criteria->params = '';
$criteria->order = 't.id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 13;
$pageParams = XUtils::buildCondition($_GET, array('filename', 'nickname'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('attach_index', array('datalist' => $result, 'pagebar' => $pages));
}
示例13: actionIndex
/**
* 首页
*
*/
public function actionIndex()
{
parent::_acl('post_index');
$model = new Post();
$criteria = new CDbCriteria();
$condition = '1';
$title = trim($this->_gets->getParam('title'));
$catalogId = intval($this->_gets->getParam('catalogId'));
$title && ($condition .= ' AND title LIKE \'%' . $title . '%\'');
$catalogId && ($condition .= ' AND catalog_id= ' . $catalogId);
$criteria->condition = $condition;
$criteria->order = 't.id DESC';
$criteria->with = array('catalog');
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 10;
$pageParams = XUtils::buildCondition($_GET, array('title', 'catalogId'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('index', array('datalist' => $result, 'pagebar' => $pages));
}
示例14: actionAdmin
public function actionAdmin()
{
parent::_acl('admin_logger');
$model = new AdminLogger();
$criteria = new CDbCriteria();
$condition = '1';
$username = $this->_gets->getParam('username');
$catalog = $this->_gets->getParam('catalog');
$username && ($condition .= ' AND admin.username= \'' . $username . '\'');
$catalog && ($condition .= ' AND t.catalog= \'' . $catalog . '\'');
$criteria->condition = $condition;
$criteria->order = 't.id DESC';
$criteria->with = 'admin';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 40;
$pageParams = XUtils::buildCondition($_GET, array('username', 'catalog'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('admin_logger', array('datalist' => $result, 'pagebar' => $pages));
}
示例15: actionPost
/**
* tags数据列表
*/
public function actionPost($name)
{
$tagName = CHtml::encode(strip_tags(urldecode($name)));
$tagModel = new Post2tags();
$post2TagsCriteria = new CDbCriteria();
if ($tagName) {
$post2TagsCriteria->addCondition("tag_name = :tagName");
$post2TagsCriteria->params[':tagName'] = $tagName;
}
$post2TagsCriteria->order = 't.id DESC';
$post2TagsCriteria->with = array('post');
$post2TagsCount = $tagModel->count($post2TagsCriteria);
$post2TagsPages = new CPagination($post2TagsCount);
$post2TagsPages->pageSize = 30;
$pageParams = XUtils::buildCondition($_GET, array('name'));
$post2TagsPages->params = is_array($pageParams) ? $pageParams : array();
$post2TagsCriteria->limit = $post2TagsPages->pageSize;
$post2TagsCriteria->offset = $post2TagsPages->currentPage * $post2TagsPages->pageSize;
$data['bagecmsDataList'] = $tagModel->findAll($post2TagsCriteria);
$data['bagecmsPagebar'] = $post2TagsPages;
$data['tagName'] = $tagName;
$this->_seoTitle = 'Tag-' . $tagName;
$this->render('post2tags', $data);
}