2009-04-07 17:44:17 +00:00
< ? php
2009-04-20 16:32:11 +00:00
session_start ();
2009-04-07 17:44:17 +00:00
if ( ! $_SESSION [ 'connected' ]) die ();
2009-04-16 16:34:13 +00:00
$tabInfo = $_SESSION [ 'tabInfo' ];
2009-04-07 17:44:17 +00:00
$vue = isset ( $_REQUEST [ 'vue' ]) ? $_REQUEST [ 'vue' ] : 'recherche' ;
2009-05-07 14:31:17 +00:00
require_once 'graydon/graydon_log.php' ;
2009-05-12 10:01:34 +00:00
require_once 'dbbootstrap.php' ;
2009-04-24 14:14:48 +00:00
/* Affichage du formulaire de recherche */
2009-04-07 17:44:17 +00:00
if ( $vue == 'recherche' ){
?>
< script type = " text/javascript " >
$ ( document ) . ready ( function (){
2009-04-20 12:41:56 +00:00
$ ( '#mode' ) . change ( function (){
var mode = $ ( '#mode :selected' ) . val ();
2009-04-27 08:29:26 +00:00
document . location . href = '<?php print EXTRANET_URL; ?>?page=international_recherche&mode=' + mode ;
2009-04-20 12:41:56 +00:00
});
$ ( '#pays' ) . change ( function (){
var pays = $ ( '#pays :selected' ) . val ();
$ ( '#method' ) . html ( '<p><img src="./img/ajax/19-1.gif" /></p>' );
$ ( '#method' ) . load ( './pages/graydon/methodfield.php' , { 'pays' : pays });
2009-04-07 17:44:17 +00:00
});
});
</ script >
< div id = " international " >
< h2 class = " StyleRechercheTitre " > RECHERCHE INTERNATIONALE </ h2 >
2009-04-20 12:41:56 +00:00
< form name = " recherche " method = " post " action = " index.php?page=international_recherche " >
2009-04-07 17:44:17 +00:00
< input type = " hidden " name = " vue " value = " list " >
2009-04-20 12:41:56 +00:00
< div class = " fieldgrp " >
< label > Mode : </ label >
< div class = " field " >
< select id = " mode " name = " mode " >
< option value = " demo " < ? php $_REQUEST [ 'mode' ] == 'demo' ? print ' selected' : '' ; ?> >D<> monstration</option>
< option value = " normal " < ? php $_REQUEST [ 'mode' ] == 'normal' ? print ' selected' : '' ; ?> >Normal</option>
</ select >
</ div >
</ div >
2009-04-07 17:44:17 +00:00
2009-04-20 12:41:56 +00:00
< div id = " subsearch " >
2009-04-07 17:44:17 +00:00
< ? php
//Si les param<61> tres mode, method sont dans l'url alors on force la m<> thode de recherche
if ( isset ( $_REQUEST [ 'method' ]))
{
$method = $_REQUEST [ 'method' ];
2009-05-14 16:44:01 +00:00
$pays = $_SESSION [ 'graydon' ][ 'pays' ];
2009-04-07 17:44:17 +00:00
}
require_once 'international_rechercheform.php' ;
?>
</ div >
</ form >
2009-04-20 12:41:56 +00:00
2009-04-07 17:44:17 +00:00
</ div >
< ? php
} elseif ( $vue == 'list' ){
//*********** Mode d<> monstration
if ( $_REQUEST [ 'mode' ] == 'demo' ){
2009-05-14 16:44:01 +00:00
$pays = $_REQUEST [ 'frmDemo' ][ 'Country' ];
$_SESSION [ 'graydon' ][ 'pays' ] = $pays ;
2009-05-07 14:31:17 +00:00
$_SESSION [ 'graydon' ][ 'mode' ] = 'demo' ;
2009-05-14 16:44:01 +00:00
2009-04-07 17:44:17 +00:00
?>
< div id = " internationallist " >
2009-04-20 12:41:56 +00:00
< span class = " StyleInfoLib " > R<EFBFBD> sultat de la recherche de d<EFBFBD> monstration :</ span >
2009-04-07 17:44:17 +00:00
< ? php
2009-04-20 16:32:11 +00:00
require_once 'i18n/cleanchar.php' ;
2009-04-07 17:44:17 +00:00
require_once 'graydon/graydonws.php' ;
// Create the request parameters
$request = new StdClass ();
// Initialise the request object
$request -> Authentication_Parameters = $authentication ;
2009-05-14 16:44:01 +00:00
$request -> Country = $pays ;
2009-04-07 17:44:17 +00:00
try
{
// Make a request on the web service
$result = $graydon -> getDemoCompanies ( $request );
2009-04-24 14:14:48 +00:00
//Enregistrement de l'action dans les logs
$transactionIdentifier = $result -> Service_Log -> TransactionIdentifier ;
$sessionID = $result -> Service_Log -> SessionID ;
2009-05-07 14:31:17 +00:00
graydonRequeteLog ( $_SESSION [ 'tabInfo' ][ 'login' ], $page , 'getDemoCompanies' , $transactionIdentifier , $sessionID , $manager );
2009-04-24 14:14:48 +00:00
2009-05-11 09:52:19 +00:00
//Log de la requete dans la bdd
2009-05-13 16:05:50 +00:00
setDbConn ( 'graydon' );
2009-05-11 09:52:19 +00:00
$log = new Requetelog ();
$log -> login = $_SESSION [ 'tabInfo' ][ 'login' ];
$log -> action = 'getDemoCompanies' ;
$log -> request = serialize ( $request );
$log -> transactionIdentifier = $transactionIdentifier ;
$log -> sessionID = $sessionID ;
$log -> mode = 'demo' ;
$log -> save ();
2009-05-13 16:05:50 +00:00
//Get the list of companies
2009-04-07 17:44:17 +00:00
$demoCompaniesCountry = $result -> DemoCompanies -> CountryAndCompany ;
?>
< br />
2009-04-20 12:41:56 +00:00
< span class = " StyleInfoLib " > Pays :</ span > < span >< ? php print $demoCompaniesCountry -> Country ; ?> </span>
2009-04-07 17:44:17 +00:00
< ol >
< ? php
$demoCompanies = array ();
//Enregitrement de la liste en session
$count = count ( $demoCompaniesCountry -> Companies -> Company );
if ( $count > 1 ){
$demoCompanies = $demoCompaniesCountry -> Companies -> Company ;
} elseif ( $count == 1 ){
$demoCompanies [] = $demoCompaniesCountry -> Companies -> Company ;
}
$firephp -> log ( $demoCompanies , 'demoCompanies' );
$counterCompany = 1 ;
foreach ( $demoCompanies as $company ){
?>
< li class = " StyleInfoData " type = " 1 " value = " <?php print $counterCompany ++; ?> " >
< b >< a title = " Voir la fiche d'identité de cet établissement " href = " index.php?page=international_identite&mode=demo&identifier=<?php print $company->CompanyMatchIdentifier ;?> " >
2009-04-20 16:32:11 +00:00
< ? php print cleanutf8 ( $company -> Name ); ?> </a></b><br />
2009-04-07 17:44:17 +00:00
Adresse :
2009-04-23 06:53:26 +00:00
< ? php
2009-04-20 16:32:11 +00:00
print cleanutf8 ( $company -> RegisteredAddress -> EntireAddress );
2009-04-07 17:44:17 +00:00
?> <br/><br/>
</ li >
< ? php
}
?>
</ ol >
</ div >
< ? php
2009-04-16 16:34:13 +00:00
} catch ( SoapFault $fault ){
2009-05-07 14:31:17 +00:00
$code = $fault -> detail -> GraydonCompanyData_Fault -> FaultReturnCode ;
$text = $fault -> detail -> GraydonCompanyData_Fault -> FaultMessage ;
$firephp -> log ( $text , 'texterror' );
require_once 'graydon/graydon_error.php' ;
if ( graydon_error ( $code , $text ) == FALSE ){
graydon_processSoapFault ( $graydon , $fault , $tabInfo );
}
2009-04-07 17:44:17 +00:00
}
//*********** Mode normal
} elseif ( $_REQUEST [ 'mode' ] == 'normal' ){
2009-05-15 16:36:05 +00:00
$paysCode = $_REQUEST [ 'frmRecherche' ][ 'CountryCode' ];
2009-05-13 16:05:50 +00:00
//Lire le lib<69> l<EFBFBD> du pays graydon en fonction du code
setDbConn ( 'graydon' );
$q = Doctrine_Query :: Create ()
-> select ( 'graydon_country' )
-> from ( 'Country' )
2009-05-14 16:44:01 +00:00
-> where ( 'code = ?' , $paysCode );
2009-05-13 16:05:50 +00:00
$result = $q -> fetchOne ();
$pays = $result -> graydon_country ;
2009-05-15 16:36:05 +00:00
$firephp -> log ( $pays , 'pays' );
2009-05-15 16:43:43 +00:00
2009-05-14 16:44:01 +00:00
$_SESSION [ 'graydon' ][ 'pays' ] = $pays ;
$_SESSION [ 'graydon' ][ 'paysCode' ] = $paysCode ;
$_SESSION [ 'graydon' ][ 'mode' ] = 'normal' ;
2009-04-07 17:44:17 +00:00
?>
< div id = " internationallist " >
2009-04-20 12:41:56 +00:00
< span class = " StyleInfoLib " > R<EFBFBD> sultat de la recherche :</ span >
2009-04-07 17:44:17 +00:00
< ? php
2009-04-20 16:32:11 +00:00
require_once 'i18n/cleanchar.php' ;
2009-04-07 17:44:17 +00:00
require_once 'graydon/graydonws.php' ;
// Create the request parameters
$request = new StdClass ();
// Initialise the request object
$request -> Authentication_Parameters = $authentication ;
// Create a new country parameters object
$company = new StdClass ();
// Initialise the country object
2009-05-13 16:05:50 +00:00
$company -> Country = $pays ;
2009-04-07 17:44:17 +00:00
$company -> ClientReference = '' ;
$request -> Authentication_Parameters = $authentication ;
$request -> CompanyMatches_Parameters = $company ;
2009-04-09 17:10:02 +00:00
if ( $_REQUEST [ 'method' ] == 'keyword' ){
$request -> Keyword = $_REQUEST [ 'frmRecherche' ][ 'Keywords' ];
$request -> City = isset ( $_REQUEST [ 'frmRecherche' ][ 'City' ]) ? $_REQUEST [ 'frmRecherche' ][ 'City' ] : '' ;
$request -> PostCode = isset ( $_REQUEST [ 'frmRecherche' ][ 'PostCode' ]) ? $_REQUEST [ 'frmRecherche' ][ 'PostCode' ] : '' ;
2009-04-16 16:34:13 +00:00
} elseif ( $_REQUEST [ 'method' ] == 'identifier' ){
2009-04-09 17:10:02 +00:00
$request -> Identifier = $_REQUEST [ 'frmRecherche' ][ 'Identifier' ];
} elseif ( $_REQUEST [ 'method' ] == 'name' ){
$request -> Name = $_REQUEST [ 'frmRecherche' ][ 'Name' ];
$request -> City = isset ( $_REQUEST [ 'frmRecherche' ][ 'City' ]) ? $_REQUEST [ 'frmRecherche' ][ 'City' ] : '' ;
$request -> PostCode = isset ( $_REQUEST [ 'frmRecherche' ][ 'PostCode' ]) ? $_REQUEST [ 'frmRecherche' ][ 'PostCode' ] : '' ;
} elseif ( $_REQUEST [ 'method' ] == 'postcode' ){
$request -> PostCode = isset ( $_REQUEST [ 'frmRecherche' ][ 'PostCode' ]) ? $_REQUEST [ 'frmRecherche' ][ 'PostCode' ] : '' ;
}
2009-04-24 16:52:30 +00:00
2009-04-07 17:44:17 +00:00
$firephp -> log ( $request , 'requete' );
try
{
2009-04-09 17:10:02 +00:00
// Make a request on the webservice
if ( $_REQUEST [ 'method' ] == 'keyword' ){
$result = $graydon -> getCompanyMatchesByKeyword ( $request );
2009-04-24 14:14:48 +00:00
//Enregistrement de l'action dans les logs
$transactionIdentifier = $result -> Service_Log -> TransactionIdentifier ;
$sessionID = $result -> Service_Log -> SessionID ;
graydonRequeteLog ( $_SESSION [ 'tabInfo' ][ 'login' ], $page , 'getCompanyMatchesByKeyword' , $transactionIdentifier , $sessionID );
2009-05-11 09:52:19 +00:00
//Log de la requete dans la bdd
2009-05-13 16:05:50 +00:00
setDbConn ( 'graydon' );
2009-05-11 09:52:19 +00:00
$log = new Requetelog ();
$log -> login = $_SESSION [ 'tabInfo' ][ 'login' ];
$log -> action = 'getCompanyMatchesByKeyword' ;
$log -> request = serialize ( $request );
$log -> transactionIdentifier = $transactionIdentifier ;
$log -> sessionID = $sessionID ;
$log -> mode = 'normal' ;
$log -> save ();
2009-04-24 14:14:48 +00:00
} elseif ( $_REQUEST [ 'method' ] == 'identifier' ){
2009-04-09 17:10:02 +00:00
$result = $graydon -> getCompanyMatchesByIdentifier ( $request );
2009-04-24 14:14:48 +00:00
//Enregistrement de l'action dans les logs
$transactionIdentifier = $result -> Service_Log -> TransactionIdentifier ;
$sessionID = $result -> Service_Log -> SessionID ;
graydonRequeteLog ( $_SESSION [ 'tabInfo' ][ 'login' ], $page , 'getCompanyMatchesByIdentifier' , $transactionIdentifier , $sessionID );
2009-05-11 09:52:19 +00:00
//Log de la requete dans la bdd
2009-05-13 16:05:50 +00:00
setDbConn ( 'graydon' );
2009-05-11 09:52:19 +00:00
$log = new Requetelog ();
$log -> login = $_SESSION [ 'tabInfo' ][ 'login' ];
$log -> action = 'getCompanyMatchByIdentifier' ;
$log -> request = serialize ( $request );
$log -> transactionIdentifier = $transactionIdentifier ;
$log -> sessionID = $sessionID ;
$log -> mode = 'normal' ;
$log -> save ();
2009-04-09 17:10:02 +00:00
} elseif ( $_REQUEST [ 'method' ] == 'name' ){
$result = $graydon -> getCompanyMatchesByName ( $request );
2009-04-24 14:14:48 +00:00
//Enregistrement de l'action dans les logs
$transactionIdentifier = $result -> Service_Log -> TransactionIdentifier ;
$sessionID = $result -> Service_Log -> SessionID ;
graydonRequeteLog ( $_SESSION [ 'tabInfo' ][ 'login' ], $page , 'getCompanyMatchesByName' , $transactionIdentifier , $sessionID );
2009-05-11 09:52:19 +00:00
//Log de la requete dans la bdd
2009-05-13 16:05:50 +00:00
setDbConn ( 'graydon' );
2009-05-11 09:52:19 +00:00
$log = new Requetelog ();
$log -> login = $_SESSION [ 'tabInfo' ][ 'login' ];
$log -> action = 'getCompanyMatchesByName' ;
$log -> request = serialize ( $request );
$log -> transactionIdentifier = $transactionIdentifier ;
$log -> sessionID = $sessionID ;
$log -> mode = 'normal' ;
$log -> save ();
2009-04-09 17:10:02 +00:00
} elseif ( $_REQUEST [ 'method' ] == 'postcode' ){
$result = $graydon -> getCompanyMatchesByPostCode ( $request );
2009-04-07 17:44:17 +00:00
2009-04-24 14:14:48 +00:00
//Enregistrement de l'action dans les logs
$transactionIdentifier = $result -> Service_Log -> TransactionIdentifier ;
$sessionID = $result -> Service_Log -> SessionID ;
graydonRequeteLog ( $_SESSION [ 'tabInfo' ][ 'login' ], $page , 'getCompanyMatchesByPostCode' , $transactionIdentifier , $sessionID );
2009-05-11 09:52:19 +00:00
//Log de la requete dans la bdd
2009-05-13 16:05:50 +00:00
setDbConn ( 'graydon' );
2009-05-11 09:52:19 +00:00
$log = new Requetelog ();
$log -> login = $_SESSION [ 'tabInfo' ][ 'login' ];
$log -> action = 'getCompanyMatchesByPostCode' ;
$log -> request = serialize ( $request );
$log -> transactionIdentifier = $transactionIdentifier ;
$log -> sessionID = $sessionID ;
$log -> mode = 'normal' ;
$log -> save ();
2009-04-24 14:14:48 +00:00
}
2009-04-07 17:44:17 +00:00
2009-04-20 12:41:56 +00:00
$_SESSION [ 'graydon' ][ 'SessionID' ] = $result -> Service_Log -> SessionID ;
$_SESSION [ 'graydon' ][ 'TransactionIdentifier' ] = $result -> Service_Log -> TransactionIdentifier ;
2009-04-07 17:44:17 +00:00
?>
< br />
2009-04-20 12:41:56 +00:00
< span class = " StyleInfoLib " > Pays :</ span > < span >< ? php print $result -> Service_Log -> Country ; ?> </span>
2009-04-07 17:44:17 +00:00
< ol >
< ? php
$count = count ( $result -> CompanyMatches -> Company );
if ( $count > 1 ){
$companies = $result -> CompanyMatches -> Company ;
} elseif ( $count == 1 ){
$companies [] = $result -> CompanyMatches -> Company ;
}
$firephp -> log ( $companies , 'companies' );
$counterCompany = 1 ;
foreach ( $companies as $company ){
?>
< li class = " StyleInfoData " type = " 1 " value = " <?php print $counterCompany ++; ?> " >
< b >< a title = " Voir la fiche d'identité de cet établissement " href = " index.php?page=international_identite&identifier=<?php print $company->CompanyMatchIdentifier ;?> " >
2009-04-20 16:32:11 +00:00
< ? php print cleanutf8 ( $company -> Name ); ?> </a></b><br />
2009-04-07 17:44:17 +00:00
Addresse :
2009-05-13 16:05:50 +00:00
< ? php
2009-04-20 16:32:11 +00:00
print cleanutf8 ( $company -> RegisteredAddress -> EntireAddress );
2009-04-07 17:44:17 +00:00
?> <br />
</ li >
< ? php
}
?>
</ ol >
2009-05-13 16:05:50 +00:00
< br />
2009-05-15 16:43:43 +00:00
< p class = " StyleInfoLib " > Si aucun r<EFBFBD> sultat ne correspond <EFBFBD> votre recherche .</ p >
< p class = " StyleInfoLib " >< a href = " ./index.php?page=international_recherche " > Cliquez - ici </ a > pour essayer <EFBFBD> nouveau avec des informations diff<EFBFBD> rentes .</ p >
2009-04-07 17:44:17 +00:00
</ div >
< ? php
2009-04-16 16:34:13 +00:00
} catch ( SoapFault $fault ){
2009-05-07 14:31:17 +00:00
$code = $fault -> detail -> GraydonCompanyData_Fault -> FaultReturnCode ;
$text = $fault -> detail -> GraydonCompanyData_Fault -> FaultMessage ;
$firephp -> log ( $text , 'texterror' );
require_once 'graydon/graydon_error.php' ;
2009-05-14 16:44:01 +00:00
$error = graydon_error ( $code , $text );
if ( $error == FALSE ){
2009-05-07 14:31:17 +00:00
graydon_processSoapFault ( $graydon , $fault , $tabInfo );
2009-05-15 15:35:25 +00:00
} elseif ( $error [ 'Code' ] == 'CWS5000' ){
2009-05-14 16:44:01 +00:00
?>
< br />
2009-05-15 16:43:43 +00:00
< p class = " StyleInfoLib " > Aucun r<EFBFBD> sultat n ' a <EFBFBD> t<EFBFBD> trouv<EFBFBD> . < a href = " ./index.php?page=international_recherche " > Cliquez - ici </ a > pour retourner au formulaire de recherche .</ p >
2009-05-14 16:44:01 +00:00
< ? php
2009-05-15 16:43:43 +00:00
/* Proposition commande de rapport
Proposition enquete */
2009-05-07 14:31:17 +00:00
}
2009-04-07 17:44:17 +00:00
}
}
}
?>