controllers/AdminController.php
public function actionView($id)
    {
        $model = $this->findModel($id);
        $modelsI18n = $model->prepareI18nModels();

        if ($model->pageSize > 0) {
            $model->orderBy = $model::$defaultOrderBy;
            $model->page = $model->calcPage();
        }

        // build frontend links
        $lh = $this->module->langHelper;
        $editAllLanguages = empty($this->module->params['editAllLanguages'])
                          ? false : $this->module->params['editAllLanguages'];
        $languages = $lh::activeLanguages($editAllLanguages);
        if (Yii::$app instanceof UniApplication && Yii::$app->type == UniApplication::APP_TYPE_BACKEND) {
            $containerModule = $this->module->module;
            if ($containerModule instanceof UniModule && array_key_exists(static::$sysAppModel, $containerModule->models)) {
                $appModel = $containerModule::model(static::$sysAppModel);
                $appFront = $appModel::initFrontendApplication();  // for backend application init separate frontend-application
              //$appFront->urlManager->baseUrl = 'http://www.mysite.com';  // frontend domain - set from app-params
            }
        }
        $moduleUid = $this->module->uniqueId;
        $frontendLinks = [];
        foreach ($languages as $langCode => $lang) {
            $frontendLinks[$langCode] = '';
            if ($model->hasInvisibleParent()) {
                if (empty($model->route)) {
                    $frontendLinks[$langCode] = Url::toRoute(["/{$moduleUid}/main/show", 'id' => $model->id, 'slug' => $model->slug]);
                } else {  // external/internal link
                    $frontendLinks[$langCode] = ContentMenuBuilder::routeToLink($model->route);
                }
            } else {
                $frontendLinks[$langCode] = Url::toRoute(["/{$moduleUid}/main/view"
                  , 'id' => $model->id, 'lang' => $langCode], true);
            }
        }
        if (!empty($appModel)) $appModel::restoreApplication();

        return $this->render('view', compact('model', 'modelsI18n', 'frontendLinks'));
    }
public function actionView($id)
    {
        $model = $this->findModel($id);
        $modelsI18n = $model->prepareI18nModels();

        if ($model->pageSize > 0) {
            $model->orderBy = $model::$defaultOrderBy;
            $model->page = $model->calcPage();
        }

        // build frontend links
        $lh = $this->module->langHelper;
        $editAllLanguages = empty($this->module->params['editAllLanguages'])
                          ? false : $this->module->params['editAllLanguages'];
        $languages = $lh::activeLanguages($editAllLanguages);
        if (Yii::$app instanceof UniApplication && Yii::$app->type == UniApplication::APP_TYPE_BACKEND) {
            $containerModule = $this->module->module;
            if ($containerModule instanceof UniModule && array_key_exists(static::$sysAppModel, $containerModule->models)) {
                $appModel = $containerModule::model(static::$sysAppModel);
                $appFront = $appModel::initFrontendApplication();  // for backend application init separate frontend-application
              //$appFront->urlManager->baseUrl = 'http://www.mysite.com';  // frontend domain - set from app-params
            }
        }
        $moduleUid = $this->module->uniqueId;
        $frontendLinks = [];
        foreach ($languages as $langCode => $lang) {
            $frontendLinks[$langCode] = '';
            if ($model->hasInvisibleParent()) {
                if (empty($model->route)) {
                    $frontendLinks[$langCode] = Url::toRoute(["/{$moduleUid}/main/show", 'id' => $model->id, 'slug' => $model->slug]);
                } else {  // external/internal link
                    $frontendLinks[$langCode] = ContentMenuBuilder::routeToLink($model->route);
                }
            } else {
                $frontendLinks[$langCode] = Url::toRoute(["/{$moduleUid}/main/view"
                  , 'id' => $model->id, 'lang' => $langCode], true);
            }
        }
        if (!empty($appModel)) $appModel::restoreApplication();

        return $this->render('view', compact('model', 'modelsI18n', 'frontendLinks'));
    }
public function actionView ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ modelsI18n = $ model -> prepareI18nModels ( ) ; if ( $ model -> pageSize > 0 ) { $ model -> orderBy = $ model :: $ defaultOrderBy ; $ model -> page = $ model -> calcPage ( ) ; } // build frontend links $ lh = $ this -> module -> langHelper ; $ editAllLanguages = empty ( $ this -> module -> params [ 'editAllLanguages' ] ) ? false : $ this -> module -> params [ 'editAllLanguages' ] ; $ languages = $ lh :: activeLanguages ( $ editAllLanguages ) ; if ( Yii :: $ app instanceof UniApplication && Yii :: $ app -> type == UniApplication :: APP_TYPE_BACKEND ) { $ containerModule = $ this -> module -> module ; if ( $ containerModule instanceof UniModule && array_key_exists ( static :: $ sysAppModel , $ containerModule -> models ) ) { $ appModel = $ containerModule :: model ( static :: $ sysAppModel ) ; $ appFront = $ appModel :: initFrontendApplication ( ) ; // for backend application init separate frontend-application //$appFront->urlManager->baseUrl = 'http://www.mysite.com';  // frontend domain - set from app-params } } $ moduleUid = $ this -> module -> uniqueId ; $ frontendLinks = [ ] ; foreach ( $ languages as $ langCode => $ lang ) { $ frontendLinks [ $ langCode ] = '' ; if ( $ model -> hasInvisibleParent ( ) ) { if ( empty ( $ model -> route ) ) { $ frontendLinks [ $ langCode ] = Url :: toRoute ( [ "/{$moduleUid}/main/show" , 'id' => $ model -> id , 'slug' => $ model -> slug ] ) ; } else { // external/internal link $ frontendLinks [ $ langCode ] = ContentMenuBuilder :: routeToLink ( $ model -> route ) ; } } else { $ frontendLinks [ $ langCode ] = Url :: toRoute ( [ "/{$moduleUid}/main/view" , 'id' => $ model -> id , 'lang' => $ langCode ] , true ) ; } } if ( ! empty ( $ appModel ) ) $ appModel :: restoreApplication ( ) ; return $ this -> render ( 'view' , compact ( 'model' , 'modelsI18n' , 'frontendLinks' ) ) ; }
Displays a single Content model.
@param integer $id
@return mixed
Displays a single Content model .