public function indexAction()
 {
     $mainLayout = $this->initializeAdminArea();
     $lang = $this->params()->fromRoute('lang');
     $moduleCode = $this->params()->fromRoute('module');
     $referenceId = $this->params()->fromRoute('referenceId');
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $userDetails = $this->layout()->getVariable('userDetails');
     try {
         $helper = new AttachmentsFormControllerHelper();
         $helper->setModulesGetterWrapper(new ModulesGetterWrapper(new ModulesGetter($em)));
         $helper->setupModuleRecords($moduleCode);
         $helper->setAttachmentsGetterWrapper(new AttachmentsGetterWrapper(new AttachmentsGetter($em)));
         $helper->setupAttachmentsRecords(array('moduleId' => ModulesContainer::recoverIdFromModuleCode($moduleCode), 'referenceId' => $referenceId, 'orderBy' => 'a.position'));
         $helper->setModuleCode($moduleCode);
         $helper->checkModuleRecords();
         $helper->setupPropertiesGetterClassPath();
         $helper->setupPropertiesGetterClassInstance();
         $helper->getPropertiesGetterClassInstance()->setModuleCode($moduleCode);
         $helper->getPropertiesGetterClassInstance()->setEntityManager($em);
         $helper->getPropertiesGetterClassInstance()->setAttachmentsReferenceId($referenceId);
         $helper->getPropertiesGetterClassInstance()->setupProperties();
         if ($moduleCode == 'albo-pretorio') {
             $alboRettificaColumnDisplay = 1;
         }
         if ($moduleCode == 'atti-concessione') {
             $attiConcessioneColumnDisplayForm = new AttiConcessioneColumnDisplayForm();
             $attiConcessioneColumnDisplayForm->addSubmitButton();
         }
         $this->layout()->setVariables(array('hideBreadcrumb' => 1, 'attachmentsList' => $helper->getAttachmentRecords(), 'articleTitle' => $helper->getPropertiesGetterClassInstance()->getAttachmentFormTitle(), 'attachmentType' => $helper->getModuleCode(), 'moduleCode' => $moduleCode, 'referenceId' => $referenceId, 'formBreadCrumbCategory' => $helper->getPropertiesGetterClassInstance()->getBreadcrumbModule(), 'formBreadCrumbCategoryLink' => $this->url()->fromRoute($helper->getPropertiesGetterClassInstance()->getBreadcrumbRoute(), array('lang' => $lang, 'languageSelection' => $lang, 'modulename' => $moduleCode)), 'alboRettificaColumnDisplay' => isset($alboRettificaColumnDisplay) ? $alboRettificaColumnDisplay : null, 'attiConcessioneCatColumnDisplay' => isset($attiConcessioneColumnDisplayForm) ? 1 : null, 'attiConcessioneColumnDisplayForm' => isset($attiConcessioneColumnDisplayForm) ? $attiConcessioneColumnDisplayForm : null, 'templatePartial' => 'attachments/attachments-summary.phtml'));
     } catch (NullException $e) {
         $this->layout()->setVariables(array('templatePartial' => 'message.phtml', 'messageType' => 'danger', 'messageTitle' => 'Si è verificato un errore', 'messageText' => $e->getMessage()));
     }
     $this->layout()->setTemplate($mainLayout);
 }
 public function updatecolumnattachmentAction()
 {
     $request = $this->getRequest();
     $post = array_merge_recursive($request->getPost()->toArray(), $request->getFiles()->toArray());
     if ($request->isPost()) {
         /**
          * @var \Doctrine\ORM\EntityManager $em
          */
         $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
         /**
          * @var \Doctrine\DBAL\Connection $connection
          */
         $connection = $em->getConnection();
         $inputFilter = new AttiConcessioneColumnDisplayFormInputFilter();
         $form = new AttiConcessioneColumnDisplayForm();
         $form->addSubmitButton();
         $form->setInputFilter($inputFilter->getInputFilter());
         $form->setData($post);
         if ($form->isValid()) {
             $inputFilter->exchangeArray($form->getData());
             $helper = new AttachmentsControllerHelper();
             $helper->setConnection($connection);
             $helper->getConnection()->beginTransaction();
             $helper->updateAttiConcessioneColonna($post['id'], $post['attiConcessioneColonna']);
             $helper->getConnection()->commit();
         }
         if (is_object($this->getRequest()->getHeader('Referer'))) {
             return $this->redirect()->toUrl($this->getRequest()->getHeader('Referer')->getUri());
         }
         return $this->redirectForUnvalidAccess();
     }
 }