/** * Lists all Thread models. * @return mixed */ public function actionIndex() { $boardId = $this->getGetValue('boardid'); $query = Thread::find()->where(['board_id' => $boardId]); $locals = $this->getPagedRows($query, ['order' => 'create_time desc']); $locals['currentBoard'] = $this->getBoard($boardId); return $this->render('index', $locals); }
/** * Lists all Thread models. * @return mixed */ public function actionIndex() { $boardId = YiiForum::getGetValue('boardid'); $query = Thread::find()->where(['board_id' => $boardId, 'status' => 1]); $locals = YiiForum::getPagedRows($query, ['order' => 'last_modify_time desc']); $locals['currentBoard'] = $this->getBoard($boardId); $locals['boards'] = $this->buildSubBoards($boardId); return $this->render('index', $locals); }
public function search($params) { $query = Thread::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'board_id' => $this->board_id, 'user_id' => $this->user_id, 'create_time' => $this->create_time, 'modify_time' => $this->modify_time, 'views' => $this->views, 'posts' => $this->posts, 'status' => $this->status]); $query->andFilterWhere(['like', 'user_name', $this->user_name])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'note1', $this->note1])->andFilterWhere(['like', 'note2', $this->note2]); return $dataProvider; }