Пример #1
0
 public function run()
 {
     $controller = $this->getController();
     $this->_setting = $controller->_setting;
     $this->_stylePath = $controller->_stylePath;
     $this->_static_public = $controller->_static_public;
     //SEO
     $controller->_seoTitle = Yii::t('common', 'User Center') . ' - ' . Yii::t('common', 'Collect Manage') . ' - ' . $this->_setting['site_name'];
     //加载css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/user.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     //收藏列表
     $collect_mod = new Collect();
     $uid = Yii::app()->user->id;
     $criteria = new CDbCriteria();
     $criteria->condition = 't.user_id=' . $uid;
     $criteria->order = 't.id DESC';
     //分页
     $count = $collect_mod->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 15;
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $datalist = $collect_mod->findAll($criteria);
     $controller->render('my_collect', array('datalist' => $datalist, 'pages' => $pages));
 }
Пример #2
0
 public function run()
 {
     $controller = $this->getController();
     $this->_setting = $controller->_setting;
     $this->_stylePath = $controller->_stylePath;
     $this->_static_public = $controller->_static_public;
     //SEO
     $controller->_seoTitle = Yii::t('common', 'User Center') . ' - ' . Yii::t('common', 'Collect Manage') . ' - ' . $this->_setting['site_name'];
     //收藏列表
     $collect_mod = new Collect();
     $uid = Yii::app()->user->id;
     $criteria = new CDbCriteria();
     $criteria->addColumnCondition(array('t.user_id' => $uid));
     $criteria->order = 't.id DESC';
     //分页
     $count = $collect_mod->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 15;
     $pages->applyLimit($criteria);
     $datalist = $collect_mod->findAll($criteria);
     $controller->render('my_collect', array('datalist' => $datalist, 'pages' => $pages));
 }