コード例 #1
0
 /**
  * Plug-in pour creation de comptes CAS
  */
 function main($content, $conf)
 {
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     $this->pi_USER_INT_obj = 1;
     // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
     $this->pi_loadLL();
     session_start();
     if (!isset($_SESSION["portalId"]) || $_SESSION["portalId"] == "") {
         header("Location: index.php?id=2822");
     }
     $type = "dev_ext";
     $url = null;
     if ($type == "prod") {
         $url = "www4.haras-nationaux.fr:8080";
     } else {
         if ($type == "dev") {
             $url = "xinf-devlinux:8080";
         } else {
             if ($type == "dev_ext") {
                 $url = "80.124.158.237:8080";
             }
         }
     }
     /**
      * declaration des urls de redirection iframe
      */
     $this->urlPassageIdentFort = $this->pi_getPageLink("3684");
     $this->urlAchatPoint = $this->pi_getPageLink("3675");
     $this->urlGererConsulterCheval = $this->pi_getPageLink("3674");
     $this->urlDeclarerCheval = $this->pi_getPageLink("3673");
     $this->urlModifSosPoulain = $this->pi_getPageLink("3672");
     $this->urlAjoutSosPoulain = $this->pi_getPageLink("3671");
     $this->urlModifCompte = $this->pi_getPageLink("3670");
     /**
      * Declaration des URL pour accéder aux services externes
      */
     $this->urlDeclaNovelleNaissance = "http://" . $url . "/cid-internet-web/declaration-naissance/ReferenceDeSaillieAction.do?dispatch=initDataBeforeLoad&typeDeclaration=POS";
     $this->urlDeclaResultNeg = "http://" . $url . "/cid-internet-web/declaration-naissance/ReferenceDeSaillieAction.do?dispatch=initDataBeforeLoad&typeDeclaration=NEG";
     $userId = $_SESSION["portalId"];
     $userId = "faible";
     $param[] = array("login" => $userId, "ctx" => null);
     $ws = new WebservicesCompte("dev_ext");
     if (!$ws->connectIdent()) {
         $content = "ERROR:" . $ws->getErrorMessage();
         $content = "L'espace privé est momentanément indisponible, veuillez nous excuser de ce désagrément.";
         return $content;
     }
     $this->personne = $ws->getPersonneByLogin($param);
     print_r($this->personne);
     /**
      * recuperation du nombre de naissance, de lieux de detention
      */
     $paramCid[] = array("login" => $_SESSION["portalId"], "ctx" => null);
     $wsCid = new WebservicesCompte("dev_ext");
     if (!$wsCid->connectCid()) {
         //$content="ERROR:".$wsCid->getErrorMessage();
         $content = "L'espace privé est momentanément indisponible, veuillez nous excuser de ce désagrément.";
         return $content;
     }
     $this->nbreNaissance = $wsCid->getNbrNaissanceAnneeEnCours4User($paramCid);
     $this->nbreLieudetention = $wsCid->getNbrLieuDetention4User($paramCid);
     $this->nbreChevaux = $wsCid->getNbrChevaux4User($paramCid);
     /**
      * recuperation du nombre de factures et le montant total
      */
     if ($this->personne["findPersonneByLoginReturn"]["key"]["numeroPersonne"] != "") {
         $paramPsi[] = $this->personne["findPersonneByLoginReturn"]["key"]["numeroPersonne"];
         $paramPsi[] = $this->personne["findPersonneByLoginReturn"]["key"]["numeroOrdreAdresse"];
         $wsPsi = new WebservicesCompte();
         if (!$wsPsi->connectPsi()) {
             //$content="ERROR:".$wsPsi->getErrorMessage();
             $content = "L'espace privé est momentanément indisponible, veuillez nous excuser de ce désagrément.";
             return $content;
         } else {
             //Nombre de factures
             $this->nbreFactures = $wsPsi->getNbrFactureARegler4User($paramPsi);
             $this->montantFactures = $wsPsi->getMontantFactureARegler4User($paramPsi);
         }
     }
     /**
      * Recup des centres tech du departement
      */
     if ($this->personne["findPersonneByLoginReturn"]["adresse"]["commune"]["codePostal"] != "" && $this->personne["findPersonneByLoginReturn"]["adresse"]["commune"]["codePostal"] > 0) {
         $ws = new WebservicesAccess();
         if ($ws->connect()) {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("codeDepartement");
             $objTransfert->setValue(substr($this->personne["findPersonneByLoginReturn"]["adresse"]["commune"]["codePostal"], 0, 2));
             $paramCT[] = $objTransfert;
             $result = $ws->getCentresTEchniques($paramCT);
             //if(!$result && $ws->getErrorMessage()!="") echo "[error resultat:]".$ws->getErrorMessage();
             /**
              * Calcul du centre le plus proche
              */
             $precTot = 10000000000;
             foreach ($result as $centre) {
                 if ($centre["codePostal"] > $this->personne["findPersonneByLoginReturn"]["adresse"]["commune"]["codePostal"]) {
                     $result = $centre["codePostal"] - $this->personne["findPersonneByLoginReturn"]["adresse"]["commune"]["codePostal"];
                 } else {
                     $result = $this->personne["findPersonneByLoginReturn"]["adresse"]["commune"]["codePostal"] - $centre["codePostal"];
                 }
                 if ($result < $precTot) {
                     $precTot = $result;
                     $this->ct = $centre;
                 }
             }
         }
     }
     /**
      * On regarde si l'utilisateur est abonn� aux news et alertes
      */
     if ($this->personne["findPersonneByLoginReturn"]["coordonnees"]["email"] != "") {
         $query = "SELECT * FROM tx_fabformmail_abonne where email='" . $this->personne["findPersonneByLoginReturn"]["coordonnees"]["email"] . "'";
         $res = mysql(TYPO3_db, $query) or die("req invalide : {$query}");
         if (mysql_num_rows($res) > 0) {
             $row = mysql_fetch_array($res);
             if ($row['newsletter'] == "1") {
                 $this->isAbonNews = true;
             }
             if ($row['hidden'] == "0") {
                 $this->isAbonAlert = true;
             }
         }
     }
     $content = $this->getEspacePerso();
     if ($_GET["debug"]) {
         $this->getDebug();
     }
     return $this->pi_wrapInBaseClass($content);
 }
