/**
  * @param int $channel
  * @return string
  */
 protected function initializeAdminArea($channel = 1)
 {
     $appServiceLoader = $this->recoverAppServiceLoader($channel);
     $configurations = $appServiceLoader->recoverService('configurations');
     $sessionContainer = new SessionContainer();
     if (!$this->checkPasswordPreviewArea($configurations, $sessionContainer)) {
         header("Location: " . $this->url()->fromRoute('password-preview'));
         exit;
     }
     $request = $this->getRequest();
     $uri = $request->getUri();
     $basePath = sprintf('%s://%s%s', $uri->getScheme(), $uri->getHost(), $request->getBaseUrl() . '/');
     $cookieWarning = $sessionContainer->offsetGet($configurations['sitename']);
     $lang = $this->params()->fromRoute('lang') ? $this->params()->fromRoute('lang') : 'it';
     $serviceLocator = $this->getServiceLocator();
     $helper = new SetupAbstractControllerHelper();
     $helper->setConfigurations($configurations);
     $helper->setRequest($request);
     $helper->setupZf2appDir();
     $helper->setupAppDirRelativePath();
     try {
         $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
         $wrapperModules = $helper->recoverWrapper(new ModulesGetterWrapper(new ModulesGetter($em)), array('status' => 1, 'fields' => 'module.code, module.name'));
         $modulesRecords = $wrapperModules->recoverModuleCodeOnly($wrapperModules->getRecords());
         $helper->checkRecords($modulesRecords, "Nessun dato relativo all'elenco moduli");
     } catch (NullException $e) {
     }
     /**
      * @var \Zend\Mvc\I18n\Translator $translator
      */
     $translator = $serviceLocator->get('translator');
     if (file_exists('./module/Application/language/form.array.' . $lang . '.php')) {
         $translator->addTranslationFile('phparray', './module/Application/language/form.array.' . $lang . '.php');
     }
     $serviceLocator->get('ViewHelperManager')->get('translate')->setTranslator($translator);
     $templateBackend = $configurations['template_backend'];
     $this->layout()->setVariables(array_merge($configurations, array('configurations' => $configurations, 'publicDirRelativePath' => $helper->getAppDirRelativePath() . '/public', 'baseUrl' => sprintf($basePath . 'admin/main/' . $this->params()->fromRoute('lang') . '/'), 'basePath' => $basePath, 'userDetails' => $sessionContainer->offsetGet('userDetails'), 'preloadResponse' => $helper->getConfigurations('preloadResponse', 1), 'templateDir' => 'backend/templates/' . $templateBackend, 'formDataCommonPath' => 'backend/templates/common/', 'passwordPreviewArea' => $this->hasPasswordPreviewArea($configurations), 'cookieWarning' => !empty($cookieWarning) ? $cookieWarning : null, 'isMultiLanguage' => isset($configurations['isMultiLanguage']) ? 1 : 0, 'defaultLanguageId' => 1, 'defaultLanguageAbbreviation' => 'it', 'modulesRecords' => $modulesRecords)));
     return 'backend/templates/' . $templateBackend . 'backend.phtml';
 }
 public function testSetConfigurations()
 {
     $this->helper->setConfigurations(array($this->helper->setConfigurations($this->getFrontendCommonInput())));
     $this->assertTrue(is_array($this->helper->getConfigurations()));
 }