/** * 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; } } }