Ejemplo n.º 1
0
 public function addPage()
 {
     if (!$this->validate()) {
         return false;
     }
     $pages = new Pages();
     $pages->title = $this->title;
     $pages->categories_id = $this->category;
     $pages->description = $this->description;
     $pages->content = $this->content;
     return $pages->save();
 }
Ejemplo n.º 2
0
 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'));
 }
Ejemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPages()
 {
     return $this->hasMany(Pages::className(), ['categories_id' => 'id']);
 }