コード例 #2
0
 /**
  * Methode de recherche qui retourne une liste de r�onses.
  * 1. Si la liste est dans la session alors le syst�e retourne une plage de la liste
  * 2. Si la liste ne se trouve pas dans la session, le syst�e fait appel au webservice et calcul la liste
  * @return String
  */
 function getListeResult()
 {
     $result = null;
     $content = $this->getScript();
     $content .= '<div><h2>' . htmlspecialchars($this->pi_getLL("titre_list")) . '</h2></div><br/>';
     $param = array();
     if (isset($this->piVars["action"]) && $this->piVars["action"] == "newListe" || isset($_GET["action"]) && $_GET["action"] == "liste") {
         unset($_SESSION["RESULT_ETALON"]);
     }
     if (!isset($_SESSION["RESULT_ETALON"])) {
         if (isset($this->piVars["nomcheval"]) && $this->piVars["nomcheval"] != "") {
             $nomCheval = str_replace("%", "", $this->piVars["nomcheval"]);
             if (strlen($nomCheval) < 2) {
                 $this->error = "Le nombre de lettres composant le nom du cheval doit �tre sup�rieur ou �gal � deux.";
                 return $this->getFormulaireVide();
             }
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("nomCheval");
             $objTransfert->setValue($this->piVars["nomcheval"]);
             $param[count($param)] = $objTransfert;
         }
         if (isset($_GET["numPerso"]) && $_GET["numPerso"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("numPerso");
             $objTransfert->setValue($_GET["numPerso"]);
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["orientation_production"]) && $this->piVars["orientation_production"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("orientationProduction");
             $objTransfert->setValue($this->piVars["orientation_production"]);
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["type_equide"]) && $this->piVars["type_equide"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("typeEquide");
             $objTransfert->setValue($this->piVars["type_equide"]);
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["groupe_race"]) && $this->piVars["groupe_race"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("groupeRace");
             $objTransfert->setValue($this->piVars["groupe_race"]);
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["code_gen"]) && $this->piVars["code_gen"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("codeGenetique");
             $objTransfert->setValue($this->piVars["code_gen"]);
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["region"]) && $this->piVars["region"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("region");
             $objTransfert->setValue($this->piVars["region"]);
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["centre_tech"]) && $this->piVars["centre_tech"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("centreTechnique");
             $objTransfert->setValue($this->piVars["centre_tech"]);
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["iac"]) && $this->piVars["iac"] == "O") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("iac");
             $objTransfert->setValue("true");
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["prix_max"]) && $this->piVars["prix_max"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("prixMax");
             $objTransfert->setValue($this->piVars["prix_max"]);
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["prix_min"]) && $this->piVars["prix_min"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("prixMin");
             $objTransfert->setValue($this->piVars["prix_min"]);
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["paiement_naissance"]) && $this->piVars["paiement_naissance"] == "O") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("paiementNaissance");
             $objTransfert->setValue("true");
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["point_fort"]) && $this->piVars["point_fort"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("pointFort");
             $value = null;
             foreach ($this->piVars["point_fort"] as $pointFort) {
                 $value = $value == null ? $pointFort : $value . "," . $pointFort;
             }
             $objTransfert->setValue($value);
             $param[count($param)] = $objTransfert;
         }
         if (isset($this->piVars["robe"]) && $this->piVars["robe"] != "") {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("robe");
             $objTransfert->setValue($this->piVars["robe"]);
             $param[count($param)] = $objTransfert;
         }
         $ws = new WebservicesAccess($this->typeDev);
         if (!$ws->connect()) {
             return "erreur a la connexion:" . $ws->getErrorMessage();
         }
         $result = $ws->getEtalons($param);
         if (!$result && $ws->getErrorMessage() != "") {
             return "erreur dans resultat:" . $ws->getErrorMessage();
         }
         $_SESSION["RESULT_ETALON"] = $result;
     } else {
         $result = $_SESSION["RESULT_ETALON"];
     }
     if (!$result) {
         $content .= "<div style='color:red;font-size:15px;text-align:center'>" . $this->pi_getLL("libelle_no_result") . "</div>";
         if (!isset($_GET["action"])) {
             $content .= $this->pi_linkToPage(htmlspecialchars($this->pi_getLL("libelle_nouvelle_recherche")), $GLOBALS["TSFE"]->id);
         }
         return $content;
     }
     if (count($result) == 1 && isset($result[0]["numError"])) {
         $content .= "<div style='color:red;font-size:9px;text-align:center'>" . $this->pi_getLL("libelle_error_count") . "</div>";
         if (!isset($_GET["action"])) {
             $content .= $this->pi_linkToPage(htmlspecialchars($this->pi_getLL("libelle_nouvelle_recherche")), $GLOBALS["TSFE"]->id);
         }
         return $content;
     }
     $content .= '<div>Vous pouvez effectuer un comparatif sur les principaux crit�res entre 2 et 5 �talons. Il suffit pour cela de cocher les cases des �talons choisis, puis de cliquer sur "Comparer" en bas de la liste.</div>';
     $content .= "<h4>" . count($result) . " " . $this->pi_getLL("libelle_compteur") . "</h4><br>";
     if (count($result) == 1) {
         $url = $this->pi_getPageLink($GLOBALS["TSFE"]->id, "toto", array("tx_dlcubehn02_pi2[showUid]" => $result[0]["codeCheval"], "no_cache" => "1"));
         Header('Location: ' . $this->baseUrl . $url);
     }
     if (count($result) > 99) {
         $content .= "<div id='message' style='color:red;font-size:15px;text-align:center'>";
         $content .= count($result) . " �talons correspondent � votre crit�res; cliquer sur OK pour afficher la liste des 100 premiers ou cliquer sur ANNULER pour affiner vos crit�res.<br/>";
         $content .= '<a href="javascript:divcache(\'message\');divaffiche(\'result\')" style="color:white;text-decoration:none" id="lienFonctionPetit">OK</a>   ';
         $content .= '<a href="' . $this->pi_getPageLink($GLOBALS["TSFE"]->id) . '" style="color:white;text-decoration:none" id="lienFonctionPetit">ANNULER</a>';
         $content .= "</div>";
     }
     $content .= "<div id='result' " . (count($result) > 99 ? "style='display:none" : "") . "'>";
     $content .= '<form name="formCmp" method="post" action="' . $this->pi_getPageLink($GLOBALS["TSFE"]->id) . '">';
     $content .= '<input type="hidden" name="no_cache" value="1">';
     $content .= '<input type="hidden" name="' . $this->prefixId . '[action]" value="comparer">';
     $i = 0;
     foreach ($result as $etalon) {
         if ($i < 100) {
             $content .= "<p><input type=\"checkbox\" name=\"cmp[]\" value='" . $etalon["codeCheval"] . "'><strong>" . $this->pi_list_linkSingle($etalon["nomCheval"], $etalon["codeCheval"], 1) . "</strong>, " . $etalon["raceLibelle"];
             if ($etalon["pourcentageSangArabe"] > 0 && ($etalon["codeGroupeRace"] == "AA" || $etalon["codeGroupeRace"] == "PFS" || $etalon["codeGroupeRace"] == "AB")) {
                 $content .= ", " . $etalon["pourcentageSangArabe"] . " % arabe";
             }
             if ($etalon["robeLibelle"] != "") {
                 $content .= ", " . $etalon["robeLibelle"];
             }
             if ($etalon["anneeNaissanceCheval"] != "") {
                 $content .= ", " . $etalon["anneeNaissanceCheval"];
             }
             $content .= "<br />\n\t\t\t\t" . $this->pi_getLL("libelle_par") . " " . $etalon["nomChevalPere"] . " " . $this->pi_getLL("libelle_et") . " " . $etalon["nomChevalMere"] . " " . $this->pi_getLL("libelle_par") . " " . $etalon["nomPereChevalMere"];
             if ($etalon["urlVideo"] != "") {
                 $content .= '   <a href="' . $etalon["urlVideo"] . '" target="_blank"><img src="fileadmin/templates/images/elts_reccurents/video.gif" border="0" title="' . htmlspecialchars($this->pi_getLL("libelle_video")) . '"></a>';
             }
             $content .= "</p>";
             $content .= "<hr>";
         }
         $i++;
     }
     $content .= '</form>';
     if (!isset($_GET["action"])) {
         /*$content .='<span id="boutonLien">';
         		$content .=$this->pi_linkToPage(htmlspecialchars($this->pi_getLL("libelle_nouvelle_recherche")),$GLOBALS["TSFE"]->id);
         		$content .='</span>';*/
         $content .= '<a style="color:white;text-decoration:none" id="lienFonctionPetit" href="index.php?id=' . $GLOBALS["TSFE"]->id . '">' . htmlspecialchars($this->pi_getLL("libelle_nouvelle_recherche")) . '</a>  ';
     } else {
         $content .= '<a href="javascript:history.back()" style="color:white;text-decoration:none" id="lienFonctionPetit">' . htmlspecialchars($this->pi_getLL("libelle_retour_liste")) . '</a>  ';
     }
     $content .= '<a href="javascript:checkMaxCmp();" style="color:white;text-decoration:none" id="lienFonctionPetit">Comparer</a>  ';
     $content .= "</div>";
     return $content;
 }
