507 |
jpm |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Affiche un formulaire de contact d'utilisateur.
|
|
|
5 |
*
|
|
|
6 |
* @category php 5.2
|
|
|
7 |
* @package eFlore-consultation
|
|
|
8 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
9 |
* @copyright Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
|
|
|
10 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
|
|
11 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
|
|
12 |
* @version $Id$
|
|
|
13 |
*/
|
|
|
14 |
|
|
|
15 |
class PopupContact extends aControleur {
|
528 |
jpm |
16 |
|
507 |
jpm |
17 |
private $conteneur = null;
|
|
|
18 |
private $imagesApi = null;
|
528 |
jpm |
19 |
private $utilisateur = null;
|
|
|
20 |
private $appUrls = null;
|
507 |
jpm |
21 |
private $id_destinataire = '';
|
|
|
22 |
private $id_image = '';
|
529 |
jpm |
23 |
private $urlWsAnnuaireUtilisateurTpl = '';
|
507 |
jpm |
24 |
|
|
|
25 |
public function initialiser() {
|
|
|
26 |
$this->capturerParametres();
|
|
|
27 |
$this->conteneur = new Conteneur();
|
|
|
28 |
$this->imagesApi = $this->conteneur->getApiImages();
|
528 |
jpm |
29 |
$this->utilisateur = $this->conteneur->getUtilisateur();
|
|
|
30 |
$this->appUrls = $this->conteneur->getAppUrls();
|
529 |
jpm |
31 |
$this->urlWsAnnuaireUtilisateurTpl = $this->conteneur->getParametre('baseUrlServicesAnnuaireTpl');
|
507 |
jpm |
32 |
}
|
|
|
33 |
|
|
|
34 |
private function capturerParametres() {
|
|
|
35 |
if (isset($_GET['id_destinataire'])) {
|
|
|
36 |
$this->id_destinataire = $_GET['id_destinataire'];
|
|
|
37 |
}
|
|
|
38 |
if (isset($_GET['id_img'])) {
|
|
|
39 |
$this->id_image = $_GET['id_img'];
|
|
|
40 |
}
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
public function executerActionParDefaut() {
|
|
|
44 |
$this->executerForm();
|
|
|
45 |
}
|
|
|
46 |
|
528 |
jpm |
47 |
public function executerForm() {
|
|
|
48 |
if ($this->utilisateur->etreIdentifie()) {
|
|
|
49 |
$this->afficherFormContact();
|
|
|
50 |
} else {
|
|
|
51 |
$this->afficherFormIdentification();
|
|
|
52 |
}
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
private function afficherFormContact() {
|
533 |
jpm |
56 |
$this->setSortie(self::META_TITRE, 'Contactez un membre du réseau');
|
528 |
jpm |
57 |
$entete = array();
|
529 |
jpm |
58 |
$entete['formType'] = 'contact';
|
|
|
59 |
$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
|
528 |
jpm |
60 |
$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
|
|
|
61 |
|
|
|
62 |
$infos = array();
|
|
|
63 |
$infos['idDestinataire'] = $this->id_destinataire;
|
507 |
jpm |
64 |
$infos['idImage'] = $this->id_image;
|
528 |
jpm |
65 |
$infos['utilisateurCourriel'] = $this->utilisateur->getCourriel();
|
|
|
66 |
$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
|
|
|
67 |
|
507 |
jpm |
68 |
$this->imagesApi->setProjet('cel');
|
528 |
jpm |
69 |
$imageInfos = $this->imagesApi->getInfosImageParIdImage($this->id_image);
|
|
|
70 |
$idObs = $imageInfos['observation.id'];
|
|
|
71 |
$nomSci = $imageInfos['determination.nom_sci'];
|
|
|
72 |
$date = $imageInfos['date'];
|
|
|
73 |
$lieu = $imageInfos['station.libelle'];
|
|
|
74 |
|
|
|
75 |
$infos['sujet'] = "Observation #$idObs de $nomSci";
|
|
|
76 |
$infos['message'] = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de $nomSci du $date au lieu $lieu";
|
|
|
77 |
|
|
|
78 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('form_contact', $infos));
|
|
|
79 |
}
|
507 |
jpm |
80 |
|
528 |
jpm |
81 |
private function afficherFormIdentification() {
|
533 |
jpm |
82 |
$this->setSortie(self::META_TITRE, 'Identification');
|
528 |
jpm |
83 |
$entete = array();
|
529 |
jpm |
84 |
$entete['formType'] = 'identification';
|
|
|
85 |
$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
|
528 |
jpm |
86 |
$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
|
|
|
87 |
|
|
|
88 |
$infos = array();
|
|
|
89 |
$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
|
|
|
90 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('form_identification', $infos));
|
507 |
jpm |
91 |
}
|
|
|
92 |
}
|
|
|
93 |
?>
|