Line 108... |
Line 108... |
108 |
$date_debut = "'{$date_debut}'";
|
108 |
$date_debut = "'{$date_debut}'";
|
109 |
$date_fin = "'{$date_fin}'";
|
109 |
$date_fin = "'{$date_fin}'";
|
Line 110... |
Line 110... |
110 |
|
110 |
|
111 |
$requete =
|
111 |
$requete =
|
- |
|
112 |
'SELECT SQL_CALC_FOUND_ROWS p.id_observation, p.id_image, '.
|
112 |
'SELECT SQL_CALC_FOUND_ROWS p.id_observation, p.id_image, '.
|
113 |
'iv.moyenne AS moyenne_votes, '.
|
- |
|
114 |
'iv.nb_votes AS nb_votes, '.
|
113 |
'GROUP_CONCAT(iv.valeur) AS votes, '.
|
115 |
'iv.nb_points AS nb_points_votes, '.
|
114 |
'GROUP_CONCAT(DISTINCT it.tag) AS del_image_tags, '.
|
116 |
'GROUP_CONCAT(DISTINCT it.tag) AS del_image_tags, '.
|
115 |
'modif_date '.
|
117 |
'modif_date '.
|
116 |
'FROM del_plantnet AS p '.
|
118 |
'FROM del_plantnet AS p '.
|
117 |
' JOIN del_observation_modif_date '.
|
119 |
' JOIN del_observation_modif_date '.
|
118 |
' ON (p.id_observation = del_observation_modif_date.id_observation '.
|
120 |
' ON (p.id_observation = del_observation_modif_date.id_observation '.
|
119 |
' AND modif_date >= '.$date_debut.' '.
|
121 |
' AND modif_date >= '.$date_debut.' '.
|
120 |
' AND modif_date <= '.$date_fin.') '.
|
122 |
' AND modif_date <= '.$date_fin.') '.
|
121 |
' LEFT JOIN del_image_vote AS iv '.
|
123 |
' LEFT JOIN del_image_stat AS iv '.
|
122 |
' ON (id_image = iv.ce_image AND iv.ce_protocole = 3) '.
|
124 |
' ON (id_image = iv.ce_image AND iv.ce_protocole = 3) '.
|
123 |
' LEFT JOIN del_image_tag AS it '.
|
125 |
' LEFT JOIN del_image_tag AS it '.
|
124 |
' ON (id_image = it.ce_image AND it.actif = 1) '.
|
126 |
' ON (id_image = it.ce_image AND it.actif = 1) '.
|
125 |
' LEFT JOIN del_commentaire AS c '.
|
127 |
' LEFT JOIN del_commentaire AS c '.
|
Line 150... |
Line 152... |
150 |
$idsImg[] = $id;
|
152 |
$idsImg[] = $id;
|
151 |
}
|
153 |
}
|
152 |
$idsImgConcat = implode(',', $idsImg);
|
154 |
$idsImgConcat = implode(',', $idsImg);
|
Line 153... |
Line 155... |
153 |
|
155 |
|
154 |
$requete = 'SELECT '.
|
156 |
$requete = 'SELECT '.
|
155 |
'p.id_observation, p.plantnet_id, p.id_image, '.
|
157 |
'p.id_observation, p.id_plantnet, p.id_image, '.
|
156 |
'cp.plant_net_occurrence_id, ' .
|
158 |
'cp.plant_net_occurrence_id, ' .
|
157 |
'p.nom_sel, p.nom_sel_nn, p.nom_ret, p.nom_ret_nn,'.
|
159 |
'p.nom_sel, p.nom_sel_nn, p.nom_ret, p.nom_ret_nn,'.
|
158 |
'p.nom_referentiel, p.famille, '.
|
160 |
'p.nom_referentiel, p.famille, '.
|
159 |
'p.zone_geo, p.altitude,'.
|
161 |
'p.zone_geo, p.latitude, p.longitude,'.
|
160 |
'p.date_observation, p.date_created, p.date_published, '.
|
162 |
'p.date_observation, p.date_created, p.date_published, '.
|
161 |
'p.is_wild, p.identiplante_score, p.is_identiplante_validated, p.cel_photo_tag, '.
|
163 |
'p.type_donnees, p.identiplante_score, p.is_identiplante_validated, p.mots_cles_cel_obs, p.programme, '.
|
162 |
'p.ce_utilisateur, p.courriel_utilisateur, '.
|
164 |
'p.ce_utilisateur, p.courriel_utilisateur, '.
|
163 |
'p.original_name AS nom_image, p.i_date_updated AS image_updated '.
|
165 |
'p.original_name AS nom_image, p.i_date_shot AS date_shot, p.i_date_updated AS image_updated, p.mots_cles_cel_image AS mots_cles_cel_image '.
|
164 |
'FROM del_plantnet AS p '.
|
166 |
'FROM del_plantnet AS p '.
|
165 |
'LEFT JOIN tb_new_cel.pn_tb_pair AS cp ON p.id_observation = cp.occurrence_id '.
|
167 |
'LEFT JOIN tb_new_cel.pn_tb_pair AS cp ON p.id_observation = cp.occurrence_id '.
|
166 |
"WHERE id_image IN ($idsImgConcat) ".
|
168 |
"WHERE id_image IN ($idsImgConcat) ".
|
167 |
' -- '.__FILE__.':'.__LINE__;
|
169 |
' -- '.__FILE__.':'.__LINE__;
|
Line 194... |
Line 196... |
194 |
if (!isset($obs[$idobs])) {
|
196 |
if (!isset($obs[$idobs])) {
|
195 |
$obs[$idobs] = array();
|
197 |
$obs[$idobs] = array();
|
196 |
}
|
198 |
}
|
Line 197... |
Line 199... |
197 |
|
199 |
|
198 |
$obs[$idobs]['id_observation'] = $idobs;
|
200 |
$obs[$idobs]['id_observation'] = $idobs;
|
199 |
$obs[$idobs]['plantnet_id'] = $imgdata['plantnet_id'];
|
201 |
$obs[$idobs]['id_plantnet'] = $imgdata['id_plantnet'];
|
Line 200... |
Line 202... |
200 |
$obs[$idobs]['auteur_courriel'] = $imgdata['courriel_utilisateur'];
|
202 |
$obs[$idobs]['auteur_courriel'] = $imgdata['courriel_utilisateur'];
|
- |
|
203 |
|
Line 201... |
Line 204... |
201 |
|
204 |
$obs[$idobs]['mots_cles_cel_obs'] = $imgdata['mots_cles_cel_obs'];
|
202 |
$obs[$idobs]['mots_cles_obs_cel'] = $imgdata['cel_photo_tag'];
|
205 |
$obs[$idobs]['programme'] = $imgdata['programme'];
|
203 |
|
206 |
|
204 |
$obs[$idobs]['date_observation'] = $imgdata['date_observation'];
|
207 |
$obs[$idobs]['date_observation'] = $imgdata['date_observation'];
|
205 |
$obs[$idobs]['date_creation'] = $imgdata['date_created'];
|
208 |
$obs[$idobs]['date_creation'] = $imgdata['date_created'];
|
206 |
$obs[$idobs]['date_changement'] = $ids['modif_date'];
|
209 |
$obs[$idobs]['date_changement'] = $ids['modif_date'];
|
207 |
$obs[$idobs]['date_publication'] = $imgdata['date_published'];
|
210 |
$obs[$idobs]['date_publication'] = $imgdata['date_published'];
|
Line 208... |
Line 211... |
208 |
$obs[$idobs]['is_wild'] = $imgdata['is_wild'];
|
211 |
$obs[$idobs]['type_donnees'] = $imgdata['type_donnees'];
|
209 |
$obs[$idobs]['identiplante_score'] = $imgdata['identiplante_score'];
|
212 |
$obs[$idobs]['identiplante_score'] = $imgdata['identiplante_score'];
|
Line 215... |
Line 218... |
215 |
$obs[$idobs]['nom_ret'] = $imgdata['nom_ret'];
|
218 |
$obs[$idobs]['nom_ret'] = $imgdata['nom_ret'];
|
216 |
$obs[$idobs]['nom_ret_nn'] = $imgdata['nom_ret_nn'];
|
219 |
$obs[$idobs]['nom_ret_nn'] = $imgdata['nom_ret_nn'];
|
217 |
$obs[$idobs]['famille'] = $imgdata['famille'];
|
220 |
$obs[$idobs]['famille'] = $imgdata['famille'];
|
Line 218... |
Line 221... |
218 |
|
221 |
|
219 |
$obs[$idobs]['zone_geo'] = $imgdata['zone_geo'];
|
222 |
$obs[$idobs]['zone_geo'] = $imgdata['zone_geo'];
|
- |
|
223 |
$obs[$idobs]['latitude'] = $imgdata['latitude'];
|
Line 220... |
Line 224... |
220 |
$obs[$idobs]['altitude'] = $imgdata['altitude'];
|
224 |
$obs[$idobs]['longitude'] = $imgdata['longitude'];
|
221 |
|
225 |
|
222 |
if (!isset($obs[$idobs]['images'])) {
|
226 |
if (!isset($obs[$idobs]['images'])) {
|
223 |
$obs[$idobs]['images'] = array();
|
- |
|
- |
|
227 |
$obs[$idobs]['images'] = array();
|
224 |
}
|
228 |
}
|
225 |
|
229 |
//print_r($ids);
|
226 |
$img_obj = array(
|
230 |
$img_obj = array(
|
227 |
'id_image' => $idimg,
|
231 |
'id_image' => $idimg,
|
- |
|
232 |
'nom_image' => $imgdata['nom_image'],
|
- |
|
233 |
'image_updated' => $imgdata['image_updated'],
|
228 |
'nom_image' => $imgdata['nom_image'],
|
234 |
'date_shot' => $imgdata['date_shot'],
|
- |
|
235 |
'mots_cles_cel_image' => $imgdata['mots_cles_cel_image'],
|
229 |
'image_updated' => $imgdata['image_updated'],
|
236 |
'url' => sprintf($imgCelTpl, $idimg, 'O'),
|
230 |
'url' => sprintf($imgCelTpl, $idimg, 'O'),
|
237 |
'votes' => [
|
- |
|
238 |
'moyenne_votes' => $ids['moyenne_votes'],
|
- |
|
239 |
'nb_votes' => $ids['nb_votes'],
|
231 |
'votes' => array_map('intval', explode(',', $ids['votes'])),
|
240 |
'nb_points_votes' => $ids['nb_points_votes'],
|
232 |
'tags' => explode(',', $ids['del_image_tags']),
|
241 |
],
|
233 |
// 'mots_cles_img_cel' => $this->formaterMotsClesCel($imgdata['mots_cles_texte_image'])
|
242 |
'del_tags' => explode(',', $ids['del_image_tags']),
|
234 |
);
|
243 |
);
|
235 |
// push
|
244 |
// push
|
236 |
$obs[$idobs]['images'][] = $img_obj;
|
245 |
$obs[$idobs]['images'][] = $img_obj;
|