コード例 #3
0
 /**
  * methode de creation de l'architecture de WebServices
  */
 function dolLaodServices()
 {
     $param = array("in0" => $this->userId, "in1" => "");
     $ws = new WebservicesCompte($this->typeExecution);
     if (!$ws->connectIdent()) {
         $content = "ERROR:" . $ws->getErrorMessage();
         $content = "L'espace priv&eacute; est momentan&eacute;ment indisponible, veuillez nous excuser de ce d&eacute;sagr&eacute;ment.";
         return $content;
     }
     $this->personne = $ws->getPersonneByLogin($param)->out;
     //print_r($this->personne);
     if ($ws->getErrorMessage() != "") {
         echo "<font color='red'>ERROR RECUPERATION PERSONNE CID (WS:findPersonneByLogin) :" . $ws->getErrorMessage() . "</font><br/>";
     }
     /**
      * recuperation du nombre de naissance, de lieux de detention
      */
     /*$paramCid = array (
     			"login" => $this->userId,
     			"ctx" => null
     		);*/
     $paramCid = array("login" => $this->userId, "ctx" => "");
     $wsCid = new WebservicesCompte($this->typeExecution);
     if (!$wsCid->connectCid()) {
         //$content="ERROR:".$wsCid->getErrorMessage();
         $content = "L'espace priv&eacute; est momentan&eacute;ment indisponible, veuillez nous excuser de ce d&eacute;sagr&eacute;ment.";
         return $content;
     }
     $this->nbreNaissance = $wsCid->getNbrNaissanceAnneeEnCours4User($paramCid)->getNbrNaissanceAnneeEnCoursReturn;
     if ($wsCid->getErrorMessage() != "") {
         echo "<font color='red'>ERROR RECUPERATION NOMBRE DE NAISSANCE CID (WS:getNbrNaissanceAnneeEnCours):" . $wsCid->getErrorMessage() . "</font><br/>";
     }
     $this->nbreLieudetention = $wsCid->getNbrLieuDetention4User($paramCid)->getNbrLieuDetentionReturn;
     if ($wsCid->getErrorMessage() != "") {
         echo "<font color='red'>ERROR RECUPERATION NOMBRE LIEU DE DETENTION CID (WS:getNbrLieuDetention):" . $wsCid->getErrorMessage() . "</font><br/>";
     }
     $this->nbreChevaux = $wsCid->getNbrChevaux4User($paramCid)->getNbrChevauxReturn;
     if ($wsCid->getErrorMessage() != "") {
         echo "<font color='red'>ERROR RECUPERATION NOMBRE DE CHEVAUX CID (WS:getNbrChevaux):" . $wsCid->getErrorMessage() . "</font><br/>";
     }
     /**
      * recuperation du nombre de factures et le montant total
      */
     if ($this->personne->key->numeroPersonne != "") {
         $paramPsi[] = $this->personne->key->numeroPersonne;
         $paramPsi[] = $this->personne->key->numeroOrdreAdresse;
         $wsPsi = new WebservicesCompte($this->typeExecution);
         if (!$wsPsi->connectPsi()) {
             //$content="ERROR:".$wsPsi->getErrorMessage();
             $content = "L'espace priv&eacute; est momentan&eacute;ment indisponible, veuillez nous excuser de ce d&eacute;sagr&eacute;ment.";
             return $content;
         } else {
             //Nombre de factures
             $this->nbreFactures = $wsPsi->getNbrFactureARegler4User($paramPsi);
             $this->montantFactures = $wsPsi->getMontantFactureARegler4User($paramPsi);
         }
     }
     /**
      * Recup des centres tech du departement
      */
     if ($this->personne->adresse->commune->codePostal != "" && $this->personne->adresse->commune->codePostal > 0) {
         $ws = new WebservicesAccess($this->typeExecution);
         if ($ws->connect()) {
             $objTransfert = new ObjectTransfertWS();
             $objTransfert->setKey("codeDepartement");
             $objTransfert->setValue(substr($this->personne->adresse->commune->codePostal, 0, 2));
             $paramCT[] = $objTransfert;
             $result = $ws->getCentresTEchniques($paramCT);
             //if(!$result && $ws->getErrorMessage()!="") echo "[error resultat:]".$ws->getErrorMessage();
             /**
              * Calcul du centre le plus proche
              */
             $precTot = 10000000000;
             foreach ($result as $centre) {
                 if ($centre["codePostal"] > $this->personne->adresse->commune->codePostal) {
                     $result = $centre["codePostal"] - $this->personne->adresse->commune->codePostal;
                 } else {
                     $result = $this->personne->adresse->commune->codePostal - $centre["codePostal"];
                 }
                 if ($result < $precTot) {
                     $precTot = $result;
                     $this->ct = $centre;
                 }
             }
         }
     }
     /**
      * On regarde si l'utilisateur est abonne aux news et alertes
      */
     if ($this->personne->coordonnees->email != "") {
         $query = "SELECT * FROM tx_fabformmail_abonne where email='" . $this->personne->coordonnees->email . "'";
         $res = mysql(TYPO3_db, $query) or die("req invalide : {$query}");
         if (mysql_num_rows($res) > 0) {
             $row = mysql_fetch_array($res);
             if ($row['newsletter'] == "1") {
                 $this->isAbonNews = true;
             }
             if ($row['hidden'] == "0") {
                 $this->isAbonAlert = true;
             }
         }
     }
     /**
      * chargement des infos liees a l'etalonnier'
      */
     if ($this->personne->profil->id == 3) {
         $wsDPS = new WebservicesCompte($this->typeExecution);
         if ($wsDPS->connectDPS()) {
             $paramDPS = array();
             if ($this->typeExecution == "dev" || $this->typeExecution == "dev_ext") {
                 $paramDPS = array("serv" => "DEV", "nuPerso" => $this->personne->key->numeroPersonne, "anMonte" => date("Y"));
             } else {
                 $paramDPS = array("serv" => "PROD", "nuPerso" => $this->personne->key->numeroPersonne, "anMonte" => date("Y"));
             }
             $return = $wsDPS->getNbrSurPlace($paramDPS);
             $this->nombreEtalonSaillie = isset($return->getNbSurPlaceReturn) && $return->getNbSurPlaceReturn != "" ? $return->getNbSurPlaceReturn : 0;
             $return = $wsDPS->getNbrIA($paramDPS);
             $this->nombreEtalonSaillieIA = isset($return->getNbIAReturn) && $return->getNbIAReturn != "" ? $return->getNbIAReturn : 0;
         }
     }
 }
