extranet/includes/giant/search.php

120 lines
4.0 KiB
PHP
Raw Normal View History

2010-08-31 13:55:19 +00:00
<?php
// --------------------------------------------------------------------------- //
// Recherche Giant
// --------------------------------------------------------------------------- //
2010-10-01 07:31:07 +00:00
$pays = $formR['pays'];
define('NUM_ROWS', 10);
define('MAX_ROWS', 200);
require_once 'giant/config.php';
2010-10-06 11:47:31 +00:00
require_once 'giant/client.php';
2010-08-31 13:55:19 +00:00
$soap_client = getClient($pays, 'search');
$o = new StdClass;
2010-08-31 13:55:19 +00:00
$o->IncludePhoneticMatches = 'false';
$o->IncludeSuggestions = 'false';
2010-08-31 13:55:19 +00:00
if (empty($siret) == false) {
$o->Query = new StdClass;
2010-10-01 07:31:07 +00:00
$o->Query->CompanyId = $siret;
$fonction = 'AdvancedSearch';
2010-08-31 13:55:19 +00:00
} else {
$o->Query = "$raisonSociale $numVoie $libVoie $cp $ville";
if (isset($position) == true) {
$o->StartRow = $position;
} else {
$o->StartRow = 0;
}
$o->NumRows = NUM_ROWS;
$fonction = 'Search';
2010-08-31 13:55:19 +00:00
}
try {
$O = $soap_client->__call($fonction, array($o));
} catch (SoapFault $f) {
giantErreurSoap($soap_client, $f);
2010-08-31 13:55:19 +00:00
}
// --------------------------------------------------------------------------- //
// afficheCompany
// --------------------------------------------------------------------------- //
2010-10-01 10:42:03 +00:00
function afficheCompany(&$c, $deb, $num, $pays)
2010-08-31 13:55:19 +00:00
{
2010-09-03 13:42:06 +00:00
print '<li class="StyleInfoData" type="1" value="'.($deb + $num + 1).'">';
2010-10-01 10:42:03 +00:00
print '<a href="?page=giant_identite&pays='.$pays.'&company='.
$c->CompanyId.'">'.$c->RegisteredName.'</a><br/>';
2010-08-31 13:55:19 +00:00
print '<b>Register number '.$c->CompanyRegisterNumber.'</b><br/>';
if (isset($c->VatNumber) == true) {
print '<b>VAT '.$c->VatNumber.'</b><br/>';
}
2010-08-31 13:55:19 +00:00
print
$c->Address->HouseNumber.' '.
$c->Address->AddressType.' ';
if (isset($c->Address->Street) == true) {
print $c->Address->Street;
}
print '<br/>';
print '<b>'.$c->Address->PostCode.' ';
if (isset($c->Address->City) == true) {
print $c->Address->City;
}
print '</b><br/>';
print '<i>Forme : '.$c->LegalForm.'</i><br/>';
print '<br/>';
}
// --------------------------------------------------------------------------- //
// affichage
// --------------------------------------------------------------------------- //
if (isset($O->Results->Company) == true) {
print '<ol>';
if (is_array($O->Results->Company) == true) {
foreach ($O->Results->Company as $i => $c) {
2010-10-01 10:42:03 +00:00
afficheCompany($c, $O->StartRow, $i, $pays);
}
} else {
2010-10-01 10:42:03 +00:00
afficheCompany($O->Results->Company, 0, 0, $pays);
}
print '</ol>';
print '<table><tr>';
print '<td width="40%" align="right">';
if ($O->StartRow >= NUM_ROWS) {
print '<a href="./?page=recherche&vue=list&p='.($O->StartRow - NUM_ROWS).
'" title="Page précédente...">';
print '<img src="./img/boutton_precedent_off.gif"'.
' onmouseover="this.src=\'./img/boutton_precedent_on.gif\'"'.
' onmouseout="this.src=\'./img/boutton_precedent_off.gif\'"/>';
print '</a>';
}
print '</td>';
$curPage = $O->StartRow / NUM_ROWS + 1;
$totPage = min(intval($O->NumberOfHits / NUM_ROWS), MAX_ROWS / NUM_ROWS);
print '<td width="20%" align="center">';
2010-10-01 10:42:03 +00:00
if ($totPage > 1) {
print 'Page '.$curPage.'/'.$totPage;
}
print '</td>';
print '<td width="40%">';
if ($O->NumberOfHits - $O->StartRow > NUM_ROWS &&
$O->StartRow + NUM_ROWS < MAX_ROWS) {
print '<a href="./?page=recherche&vue=list&p='.($O->StartRow + NUM_ROWS).
'" title="Page suivante...">';
print '<img src="./img/boutton_suivant_off.gif"'.
' onmouseover="this.src=\'./img/boutton_suivant_on.gif\'"'.
' onmouseout="this.src=\'./img/boutton_suivant_off.gif\'"/>';
print '</a>';
2010-08-31 13:55:19 +00:00
}
print '</td>';
print '</tr><table>';
2010-08-31 13:55:19 +00:00
} else {
print 'Aucun r&eacute;sultat.';
if (DEBUG_SOAP) {
print '<br/><br/>';
print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest());
print '<br/><br/>';
print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse());
}
2010-08-31 13:55:19 +00:00
}
?>