/** * 获取栏目内容数据 * * @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); }
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)); }
/** * 查看专题 */ 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); }
/** * 首页 * */ 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)); }
/** * 首页 * */ 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)); }
/** * 首页 */ 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)); }
/** * 首页 * */ 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)); }
/** * 首页 * */ 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)); }
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)); }
/** * 首页 */ 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)); }
/** * 首页 */ 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)); }
/** * 附件管理 */ 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)); }
/** * 首页 * */ 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)); }
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)); }
/** * 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); }
<?php $bagecmsCommentModel = new PostComment(); $bagecmsCommentCriteria = new CDbCriteria(); $bagecmsCommentCriteria->condition = 'post_id=' . $bagecmsShow['id']; $bagecmsCommentCriteria->order = 't.id DESC'; $bagecmsCommentCount = $bagecmsCommentModel->count($bagecmsCommentCriteria); $bagecmsCommentPages = new CPagination($bagecmsCommentCount); $bagecmsCommentPages->pageSize = 15; $bagecmsCommentPageParams = XUtils::buildCondition($_GET, array('id')); $bagecmsCommentPageParams['#'] = 'commentList'; $bagecmsCommentPages->params = is_array($bagecmsCommentPageParams) ? $bagecmsCommentPageParams : array(); $bagecmsCommentCriteria->limit = $bagecmsCommentPages->pageSize; $bagecmsCommentCriteria->offset = $bagecmsCommentPages->currentPage * $bagecmsCommentPages->pageSize; $bagecmsCommentList = $bagecmsCommentModel->findAll($bagecmsCommentCriteria); ?> <div id="comment"> <div class="boxTit "> <h3>最新评论</h3> </div> <div class="bmc"> <?php foreach ($bagecmsCommentList as $key => $row) { ?> <dl class="item clear"> <dt class="user"> <a class="title" ><?php echo CHtml::encode($row->nickname); ?> </a> <span class=" xw0"><?php echo date('Y-m-d H:i:s', $row['create_time']); ?>
public function actionLogger() { //所有账号 $users = Admin::model()->findAll(array('select' => 'id,username')); // ppr($users); $uid = reqGetNum('uid'); $model = new AdminLogger(); $condition = '1'; $uid && ($condition = "t.`user_id`='{$uid}'"); $criteria = new CDbCriteria(); $criteria->condition = $condition; $criteria->order = 't.create_time DESC'; $criteria->with = array('user'); $count = $model->count($criteria); $pages = new CPagination($count); $pages->pageSize = 10; $pageParams = XUtils::buildCondition($_GET, array('user_id', 'r')); $pages->params = is_array($pageParams) ? $pageParams : array(); $criteria->limit = $pages->pageSize; $criteria->offset = $pages->currentPage * $pages->pageSize; $datalist = $model->findAll($criteria); $this->render('logger', array('datalist' => $datalist, 'pagebar' => $pages, 'pagecount' => $count, 'users' => $users, 'uid' => $uid)); }
/** * 首页 * */ public function actionIndex() { parent::_acl(); //过期 $show = reqGet('show', null); $catalogId = intval(reqGet('catalogId', 0)); $catalogList = $catalogListSub = null; //顶级分类 if ($catalogId > 0) { $catalogList = XXcache::_doCatalog($catalogId, $this->_catalog); foreach ($this->_catalog as $value) { if ($value['id'] == $catalogId) { $value['catalog_name'] = '==' . $value['catalog_name'] . '=='; if (empty($catalogList)) { $catalogList = array($value); } else { $catalogList = array_merge(array($value), $catalogList); } } } if (!empty($catalogList)) { //非last foreach ($catalogList as $value) { $catalogListSub[] = $value['id']; } // $catalogListSub = implode(',', $catalogListSub); } } else { //全部有效分类 if (!empty($this->_catalog)) { //非last foreach ($this->_catalog as $value) { $catalogListSub[] = $value['id']; } } } $catalogList = $this->_catalog; $model = new Links(); $criteria = new CDbCriteria(); $condition = '1'; $keyword = trim(reqGet('keyword')); $search_type = trim(reqGet('search_type')); $keyword && $search_type && ($condition .= ' AND ' . $search_type . ' LIKE \'%' . $keyword . '%\''); if ($show) { $theTime = time(); //有效但过期 if ($show == 'past') { $condition .= " AND t.status_is = 'Y' AND begin_time>0 AND end_time>0 AND (`begin_time` > '{$theTime}' OR `end_time` < '{$theTime}')"; } //无效 if ($show == 'status_n') { $condition .= " AND t.status_is = 'N' "; } } if (!empty($catalogListSub)) { $temp = null; foreach ($catalogListSub as $value) { $temp[] = "`catalog_id` = '{$value}'"; } $condition .= ' AND (' . implode(' OR ', $temp) . ')'; // $condition .= ' AND `catalog_id` IN ('.$catalogListSub.')'; } else { $catalogId && ($condition .= ' AND `catalog_id`= ' . $catalogId); } $criteria->condition = $condition; $criteria->order = 't.catalog_id ASC,t.status_is ASC,t.sort_order ASC'; $criteria->with = array('catalog', 'user'); $count = $model->count($criteria); $pages = new CPagination($count); $pages->pageSize = 15; $pageParams = XUtils::buildCondition($_GET, array('title', 'catalogId', 'search_type', 'keyword', 'show', 'r')); $pages->params = is_array($pageParams) ? $pageParams : array(); $criteria->limit = $pages->pageSize; $criteria->offset = $pages->currentPage * $pages->pageSize; $result = $model->findAll($criteria); // ppr($result); $this->render('index', array('datalist' => $result, 'pagebar' => $pages, 'pagecount' => $count, 'catalogList' => $catalogList, 'catalogId' => $catalogId, 'keyword' => $keyword, 'search_type' => $search_type)); }