Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1054 Rev 1115
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
 
17
	private $conteneur = null;
17
	private $conteneur = null;
18
	private $imagesApi = null;
18
	private $imagesApi = null;
19
	private $utilisateur = null;
19
	private $utilisateur = null;
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
 
25
 
26
	public function initialiser() {
26
	public function initialiser() {
27
		$this->capturerParametres();
27
		$this->capturerParametres();
28
		$this->conteneur = new Conteneur();
28
		$this->conteneur = new Conteneur();
29
		$this->imagesApi = $this->conteneur->getApiImages();
29
		$this->imagesApi = $this->conteneur->getApiImages();
30
		$this->utilisateur = $this->conteneur->getUtilisateur();
30
		$this->utilisateur = $this->conteneur->getUtilisateur();
31
		$this->appUrls = $this->conteneur->getAppUrls();
31
		$this->appUrls = $this->conteneur->getAppUrls();
32
		$this->urlWsAnnuaireUtilisateurTpl = $this->conteneur->getParametre('baseUrlServicesAnnuaireTpl');
32
		$this->urlWsAnnuaireUtilisateurTpl = $this->conteneur->getParametre('baseUrlServicesAnnuaireTpl');
33
		$this->urlWsCelTpl = $this->conteneur->getParametre('baseUrlServicesCelTpl');
33
		$this->urlWsCelTpl = $this->conteneur->getParametre('baseUrlServicesCelTpl');
34
	}
34
	}
35
 
35
 
36
	private function capturerParametres() {
36
	private function capturerParametres() {
37
		if (isset($_GET['id_destinataire'])) {
37
		if (isset($_GET['id_destinataire'])) {
38
			$this->id_destinataire = $_GET['id_destinataire'];
38
			$this->id_destinataire = $_GET['id_destinataire'];
39
		}
39
		}
40
		if (isset($_GET['id_img'])) {
40
		if (isset($_GET['id_img'])) {
41
			$this->id_image = $_GET['id_img'];
41
			$this->id_image = $_GET['id_img'];
42
		}
42
		}
43
	}
43
	}
44
 
44
 
45
	public function executerActionParDefaut() {
45
	public function executerActionParDefaut() {
46
		$this->executerForm();
46
		$this->executerForm();
47
	}
47
	}
48
 
48
 
49
	public function executerForm() {
49
	public function executerForm() {
50
		if ($this->utilisateur->etreIdentifie()) {
50
		if ($this->utilisateur->etreIdentifie()) {
51
			$this->afficherFormContact();
51
			$this->afficherFormContact();
52
		} else {
52
		} else {
53
			$this->afficherFormIdentification();
53
			$this->afficherFormIdentification();
54
		}
54
		}
55
	}
55
	}
56
 
56
 
57
	private function afficherFormContact() {
57
	private function afficherFormContact() {
58
		$this->setSortie(self::META_TITRE, 'Contactez un membre du réseau');
58
		$this->setSortie(self::META_TITRE, 'Contactez un membre du réseau');
59
		$entete = array();
59
		$entete = array();
60
		$entete['formType'] = 'contact';
60
		$entete['formType'] = 'contact';
61
		$entete['urlWsMessageCel'] = sprintf($this->urlWsCelTpl, 'celMessage/image');
61
		$entete['urlWsMessageCel'] = sprintf($this->urlWsCelTpl, 'celMessage/image');
62
		$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
62
		$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
63
		
63
		
64
		$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
64
		$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
65
 
65
 
66
		$infos = array();
66
		$infos = array();
67
		// cas d'une obs saisie par une personne non inscrite
67
		// 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
68
		// le message doit être envoyé au cel qui fournira le courriel de l'auteur
69
		if(trim($this->id_destinataire) == "") {
69
		if(trim($this->id_destinataire) == "") {
70
			$infos['idDestinataire'] = $this->id_image;
70
			$infos['idDestinataire'] = $this->id_image;
71
			$infos['typeEnvoi'] = 'non-inscrit';
71
			$infos['typeEnvoi'] = 'non-inscrit';
72
		} else {
72
		} else {
73
			$infos['idDestinataire'] = $this->id_destinataire;
73
			$infos['idDestinataire'] = $this->id_destinataire;
74
			$infos['typeEnvoi'] = 'inscrit';
74
			$infos['typeEnvoi'] = 'inscrit';
75
		}
75
		}
76
		$infos['idImage'] = $this->id_image;
76
		$infos['idImage'] = $this->id_image;
77
		$infos['utilisateurCourriel'] = $this->utilisateur->getCourriel();
77
		$infos['utilisateurCourriel'] = $this->utilisateur->getCourriel();
78
		$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
78
		$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
79
 
79
 
80
		$this->imagesApi->setProjet('cel');
80
		$this->imagesApi->setProjet('cel');
81
		$imageInfos = $this->imagesApi->getInfosImageParIdImage($this->id_image);
81
		$imageInfos = $this->imagesApi->setApi(Eflore::API_DEL)->getInfosImageParIdImage($this->id_image); // prêt à passer à API_DEL
82
		$idObs = $imageInfos['observation.id'];
82
		$idObs = $imageInfos['observation.id'];
83
		$nomSci = $imageInfos['determination.nom_sci'];
83
		$nomSci = $imageInfos['determination.nom_sci'];
84
		$date = $imageInfos['date'];
84
		$date = $imageInfos['date'];
85
		$lieu = $imageInfos['station.libelle'];
85
		$lieu = $imageInfos['station.libelle'];
86
 
86
 
87
		$infos['sujet'] = "Observation #$idObs de $nomSci";
87
		$infos['sujet'] = "Observation #$idObs de $nomSci";
88
		$infos['message'] = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de $nomSci du $date au lieu $lieu";
88
		$infos['message'] = "\n\n\n\n\n\n\n\n--\nConcerne l'observation de $nomSci du $date au lieu $lieu";
89
 
89
 
90
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_contact', $infos));
90
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_contact', $infos));
91
	}
91
	}
92
 
92
 
93
	private function afficherFormIdentification() {
93
	private function afficherFormIdentification() {
94
		$this->setSortie(self::META_TITRE, 'Identification');
94
		$this->setSortie(self::META_TITRE, 'Identification');
95
		$entete = array();
95
		$entete = array();
96
		$entete['formType'] = 'identification';
96
		$entete['formType'] = 'identification';
97
		$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
97
		$entete['urlWsUtilisateur'] = sprintf($this->urlWsAnnuaireUtilisateurTpl, 'utilisateur');
98
		$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
98
		$this->setSortie(self::ENTETE, $this->getVue('contact_entete', $entete));
99
 
99
 
100
		$infos = array();
100
		$infos = array();
101
		$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
101
		$infos['urlPopUp'] = $this->appUrls->obtenirUrlPopUpContact($this->id_destinataire, $this->id_image);
102
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_identification', $infos));
102
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_identification', $infos));
103
	}
103
	}
104
}
104
}
105
?>
105
?>