コード例 #4
0
 /**
  * Methode de recherche qui retourne une liste de reponses.
  * 1. Si la liste est dans la session alors le systeme retourne une plage de la liste
  * 2. Si la liste ne se trouve pas dans la session, le systeme fait appel au webservice et calcul la liste	
  * @return String
  */
 function getListeResult()
 {
     $this->GoogleMapsTool = new GoogleMapsTool();
     $this->GoogleMapsTool->outJSB = false;
     // pas de balises JS, c'est typo qui les met
     // echoise la clé Google dans le header
     $GLOBALS['TSFE']->additionalHeaderData['OutGMJSWK_0'] = $this->GoogleMapsTool->OutGMJSWK();
     $result = null;
     $content = '<div><h2>' . htmlspecialchars($this->pi_getLL("titre_list")) . '</h2></div><br />';
     $content .= $this->GoogleMapsTool->OutMapIdS();
     $param = array();
     if (isset($this->piVars["commune"]) && $this->piVars["commune"] != "") {
         $objTransfert = new ObjectTransfertWS();
         $objTransfert->setKey("commune");
         $objTransfert->setValue($this->piVars["commune"]);
         $param[count($param)] = $objTransfert;
         $address = addslashes($this->piVars["commune"]) . "," . $this->piVars["pays"];
     }
     if (isset($this->piVars["region"]) && $this->piVars["region"] != "") {
         $objTransfert = new ObjectTransfertWS();
         $objTransfert->setKey("codeRegion");
         $objTransfert->setValue($this->piVars["region"]);
         $param[count($param)] = $objTransfert;
     }
     if (isset($this->piVars["departement"]) && $this->piVars["departement"] != "") {
         $objTransfert = new ObjectTransfertWS();
         $objTransfert->setKey("codeDepartement");
         $objTransfert->setValue($this->piVars["departement"]);
         $param[count($param)] = $objTransfert;
     }
     if (isset($this->piVars["centre"]) && $this->piVars["centre"] != "") {
         $objTransfert = new ObjectTransfertWS();
         $objTransfert->setKey("centre");
         $objTransfert->setValue($this->piVars["centre"]);
         $param[count($param)] = $objTransfert;
     }
     if (isset($this->piVars["type_centre"]) && $this->piVars["type_centre"] != "") {
         $objTransfert = new ObjectTransfertWS();
         $objTransfert->setKey("typeCentre");
         $objTransfert->setValue("ct" . $this->piVars["type_centre"]);
         $param[count($param)] = $objTransfert;
     }
     $GLOBALS["TSFE"]->setJS("OutGMJSWK_1", $this->GoogleMapsTool->InitMap(false));
     // sera eventuellement ecrasé apres la fin de la liste des CT
     if ($this->searchConfig == "WSDatastore") {
         $ws = new WebservicesAccess();
         if (!$ws->connect()) {
             return $ws->getErrorMessage();
         }
         $result = $ws->getCentresTEchniques($param);
         if (!$result && $ws->getErrorMessage() != "") {
             return "[error resultat:]" . $ws->getErrorMessage();
         }
     } elseif ($this->piVars["commune"] != "") {
         // que pour la commune ie l'adresse
         if ($this->GoogleMapsTool->map_geocoder($address)) {
             $content .= "<small>" . $this->pi_getLL("vos_coords") . "lattitude: " . $this->GoogleMapsTool->GeoCodeAddressData[2] . "&#176;, longitude: " . $this->GoogleMapsTool->GeoCodeAddressData[3] . "&#176;</small>";
             $addwhere = $this->GoogleMapsTool->retWhere($param);
             $this->GoogleMapsTool->DataScript .= $this->GoogleMapsTool->look4closest($this->GoogleMapsTool->GeoCodeAddressData[2], $this->GoogleMapsTool->GeoCodeAddressData[3], 5, "CT", $addwhere, $address);
             $result = $this->GoogleMapsTool->tbresult;
             //				$this->GoogleMapsTool->DataScript.="showAddress('$address');"; // fait dans look4closer
         } else {
             $content .= $this->pi_getLL("libelle_no_address_geoc");
         }
     } else {
         // rajoute le type CT
         $objTransfert = new ObjectTransfertWS();
         $objTransfert->setKey("type");
         $objTransfert->setValue("CT");
         $param[count($param)] = $objTransfert;
         $this->GoogleMapsTool->DataScript .= $this->GoogleMapsTool->getPoints($param);
         $result = $this->GoogleMapsTool->tbresult;
     }
     //print_r($result);
     $_SESSION["RESULT_CT"] = $result;
     if (!$result) {
         $content .= "<H4>" . $this->pi_getLL("libelle_no_result") . "</H4>";
         if (!$this->afficheRegion) {
             $content .= $this->pi_linkToPage(htmlspecialchars($this->pi_getLL("libelle_nouvelle_recherche")), $GLOBALS["TSFE"]->id);
         }
         return $content;
     }
     if (count($result) == 1 && isset($result[0]["numError"])) {
         $content .= "<H4>" . $this->pi_getLL("libelle_error_count") . "</H4>";
         if (!$this->afficheRegion) {
             $content .= $this->pi_linkToPage(htmlspecialchars($this->pi_getLL("libelle_nouvelle_recherche")), $GLOBALS["TSFE"]->id);
         }
         return $content;
     }
     // adresse du centre de dun le palestel
     //http://maps.google.fr/maps?f=q&hl=fr&q=1+PROMENADE+DE+LA+FORET%3B+23800+DUN+LE+PALESTEL&ie=UTF8&om=1&z=11&ll=46.318007,1.663055&spn=0.312047,0.858994&iwloc=A
     // verrue pour mise à jour
     if (strstr($this->cObj->data["select_key"], "SPC_MAJ")) {
         $SpcModInsert = true;
         $tbtp = explode(":", $this->cObj->data["select_key"]);
         $pidgeo = $tbtp[1];
         //print_r($tbtp);
     }
     $content .= "<H4>" . count($result) . " centre(s) technique(s) trouv&eacute;s)</H4><br>";
     // si région choisie, centre directement sur elle
     $recentrg = false;
     if ($this->piVars["region"]) {
         $rc = $this->GoogleMapsTool->RegionReCenter($this->piVars["region"]);
         if ($rc) {
             $this->GoogleMapsTool->DataScript .= $rc;
             $recentrg = true;
         }
     }
     foreach ($result as $ce) {
         if ($ce['dist'] > 0) {
             $dist = " (" . $ce['dist'] . " km)";
         }
         $content .= '<p style="height:20px;padding-bottom:5px";><strong><a href="' . $this->pi_getPageLink(2973, '', array("numPerso" => $ce["numPerso"], "action" => "liste", "no_cache" => 1)) . '" title="voir la liste des &eacute;talons pr&eacute;sents" style="height:40px;padding-bottom:20px;padding-left:25px;background-repeat: no-repeat;background-image:url(fileadmin/templates/images/elts_reccurents/cheval.gif);">' . $ce["nom"] . '</a></strong> ' . $dist . '<br></p>';
         if ($SpcModInsert) {
             // mode insertion/maj des points dans la table
             // hidden, starttime, endtime, name, number, type, geo_pos, label, adresse1, adresse2, cdpst, ville, tel, cell,fax, mail
             $set = "SET tstamp=" . time() . ",name='" . addslashes($ce["nom"]) . "', number='" . $ce["numPerso"] . "', type='CT', adresse1='" . addslashes($ce["adresse1"]) . "', adresse2='" . addslashes($ce["adresse2"]) . "', cdpst='" . $ce["codePostal"] . "', ville='" . addslashes($ce["libelleCommune"]) . "', tel='" . $ce["telephone"] . "', cell='" . $ce["telPortable"] . "',fax='" . $ce["telecopie"] . "', mail='" . $ce["mail"] . "', pid=" . $pidgeo . ", region='" . addslashes($ce["coRegion"]) . "'";
             if ($ce['actCtmp'] == "O") {
                 $type_det = "_mp_";
             }
             if ($ce['actCtpr'] == "O") {
                 $type_det .= "_pr_";
             }
             if ($ce['actCttre'] == "O") {
                 $type_det .= "_tre_";
             }
             $set .= ", type_det='{$type_det}'";
             //print_r($ce);
             //echo $set;
             $rep = msq("SELECT * FROM tx_dlcubehn03geomatic_points WHERE number=" . $ce["numPerso"]);
             if (mysql_num_rows($rep) > 0) {
                 msq("UPDATE tx_dlcubehn03geomatic_points {$set} WHERE number=" . $ce["numPerso"]);
             } else {
                 msq("INSERT INTO tx_dlcubehn03geomatic_points {$set},crdate=" . time());
             }
         }
         $txt = null;
         if ($ce["actCtmp"] == "O") {
             $txt = $txt == null ? "Centre de mise en place" : $txt . " et Centre de mise en place";
         }
         if ($ce["actCtpr"] == "O") {
             $txt = $txt == null ? "Centre de production" : $txt . " et Centre de production";
         }
         if ($ce["actCttre"] == "O") {
             $txt = $txt == null ? "Centre de transfert" : $txt . " et centre de transfert embryonnaire";
         }
         if ($txt != null) {
             $content .= "<p>" . $txt . "</p>";
         }
         // affiche le point sur la carte, qu'en mode webservice datastore
         // sinon c'est fait dans le calcul du result
         if ($this->searchConfig == "WSDatastore") {
             $this->GoogleMapsTool->IconImageFile = "http://www.haras-nationaux.fr/portail/fileadmin/templates/images/elts_reccurents/cheval.gif";
             $this->GoogleMapsTool->PointInfo = $txIconImageFilet . '<br/>' . $ce["adresse1"] . "<br/>" . $ce["adresse2"] . "<br/>" . $ce["codePostal"] . " " . $ce["libelleCommune"];
             $this->GoogleMapsTool->DataScript .= $this->GoogleMapsTool->displayPointbyNumber($ce["numPerso"], !$recentrg);
         }
         $content .= "<p><span id='adresseCT'>" . $ce["adresse1"] . "</span> <span id='adresseCT'>" . $ce["adresse2"] . "</span> <span id='codepostalCT'>" . $ce["codePostal"] . "</span> <span id='communeCT'>" . $ce["libelleCommune"] . "</span></p>";
         $content .= "<p>";
         if ($ce["telephone"] != "") {
             $content .= $this->pi_getLL("libelle_telephone") . " : " . $ce["telephone"];
         }
         if ($ce["telecopie"] != "") {
             $content .= " " . $ce["telecopie"];
         }
         if ($ce["telPortable"]) {
             $content .= " " . $this->pi_getLL("libelle_telport") . " : " . $ce["telPortable"];
         }
         if ($ce["mail"]) {
             $content .= " " . $this->pi_getLL("libelle_mail") . " : " . $ce["mail"];
         }
         $content .= "</p>";
         $content .= "<hr>";
     }
     // fin boucle sur centres techniques
     // sort tous le Jscript Google Maps, mais dans le header, pour que ca marche avec ce putain d'explorer
     $GLOBALS["TSFE"]->setJS("OutGMJSWK_1", $this->GoogleMapsTool->InitMap(false));
     if (!$this->afficheRegion) {
         //echo "test:".$this->pi_getPageLink($GLOBALS["TSFE"]->id);
         $content .= '<a style="color:white;text-decoration:none" id="lienFonctionPetit" href="index.php?id=' . $GLOBALS["TSFE"]->id . '">' . htmlspecialchars($this->pi_getLL("libelle_nouvelle_recherche")) . '</a>';
     }
     return $content;
 }
