Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserBibi::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'User_id' => $this->User_id]);
     $query->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'paper', $this->paper]);
     return $dataProvider;
 }
Esempio n. 2
0
 public function actionIndex()
 {
     if (Yii::$app->user->isGuest) {
         $userBibi = UserBibi::getAllDisplayUser();
         return $this->render('index', ['userBibi' => $userBibi]);
     } else {
         $mySchedule = Activity::getJoinActivity();
         $newPost = new Post();
         $sentPost = false;
         if ($newPost->load(Yii::$app->request->post())) {
             $newPost->datetime = date("Y-m-d H:i:s");
             $newPost->Participant_id = Yii::$app->user->id;
             if ($newPost->save()) {
                 $sentPost = true;
             }
         }
         return $this->render('myindex', ['schedule' => $mySchedule, 'newPost' => $newPost, 'sentPost' => $sentPost]);
     }
 }
Esempio n. 3
0
 public function getAllDisplayUser()
 {
     return UserBibi::find()->select(['id', 'User_id'])->asArray()->all();
 }
 /**
  * Finds the UserBibi model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return UserBibi the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = UserBibi::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }