extranet/includes/giant/Search.php
2011-04-14 14:24:35 +00:00

53 lines
1.6 KiB
PHP

<?php
/**
* Controller pour la recherche
* Permet de préparer les données pour le Template
*
*/
require_once 'giant/Config.php';
require_once 'giant/Client.php';
if(isset($formR['raisonSociale']) or isset($formR['siret']))
{
if(!empty($formR['raisonSociale']) or !empty($formR['siret']))
{
$pays = IssetObject($formR['pays']);
$AdvencedSearch = AdvencedSearch($formR['siret']);
$soap_client = getClient($pays, 'Search');
$Search = new SearchPortType();
$params = $Search->Search();
$params->Search->IncludePhoneticMatches = false;
$params->Search->IncludeSuggestions = false;
$params->Search->NumRows = (isset($_SESSION['nbReponses']))?$_SESSION['nbReponses']:10;
$params->Search->StartRows = setPosition($position);
if ($AdvencedSearch == true)
{
$params->Search->Query = new AdvancedSearch($formR);
$service = 'AdvancedSearch';
}
else {
$query = new SimpleSearch($formR);
$params->Search->Query = $query->Query;
$service = 'Search';
}
$informations = SwitchWSDLFunction($service, $params->Search, $soap_client);
if ($informations->Results->Company == true)
{
// Dans le cas ou nous avont plusieurs reponses (foreach).
if(is_array($informations->Results->Company))
$manyResponses = true;
require_once 'giant/templates/NbOfHits.tpl.php';
require_once 'giant/templates/Search.tpl.php';
require_once 'giant/templates/Pagination.tpl.php';
}
else
echo 'Aucun r&eacute;sultat.';
} else
echo 'Vous devez au moin rensseigner Siret ou le nom de la company';
}
?>