Пример #1
0
 /**
  * Прогноз
  * @param $id
  * @return string
  */
 public function actionPrognose($id)
 {
     $this->layout = '@app/themes/prognose/views/layouts/pagein';
     if ($this->userIfUserLegal($id)) {
         $now_id = 1;
         $users_predicted_matches = implode(',', ArrayHelper::map(Totpredict::find()->where(['user_id' => $this->current_user->id])->all(), 'id', 'match_id'));
         $all = Totmatch::find()->all();
         foreach ($all as $one) {
             /*echo date('Y-m-d H:i:s', Totmatch::formatMatchDateToTime(explode(' ', $one->date)[0]))." "
                   .Totmatch::formatMatchDateToTime(explode(' ', $one->date)[0])." ".time()."<br>";
               var_dump(Totmatch::formatMatchDateToTime(explode(' ', $one->date)[0]) >= time());
               */
             if (Totmatch::formatMatchDateToTime(explode(' ', $one->date)[0]) + 36000 <= time()) {
                 $now_id = $one->id;
             }
         }
         if ($users_predicted_matches) {
             $match_list = Totmatch::find()->where("id NOT IN (" . $users_predicted_matches . ") AND id > " . $now_id)->all();
         } else {
             $match_list = Totmatch::find()->where("id > " . $now_id)->all();
         }
         return $this->render('group', ['user' => $this->current_user, 'match_list' => $match_list]);
     }
     return $this->render('index');
 }