コード例 #1
0
ファイル: Page.php プロジェクト: cheremhovo1990/eshopyii
 public function actionPage($id)
 {
     if (Yii::$app->user->isGuest) {
         throw new \yii\web\ForbiddenHttpException(Yii::t('app', '<div class="alert">Thank you for your interest in this content. You must be logged in as a registered user to view this page in its entirety.</div>'));
     }
     if (!Yii::$app->user->can('show', Yii::$app->user->identity)) {
         throw new \yii\web\ForbiddenHttpException(Yii::t('app', '<div class="alert"><h4>Expired Account</h4>Thank you for your interest in this content, but your account is no longer current. Please <a href="renew.php">renew your account</a> in order to view this page in its entirety.</div>'));
     }
     $page = Pages::find()->where('id=:id', [':id' => $id])->one();
     if (empty($page)) {
         throw new \yii\web\NotFoundHttpException();
     }
     return $this->render('page', compact('page'));
 }