Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 507 | Rev 529 | 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 = '';
23
 
24
	public function initialiser() {
25
		$this->capturerParametres();
26
		$this->conteneur = new Conteneur();
27
		$this->imagesApi = $this->conteneur->getApiImages();
528 jpm 28
		$this->utilisateur = $this->conteneur->getUtilisateur();
29
		$this->appUrls = $this->conteneur->getAppUrls();
507 jpm 30
	}
31
 
32
	private function capturerParametres() {
33
		if (isset($_GET['id_destinataire'])) {
34
			$this->id_destinataire = $_GET['id_destinataire'];
35
		}
36
		if (isset($_GET['id_img'])) {
37
			$this->id_image = $_GET['id_img'];
38
		}
39
	}
40
 
41
	public function executerActionParDefaut() {
42
		$this->executerForm();
43
	}
44
 
528 jpm 45
	public function executerForm() {
46
		if ($this->utilisateur->etreIdentifie()) {
47
			$this->afficherFormContact();
48
		} else {
49
			$this->afficherFormIdentification();
50
		}
51
	}
52
 
53
	private function afficherFormContact() {
54
		$entete = array();
55
		$entete['formType'] = 'contact';
56
		$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
57
 
58
		$infos = array();
59
		$infos['idDestinataire'] = $this->id_destinataire;
507 jpm 60
		$infos['idImage'] = $this->id_image;
528 jpm 61
		$infos['utilisateurCourriel'] = $this->utilisateur->getCourriel();
62
		$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
63
 
507 jpm 64
		$this->imagesApi->setProjet('cel');
528 jpm 65
		$imageInfos = $this->imagesApi->getInfosImageParIdImage($this->id_image);
66
		$idObs = $imageInfos['observation.id'];
67
		$nomSci = $imageInfos['determination.nom_sci'];
68
		$date = $imageInfos['date'];
69
		$lieu = $imageInfos['station.libelle'];
70
 
71
		$infos['sujet'] = "Observation #$idObs de $nomSci";
72
		$infos['message'] = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de $nomSci du $date au lieu $lieu";
73
 
74
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_contact', $infos));
75
	}
507 jpm 76
 
528 jpm 77
	private function afficherFormIdentification() {
78
		$entete = array();
79
		$entete['formType'] = 'identification';
80
		$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
81
 
82
		$infos = array();
83
		$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
84
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_identification', $infos));
507 jpm 85
	}
86
}
87
?>