| Line 61... |
Line 61... |
| 61 |
/**
|
61 |
/**
|
| 62 |
* Vérifier que le service est bien configuré
|
62 |
* Vérifier que le service est bien configuré
|
| 63 |
* */
|
63 |
* */
|
| 64 |
public function verifierConfiguration() {
|
64 |
public function verifierConfiguration() {
|
| 65 |
$erreurs = array();
|
65 |
$erreurs = array();
|
| 66 |
$tableauImages = $this->conteneur->getParametre('mapping_masque');
|
- |
|
| Line 67... |
Line 66... |
| 67 |
|
66 |
|
| 68 |
if (empty($this->mappingFiltre)) {
|
67 |
if (empty($this->mappingFiltre)) {
|
| 69 |
$erreurs[] = '- le fichier de configuration ne contient pas le tableau [mapping_masque] ou celui-ci est vide ;';
|
68 |
$erreurs[] = '- le fichier de configuration ne contient pas le tableau [mapping_masque] ou celui-ci est vide ;';
|
| 70 |
} else {
|
69 |
} else {
|
| Line 136... |
Line 135... |
| 136 |
|
135 |
|
| 137 |
/**
|
136 |
/**
|
| 138 |
* Générer le lien du flux RSS
|
137 |
* Générer le lien du flux RSS
|
| 139 |
* */
|
138 |
* */
|
| 140 |
private function creerUrlService() {
|
139 |
private function creerUrlService() {
|
| 141 |
$url_service = $this->conteneur->getParametre('url_service');
|
- |
|
| 142 |
$url_service .= '/'.$this->type_rss;
|
- |
|
| 143 |
//$url_service = '';
|
- |
|
| 144 |
if (count($_GET) > 0) {
|
- |
|
| 145 |
$parametres_get = array();
|
- |
|
| 146 |
foreach ($_GET as $cle => $valeur) {
|
- |
|
| 147 |
$parametres_get[] = $cle.'='.$valeur;
|
- |
|
| 148 |
}
|
- |
|
| 149 |
$url_service .= '?'.implode('&', $parametres_get);
|
- |
|
| 150 |
}
|
140 |
$url_service = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
|
| 151 |
return $url_service;
|
141 |
return $url_service;
|
| Line 152... |
Line 142... |
| 152 |
}
|
142 |
}
|
| 153 |
|
143 |
|
| Line 165... |
Line 155... |
| 165 |
$item['guid'] = $this->creerGuidItem($info);
|
155 |
$item['guid'] = $this->creerGuidItem($info);
|
| 166 |
$item['lien'] = $this->creerLienItem($info);
|
156 |
$item['lien'] = $this->creerLienItem($info);
|
| 167 |
$item['categorie'] = $this->creerCategorie($item);
|
157 |
$item['categorie'] = $this->creerCategorie($item);
|
| 168 |
$item['description'] = $this->creerDescription($info, $item);
|
158 |
$item['description'] = $this->creerDescription($info, $item);
|
| 169 |
$item['description_encodee'] = htmlspecialchars($this->creerDescription($info, $item));
|
159 |
$item['description_encodee'] = htmlspecialchars($this->creerDescription($info, $item));
|
| 170 |
$item['modifie_par'] = $this->creerAuteur($info);
|
160 |
$item['modifie_par'] = $this->creerVotant($info);
|
| 171 |
return $item;
|
161 |
return $item;
|
| 172 |
}
|
162 |
}
|
| Line 173... |
Line 163... |
| 173 |
|
163 |
|
| 174 |
private function creerCategorie($element) {
|
164 |
private function creerCategorie($element) {
|
| Line 188... |
Line 178... |
| 188 |
}
|
178 |
}
|
| Line 189... |
Line 179... |
| 189 |
|
179 |
|
| 190 |
private function creerTitre($element) {
|
180 |
private function creerTitre($element) {
|
| 191 |
$noteVote = $element['valeur'];
|
181 |
$noteVote = $element['valeur'];
|
| 192 |
$nomSci = htmlspecialchars($element['nom_sel']);
|
- |
|
| 193 |
$votant = array('prenom' => $element['votant_prenom'], 'nom' => $element['votant_nom']);
|
182 |
$nomSci = htmlspecialchars($element['nom_sel']);
|
| 194 |
$votantTxt = htmlspecialchars($this->creerAuteur($votant));
|
- |
|
| 195 |
$observateur = array('prenom' => $element['observateur_prenom'], 'nom' => $element['observateur_nom']);
|
183 |
$votant = htmlspecialchars($this->creerVotant($element));
|
| Line 196... |
Line 184... |
| 196 |
$observateurTxt = htmlspecialchars($this->creerAuteur($observateur));
|
184 |
$observateur = htmlspecialchars($this->creerObservateur($element));
|
| 197 |
|
185 |
|
| 198 |
$titre = "Vote $noteVote par $votantTxt pour $nomSci de $observateurTxt";
|
186 |
$titre = "Vote $noteVote par $votant pour $nomSci de $observateur";
|
| Line 199... |
Line 187... |
| 199 |
return $titre;
|
187 |
return $titre;
|
| 200 |
}
|
188 |
}
|
| 201 |
|
189 |
|
| 202 |
private function creerDescription($donnees, $item) {
|
190 |
private function creerDescription($donnees, $item) {
|
| 203 |
$idVote = htmlspecialchars($donnees['id_vote']);
|
191 |
$idVote = htmlspecialchars($donnees['id_vote']);
|
| 204 |
$idObs = htmlspecialchars($donnees['id_observation']);
|
192 |
$idObs = htmlspecialchars($donnees['id_observation']);
|
| 205 |
$idImg = htmlspecialchars($donnees['ce_image']);
|
193 |
$idImg = htmlspecialchars($donnees['ce_image']);
|
| - |
|
194 |
$urlImg = $this->getUrlImage($donnees['ce_image']);
|
| - |
|
195 |
$miniatureUrl = $this->getUrlImage($donnees['ce_image'], 'CRS');
|
| 206 |
$urlImg = $this->getUrlImage($donnees['ce_image']);
|
196 |
$nomSelActuel = htmlspecialchars($donnees['nom_sel']);
|
| 207 |
$miniatureUrl = $this->getUrlImage($donnees['ce_image'], 'CRX2S');
|
- |
|
| 208 |
$proposition = htmlspecialchars($donnees['nom_sel']);
|
197 |
$dateObs = htmlspecialchars(str_replace(' 00:00:00', '', $donnees['date_observation']));
|
| 209 |
$protocole = htmlspecialchars($donnees['intitule']);
|
198 |
$lieuObs = htmlspecialchars($donnees['zone_geo']);
|
| 210 |
$votant = array('prenom' => $donnees['votant_prenom'], 'nom' => $donnees['votant_nom']);
|
199 |
$protocole = htmlspecialchars($donnees['intitule']);
|
| 211 |
$votantTxt = htmlspecialchars($this->creerAuteur($votant));
|
200 |
$votant = htmlspecialchars($this->creerVotant($donnees));
|
| 212 |
$observateur = array('prenom' => $donnees['observateur_prenom'], 'nom' => $donnees['observateur_nom']);
|
201 |
$dateVote = htmlspecialchars(strftime('%A %d %B %Y à %H:%M', strtotime($donnees['date_vote'])));
|
| 213 |
$observateurTxt = htmlspecialchars($this->creerAuteur($observateur));
|
202 |
$observateur = htmlspecialchars($this->creerObservateur($donnees));
|
| 214 |
|
203 |
|
| 215 |
$description = '<ul>'.
|
204 |
$description = '<style>.champ{color:grey} .gauche{float:left;padding:0 20px 0 0;} ul{list-style-type:none;padding:0;}</style>'.
|
| 216 |
"<li>Vote pictoFlora #$idVote</li>".
|
205 |
'<h2>'."Vote pictoFlora #$idVote pour l'image #$idImg de l'observation #$idObs".'</h2>'.
|
| 217 |
'<li>'.
|
- |
|
| 218 |
' <a href="'.$urlImg.'">'.
|
206 |
'<div class="gauche">'.
|
| 219 |
' <img src="'.$miniatureUrl.'" alt="Img #'.$idImg.'"/>'.
|
207 |
' <a href="'.$urlImg.'">'.
|
| - |
|
208 |
' <img src="'.$miniatureUrl.'" alt="Img #'.$idImg.'"/>'.
|
| - |
|
209 |
' </a>'.
|
| - |
|
210 |
'</div>'.
|
| 220 |
' Image #'.$idImg.
|
211 |
'<div class="gauche">'.
|
| - |
|
212 |
" <h3>Image #$idImg de l'observation #$idObs</h3>".
|
| 221 |
' </a>'.
|
213 |
' <ul>'.
|
| - |
|
214 |
' <li><span class="champ">'."Auteur de l'image :</span> $observateur</li>".
|
| - |
|
215 |
' <li><span class="champ">'."Nom saisi actuel :</span> <em>$nomSelActuel</em></li>".
|
| - |
|
216 |
' <li><span class="champ">'."Lieu :</span> $lieuObs</li>".
|
| - |
|
217 |
' <li><span class="champ">'."Date :</span> $dateObs</li>".
|
| 222 |
'</li>'.
|
218 |
' </ul>'.
|
| - |
|
219 |
'</div>'.
|
| - |
|
220 |
'<div class="gauche">'.
|
| 223 |
"<li>Auteur de l'image : $observateurTxt</li>".
|
221 |
" <h3>Vote #$idVote</h3>".
|
| 224 |
"<li>Observation #$idObs : <em>$proposition</em></li>".
|
222 |
' <ul>'.
|
| - |
|
223 |
' <li><span class="champ">'."Protocole :</span> <strong>$protocole</strong></li>".
|
| 225 |
"<li>Protocole : $protocole</li>".
|
224 |
' <li><span class="champ">'."Valeur :</span> <strong>{$donnees['valeur']}</strong>/5</li>".
|
| - |
|
225 |
' <li><span class="champ">'."Votant :</span> $votant</li>".
|
| 226 |
'<li>Valeur : <strong>'.$donnees['valeur'].'</strong>/5</li>'.
|
226 |
' <li><span class="champ">'."À voté le :</span> $dateVote</li>".
|
| 227 |
'<li>Votant : '.$votantTxt.'</li>'.
|
227 |
' </ul>'.
|
| Line 228... |
Line 228... |
| 228 |
'</ul>';
|
228 |
'</div>';
|
| 229 |
return $description;
|
229 |
return $description;
|
| 230 |
}
|
230 |
}
|
| 231 |
|
231 |
|
| 232 |
private function getUrlImage($id, $format = 'L') {
|
232 |
private function getUrlImage($id, $format = 'L') {
|
| 233 |
$url_tpl = $this->conteneur->getParametre('celImgUrlTpl');
|
233 |
$url_tpl = $this->conteneur->getParametre('celImgUrlTpl');
|
| Line 234... |
Line 234... |
| 234 |
$id = sprintf('%09s', $id).$format;
|
234 |
$id = sprintf('%09s', $id).$format;
|
| 235 |
$url = sprintf($url_tpl, $id);
|
235 |
$url = sprintf($url_tpl, $id);
|
| 236 |
return $url;
|
236 |
return $url;
|
| 237 |
}
|
237 |
}
|
| - |
|
238 |
|
| - |
|
239 |
private function creerVotant($info) {
|
| - |
|
240 |
$votant = 'Anonyme';
|
| - |
|
241 |
if (isset($info['votant_prenom']) && isset($info['votant_nom'])) {
|
| - |
|
242 |
$votant = $info['votant_prenom'].' '.$info['votant_nom'];
|
| - |
|
243 |
}
|
| - |
|
244 |
return $votant;
|
| - |
|
245 |
}
|
| 238 |
|
246 |
|
| 239 |
private function creerAuteur($info) {
|
247 |
private function creerObservateur($info) {
|
| 240 |
$intitule = 'Anonyme';
|
248 |
$observateur = 'Anonyme';
|
| Line 241... |
Line 249... |
| 241 |
if (isset($info['prenom']) && isset($info['nom'])) {
|
249 |
if ($info['observateur_prenom'] != '' && $info['observateur_nom'] != '') {
|
| 242 |
$intitule = $info['prenom'].' '.$info['nom'];
|
250 |
$observateur = $info['observateur_prenom'].' '.$info['observateur_nom'];
|
| 243 |
}
|
251 |
}
|
| 244 |
return $intitule;
|
252 |
return $observateur;
|
| 245 |
}
|
253 |
}
|
| 246 |
|
254 |
|
| 247 |
/**
|
255 |
/**
|
| 248 |
* Retrouver les derniers votes image
|
256 |
* Retrouver les derniers votes image
|
| 249 |
* */
|
257 |
* */
|
| 250 |
private function getDerniersVotesImage() {
|
258 |
private function getDerniersVotesImage() {
|
| 251 |
$requete = 'SELECT DISTINCT id_vote, ce_image, valeur, divo.date AS date_vote, '.
|
259 |
$requete = 'SELECT DISTINCT id_vote, ce_image, valeur, divo.date AS date_vote, '.
|
| 252 |
' duo.prenom AS observateur_prenom, duo.nom AS observateur_nom, '.
|
260 |
' duo.prenom AS observateur_prenom, duo.nom AS observateur_nom, '.
|
| 253 |
' duv.prenom AS votant_prenom, duv.nom AS votant_nom, '.
|
261 |
' duv.prenom AS votant_prenom, duv.nom AS votant_nom, '.
|