Line 156... |
Line 156... |
156 |
|
156 |
|
157 |
/**
|
157 |
/**
|
158 |
* Retrouver les derniers votes image
|
158 |
* Retrouver les derniers votes image
|
159 |
* */
|
159 |
* */
|
- |
|
160 |
private function getDerniersVotesImage() {
|
160 |
private function getDerniersVotesImage() {
|
161 |
$elements = array();
|
- |
|
162 |
$idsVotes = $this->getIdsDerniersVotesImage();
|
161 |
$idsVotes = $this->getIdsDerniersVotesImage();
|
163 |
if (!empty($idsVotes)) {
|
162 |
$idsVotesConcat = implode(', ', $idsVotes);
|
164 |
$idsVotesConcat = implode(', ', $idsVotes);
|
163 |
$requete = 'SELECT DISTINCT id_vote, ce_image, valeur, divo.date AS date_vote, '.
|
165 |
$requete = 'SELECT DISTINCT id_vote, ce_image, valeur, divo.date AS date_vote, '.
|
164 |
' duo.prenom AS observateur_prenom, duo.nom AS observateur_nom, '.
|
166 |
' duo.prenom AS observateur_prenom, duo.nom AS observateur_nom, '.
|
165 |
' duv.prenom AS votant_prenom, duv.nom AS votant_nom, '.
|
167 |
' duv.prenom AS votant_prenom, duv.nom AS votant_nom, '.
|
166 |
' do.id_observation, do.nom_sel, do.zone_geo, do.date_observation, dip.intitule '.
|
168 |
' do.id_observation, do.nom_sel, do.zone_geo, do.date_observation, dip.intitule '.
|
167 |
'FROM del_image_vote AS divo '.
|
169 |
'FROM del_image_vote AS divo '.
|
168 |
' INNER JOIN del_image AS di '.
|
170 |
' INNER JOIN del_image AS di '.
|
169 |
' ON divo.ce_image = di.id_image '.
|
171 |
' ON divo.ce_image = di.id_image '.
|
170 |
' INNER JOIN del_observation AS do '.
|
172 |
' INNER JOIN del_observation AS do '.
|
171 |
' ON di.ce_observation = do.id_observation '.
|
173 |
' ON di.ce_observation = do.id_observation '.
|
172 |
' INNER JOIN del_image_protocole AS dip '.
|
174 |
' INNER JOIN del_image_protocole AS dip '.
|
173 |
' ON ce_protocole = id_protocole '.
|
175 |
' ON ce_protocole = id_protocole '.
|
174 |
' LEFT JOIN del_utilisateur AS duo '.
|
176 |
' LEFT JOIN del_utilisateur AS duo '.
|
175 |
' ON do.ce_utilisateur = duo.id_utilisateur '.
|
177 |
' ON do.ce_utilisateur = duo.id_utilisateur '.
|
176 |
' LEFT JOIN del_utilisateur AS duv '.
|
178 |
' LEFT JOIN del_utilisateur AS duv '.
|
177 |
' ON if((CHAR_LENGTH(divo.ce_utilisateur) <> 32),CAST(divo.ce_utilisateur AS unsigned),0) '.
|
179 |
' ON if((CHAR_LENGTH(divo.ce_utilisateur) <> 32),CAST(divo.ce_utilisateur AS unsigned),0) '.
|
178 |
' = duv.id_utilisateur '.
|
180 |
' = duv.id_utilisateur '.
|
179 |
"WHERE id_vote IN ($idsVotesConcat) ".
|
181 |
"WHERE id_vote IN ($idsVotesConcat) ".
|
180 |
'ORDER BY divo.date DESC '.
|
182 |
'ORDER BY divo.date DESC '.
|
181 |
'LIMIT '.$this->navigation->getDepart().','.$this->navigation->getLimite().
|
183 |
'LIMIT '.$this->navigation->getDepart().','.$this->navigation->getLimite().
|
182 |
' -- '.__FILE__.' : '.__LINE__;
|
184 |
' -- '.__FILE__.' : '.__LINE__;
|
- |
|
185 |
$elements = $this->bdd->recupererTous($requete);
|
183 |
$elements = $this->bdd->recupererTous($requete);
|
186 |
}
|
184 |
return $elements;
|
187 |
return $elements;
|
Line 185... |
Line 188... |
185 |
}
|
188 |
}
|
186 |
|
189 |
|
Line 196... |
Line 199... |
196 |
'LIMIT '.$this->navigation->getDepart().','.$this->navigation->getLimite().
|
199 |
'LIMIT '.$this->navigation->getDepart().','.$this->navigation->getLimite().
|
197 |
' -- '.__FILE__.' : '.__LINE__;
|
200 |
' -- '.__FILE__.' : '.__LINE__;
|
198 |
$resultats = $this->bdd->recupererTous($requete);
|
201 |
$resultats = $this->bdd->recupererTous($requete);
|
Line 199... |
Line 202... |
199 |
|
202 |
|
200 |
$idsVotes = array();
|
203 |
$idsVotes = array();
|
201 |
if ($resultats != false && is_array($idsVotes)) {
|
204 |
if ($resultats != false && is_array($resultats)) {
|
202 |
foreach ($resultats as $infos) {
|
205 |
foreach ($resultats as $infos) {
|
203 |
$idsVotes[] = $infos['id_vote'];
|
206 |
$idsVotes[] = $infos['id_vote'];
|
204 |
}
|
207 |
}
|
205 |
}
|
208 |
}
|