コード例 #5
0
    /**
     * Methode de recherche qui retourne une liste de réponses.
     * 1. Si la liste est dans la session alors le système retourne une plage de la liste
     * 2. Si la liste ne se trouve pas dans la session, le système fait appel au webservice et calcul la liste
     * @return String
     */
    function getListeResult()
    {
        $result = null;
        $content = '<div><h2>' . htmlspecialchars($this->pi_getLL("titre_list")) . '</h2>';
        $param = array();
        if (!isset($_SESSION["RESULT_NEW"])) {
            $ws = new WebservicesAccess("dev_ext");
            if (!$ws->connect()) {
                return "erreur a la connexion:" . $ws->getErrorMessage();
            }
            $objTransfert = new ObjectTransfertWS();
            $objTransfert->setKey("flagNouveau");
            $objTransfert->setValue("O");
            $param[count($param)] = $objTransfert;
            $result = $ws->getNouveauxEtalons($param);
            if (!$result && $ws->getErrorMessage() != "") {
                return "erreur dans resultat:" . $ws->getErrorMessage();
            }
            $_SESSION["RESULT_NEW"] = $result;
        } else {
            $result = $_SESSION["RESULT_NEW"];
        }
        if (!$result) {
            $content .= "<div style='color:red;font-size:9px;text-align:center'>" . $this->pi_getLL("libelle_no_result") . "</div>";
            return $content;
        }
        if (count($result) == 1 && isset($result[0]["numError"])) {
            $content .= "<div style='color:red;font-size:9px;text-align:center'>" . $this->pi_getLL("libelle_error_count") . "</div>";
            return $content;
        }
        $content .= '
		<table border="0" cellpadding="0" cellspacing="0" border="0">';
        foreach ($result as $etalon) {
            if ($count == 0) {
                $content .= '';
            }
            $img = false;
            if (file_exists($this->urlPhoto . $etalon["codeCheval"] . '.jpg')) {
                $img = true;
            }
            $content .= '<tr valign="top"><td valign="top" width="600px" style="border:solid 1px #C1131E;padding:15px;">
					<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap">
						<tr>
							<td valign="top">';
            if ($img) {
                $content .= '
								<table width="111" border="0" cellspacing="0" cellpadding="0" class="imgtext-table">
									<tr>
										<td colspan="1">
											<img src="clear.gif" width="100" height="1" alt="" />
										</td>
										<td rowspan="2" valign="top">
											<img src="clear.gif" width="10" height="1" alt="" title="" />
										</td>
									</tr>
									<tr>
										<td valign="top">
											<a href="#" onclick="vHWin=window.open(\'' . $this->urlPhoto . $etalon["codeCheval"] . '.jpg\',\'FEopenLink\',\'width=400,height=300\');vHWin.focus();return false;">
												<img src="' . $this->urlPhoto . $etalon["codeCheval"] . '.jpg" width="100" height="82" border="0" align="top" alt="" title="" />
											</a>
											<br />
										</td>
									</tr>
								  </table>';
            }
            $content .= '
							</td>
							<td valign="top">';
            if (!$img) {
                $content .= '<h3 style="margin-left:20px">' . $etalon["nomCheval"] . '</h3>';
            } else {
                $content .= '<h3>' . $etalon["nomCheval"] . '</h3>';
            }
            $content .= '
								<p>' . $etalon["raceLibelle"];
            if ($etalon["pourcentageSangArabe"] > 0) {
                $content .= ', ' . $etalon["pourcentageSangArabe"] . '% arabe';
            }
            if ($etalon["robeLibelle"] != "") {
                $content .= ', ' . $etalon["robeLibelle"];
            }
            $content .= ' ' . $etalon["anneeNaissanceCheval"] . ' ' . $this->pi_getLL("libelle_par") . ' ' . $etalon["nomChevalPere"] . ' ' . $this->pi_getLL("libelle_et") . ' ' . $etalon["nomChevalMere"] . ' ' . $this->pi_getLL("libelle_par") . ' ' . $etalon["nomPereChevalMere"] . '</p>
								<p>&nbsp;</p>
								<p>&nbsp;</p>
							</td>
					</tr>
				</table>';
            if ($etalon["proprietaire"] != "") {
                $content .= '<p>' . htmlspecialchars($this->pi_getLL("libelle_proprietaire")) . ' : ' . $etalon["proprietaire"] . ' </p>';
            }
            if ($etalon["libelleCentreTechnique"] == "") {
                $content .= htmlspecialchars($this->pi_getLL("libelle_attente_affectation")) . '<br>';
            } else {
                $content .= '<p>' . htmlspecialchars($this->pi_getLL("libelle_station")) . ' : ' . $etalon["libelleCentreTechnique"] . '</p>';
            }
            $content .= '<p>' . htmlspecialchars($this->pi_getLL("libelle_prix_saut")) . ' : ';
            $listPrix = $etalon["prix"];
            if (is_array($listPrix) && count($listPrix) > 0) {
                foreach ($listPrix as $prix) {
                    $content .= $this->pi_getLL("libelle_prix_saut_" . $prix["codeTypeProduit"]) . ' ' . $prix["prix"] . ' euros<br>';
                }
            }
            $content .= '</p>';
            if ($etalon["pointFort1"] != "" || $etalon["pointFort2"] != "" || $etalon["pointFort3"] != "") {
                $content .= '<h4>' . htmlspecialchars($this->pi_getLL("libelle_3points_fort")) . ' :</h4>
				<p>';
                $content .= $etalon["pointFort1"];
                if ($etalon["pointFort2"] != "") {
                    $content .= ", " . $etalon["pointFort2"];
                }
                if ($etalon["pointFort2"] != "") {
                    $content .= ", " . $etalon["pointFort3"];
                }
                $content .= '</p>';
            }
            if ($etalon["commentaire"] != "") {
                $content .= '<h4>' . htmlspecialchars($this->pi_getLL("libelle_aretenir")) . ':</h4>';
                $content .= '<p>' . $etalon["commentaire"] . '</p>';
            }
            if ($etalon["conseilCroisement"] != "") {
                $content .= '<h4>' . htmlspecialchars($this->pi_getLL("libelle_conseil_croisement")) . ':</h4>';
                $content .= '<p>' . $etalon["conseilCroisement"] . '</p>';
            }
            $content .= '<p>&nbsp;</p>';
            $content .= '
				<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap">
					<tr>
						<td valign="top"></td>
						<td valign="top">
							<table width="100%" border="0" cellspacing="0" cellpadding="0" class="imgtext-table">
								<tr>
									<td valign="top">
										<img src="clear.gif" width="10" height="1" alt="" title="" />
									</td>
									<td colspan="1">
										<img src="clear.gif" width="20" height="1" alt="" />
									</td>
								</tr>';
            $content .= '
								<tr>
									<td valign="top">
										<img src="clear.gif" width="10" height="1" alt="" title="" />
									</td>
									<td valign="top" height="25x">
										<a href="http://www.haras-nationaux.fr/portail/uploads/tx_vm19docsbase/Bulletin_toute_race_sauf_si_tirage_au_sort.doc" style="height:40px;padding-bottom:10px;padding-left:25px;background-repeat: no-repeat;background-image:url(fileadmin/templates/images/elts_reccurents/valid1.gif);">' . htmlspecialchars($this->pi_getLL("libelle_reservation_saillie")) . '</a>
									</td>
								</tr>';
            if ($etalon["urlVideo"] != "") {
                $content .= '
								<tr>
									<td valign="top">
										<img src="clear.gif" width="10" height="1" alt="" title="" />
									</td>
									<td valign="top" height="25x">
										<a href="#" onclick="vHWin=window.open(\'' . $etalon["urlVideo"] . '\',\'FEopenLink\',\'width=400,height=300\');vHWin.focus();return false;" style="height:40px;padding-bottom:10px;padding-left:25px;background-repeat: no-repeat;background-image:url(fileadmin/templates/images/elts_reccurents/video.gif);">' . htmlspecialchars($this->pi_getLL("libelle_voir_video")) . '</a>
									</td>
								</tr>';
            }
            $content .= '
								<tr>
									<td valign="top">
										<img src="clear.gif" width="10" height="1" alt="" title="" />
									</td>
									<td valign="top" height="25px">';
            $lien = $this->pi_getPageLink(2973, '', array("tx_dlcubehn02_pi2[showUid]" => $etalon["codeCheval"], "no_cache" => 1));
            $content .= '<a href="' . $lien . '" style="height:40px;padding-bottom:10px;padding-left:25px;background-repeat: no-repeat;background-image:url(fileadmin/templates/images/elts_reccurents/detail.gif);">' . htmlspecialchars($this->pi_getLL("libelle_savoir_plus")) . '</a>';
            $content .= '<br/>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td></tr><tr><td><br></td></tr>';
            if ($count == 1) {
                $count = 0;
            } else {
                $count = 1;
            }
        }
        $content .= '</table></div>';
        return $content;
    }