Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 528 | Rev 533 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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() {
56
		$entete = array();
529 jpm 57
		$entete['formType'] = 'contact';
58
		$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
528 jpm 59
		$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
60
 
61
		$infos = array();
62
		$infos['idDestinataire'] = $this->id_destinataire;
507 jpm 63
		$infos['idImage'] = $this->id_image;
528 jpm 64
		$infos['utilisateurCourriel'] = $this->utilisateur->getCourriel();
65
		$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
66
 
507 jpm 67
		$this->imagesApi->setProjet('cel');
528 jpm 68
		$imageInfos = $this->imagesApi->getInfosImageParIdImage($this->id_image);
69
		$idObs = $imageInfos['observation.id'];
70
		$nomSci = $imageInfos['determination.nom_sci'];
71
		$date = $imageInfos['date'];
72
		$lieu = $imageInfos['station.libelle'];
73
 
74
		$infos['sujet'] = "Observation #$idObs de $nomSci";
75
		$infos['message'] = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de $nomSci du $date au lieu $lieu";
76
 
77
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_contact', $infos));
78
	}
507 jpm 79
 
528 jpm 80
	private function afficherFormIdentification() {
81
		$entete = array();
529 jpm 82
		$entete['formType'] = 'identification';
83
		$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
528 jpm 84
		$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
85
 
86
		$infos = array();
87
		$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
88
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_identification', $infos));
507 jpm 89
	}
90
}
91
?>