public function indexAction()
 {
     $mainLayout = $this->initializeAdminArea();
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     try {
         $helper = new HomePageControllerHelper();
         $homePageRecords = $helper->recoverWrapperRecords(new HomePageBlocksGetterWrapper(new HomePageBlocksGetter($em)), array('orderBy' => 'homePageBlocks.position', 'fields' => ''));
         $helper->checkRecords($homePageRecords, 'Nessun blocco home page presente');
         $this->layout()->setVariables(array('records' => $homePageRecords, 'templatePartial' => 'homepage/homepage-blocks-positions.phtml'));
     } catch (\Exception $e) {
         $this->layout()->setVariables(array('messageType' => 'danger', 'messageTitle' => 'Errore verificato', 'messageText' => $e->getMessage(), 'showBreadCrumb' => 1, 'formBreadCrumbCategory' => array(array('label' => 'Gestione home page', 'href' => $this->url()->fromRoute('admin/homepage-management', array('lang' => $this->params()->fromRoute('lang'), 'title' => 'Vai alla gestione home page')), 'title' => 'Vai alla gestione home page')), 'dataTableActiveTitle' => 'Posizioni moduli', 'templatePartial' => 'message.phtml'));
     }
     $this->layout()->setTemplate($mainLayout);
 }
 public function indexAction()
 {
     $mainLayout = $this->initializeAdminArea();
     $id = $this->params()->fromRoute('id');
     $lang = $this->params()->fromRoute('lang');
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $helper = new HomePageControllerHelper();
     $entiTerziRecords = $helper->recoverWrapperRecords(new HomePageGetterWrapper(new HomePageGetter($em)), array('languageAbbreviation' => ''));
     $form = new EntiTerziForm();
     if (!empty($entiTerziRecords)) {
         $form->setData($entiTerziRecords[0]);
         $submitButtonValue = 'Modifica';
         $formTitle = 'Modifica testo libero';
         $formAction = $this->url()->fromRoute('admin/homepage-freetext-update', array('lang' => $lang));
     } else {
         $formTitle = 'Nuovo testo libero';
         $submitButtonValue = 'Inserisci';
         $formAction = $this->url()->fromRoute('admin/homepage-freetext-insert', array('lang' => $lang));
     }
     $this->layout()->setVariables(array('formTitle' => $formTitle, 'formDescription' => "Compila i dati relativi al testo da inserire in home page", 'form' => $form, 'formAction' => $formAction, 'submitButtonValue' => $submitButtonValue, 'formBreadCrumbCategory' => 'Enti terzi', 'formBreadCrumbCategoryLink' => $this->url()->fromRoute('admin/enti-terzi-summary', array('lang' => $lang)), 'templatePartial' => self::formTemplate));
     $this->layout()->setTemplate($mainLayout);
 }