/**
  * Updates an existing tournaments model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     Yii::$app->user->returnUrl = Yii::$app->request->url;
     $model = $this->findModel($id);
     //getting standings with participants
     $participants = new ArrayDataProvider(['allModels' => Result::getStandings($id), 'pagination' => false]);
     //all teams(potential participants) for the current tournament
     $teams = Teams::getTeamCandidates($model->country0, TeamTournaments::getTournamentParticipantsID($id));
     $forecasters = new ArrayDataProvider(['allModels' => $model->getForecastersListNew()]);
     //getting the next tour number
     $nextTour = Tournaments::getNextTour($id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->goBack();
     } else {
         return $this->render('update', compact('nextTour', 'model', 'teams', 'participants', 'forecasters'));
     }
 }