Example #1
0
 /**
  * Displays event view page.
  *
  * @return mixed
  */
 public function actionShow()
 {
     if (Yii::$app->request->get("eventname") == "") {
         throw new CHttpException(404, 'The specified post cannot be found.');
     }
     $eventname = Yii::$app->request->get("eventname");
     $list = Events::find()->where(['link' => $eventname]);
     if ($list->count() == 0) {
         throw new CHttpException(404, 'The specified post cannot be found.');
     }
     $list = $list->one();
     $org = Users::find()->where(['id' => $list["FK_organizer_id"]])->one();
     $participients = UsersEvents::find()->where(['FK_event_id' => $list->id]);
     $pars = array();
     if ($participients->count() == 0) {
         $participients = false;
     }
     if ($participients) {
         $participients = $participients->all();
         foreach ($participients as $value) {
             $pars[] = $value["id"];
         }
     }
     Users::current()->id;
     $participients = Users::find()->where(['id' => $pars])->all();
     return $this->render('view', ['model' => $list, 'org' => $org, 'participients' => $participients]);
 }