Exemplo n.º 1
0
 public function indexAction()
 {
     parent::indexAction();
     $viewmodel = new ViewModel();
     $return = array();
     if ($this->flashMessenger()->hasErrorMessages()) {
         $return['error'] = $this->flashMessenger()->getErrorMessages();
     }
     if ($this->flashMessenger()->hasSuccessMessages()) {
         $return['success'] = $this->flashMessenger()->getSuccessMessages();
     }
     $this->flashMessenger()->clearMessages();
     $objectManager = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
     $tabid = $this->params()->fromQuery('tabid', null);
     if ($tabid) {
         $tab = $objectManager->getRepository('Application\\Entity\\Tab')->find($tabid);
         if ($tab) {
             $categories = $tab->getCategories();
             $cats = array();
             foreach ($categories as $cat) {
                 $cats[] = $cat->getId();
             }
             $viewmodel->setVariable('onlyroot', $tab->isOnlyroot());
             $viewmodel->setVariable('cats', $cats);
             $viewmodel->setVariable('tabid', $tabid);
         } else {
             $return['error'][] = "Impossible de trouver l'onglet correspondant. Contactez votre administrateur.";
         }
     } else {
         $return['error'][] = "Aucun onglet défini. Contactez votre administrateur.";
     }
     $viewmodel->setVariables(array('messages' => $return));
     return $viewmodel;
 }
Exemplo n.º 2
0
 public function indexAction()
 {
     parent::indexAction();
     $return = array();
     if ($this->flashMessenger()->hasErrorMessages()) {
         $return['error'] = $this->flashMessenger()->getErrorMessages();
     }
     if ($this->flashMessenger()->hasSuccessMessages()) {
         $return['success'] = $this->flashMessenger()->getSuccessMessages();
     }
     $this->flashMessenger()->clearMessages();
     $this->viewmodel->setVariables(array('messages' => $return));
     return $this->viewmodel;
 }
Exemplo n.º 3
0
 public function indexAction()
 {
     parent::indexAction();
     $viewmodel = new ViewModel();
     $return = array();
     if ($this->flashMessenger()->hasErrorMessages()) {
         $return['errorMessages'] = $this->flashMessenger()->getErrorMessages();
     }
     if ($this->flashMessenger()->hasSuccessMessages()) {
         $return['successMessages'] = $this->flashMessenger()->getSuccessMessages();
     }
     $this->flashMessenger()->clearMessages();
     $viewmodel->setVariables(array('messages' => $return, 'form' => $this->getRadarForm()));
     $viewmodel->setVariable('radars', $this->getRadars());
     return $viewmodel;
 }
Exemplo n.º 4
0
 public function indexAction()
 {
     parent::indexAction();
     $viewmodel = new ViewModel();
     $return = array();
     if ($this->flashMessenger()->hasErrorMessages()) {
         $return['errorMessages'] = $this->flashMessenger()->getErrorMessages();
     }
     if ($this->flashMessenger()->hasSuccessMessages()) {
         $return['successMessages'] = $this->flashMessenger()->getSuccessMessages();
     }
     $this->flashMessenger()->clearMessages();
     $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
     $qb = $em->createQueryBuilder();
     $qb->select(array('s', 'z'))->from('Application\\Entity\\SectorGroup', 's')->leftJoin('s.zone', 'z')->andWhere($qb->expr()->eq('s.display', true))->orderBy('s.position', 'ASC');
     $session = new Container('zone');
     $zonesession = $session->zoneshortname;
     if ($zonesession != null) {
         if ($zonesession != '0') {
             $orga = $em->getRepository('Application\\Entity\\Organisation')->findOneBy(array('shortname' => $zonesession));
             if ($orga) {
                 $qb->andWhere($qb->expr()->eq('z.organisation', $orga->getId()));
             } else {
                 $zone = $em->getRepository('Application\\Entity\\QualificationZone')->findOneBy(array('shortname' => $zonesession));
                 if ($zone) {
                     $qb->andWhere($qb->expr()->andX($qb->expr()->eq('z.organisation', $zone->getOrganisation()->getId()), $qb->expr()->eq('s.zone', $zone->getId())));
                 } else {
                     // error
                 }
             }
         }
     }
     if (($zonesession == null || $zonesession != null && $zonesession == '0') && $this->zfcUserAuthentication()->hasIdentity()) {
         $orga = $this->zfcUserAuthentication()->getIdentity()->getOrganisation();
         $qb->andWhere($qb->expr()->eq('z.organisation', $orga->getId()));
     }
     // pas de session, pas d'utilisateur connecté => tout ?
     $groups = $qb->getQuery()->getResult();
     $criteria = Criteria::create();
     $criteria->andWhere(Criteria::expr()->isNull('defaultsector'));
     $criteria->andWhere(Criteria::expr()->eq('decommissionned', false));
     $otherfrequencies = $em->getRepository('Application\\Entity\\Frequency')->matching($criteria);
     $config = $this->getServiceLocator()->get('config');
     $frequencyMenu = isset($config['frequency_test_menu']) ? $config['frequency_test_menu'] : false;
     $viewmodel->setVariables(array('antennas' => $this->getAntennas(), 'messages' => $return, 'groups' => $groups, 'other' => $otherfrequencies, 'frequencyTestMenu' => $frequencyMenu));
     return $viewmodel;
 }