public function indexAction()
 {
     $mainLayout = $this->initializeFrontendWebsite();
     $page = $this->params()->fromRoute('page');
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $sessionContainer = new SessionContainer();
     $sessionSearch = $sessionContainer->offsetGet(AlboPretorioSearchController::sessionIdentifier);
     try {
         $helper = new AlboPretorioControllerHelper();
         $sezioniRecords = $helper->recoverWrapperRecords(new AlboPretorioSezioniGetterWrapper(new AlboPretorioSezioniGetter($em)), array());
         $articoliWrapper = $helper->recoverWrapperRecordsPaginator(new AlboPretorioArticoliGetterWrapper(new AlboPretorioArticoliGetter($em)), array('freeSearch' => isset($sessionSearch['testo']) ? $sessionSearch['testo'] : null, 'sezioneId' => isset($sessionSearch['sezine']) ? $sessionSearch['sezine'] : null, 'numeroProgressivo' => isset($sessionSearch['numero_progressivo']) ? $sessionSearch['numero_progressivo'] : null, 'numeroAtto' => isset($sessionSearch['numero_atto']) ? $sessionSearch['numero_atto'] : null, 'mese' => isset($sessionSearch['mese']) ? $sessionSearch['mese'] : null, 'anno' => isset($sessionSearch['anno']) ? $sessionSearch['anno'] : null, 'noScaduti' => 1, 'orderBy' => 'alboArticoli.id DESC', 'pubblicare' => 1), $page, null);
         $articoliWrapper->setEntityManager($em);
         $mainRecords = $articoliWrapper->addAttachmentsToPaginatorRecords($articoliWrapper->setupRecords(), array('moduleId' => ModulesContainer::albo_pretorio_id, 'noScaduti' => 1, 'orderBy' => 'a.position'));
         $formSearch = new AlboPretorioFormSearch();
         $formSearch->addYears();
         $formSearch->addSezioni($helper->formatForDropwdown($sezioniRecords, 'id', 'nome'));
         $formSearch->addCheckExpired();
         $formSearch->addSubmitButton();
         if (!empty($sessionSearch)) {
             $formSearch->setData(array('numero_progressivo' => $sessionSearch['numero_progressivo'], 'numero_atto' => $sessionSearch['numero_atto'], 'mese' => $sessionSearch['mese'], 'anno' => $sessionSearch['anno'], 'sezione' => $sessionSearch['sezione'], 'testo' => $sessionSearch['testo'], 'expired' => $sessionSearch['expired']));
         }
         $this->layout()->setVariables(array('sessionSearch' => $sessionSearch, 'form' => $formSearch, 'paginator' => $articoliWrapper->getPaginator(), 'emptyRecords' => count($mainRecords), 'records' => $mainRecords, 'templatePartial' => 'albo-pretorio/albo-pretorio.phtml'));
     } catch (\Exception $e) {
         $this->layout()->setVariables(array('messageTitle' => 'Si è verificato un problema:', 'messageText' => $e->getMessage(), 'moduleLabel' => 'Albo pretorio', 'templatePartial' => 'message.phtml'));
     }
     $this->layout()->setTemplate($mainLayout);
 }
 public function indexAction()
 {
     $mainLayout = $this->initializeAdminArea();
     $page = $this->params()->fromRoute('page');
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $userDetails = $this->recoverUserDetails();
     $acl = $userDetails->acl;
     $translator = $this->getServiceLocator()->get('translator');
     $helper = new AlboPretorioControllerHelper();
     $wrapper = $helper->recoverWrapperRecordsPaginator(new EntiTerziGetterWrapper(new EntiTerziGetter($em)), array('orderBy' => 'ret.id DESC'), $page);
     $paginatorRecords = $wrapper->setupRecords();
     $this->layout()->setVariables(array('tableTitle' => $translator->translate('Rubrica enti terzi'), 'tableDescription' => $wrapper->getPaginator()->getTotalItemCount() . $translator->translate(' enti in archivio'), 'columns' => array("Nome", "Email", " ", $acl->hasResource('enti_terzi_delete') ? " " : null), 'paginator' => $wrapper->getPaginator(), 'records' => $this->formatRecordsToShowOnTable($paginatorRecords), 'templatePartial' => self::summaryTemplate));
     $this->layout()->setTemplate($mainLayout);
 }
 public function indexAction()
 {
     $mainLayout = $this->initializeAdminArea();
     $page = $this->params()->fromRoute('page');
     $perPage = $this->params()->fromRoute('perpage');
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $helper = new AlboPretorioControllerHelper();
     $sessionContainer = new SessionContainer();
     $sessionSearch = $sessionContainer->offsetGet(AlboPretorioSearchController::sessionIdentifier);
     try {
         $arraySearch = $helper->recoverArrayQuerySearch($sessionSearch);
         $sezioniRecords = $helper->recoverWrapperRecords(new AlboPretorioSezioniGetterWrapper(new AlboPretorioSezioniGetter($em)), array('orderBy' => 'aps.nome ASC'));
         $helper->checkRecords($sezioniRecords, 'Nessuna sezione presente');
         $alboArticoliWrapper = $helper->recoverWrapperRecordsPaginator(new AlboPretorioArticoliGetterWrapper(new AlboPretorioArticoliGetter($em)), $arraySearch, $page, $perPage);
         $formSearch = new AlboPretorioFormSearch();
         $formSearch->addYears();
         $formSearch->addSezioni($helper->formatForDropwdown($sezioniRecords, 'id', 'nome'));
         $formSearch->addCheckExpired();
         $formSearch->addSubmitButton();
         $formSearch->addResetButton();
         $formSearch->addHomePage();
         if (!empty($sessionSearch)) {
             $formSearch->setData(array('numero_progressivo' => $sessionSearch['numero_progressivo'], 'numero_atto' => $sessionSearch['numero_atto'], 'mese' => $sessionSearch['mese'], 'anno' => $sessionSearch['anno'], 'sezione' => $sessionSearch['sezione'], 'testo' => $sessionSearch['testo'], 'home' => $sessionSearch['home'], 'expired' => $sessionSearch['expired']));
         }
         $alboArticoliRecords = $alboArticoliWrapper->setupRecords();
         $alboArticoliWrapper->setEntityManager($em);
         $alboArticoliWrapper->addAttachmentsFromRecords($alboArticoliRecords, array('moduleId' => ModulesContainer::albo_pretorio_id));
         $paginator = $alboArticoliWrapper->getPaginator();
         $paginatorCount = $paginator->getTotalItemCount();
         $tableDescription = $paginatorCount . " atti in archivio. ";
         if ($paginatorCount > 0) {
             $alboStatisticsRecords = $helper->recoverWrapperRecords(new AlboPretorioArticoliGetterWrapper(new AlboPretorioArticoliGetter($em)), array_merge($arraySearch, array('fields' => '
                         (SELECT COUNT(alboArt.id) FROM Application\\Entity\\ZfcmsComuniAlboArticoli alboArt WHERE alboArt.attivo = 0) AS disattivati,
                         (SELECT COUNT(aArt.id) FROM Application\\Entity\\ZfcmsComuniAlboArticoli aArt WHERE aArt.annullato = 1) AS annullati,
                         (SELECT COUNT(aa.id) FROM Application\\Entity\\ZfcmsComuniAlboArticoli aa WHERE aa.pubblicare = 0) AS nonPubblicati,
                         (SELECT COUNT(aHome.id) FROM Application\\Entity\\ZfcmsComuniAlboArticoli aHome WHERE aHome.pubblicare = 0) AS inHome
                     ', 'limit' => 1)));
             $tableDescription .= $alboStatisticsRecords[0]['disattivati'] . ' disattivati';
             $tableDescription .= ', ' . $alboStatisticsRecords[0]['annullati'] . ' annullati';
             $tableDescription .= ', ' . $alboStatisticsRecords[0]['nonPubblicati'] . ' non pubblicati';
             $tableDescription .= ', ' . $alboStatisticsRecords[0]['inHome'] . ' presenti in home page';
         }
         $this->layout()->setVariables(array('formSearch' => $formSearch, 'tableTitle' => 'Albo pretorio', 'tableDescription' => $tableDescription, 'columns' => array(array('label' => 'Num \\ Anno', 'width' => '10%'), array('label' => 'Titolo', 'width' => '20%'), 'Sezione', 'Date', 'Inserito da', ' ', ' ', ' ', ' ', ' ', ' '), 'sessionSearch' => $sessionSearch, 'paginator' => $paginator, 'records' => $this->formatArticoliRecords($alboArticoliRecords), 'templatePartial' => 'datatable/datatable_albo_pretorio.phtml'));
     } catch (\Exception $e) {
         $this->layout()->setVariables(array('messageType' => 'warning', 'messageTitle' => 'Problema verificato', 'messageText' => $e->getMessage(), 'templatePartial' => 'message.phtml'));
     }
     $this->layout()->setTemplate($mainLayout);
 }