/** * 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] . "°, longitude: " . $this->GoogleMapsTool->GeoCodeAddressData[3] . "°</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é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 étalons pré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; }
/** * 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); }
/** * 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é est momentanément indisponible, veuillez nous excuser de ce désagré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é est momentanément indisponible, veuillez nous excuser de ce désagré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é 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->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; } } }