コード例 #1
0
ファイル: SiteController.php プロジェクト: efabrikov/chomu
 public function actionResult()
 {
     if (!Yii::$app->user->identity) {
         return $this->goHome();
     }
     \Yii::$app->view->registerMetaTag(['name' => 'description', 'content' => '']);
     $this->getMetaTagsDefault();
     $questionsYes = Questions::find()->andWhere(['yes' => 1])->all();
     $questionsNo = Questions::find()->andWhere(['no' => 1])->all();
     $customYes = new Questions();
     $customYes->id = 1000001;
     $customYes->questions = 'Iншi';
     $customYes->yes = 1;
     $questionsYes[] = $customYes;
     $customNo = new Questions();
     $customNo->id = 1000002;
     $customNo->questions = 'Iншi';
     $customNo->no = 1;
     $questionsNo[] = $customNo;
     $result = Vote::getResult();
     return $this->render('result', ['questionsYes' => $questionsYes, 'questionsNo' => $questionsNo, 'result' => $result]);
 }