/** * Reset password */ public function actionReset($key) { /** @var \common\modules\user\models\User $user */ /** @var \common\modules\user\models\UserKey $userKey */ // check for valid userKey $userKey = Yii::$app->getModule("user")->model("UserKey"); $userKey = $userKey::findActiveByKey($key, $userKey::TYPE_PASSWORD_RESET); if (!$userKey) { return $this->render('reset', ["invalidKey" => true]); } // get user and set "reset" scenario $success = false; $user = Yii::$app->getModule("user")->model("User"); $user = $user::findOne($userKey->user_id); $user->setScenario("reset"); // load post data and reset user password if ($user->load(Yii::$app->request->post()) && $user->save()) { // consume userKey and set success = true $userKey->consume(); $success = true; } // render // return $this->render('reset', compact("user", "success")); return $this->render('@frontend/views/site/index', ['templateType' => 'col3', 'title' => Yii::t('user', 'Вход'), 'columnFirst' => ['top3News' => SiteBlock::getTop3News(), 'top6News' => SiteBlock::getTop6News(), 'subscribing' => SiteBlock::getSubscribingForm(), 'blog_column' => SiteBlock::getBlogPosts()], 'columnSecond' => ['forgot_block' => ['view' => 'reset', 'data' => compact('user', 'success')], 'short_news' => SiteBlock::getShortNews()], 'columnThird' => ['reviewNews' => SiteBlock::getPhotoVideoNews(), 'questionBlock' => SiteBlock::getQuestionBlock(), 'tournament' => SiteBlock::getTournamentTable()]]); }
/** * Url: /match/{$id} * @param int $id Match id * @return mixed * @throws NotFoundHttpException */ public function actionMatchTranslation($id) { $match = Match::findOne($id); if (!isset($match)) { throw new NotFoundHttpException('Страница не найдена.'); } $teamPlayers = Composition::getSquadSort($match->id); $teamHomePlayers = array(); $teamGuestPlayers = array(); foreach ($teamPlayers as $player) { if ($player->command_id == $match->command_home_id) { array_push($teamHomePlayers, $player); } else { array_push($teamGuestPlayers, $player); } } $title = "Онлайн трансляция матча " . $match->teamHome->name . " - " . $match->teamGuest->name; $columnFirst = ['menu' => ['view' => '@frontend/views/translation/menu', 'data' => compact('match'), 'weight' => 0], 'comments' => Comment::getCommentsBlock($match->id, Comment::COMMENTABLE_MATCH)]; $columnFirst['comments']['weight'] = 10; $relation = Relation::find()->where(['parent_id' => $match->id, 'relation_type_id' => Relation::RELATION_ONLINE])->one(); if (isset($relation)) { $post = Post::findOne($relation->relationable_id); $columnFirst['translation'] = ['view' => '@frontend/views/translation/tpost', 'data' => compact('match', 'post'), 'weight' => 5]; } else { $matchEvents = MatchEvent::find()->where(['match_id' => $match->id])->all(); $columnFirst['match_preview'] = ['view' => '@frontend/views/translation/match_preview', 'data' => compact('match', 'matchEvents', 'post', 'teamHomePlayers', 'teamGuestPlayers'), 'weight' => 2]; $columnFirst['translation'] = ['view' => '@frontend/views/translation/index', 'data' => compact('match', 'matchEvents'), 'weight' => 5]; } // Disable banners if match is online if ($match->is_visible && !$match->is_finished && strtotime($match->date) < time()) { // SiteBlock::$banners = [false]; } usort($columnFirst, 'self::cmp'); return $this->render('@frontend/views/site/index', ['templateType' => 'col2', 'title' => 'Dynamomania.com | ' . $title, 'columnFirst' => $columnFirst, 'columnSecond' => ['tournament' => SiteBlock::getTournamentTable(), 'short_news' => SiteBlock::getshortNews(50)]]); }