Esempio n. 1
0
 public function search()
 {
     $criteria = new CDbCriteria();
     if ($this->comment_id) {
         if ($this->comment_id) {
             $criteria->addColumnCondition(array('t.id' => $this->comment_id));
         }
     } else {
         if ($this->post_id) {
             $criteria->addColumnCondition(array('t.post_id' => $this->post_id));
         }
         if ($this->user_id) {
             $criteria->addColumnCondition(array('t.user_id' => $this->user_id));
         }
         if ($this->user_name) {
             $criteria->addColumnCondition(array('t.user_name' => $this->user_name));
         }
         if ($this->keyword) {
             $criteria->addSearchCondition('t.content', $this->keyword);
         }
         if ($this->start_create_time || $this->end_create_time) {
             $criteria->addCondition(array('and', 't.create_time > :starttime', 't.create_time < :endtime'));
             $starttime = (int) $this->start_create_time ? strtotime($this->start_create_time) : 0;
             $endtime = (int) $this->end_create_time ? strtotime($this->end_create_time) : $_SERVER['REQUEST_TIME'];
             $params = array(':starttime' => $starttime, ':endtime' => $endtime);
             $criteria->params = array_merge($criteria->params, $params);
         }
     }
     $data = $criteria->condition ? AdminComment::fetchList($criteria) : null;
     return $data;
 }
Esempio n. 2
0
 public function actionRecommend()
 {
     $count = (int) param('adminCommentCountOfPage');
     $criteria = new CDbCriteria();
     $criteria->scopes = 'recommend';
     $criteria->limit = $count;
     $data = AdminComment::fetchList($criteria);
     $this->adminTitle = t('recommend_comment', 'admin');
     $this->render('list', $data);
 }