Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 507 | Rev 529 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 507 Rev 528
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Affiche un formulaire de contact d'utilisateur.
4
 * Affiche un formulaire de contact d'utilisateur.
5
 *
5
 *
6
 * @category	php 5.2
6
 * @category	php 5.2
7
 * @package		eFlore-consultation
7
 * @package		eFlore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @copyright	Copyright (c) 2012, Tela Botanica (accueil@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
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
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @version		$Id$
12
 * @version		$Id$
13
 */
13
 */
14
 
14
 
15
class PopupContact extends aControleur {
15
class PopupContact extends aControleur {
-
 
16
 
16
	private $conteneur = null;
17
	private $conteneur = null;
17
	private $imagesApi = null;
18
	private $imagesApi = null;
-
 
19
	private $utilisateur = null;
-
 
20
	private $appUrls = null;
18
	private $id_destinataire = '';
21
	private $id_destinataire = '';
19
	private $id_image = '';
22
	private $id_image = '';
20
 
-
 
21
 
23
 
22
	public function initialiser() {
24
	public function initialiser() {
23
		$this->capturerParametres();
-
 
24
		$this->setSortie(self::RENDU_SCRIPT, $this->getVue('contact_scripts'));
-
 
25
		$style = '<link href="modules/popup_contact/presentations/styles/contact.css" rel="stylesheet" type="text/css" />';
-
 
26
		$this->setSortie(self::RENDU_STYLE, $style);
25
		$this->capturerParametres();
27
		$this->conteneur = new Conteneur();
26
		$this->conteneur = new Conteneur();
-
 
27
		$this->imagesApi = $this->conteneur->getApiImages();
-
 
28
		$this->utilisateur = $this->conteneur->getUtilisateur();
28
		$this->imagesApi = $this->conteneur->getApiImages();
29
		$this->appUrls = $this->conteneur->getAppUrls();
29
	}
30
	}
30
 
31
 
31
	private function capturerParametres() {
32
	private function capturerParametres() {
32
		if (isset($_GET['id_destinataire'])) {
33
		if (isset($_GET['id_destinataire'])) {
33
			$this->id_destinataire = $_GET['id_destinataire'];
34
			$this->id_destinataire = $_GET['id_destinataire'];
34
		}
35
		}
35
		if (isset($_GET['id_img'])) {
36
		if (isset($_GET['id_img'])) {
36
			$this->id_image = $_GET['id_img'];
37
			$this->id_image = $_GET['id_img'];
37
		}
38
		}
38
	}
39
	}
39
 
40
 
40
	public function executerActionParDefaut() {
41
	public function executerActionParDefaut() {
41
		$this->executerForm();
42
		$this->executerForm();
42
	}
43
	}
43
 
44
 
44
	public function executerForm(){
45
	public function executerForm() {
45
		$infos = array();
46
		if ($this->utilisateur->etreIdentifie()) {
-
 
47
			$this->afficherFormContact();
46
		$infos['idDestinataire'] = $this->id_destinataire;
48
		} else {
-
 
49
			$this->afficherFormIdentification();
-
 
50
		}
47
		$infos['idImage'] = $this->id_image;
51
	}
48
 
-
 
49
		$this->imagesApi->setProjet('cel');
52
 
50
		$imageInfos = $this->imagesApi->getInfosImageParIdImage($this->id_image);
53
	private function afficherFormContact() {
51
		Debug::printr($imageInfos);
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;
-
 
60
		$infos['idImage'] = $this->id_image;
-
 
61
		$infos['utilisateurCourriel'] = $this->utilisateur->getCourriel();
-
 
62
		$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
-
 
63
 
-
 
64
		$this->imagesApi->setProjet('cel');
-
 
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
 
52
		//$infos['sujet'] = "Observation #"+idObs+" de "+nomSci;
71
		$infos['sujet'] = "Observation #$idObs de $nomSci";
53
		//$infos['message'] = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de \""+nomSci+'" du "'+date+'" au lieu "'+lieu+'".';
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
	}
-
 
76
 
-
 
77
	private function afficherFormIdentification() {
-
 
78
		$entete = array();
-
 
79
		$entete['formType'] = 'identification';
-
 
80
		$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
-
 
81
 
54
 
82
		$infos = array();
55
		$this->setSortie(self::RENDU_CORPS, $this->getVue('popup_contact', $infos));
83
		$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
56
	}
84
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_identification', $infos));
57
 
85
	}
58
}
86
}
59
?>
87
?>