Ejemplo n.º 1
0
 public function run()
 {
     $controller = $this->getController();
     $controller->_seoTitle = Yii::t('common', 'User Center') . ' - ' . Yii::t('common', 'My Replys') . ' - ' . $controller->_setting['site_name'];
     //我的回复
     $uid = Yii::app()->user->id;
     $comment_mod = new Comment();
     $reply_mod = new Reply();
     $criteria = new CDbCriteria();
     $criteria->addColumnCondition(array('t.user_id' => $uid));
     $criteria->order = 't.id DESC';
     //分页
     $count = $reply_mod->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 15;
     $pages->applyLimit($criteria);
     $datalist = $reply_mod->findAll($criteria);
     foreach ((array) $datalist as $k => $v) {
         $reply = $comment_mod->findByPk($v->cid);
         if ($reply) {
             $c_mod_class = $controller->_content_models[$reply->type];
             $c_mod_name = strtolower($c_mod_class);
             $content_mod = new $c_mod_class();
             $content = $content_mod->findByPk($reply->content_id);
             $datalist[$k]['title'] = $content->title;
             $datalist[$k]['url'] = $controller->createUrl($c_mod_name . '/view', array('id' => $reply->content_id));
         }
     }
     $controller->render('my_replys', array('datalist' => $datalist, 'pages' => $pages));
 }
Ejemplo n.º 2
0
 /**
  * 回复管理
  *
  */
 public function actionIndex()
 {
     $model = new Reply();
     $criteria = new CDbCriteria();
     $condition = '1';
     $status = $this->_request->getParam('status');
     $status && ($condition .= " AND t.status='{$status}'");
     $criteria->condition = $condition;
     $criteria->order = 't.id DESC';
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 15;
     $pageParams = $this->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);
     Yii::app()->clientScript->registerCssFile($this->_static_public . "/js/kindeditor/code/prettify.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/kindeditor/code/prettify.js", CClientScript::POS_END);
     $this->render('index', array('datalist' => $result, 'pagebar' => $pages));
 }
Ejemplo n.º 3
0
 public function run()
 {
     $model = new Reply();
     //条件
     $criteria = new CDbCriteria();
     $status = trim(Yii::app()->request->getParam('status'));
     $status && $criteria->addColumnCondition(array('status' => $status));
     $title = trim(Yii::app()->request->getParam('content'));
     $title && $criteria->addSearchCondition('content', $title);
     $criteria->order = 't.id DESC';
     $count = $model->count($criteria);
     //分页
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     //查询
     $result = $model->findAll($criteria);
     Yii::app()->clientScript->registerCssFile($this->controller->_static_public . "/js/kindeditor/code/prettify.css");
     Yii::app()->clientScript->registerScriptFile($this->controller->_static_public . "/js/kindeditor/code/prettify.js", CClientScript::POS_END);
     $this->controller->render('index', array('model' => $model, 'datalist' => $result, 'pagebar' => $pages));
 }
Ejemplo n.º 4
0
 public function run()
 {
     $controller = $this->getController();
     $this->_setting = $controller->_setting;
     $this->_stylePath = $controller->_stylePath;
     $this->_static_public = $controller->_static_public;
     $controller->_seoTitle = Yii::t('common', 'User Center') . ' - ' . Yii::t('common', 'My Replys') . ' - ' . $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");
     //我的回复
     $uid = Yii::app()->user->id;
     $comment_mod = new Comment();
     $reply_mod = new Reply();
     $model_type = new ModelType();
     $uid = Yii::app()->user->id;
     $criteria = new CDbCriteria();
     $criteria->condition = 't.user_id=' . $uid;
     $criteria->order = 't.id DESC';
     //分页
     $count = $reply_mod->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 15;
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $datalist = $reply_mod->findAll($criteria);
     foreach ((array) $datalist as $k => $v) {
         $reply = $comment_mod->findByPk($v->cid);
         if ($reply) {
             $c_mod_class = $controller->_content_models[$reply->type];
             $c_mod_name = strtolower($c_mod_class);
             $content_mod = new $c_mod_class();
             $content = $content_mod->findByPk($reply->topic_id);
             $datalist[$k]['title'] = $content->title;
             $datalist[$k]['url'] = $controller->createUrl($c_mod_name . '/view', array('id' => $reply->topic_id));
         }
     }
     $controller->render('my_replys', array('datalist' => $datalist));
 }