Line 41... |
Line 41... |
41 |
$this->collecterParametres();
|
41 |
$this->collecterParametres();
|
42 |
$ids_observations = $this->obtenirIdsObservation();
|
42 |
$ids_observations = $this->obtenirIdsObservation();
|
43 |
$donnees = $this->obtenirDonnees($this->id_observation);
|
43 |
$donnees = $this->obtenirDonnees($this->id_observation);
|
Line 44... |
Line 44... |
44 |
|
44 |
|
45 |
$widget['donnees']['titre'] = $this->construireTitreImage($donnees);
|
45 |
$widget['donnees']['titre'] = $this->construireTitreImage($donnees);
|
46 |
$widget['donnees']['url'] = $this->obtenirUrlImage(&$donnees['images']);
|
46 |
$widget['donnees']['url'] = $this->obtenirUrlImage($donnees['images']);
|
47 |
$widget['donnees']['images'] = $donnees['images'];
|
47 |
$widget['donnees']['images'] = $donnees['images'];
|
48 |
$widget['donnees']['liste_votes_determination'] = $this->formaterDeterminations($donnees);
|
48 |
$widget['donnees']['liste_votes_determination'] = $this->formaterDeterminations($donnees);
|
49 |
$widget['donnees']['url_css'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/vote/squelettes/css/');
|
49 |
$widget['donnees']['url_css'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/vote/squelettes/css/');
|
50 |
$widget['donnees']['url_js'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/vote/squelettes/scripts/');
|
50 |
$widget['donnees']['url_js'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/vote/squelettes/scripts/');
|
Line 59... |
Line 59... |
59 |
$this->envoyer($contenu);
|
59 |
$this->envoyer($contenu);
|
60 |
}
|
60 |
}
|
Line 61... |
Line 61... |
61 |
|
61 |
|
62 |
private function collecterParametres() {
|
62 |
private function collecterParametres() {
|
- |
|
63 |
$this->id_observation = (isset($_GET['id_observation'])) ? $_GET['id_observation'] : null;
|
- |
|
64 |
unset($_GET['id_observation']);
|
- |
|
65 |
$this->parametres = $_GET;
|
- |
|
66 |
}
|
- |
|
67 |
|
- |
|
68 |
private function convertirParametresEnChaineRequete() {
|
- |
|
69 |
$requete = str_replace('masque_','masque.',http_build_query($this->parametres));
|
- |
|
70 |
if(!empty($this->parametres)) {
|
- |
|
71 |
$requete = '&'.$requete;
|
- |
|
72 |
}
|
63 |
$this->id_observation = (isset($_GET['id_observation'])) ? $_GET['id_observation'] : null;
|
73 |
return $requete;
|
Line 64... |
Line 74... |
64 |
}
|
74 |
}
|
65 |
|
75 |
|
66 |
private function obtenirIdsObservation() {
|
76 |
private function obtenirIdsObservation() {
|
67 |
$ids = json_decode(file_get_contents($this->del_url_service_tpl.'observations?retour.format=widget'), true);
|
77 |
$ids = json_decode(file_get_contents($this->del_url_service_tpl.'observations?retour.format=widget'.$this->convertirParametresEnChaineRequete()), true);
|
68 |
if($this->id_observation == null) {
|
78 |
if($this->id_observation == null) {
|
69 |
$this->id_observation = $ids['resultats'][0];
|
79 |
$this->id_observation = $ids['resultats'][0];
|
70 |
}
|
80 |
}
|
Line 82... |
Line 92... |
82 |
$url_base = $this->obtenirUrlBaseWidget();
|
92 |
$url_base = $this->obtenirUrlBaseWidget();
|
Line 83... |
Line 93... |
83 |
|
93 |
|
84 |
$indice_predecent = isset($tableau_id_observation[$indice_obs_courante - 1]) ? $tableau_id_observation[$indice_obs_courante - 1] : '';
|
94 |
$indice_predecent = isset($tableau_id_observation[$indice_obs_courante - 1]) ? $tableau_id_observation[$indice_obs_courante - 1] : '';
|
Line 85... |
Line 95... |
85 |
$indice_suivant = isset($tableau_id_observation[$indice_obs_courante + 1]) ? $tableau_id_observation[$indice_obs_courante + 1] : '';
|
95 |
$indice_suivant = isset($tableau_id_observation[$indice_obs_courante + 1]) ? $tableau_id_observation[$indice_obs_courante + 1] : '';
|
86 |
|
96 |
|
87 |
$url_suivant = isset($tableau_id_observation[$indice_obs_courante + 1]) ? $url_base.'?id_observation='.$tableau_id_observation[$indice_obs_courante + 1] : null;
|
97 |
$url_suivant = isset($tableau_id_observation[$indice_obs_courante + 1]) ? $url_base.'?id_observation='.$tableau_id_observation[$indice_obs_courante + 1].$this->convertirParametresEnChaineRequete() : null;
|
88 |
$url_precedent = isset($tableau_id_observation[$indice_obs_courante - 1]) ? $url_base.'?id_observation='.$tableau_id_observation[$indice_obs_courante - 1] : null;
|
98 |
$url_precedent = isset($tableau_id_observation[$indice_obs_courante - 1]) ? $url_base.'?id_observation='.$tableau_id_observation[$indice_obs_courante - 1].$this->convertirParametresEnChaineRequete() : null;
|
89 |
|
99 |
|
90 |
return array('url_suivant' => $url_suivant,
|
100 |
return array('url_suivant' => $url_suivant,
|
91 |
'url_precedent' => $url_precedent
|
101 |
'url_precedent' => $url_precedent
|
Line 92... |
Line 102... |
92 |
);
|
102 |
);
|
93 |
}
|
103 |
}
|
94 |
|
- |
|
95 |
private function obtenirDonnees($id_observation) {
|
104 |
|
96 |
$donnees = json_decode(file_get_contents($this->del_url_service_tpl.'observations/'.$id_observation), true);
|
105 |
private function obtenirDonnees($id_observation) {
|
Line 97... |
Line 106... |
97 |
$donnees = $donnees;
|
106 |
$donnees = json_decode(file_get_contents($this->del_url_service_tpl.'observations/'.$id_observation), true);
|
98 |
return $donnees;
|
107 |
return $donnees;
|
99 |
}
|
108 |
}
|
Line 100... |
Line 109... |
100 |
|
109 |
|
101 |
private function construireTitreImage($donnees) {
|
- |
|
102 |
return 'Pris par '.$donnees['auteur.prenom'].' '.$donnees['auteur.nom'].' à '.$donnees['zone_geo'];
|
- |
|
103 |
}
|
110 |
private function construireTitreImage($donnees) {
|
104 |
|
111 |
return 'Pris par '.$donnees['auteur.prenom'].' '.$donnees['auteur.nom'].' à '.$donnees['zone_geo'].' le '.$this->formaterDate($donnees['date_observation'],'%d/%m/%Y');
|
Line 105... |
Line 112... |
105 |
private function obtenirUrlImage($images) {
|
112 |
}
|
106 |
$index = 0;
|
113 |
|
107 |
$premiere_image = $images[$index];
|
114 |
private function obtenirUrlImage($images) {
|