/** * {@inheritDoc} */ public function getClientsByTypesSegmentAndMotCle($sm, $typesSegment, $motCle = NULL) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getClientsByTypesSegmentAndMotCle', array($sm, $typesSegment, $motCle)); return parent::getClientsByTypesSegmentAndMotCle($sm, $typesSegment, $motCle); }
/** * Action qui permet d'avoir un listing des clients et des interlocuteurs */ public function listeclientAction() { $client = new Client(); //Si la requète n'est pas de type AJAX, on n'effectue pas de recherche if (!$this->getRequest()->isXmlHttpRequest()) { //Assignation de variables au layout $this->layout()->setVariables(array('headTitle' => $this->getServiceLocator()->get('Translator')->translate('Liste des clients'), 'breadcrumbActive' => $this->getServiceLocator()->get('Translator')->translate('Liste des clients'), 'route' => array('Clients'), 'action' => 'listeclient', 'module' => 'client', 'plugins' => array('dataTable', 'chosen'))); $types = $this->getEntityManager()->getRepository('Client\\Entity\\TypeSegment')->findBy(array(), array('intituleTypeSegment' => 'ASC')); $segments = $this->getEntityManager()->getRepository('Client\\Entity\\Segment')->findBy(array(), array('intituleSegment' => 'ASC')); $produitsFinis = $this->getEntityManager()->getRepository('Client\\Entity\\ProduitFini')->findBy(array(), array('intituleProduitFini' => 'ASC')); return new ViewModel(array('clients' => $client->getListeClient($this->getServiceLocator()), 'types_segment' => $types, 'segments' => $segments, 'produits_finis' => $produitsFinis)); } // S'il s'agit d'une recherche $resultat = array(); $motCle = isset($_GET['motCle']) ? $_GET['motCle'] : null; // Avec type de segment if (isset($_GET['produitsFinis'])) { $arrayProduits = $_GET['produitsFinis']; $resultat = $client->getClientsByProduitsFinisAndMotCle($this->getServiceLocator(), $arrayProduits, $motCle); } else { if (isset($_GET['segments'])) { $arraySegments = $_GET['segments']; $resultat = $client->getClientsBySegmentsAndMotCle($this->getServiceLocator(), $arraySegments, $motCle); } else { if (isset($_GET['typesSegment'])) { $arrayTypes = $_GET['typesSegment']; $resultat = $client->getClientsByTypesSegmentAndMotCle($this->getServiceLocator(), $arrayTypes, $motCle); } else { if (!is_null($motCle)) { $resultat = $client->getClients($this->getServiceLocator(), '%' . addslashes($motCle) . '%', intval($_GET['maxRows'])); } else { $resultat = $client->getListeClient($this->getServiceLocator()); } } } } return new JsonModel(array('resultat' => json_encode($resultat))); }