| Line 20... |
Line 20... |
| 20 |
private $appUrls = null;
|
20 |
private $appUrls = null;
|
| 21 |
private $id_destinataire = '';
|
21 |
private $id_destinataire = '';
|
| 22 |
private $id_image = '';
|
22 |
private $id_image = '';
|
| 23 |
private $urlWsCelTpl = '';
|
23 |
private $urlWsCelTpl = '';
|
| 24 |
private $urlWsAnnuaireUtilisateurTpl = '';
|
24 |
private $urlWsAnnuaireUtilisateurTpl = '';
|
| - |
|
25 |
protected $urlConnexionSite = '';
|
| Line 25... |
Line 26... |
| 25 |
|
26 |
|
| 26 |
public function initialiser() {
|
27 |
public function initialiser() {
|
| 27 |
$this->capturerParametres();
|
28 |
$this->capturerParametres();
|
| 28 |
$this->conteneur = new Conteneur();
|
29 |
$this->conteneur = new Conteneur();
|
| 29 |
$this->imagesApi = $this->conteneur->getApiImages();
|
30 |
$this->imagesApi = $this->conteneur->getApiImages();
|
| 30 |
$this->utilisateur = $this->conteneur->getUtilisateur();
|
31 |
$this->utilisateur = $this->conteneur->getUtilisateur();
|
| 31 |
$this->appUrls = $this->conteneur->getAppUrls();
|
32 |
$this->appUrls = $this->conteneur->getAppUrls();
|
| 32 |
$this->urlWsAnnuaireUtilisateurTpl = $this->conteneur->getParametre('baseUrlServicesAnnuaireTpl');
|
33 |
$this->urlWsAnnuaireUtilisateurTpl = $this->conteneur->getParametre('baseUrlServicesAnnuaireTpl');
|
| - |
|
34 |
$this->urlWsCelTpl = $this->conteneur->getParametre('baseUrlServicesCelTpl');
|
| 33 |
$this->urlWsCelTpl = $this->conteneur->getParametre('baseUrlServicesCelTpl');
|
35 |
$this->urlConnexionSite = $this->conteneur->getParametre('auth.baseUrlConnexionSite');
|
| Line 34... |
Line 36... |
| 34 |
}
|
36 |
}
|
| 35 |
|
37 |
|
| 36 |
private function capturerParametres() {
|
38 |
private function capturerParametres() {
|
| 37 |
if (isset($_GET['id_destinataire'])) {
|
39 |
if (isset($_GET['id_destinataire'])) {
|
| 38 |
$this->id_destinataire = $_GET['id_destinataire'];
|
40 |
$this->id_destinataire = $_GET['id_destinataire'];
|
| 39 |
}
|
41 |
}
|
| 40 |
if (isset($_GET['id_img'])) {
|
42 |
if (isset($_GET['id_img'])) {
|
| 41 |
$this->id_image = $_GET['id_img'];
|
43 |
$this->id_image = $_GET['id_img'];
|
| Line 42... |
Line 44... |
| 42 |
}
|
44 |
}
|
| 43 |
}
|
45 |
}
|
| 44 |
|
46 |
|
| Line 45... |
Line 47... |
| 45 |
public function executerActionParDefaut() {
|
47 |
public function executerActionParDefaut() {
|
| 46 |
$this->executerForm();
|
48 |
$this->executerForm();
|
| 47 |
}
|
49 |
}
|
| 48 |
|
50 |
|
| 49 |
public function executerForm() {
|
51 |
public function executerForm() {
|
| 50 |
if ($this->utilisateur->etreIdentifie()) {
|
52 |
if ($this->utilisateur->estIdentifie()) {
|
| 51 |
$this->afficherFormContact();
|
53 |
$this->afficherFormContact();
|
| Line 58... |
Line 60... |
| 58 |
$this->setSortie(self::META_TITRE, 'Contactez un membre du réseau');
|
60 |
$this->setSortie(self::META_TITRE, 'Contactez un membre du réseau');
|
| 59 |
$entete = array();
|
61 |
$entete = array();
|
| 60 |
$entete['formType'] = 'contact';
|
62 |
$entete['formType'] = 'contact';
|
| 61 |
$entete['urlWsMessageCel'] = sprintf($this->urlWsCelTpl, 'celMessage/image');
|
63 |
$entete['urlWsMessageCel'] = sprintf($this->urlWsCelTpl, 'celMessage/image');
|
| 62 |
$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
|
64 |
$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
|
| 63 |
|
65 |
|
| 64 |
$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
|
66 |
$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
|
| Line 65... |
Line 67... |
| 65 |
|
67 |
|
| 66 |
$infos = array();
|
68 |
$infos = array();
|
| 67 |
// cas d'une obs saisie par une personne non inscrite
|
69 |
// cas d'une obs saisie par une personne non inscrite
|
| 68 |
// le message doit être envoyé au cel qui fournira le courriel de l'auteur
|
70 |
// le message doit être envoyé au cel qui fournira le courriel de l'auteur
|
| 69 |
if(trim($this->id_destinataire) == "") {
|
71 |
if(trim($this->id_destinataire) == "" || trim($this->id_destinataire) == "null") {
|
| 70 |
$infos['idDestinataire'] = $this->id_image;
|
72 |
$infos['idDestinataire'] = $this->id_image;
|
| 71 |
$infos['typeEnvoi'] = 'non-inscrit';
|
73 |
$infos['typeEnvoi'] = 'non-inscrit';
|
| 72 |
} else {
|
74 |
} else {
|
| 73 |
$infos['idDestinataire'] = $this->id_destinataire;
|
75 |
$infos['idDestinataire'] = $this->id_destinataire;
|
| 74 |
$infos['typeEnvoi'] = 'inscrit';
|
76 |
$infos['typeEnvoi'] = 'inscrit';
|
| 75 |
}
|
77 |
}
|
| 76 |
$infos['idImage'] = $this->id_image;
|
78 |
$infos['idImage'] = $this->id_image;
|
| 77 |
$infos['utilisateurCourriel'] = $this->utilisateur->getCourriel();
|
79 |
$infos['utilisateurCourriel'] = $this->utilisateur->getCourriel();
|
| 78 |
$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
|
80 |
$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
|
| 79 |
|
81 |
|
| 80 |
$this->imagesApi->setProjet('cel');
|
82 |
$this->imagesApi->setProjet('cel');
|
| 81 |
// prêt à passer à API_DEL
|
83 |
// prêt à passer à API_DEL
|
| 82 |
// TODO: voir pourquoi la forme service:del:images/#id_image ne fonctionne pas
|
84 |
// TODO: voir pourquoi la forme service:del:images/#id_image ne fonctionne pas
|
| 83 |
// et s'il est vraiment utile d'appeler DEL ici
|
85 |
// et s'il est vraiment utile d'appeler DEL ici
|
| 84 |
$imageInfos = $this->imagesApi->setApi(Eflore::API_EFLORE)->getInfosImageParIdImage($this->id_image);
|
86 |
$imageInfos = $this->imagesApi->setApi(Eflore::API_EFLORE)->getInfosImageParIdImage($this->id_image);
|
| 85 |
$idObs = $imageInfos['observation.id'];
|
87 |
$idObs = $imageInfos['observation.id'];
|
| 86 |
$nomSci = $imageInfos['determination.nom_sci'];
|
88 |
$nomSci = $imageInfos['determination.nom_sci'];
|
| 87 |
$date = $imageInfos['date'];
|
89 |
$date = $imageInfos['date'];
|
| 88 |
$lieu = $imageInfos['station.libelle'];
|
90 |
$lieu = $imageInfos['station.libelle'];
|
| 89 |
|
91 |
|
| 90 |
$infos['sujet'] = "Observation #$idObs de $nomSci";
|
92 |
$infos['sujet'] = "Observation #$idObs de $nomSci";
|
| 91 |
$infos['message'] = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de $nomSci du $date au lieu $lieu";
|
93 |
$infos['message'] = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de $nomSci du $date au lieu $lieu";
|
| 92 |
|
94 |
|
| 93 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('form_contact', $infos));
|
95 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('form_contact', $infos));
|
| Line 94... |
Line 96... |
| 94 |
}
|
96 |
}
|
| 95 |
|
97 |
|
| 96 |
private function afficherFormIdentification() {
|
98 |
private function afficherFormIdentification() {
|
| 97 |
$this->setSortie(self::META_TITRE, 'Identification');
|
99 |
$this->setSortie(self::META_TITRE, 'Identification');
|
| 98 |
$entete = array();
|
100 |
$entete = array();
|
| 99 |
$entete['formType'] = 'identification';
|
101 |
$entete['formType'] = 'identification';
|
| Line -... |
Line 102... |
| - |
|
102 |
$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
|
| 100 |
$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
|
103 |
$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
|
| - |
|
104 |
|
| - |
|
105 |
|
| - |
|
106 |
$infos = array();
|
| - |
|
107 |
$currentUrl = ((@$_SERVER["HTTPS"] == "on") ? "https://" : "http://")
|
| - |
|
108 |
. $_SERVER["SERVER_NAME"]
|
| - |
|
109 |
. $_SERVER['REQUEST_URI'];
|
| - |
|
110 |
|
| 101 |
$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
|
111 |
var_dump($currentUrl); echo "<br/>";
|
| - |
|
112 |
var_dump(urlencode($currentUrl)); echo "<br/>";
|
| 102 |
|
113 |
|
| 103 |
$infos = array();
|
114 |
$infos['urlPopUp'] = $this->urlConnexionSite . '?redirect_to=' . urlencode($currentUrl);
|
| 104 |
$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
|
115 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('form_identification', $infos));
|
| 105 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('form_identification', $infos));
|
116 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('form_identification', $infos));
|
| 106 |
}
|
117 |
}
|