extranet/www/pages/graydon/methodfield.php

124 lines
4.5 KiB
PHP
Raw Normal View History

2009-04-06 17:05:03 +00:00
<?php
$firephp->log($_SESSION, 'SESSION');
if(isset($_REQUEST['paysCode'])){
2009-07-21 15:08:08 +00:00
$paysCode = $_REQUEST['paysCode'];
}else{
2009-07-21 15:08:08 +00:00
$paysCode = $_SESSION['graydon']['paysCode'];
2009-04-07 17:44:17 +00:00
}
$firephp->log($paysCode, 'paysCode');
2009-05-04 13:45:12 +00:00
$tabInfo = $_SESSION['tabInfo'];
2009-05-11 09:52:19 +00:00
$mode = $_SESSION['graydon']['mode'];
2009-05-04 13:45:12 +00:00
require_once 'dbbootstrap.php';
2009-04-06 17:05:03 +00:00
require_once 'graydon/graydonws.php';
require_once 'graydon/graydon_log.php';
2009-05-13 16:05:50 +00:00
setDbConn('graydon');
$q = Doctrine_Query::Create()
->select('graydon_country')
->from('Country')
->where('code = ?', $paysCode);
2009-05-13 16:05:50 +00:00
$result = $q->fetchOne();
$pays = $result->graydon_country;
$firephp->log($pays, 'pays');
$_SESSION['graydon']['paysCode'] = $paysCode;
$_SESSION['graydon']['pays'] = $pays;
2009-05-04 16:59:52 +00:00
//Disponibilit<69> des pays
2009-06-08 15:36:41 +00:00
$availability = getCountryAvailability($pays);
2009-05-04 13:45:12 +00:00
2009-05-04 16:59:52 +00:00
//M<>thodes de recherche disponible pour les pays
2009-06-08 15:36:41 +00:00
$methods = getCompanyMatchMethods($pays);
2009-06-10 12:09:30 +00:00
$firephp->log($methods,'methods');
if (is_array($methods)){
2009-04-06 17:05:03 +00:00
$firephp->log($methods,'methods');
//Affichage de la meilleur m<>thode de recherche OU la premi<6D>re
2009-06-03 09:36:53 +00:00
$lien = 'La meilleure m<>thode de recherche vous est affich<63> par d<>faut.<br/> Effectuer un autre type recherche : ';
2009-04-06 17:05:03 +00:00
$flagBestMethod = false;
2009-04-20 12:54:22 +00:00
$countMethods = 0;
2009-04-09 17:10:02 +00:00
foreach($methods as $item){
$WithCity = $item->WithCity;
$WithPostCode = $item->WithPostCode;
if( ($item->BestMethod==TRUE && $item->MatchingMethod=='Keyword') && !isset($method) || $method=='keyword' ){
2009-07-21 15:08:08 +00:00
$flagBestMethod = TRUE;
2009-04-06 17:05:03 +00:00
require_once realpath(dirname(__FILE__)).'/method_keyword.php';
2009-04-09 17:10:02 +00:00
}elseif( ($item->BestMethod==TRUE && $item->MatchingMethod=='Identifier') && !isset($method) || $method=='identifier' ){
2009-04-06 17:05:03 +00:00
$flagBestMethod = TRUE;
require_once realpath(dirname(__FILE__)).'/method_identifier.php';
2009-04-09 17:10:02 +00:00
}elseif( ($item->BestMethod==TRUE && $item->MatchingMethod=='Name') && !isset($method) || $method=='name' ){
2009-04-06 17:05:03 +00:00
$flagBestMethod = TRUE;
require_once realpath(dirname(__FILE__)).'/method_name.php';
2009-04-09 17:10:02 +00:00
}elseif( ($item->BestMethod==TRUE && $item->MatchingMethod=='PostCode') && !isset($method) || $method=='postcode' ){
2009-04-06 17:05:03 +00:00
$flagBestMethod = TRUE;
2009-04-09 17:10:02 +00:00
require_once realpath(dirname(__FILE__)).'/method_postcode.php';
2009-07-21 15:08:08 +00:00
}
2009-04-20 12:54:22 +00:00
$countMethods++;
2009-04-06 17:05:03 +00:00
//Affichage des propostions des m<>thodes de recherche
if($item->MatchingMethod=='Keyword'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=keyword">Par mots cl<63>s</a>'; }
if($item->MatchingMethod=='Identifier'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=identifier">Par identifiant</a>'; }
if($item->MatchingMethod=='Name'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=name">Par nom</a>'; }
if($item->MatchingMethod=='PostCode'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=postcode">Par Post Code</a>'; }
if($countMethods>=count($methods)){ $separator=''; break; }else{ $separator=' - '; }
2009-04-20 12:54:22 +00:00
$lien = $lien.$separator;
2009-04-06 17:05:03 +00:00
}
print '<span class="left">'.$lien.'</span>';
2009-07-21 15:08:08 +00:00
}elseif($methods=='nomethods'){
2009-07-21 15:08:08 +00:00
print '<div>Il n\'est pas possible de faire une recherche dans la base de ce pays.';
2009-06-03 09:36:53 +00:00
//V<>rification des droits
if(preg_match('/international/i', $_SESSION['tabInfo']['droits'])){
2009-07-23 14:32:06 +00:00
//print 'Pour commander une enqu<71>te sur ce pays rendez-vous sur cette <a href="/?page=international_enquete&pays='.$pays.'">page</a>.';
print 'Pour commander une enqu<71>te sur ce pays rendez-vous sur cette <a href="#">page</a>.';
2009-06-03 09:36:53 +00:00
}else{
2009-06-10 12:09:30 +00:00
print 'Vous n\'avez pas les droits n<>cessaires pour commander une enqu<71>te sur ce pays.';
2009-06-03 09:36:53 +00:00
}
print '</div>';
2009-07-21 15:08:08 +00:00
2009-06-08 15:36:41 +00:00
}else{
print $methods;
2009-05-13 16:05:50 +00:00
}
//Intersud
2009-05-15 16:29:29 +00:00
/*
2009-05-13 16:05:50 +00:00
setDbConn('intersud');
$q = Doctrine_Query::Create()
->select('id, intersud_country')
->from('Country')
2009-07-21 15:08:08 +00:00
->where('code = ?', $paysCode);
2009-05-13 16:05:50 +00:00
$result = $q->fetchOne();
$idPays = $result->id;
$q = Doctrine_Query::Create()
->from('Price')
2009-07-21 15:08:08 +00:00
->where('country_id = ?', $idPays);
2009-05-13 16:05:50 +00:00
$price = $q->fetchOne();
$q = Doctrine_Query::Create()
->from('Delais')
2009-07-21 15:08:08 +00:00
->where('country_id = ?', $idPays);
2009-05-13 16:05:50 +00:00
$delais = $q->fetchOne();
if($result && $price && $delais){
$pays = $result->intersud_country;
?>
<br/>
<div>
<h3>Commander une enqu<EFBFBD>te terrain</h3>
2009-07-21 15:08:08 +00:00
Tarifs :
2009-05-13 16:05:50 +00:00
<table>
<tr><td>Mode normal : </td><td><?php print $price->normal; ?></td><td>, D<>lais : </td><td><?php if($delais->normalDe==0){ print $delais->normalA.' jours'; }else{ print $delais->normalDe.' <20> '.$delais->normalA.' jours'; } ?></td></tr>
<tr><td>Mode rapide : </td><td><?php print $price->rapide; ?></td><td>, D<>lais : </td><td><?php if($delais->rapideDe==0){ print $delais->rapideA.' jours'; }else{ print $delais->rapideDe.' <20> '.$delais->rapideA.' jours'; } ?></td></tr>
</table>
Cliquer ici pour acc<EFBFBD>der au formulaire.
</div>
2009-07-21 15:08:08 +00:00
<?php
}
2009-05-15 16:29:29 +00:00
*/
2009-04-06 17:05:03 +00:00
?>