Line 25... |
Line 25... |
25 |
const DS = DIRECTORY_SEPARATOR;
|
25 |
const DS = DIRECTORY_SEPARATOR;
|
26 |
const SERVICE_DEFAUT = 'photo';
|
26 |
const SERVICE_DEFAUT = 'photo';
|
27 |
private $ce_img_url_tpl = null;
|
27 |
private $ce_img_url_tpl = null;
|
28 |
private $del_url_service_tpl = null;
|
28 |
private $del_url_service_tpl = null;
|
Line -... |
Line 29... |
- |
|
29 |
|
- |
|
30 |
private $id_observation_suivant = null;
|
- |
|
31 |
private $id_observation_precedent = null;
|
- |
|
32 |
private $id_observation = null;
|
29 |
|
33 |
|
30 |
/**
|
34 |
/**
|
31 |
* Méthode appelée par défaut pour charger ce widget.
|
35 |
* Méthode appelée par défaut pour charger ce widget.
|
32 |
*/
|
36 |
*/
|
33 |
public function executer() {
|
37 |
public function executer() {
|
34 |
$this->del_url_service_tpl = $this->config['vote']['baseURLServicesDelTpl'];
|
38 |
$this->del_url_service_tpl = $this->config['vote']['baseURLServicesDelTpl'];
|
Line -... |
Line 39... |
- |
|
39 |
$this->ce_img_url_tpl = $this->config['vote']['celImgUrlTpl'];
|
- |
|
40 |
|
35 |
$this->ce_img_url_tpl = $this->config['vote']['celImgUrlTpl'];
|
41 |
$this->collecterParametres();
|
Line 36... |
Line 42... |
36 |
|
42 |
$ids_observations = $this->obtenirIdsObservation();
|
37 |
$donnees = $this->obtenirDonnees();
|
43 |
$donnees = $this->obtenirDonnees($this->id_observation);
|
38 |
|
- |
|
39 |
$widget['donnees']['titre'] = $this->construireTitreImage($donnees);
|
44 |
|
40 |
$widget['donnees']['url'] = $this->obtenirUrlImage(&$donnees['images']);
|
45 |
$widget['donnees']['titre'] = $this->construireTitreImage($donnees);
|
41 |
$widget['donnees']['utilisateur'] = $this->obtenirUtilisateur();
|
46 |
$widget['donnees']['url'] = $this->obtenirUrlImage(&$donnees['images']);
|
42 |
$widget['donnees']['images'] = $donnees['images'];
|
47 |
$widget['donnees']['images'] = $donnees['images'];
|
43 |
$widget['donnees']['liste_votes_determination'] = $this->formaterDeterminations($donnees);
|
48 |
$widget['donnees']['liste_votes_determination'] = $this->formaterDeterminations($donnees);
|
44 |
$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/');
|
45 |
$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/');
|
- |
|
51 |
$widget['donnees']['votes_js'] = $this->convertirTableauVotesEnJs($donnees['commentaires']);
|
Line 46... |
Line 52... |
46 |
$widget['donnees']['votes_js'] = $this->convertirTableauVotesEnJs($donnees['commentaires']);
|
52 |
$widget['donnees']['url_service_votes'] = $this->del_url_service_tpl.'observations/'.$this->id_observation;
|
47 |
$widget['donnees']['url_service_votes'] = $this->del_url_service_tpl.'observations/726365';
|
53 |
$widget['donnees']['url_service_utilisateurs'] = $this->del_url_service_tpl.'utilisateurs/';
|
Line 48... |
Line 54... |
48 |
$widget['donnees']['url_service_utilisateurs'] = $this->del_url_service_tpl.'utilisateurs/';
|
54 |
$widget['donnees']['urls_navigation'] = $this->construireUrlsSuivantesEtPrecedentes($ids_observations);
|
49 |
|
55 |
|
Line -... |
Line 56... |
- |
|
56 |
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.'vote.tpl.html';
|
- |
|
57 |
$contenu = $this->traiterSquelettePhp($squelette, $widget['donnees']);
|
- |
|
58 |
|
- |
|
59 |
$this->envoyer($contenu);
|
- |
|
60 |
}
|
- |
|
61 |
|
- |
|
62 |
private function collecterParametres() {
|
- |
|
63 |
$this->id_observation = (isset($_GET['id_observation'])) ? $_GET['id_observation'] : null;
|
- |
|
64 |
}
|
- |
|
65 |
|
- |
|
66 |
private function obtenirIdsObservation() {
|
- |
|
67 |
$ids = json_decode(file_get_contents($this->del_url_service_tpl.'observations?retour.format=widget'), true);
|
50 |
$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.'vote.tpl.html';
|
68 |
if($this->id_observation == null) {
|
- |
|
69 |
$this->id_observation = $ids['resultats'][0];
|
- |
|
70 |
}
|
- |
|
71 |
return $ids['resultats'];
|
- |
|
72 |
}
|
- |
|
73 |
|
- |
|
74 |
private function obtenirUrlBaseWidget() {
|
- |
|
75 |
return $this->config['chemins']['baseURL'].'vote';
|
- |
|
76 |
}
|
- |
|
77 |
|
- |
|
78 |
private function construireUrlsSuivantesEtPrecedentes($tableau_id_observation) {
|
- |
|
79 |
|
- |
|
80 |
$indices_id_obs = array_flip($tableau_id_observation);
|
- |
|
81 |
$indice_obs_courante = $indices_id_obs[$this->id_observation];
|
- |
|
82 |
$url_base = $this->obtenirUrlBaseWidget();
|
- |
|
83 |
|
- |
|
84 |
$indice_predecent = isset($tableau_id_observation[$indice_obs_courante - 1]) ? $tableau_id_observation[$indice_obs_courante - 1] : '';
|
- |
|
85 |
$indice_suivant = isset($tableau_id_observation[$indice_obs_courante + 1]) ? $tableau_id_observation[$indice_obs_courante + 1] : '';
|
- |
|
86 |
|
- |
|
87 |
$url_suivant = isset($tableau_id_observation[$indice_obs_courante + 1]) ? $url_base.'?id_observation='.$tableau_id_observation[$indice_obs_courante + 1] : null;
|
- |
|
88 |
$url_precedent = isset($tableau_id_observation[$indice_obs_courante - 1]) ? $url_base.'?id_observation='.$tableau_id_observation[$indice_obs_courante - 1] : null;
|
- |
|
89 |
|
51 |
$contenu = $this->traiterSquelettePhp($squelette, $widget['donnees']);
|
90 |
return array('url_suivant' => $url_suivant,
|
52 |
|
91 |
'url_precedent' => $url_precedent
|
53 |
$this->envoyer($contenu);
|
92 |
);
|
54 |
}
|
93 |
}
|
Line 55... |
Line 94... |
55 |
|
94 |
|
Line 137... |
Line 176... |
137 |
}
|
176 |
}
|
138 |
}
|
177 |
}
|
Line 139... |
Line 178... |
139 |
|
178 |
|
140 |
return $tableau_js;
|
179 |
return $tableau_js;
|
141 |
}
|
- |
|
142 |
|
- |
|
143 |
private function obtenirUtilisateur() {
|
- |
|
144 |
$donnees = json_decode(file_get_contents($this->del_url_service_tpl.'utilisateurs/'), true);
|
- |
|
145 |
$donnees = $donnees['id_utilisateur'];
|
- |
|
146 |
return $donnees;
|
- |
|
147 |
}
|
180 |
}
|
148 |
}
|
181 |
}
|
149 |
?>
|
182 |
?>
|