Line 33... |
Line 33... |
33 |
const DS = DIRECTORY_SEPARATOR;
|
33 |
const DS = DIRECTORY_SEPARATOR;
|
34 |
const SERVICE_CARTO_NOM = 'CelWidgetMapPoint';
|
34 |
const SERVICE_CARTO_NOM = 'CelWidgetMapPoint';
|
35 |
const SERVICE_CARTO_ACTION_DEFAUT = 'carte-defaut';
|
35 |
const SERVICE_CARTO_ACTION_DEFAUT = 'carte-defaut';
|
Line 36... |
Line 36... |
36 |
|
36 |
|
- |
|
37 |
private $carte = null;
|
37 |
private $carte = null;
|
38 |
private $num_taxon = false;
|
38 |
private $utilisateur = null;
|
39 |
private $utilisateur = null;
|
39 |
private $projet = null;
|
40 |
private $projet = null;
|
40 |
private $dept = null;
|
41 |
private $dept = null;
|
41 |
private $num_taxon = null;
|
42 |
private $num_nom_ret = null;
|
42 |
private $station = null;
|
43 |
private $station = null;
|
43 |
private $format = null;// Format des obs pour les stations (tableau/liste)
|
44 |
private $format = null;// Format des obs pour les stations (tableau/liste)
|
44 |
private $photos = null; // Seulement les obs avec photos ou bien toutes
|
45 |
private $photos = null; // Seulement les obs avec photos ou bien toutes
|
45 |
private $titre = null; // Indication s'il faut le titre par défaut, personnalisé ou bien sans titre
|
46 |
private $titre = null; // Indication s'il faut le titre par défaut, personnalisé ou bien sans titre
|
Line 57... |
Line 58... |
57 |
* Méthode appelée par défaut pour charger ce widget.
|
58 |
* Méthode appelée par défaut pour charger ce widget.
|
58 |
*/
|
59 |
*/
|
59 |
public function executer() {
|
60 |
public function executer() {
|
60 |
$retour = null;
|
61 |
$retour = null;
|
61 |
$this->extraireParametres();
|
62 |
$this->extraireParametres();
|
- |
|
63 |
if ($this->num_taxon == false) {
|
62 |
$methode = $this->traiterNomMethodeExecuter($this->carte);
|
64 |
$methode = $this->traiterNomMethodeExecuter($this->carte);
|
63 |
if (method_exists($this, $methode)) {
|
65 |
if (method_exists($this, $methode)) {
|
64 |
$retour = $this->$methode();
|
66 |
$retour = $this->$methode();
|
- |
|
67 |
} else {
|
- |
|
68 |
$this->messages[] = "Ce type de service '$methode' n'est pas disponible.";
|
- |
|
69 |
}
|
- |
|
70 |
if (is_null($retour)) {
|
- |
|
71 |
$info = 'Un problème est survenu : '.print_r($this->messages, true);
|
- |
|
72 |
$this->envoyer($info);
|
- |
|
73 |
} else {
|
- |
|
74 |
// Suffixe de template pour la langue - fr par défaut @TODO configurer ça un jour
|
- |
|
75 |
$suffixeLangue = "";
|
- |
|
76 |
if ($this->langue != null && $this->langue != "fr") {
|
- |
|
77 |
$suffixeLangue = "_" . $this->langue;
|
- |
|
78 |
}
|
- |
|
79 |
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$retour['squelette'].$suffixeLangue.'.tpl.html';
|
- |
|
80 |
$html = $this->traiterSquelettePhp($squelette, $retour['donnees']);
|
- |
|
81 |
$this->envoyer($html);
|
- |
|
82 |
}
|
65 |
} else {
|
83 |
} else {
|
66 |
$this->messages[] = "Ce type de service '$methode' n'est pas disponible.";
|
84 |
$this->envoyer("Le paramètre num_taxon n'est plus maintenu");
|
67 |
}
|
- |
|
68 |
if (is_null($retour)) {
|
- |
|
69 |
$info = 'Un problème est survenu : '.print_r($this->messages, true);
|
- |
|
70 |
$this->envoyer($info);
|
- |
|
71 |
} else {
|
- |
|
72 |
// Suffixe de template pour la langue - fr par défaut @TODO configurer ça un jour
|
- |
|
73 |
$suffixeLangue = "";
|
- |
|
74 |
if ($this->langue != null && $this->langue != "fr") {
|
- |
|
75 |
$suffixeLangue = "_" . $this->langue;
|
- |
|
76 |
}
|
- |
|
77 |
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$retour['squelette'].$suffixeLangue.'.tpl.html';
|
- |
|
78 |
$html = $this->traiterSquelettePhp($squelette, $retour['donnees']);
|
- |
|
79 |
$this->envoyer($html);
|
- |
|
80 |
}
|
85 |
}
|
81 |
}
|
86 |
}
|
Line 82... |
Line 87... |
82 |
|
87 |
|
83 |
public function extraireParametres() {
|
88 |
public function extraireParametres() {
|
- |
|
89 |
extract($this->parametres);
|
84 |
extract($this->parametres);
|
90 |
$this->num_taxon = (isset($num_taxon) ? true : false);
|
85 |
$this->carte = (isset($carte) ? $carte : self::SERVICE_CARTO_ACTION_DEFAUT);
|
91 |
$this->carte = (isset($carte) ? $carte : self::SERVICE_CARTO_ACTION_DEFAUT);
|
86 |
$this->utilisateur = (isset($utilisateur) ? $utilisateur : '*');
|
92 |
$this->utilisateur = (isset($utilisateur) ? $utilisateur : '*');
|
87 |
$this->projet = (isset($projet) ? $projet : '*');
|
93 |
$this->projet = (isset($projet) ? $projet : '*');
|
88 |
$this->tag = (isset($tag) ? $tag : '*');
|
94 |
$this->tag = (isset($tag) ? $tag : '*');
|
89 |
$this->tag = (isset($motcle) ? $motcle : $this->tag);
|
95 |
$this->tag = (isset($motcle) ? $motcle : $this->tag);
|
90 |
$this->dept = (isset($dept) ? $dept : '*');
|
96 |
$this->dept = (isset($dept) ? $dept : '*');
|
91 |
$this->commune = (isset($commune) ? $commune : '*');
|
97 |
$this->commune = (isset($commune) ? $commune : '*');
|
92 |
$this->pays = (isset($pays) ? $pays : '*');
|
98 |
$this->pays = (isset($pays) ? $pays : '*');
|
93 |
$this->num_taxon = (isset($num_taxon) ? $num_taxon : '*');
|
99 |
$this->num_nom_ret = (isset($num_nom_ret) ? $num_nom_ret : '*');
|
94 |
$this->date = (isset($date) ? $date : '*');
|
100 |
$this->date = (isset($date) ? $date : '*');
|
95 |
$this->taxon = (isset($taxon) ? $taxon : '*');
|
101 |
$this->taxon = (isset($taxon) ? $taxon : '*');
|
96 |
$this->commentaire = (isset($commentaire) ? $commentaire : null);
|
102 |
$this->commentaire = (isset($commentaire) ? $commentaire : null);
|
97 |
$this->station = (isset($station) ? $station : null);
|
103 |
$this->station = (isset($station) ? $station : null);
|
Line 129... |
Line 135... |
129 |
$widget['donnees']['projet'] = $this->projet;
|
135 |
$widget['donnees']['projet'] = $this->projet;
|
130 |
$widget['donnees']['tag'] = $this->tag;
|
136 |
$widget['donnees']['tag'] = $this->tag;
|
131 |
$widget['donnees']['dept'] = $this->dept;
|
137 |
$widget['donnees']['dept'] = $this->dept;
|
132 |
$widget['donnees']['commune'] = $this->commune;
|
138 |
$widget['donnees']['commune'] = $this->commune;
|
133 |
$widget['donnees']['pays'] = $this->pays;
|
139 |
$widget['donnees']['pays'] = $this->pays;
|
134 |
$widget['donnees']['num_taxon'] = $this->num_taxon;
|
140 |
$widget['donnees']['num_nom_ret'] = $this->num_nom_ret;
|
135 |
$widget['donnees']['date'] = $this->date;
|
141 |
$widget['donnees']['date'] = $this->date;
|
136 |
$widget['donnees']['taxon'] = $this->taxon;
|
142 |
$widget['donnees']['taxon'] = $this->taxon;
|
137 |
$widget['donnees']['commentaire'] = $this->commentaire;
|
143 |
$widget['donnees']['commentaire'] = $this->commentaire;
|
138 |
$widget['donnees']['photos'] = $this->photos;
|
144 |
$widget['donnees']['photos'] = $this->photos;
|
139 |
$widget['donnees']['titre'] = $this->titre;
|
145 |
$widget['donnees']['titre'] = $this->titre;
|
Line 165... |
Line 171... |
165 |
if ($action) {
|
171 |
if ($action) {
|
166 |
$url .= "/$action";
|
172 |
$url .= "/$action";
|
Line 167... |
Line 173... |
167 |
|
173 |
|
168 |
$parametres_retenus = array();
|
174 |
$parametres_retenus = array();
|
169 |
$parametres_a_tester = array('station', 'utilisateur', 'projet', 'tag', 'dept', 'commune',
|
175 |
$parametres_a_tester = array('station', 'utilisateur', 'projet', 'tag', 'dept', 'commune',
|
170 |
'num_taxon', 'taxon', 'date', 'commentaire', 'nbjours', 'referentiel','pays', 'groupe_zones_geo',
|
176 |
'num_nom_ret', 'taxon', 'date', 'commentaire', 'nbjours', 'referentiel','pays', 'groupe_zones_geo',
|
171 |
'start', 'limit');
|
177 |
'start', 'limit');
|
172 |
foreach ($parametres_a_tester as $param) {
|
178 |
foreach ($parametres_a_tester as $param) {
|
173 |
if (isset($this->$param) && $this->$param != '*') {
|
179 |
if (isset($this->$param) && $this->$param != '*') {
|
174 |
$parametres_retenus[$param] = $this->$param;
|
180 |
$parametres_retenus[$param] = $this->$param;
|