Exemplo n.º 1
0
 /**
  * Finds the AboutPage model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return AboutPage the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AboutPage::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 2
0
 private static function isActiveMenuItem($mid, $locale)
 {
     $result = false;
     if (preg_match('/^about-page/', Yii::$app->request->pathinfo)) {
         if ($mid == Yii::$app->request->get('mid')) {
             $result = true;
         }
     }
     if (preg_match('/^about-page\\/update/', Yii::$app->request->pathinfo)) {
         if (Yii::$app->request->get('id')) {
             $model = AboutPage::findOne(['id' => Yii::$app->request->get('id')]);
             $localGroupModel = AboutPage::findOne(['locale_group_id' => $model->locale_group_id, 'locale' => $locale]);
             if ($model and $mid == $model->about_id) {
                 $result = true;
             }
         }
     }
     return $result;
 }