label = new Zend_Config_Ini('Giant/Traductions/label.ini', 'search'); $this->labelResults = new Zend_Config_Ini('Giant/Traductions/results.ini', 'search'); $this->headerSearch = new stdClass(); $this->headerSearch->IncludePhoneticMatches = FALSE; $this->headerSearch->IncludeSuggestions = FALSE; $this->soapClient = $soap; self::searchPaginator($paginatorAction); } /** * Retourne une methode présent dans cette classe * * @param Nom de la methode $methode * @param uparametres $parametres */ public function getMethode($methode, $parametres) { foreach($this->methodes as $fonction) { if ($methode == $fonction) return (self::$fonction($parametres)); } } /** * Methode de recherche traite les informations retounrés par giant. * * @param unknown_type $paramatres */ protected function search($paramatres) { $searchParametre = new stdClass(); $searchParametre->Query = ''; $champQuery = array( 'raisonSociale', 'numero', 'voie', 'cpVille', 'telFax', 'naf' ); $this->soapClient->getAllMethodesFromWsdl('search'); $searchParametre->StartRow = $_SESSION['recherche']['giant']['page']; foreach($paramatres as $champ => $parametre) { if(!empty($parametre)) { foreach($champQuery as $valeur) { if($champ == $valeur) $searchParametre->Query .= $parametre.' '; } } } $this->query = $searchParametre->Query; $search = array_merge((array)$searchParametre, (array)$this->headerSearch); return ($this->soapClient->search($search)); } public function advancedSearch($parametres) { $advancedParametres = new stdClass(); $TypeAdvanced = new stdClass(); $this->soapClient->getAllMethodesFromWsdl('advancedSearch'); $labelForm = array( 'siret' => 'CompanyId', 'raisonSociale' => 'RegisteredName', 'numero' => 'HouseNumber', 'voie' => 'Street', 'cpVille' => 'City' ); foreach ($parametres as $champ => $parametre) { if (!empty($parametre)) { foreach ($labelForm as $nameForm => $valeur) { if ($champ == $nameForm) $TypeAdvanced->$valeur = $parametre; } } } $advancedParametres->Query = $TypeAdvanced; $advanced = array_merge((array)$advancedParametres, (array)$this->headerSearch); $this->query = $advancedParametres->Query->CompanyId; return($this->soapClient->advancedSearch($advanced)); } /** * Permet de routourner la frappe utilisateur la recherche */ public function getQuery() { return ($this->query); } /** * Gere la pagination * * @param unknown_type $action */ private function searchPaginator($action) { if ($action == 'up') { if ($_SESSION['recherche']['giant']['page'] <= $_SESSION['recherche']['giant']['nbResults']) $_SESSION['recherche']['giant']['page']++; } else if ($action == 'down') { if ($_SESSION['recherche']['giant']['page'] > 0) $_SESSION['recherche']['giant']['page']--; } } /** * Gestion des label Descriptions */ public function getLabelDesc() { return ($this->label); } /** * Gestion des labels de resultats */ public function getLabelResults() { return ($this->labelResults); } private function checkValide($valeur) { if (!empty($valeur)) return ($valeur); return (null); } public function __destruct() { unset($this->soapClient); } }