public function search($params) { $query = YBoardMember::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'birthdate' => $this->birthdate, 'show_online' => $this->show_online, 'contact_email' => $this->contact_email, 'contact_pm' => $this->contact_pm, 'first_visit' => $this->first_visit, 'last_visit' => $this->last_visit, 'warning' => $this->warning, 'posts' => $this->posts, 'group_id' => $this->group_id, 'upvoted' => $this->upvoted, 'moderator' => $this->moderator]); $query->andFilterWhere(['like', 'location', $this->location])->andFilterWhere(['like', 'personal_text', $this->personal_text])->andFilterWhere(['like', 'signature', $this->signature])->andFilterWhere(['like', 'avatar', $this->avatar])->andFilterWhere(['like', 'timezone', $this->timezone])->andFilterWhere(['like', 'blogger', $this->blogger])->andFilterWhere(['like', 'facebook', $this->facebook])->andFilterWhere(['like', 'github', $this->github])->andFilterWhere(['like', 'google', $this->google])->andFilterWhere(['like', 'linkedin', $this->linkedin])->andFilterWhere(['like', 'metacafe', $this->metacafe])->andFilterWhere(['like', 'skype', $this->skype])->andFilterWhere(['like', 'orkut', $this->orkut])->andFilterWhere(['like', 'tumblr', $this->tumblr])->andFilterWhere(['like', 'twitter', $this->twitter])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'wordpress', $this->wordpress])->andFilterWhere(['like', 'yahoo', $this->yahoo])->andFilterWhere(['like', 'youtube', $this->youtube]); return $dataProvider; }
/** * Lists all YBoardMember models. * @return mixed */ public function actionIndex() { if (!Yii::$app->user->can('app.forum.member.index')) { throw new ForbiddenHttpException(YBoard::t('yboard', 'You have no enough permission to access this page! If you think its a mistake, please consider reporting to us.')); } $user = new User(); $qstring = Yii::$app->request->get($user->formName())['username']; $user->username = $qstring; $userIds = User::find()->select('id')->asArray()->filterWhere(['like', 'username', $qstring])->all(); $query = YBoardMember::find(); foreach ($userIds as $id) { $query->orWhere(['id' => $id['id']]); } $dataProvider = new ActiveDataProvider(['query' => $query]); //if ($searchModel->load(Yii::$app->request->getQueryParams())) { // $query->andFilterWhere(['like','id', $searchModel->id]); //} return $this->render('index', ['dataProvider' => $dataProvider, 'searchModel' => $user]); }
?> </div> <div class="col-md-1"><?php echo YBoardMember::find()->count(); ?> </div> <div class="col-md-9"></div> </div> <div class="row"> <div class="col-md-2"><?php echo YBoard::t('yboard', 'Newest member'); ?> </div> <div class="col-md-1"><?php $member = YBoardMember::find()->newestScope()->one(); echo $member == null ? YBoard::t('yboard', 'None') : Html::a($member->profile->username, ['member/view', 'id' => $member->id]); ?> </div> <div class="col-md-9"></div> </div> <div class="row"> <div class="col-md-2"><?php echo YBoard::t('yboard', 'Visitors today'); ?> </div> <div class="col-md-1"><?php echo YBoardSession::find()->count(); ?> </div>