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