41,7 → 41,7 |
'milieu' => 'milieu', |
'latitude' => 'coord_x', |
'longitude' => 'coord_y', |
'geodatum' => 'ref_geo', |
'geodatum' => 'traiterGeodatum', |
'date_observation' => 'date_observation', |
'mots_cles_texte' => 'traiterMotsClesTexte', |
'commentaire' => 'commentaire', |
214,7 → 214,6 |
} |
|
private function migrerUtilisateurs() { |
|
$pas = 1000; |
$nbTotal = 0; |
$tabUtilisateurs = $this->tableau_utilisateurs; |
317,7 → 316,6 |
} |
|
private function convertirUtmVersLatLong($x, $y, $sector) { |
|
$lat_long = array(); |
|
$convertisseur = new gPoint(); |
330,7 → 328,6 |
} |
|
private function migrerObs() { |
|
$debut = 0; |
$pas = 1000; |
$nbTotal = 0; |
384,29 → 381,25 |
} |
|
private function ordonnerObs() { |
$requete = 'ALTER TABLE cel_obs ORDER BY id_observation'; |
$requete = 'ALTER TABLE '.self::$bdd_cel_migration.'.cel_obs ORDER BY id_observation'; |
$this->executerRequeteSimple($requete); |
} |
|
private function traiterLigneObservation($obs) { |
|
$nouvelle_obs = array(); |
|
foreach($this->tableau_nouveau_ancien as $nouveau_champ_obs => $ancien_champ_obs) { |
|
if ($this->estUnChampATraiter($ancien_champ_obs)) { |
if (method_exists($this,$ancien_champ_obs)) { |
if (method_exists($this, $ancien_champ_obs)) { |
$nouvelle_obs[$nouveau_champ_obs] = $this->$ancien_champ_obs($obs); |
} else { |
$nouvelle_obs[$nouveau_champ_obs] = ''; |
} |
|
} else { |
if($obs[$ancien_champ_obs] == '000null' || $obs[$ancien_champ_obs] == 'null' || trim($obs[$ancien_champ_obs]) == '') { |
if ($obs[$ancien_champ_obs] == '000null' || $obs[$ancien_champ_obs] == 'null' || trim($obs[$ancien_champ_obs]) == '') { |
$obs[$ancien_champ_obs] = 'NULL'; |
} |
|
if(($ancien_champ_obs == 'coord_x' || $ancien_champ_obs == 'coord_y') && ($obs[$ancien_champ_obs] == '0' || $obs[$ancien_champ_obs] == 0)) { |
if (($ancien_champ_obs == 'coord_x' || $ancien_champ_obs == 'coord_y') && ($obs[$ancien_champ_obs] == '0' || $obs[$ancien_champ_obs] == 0)) { |
$obs[$ancien_champ_obs] = 'NULL'; |
} |
|
417,7 → 410,7 |
} |
|
private function protegerSiNonNull($valeur) { |
if($valeur != 'NULL') { |
if ($valeur != 'NULL') { |
$valeur = $this->proteger($valeur); |
} |
return $valeur; |
428,17 → 421,28 |
} |
|
private function traiterReferentiel($observation) { |
return 'bdnff:4.02'; |
$retour = 'NULL'; |
if ($observation['num_nom_sel'] != '' && $observation['num_nom_sel'] != '0') { |
$retour = 'bdnff:4.02'; |
} |
return $retour; |
} |
|
private function traiterGeodatum($observation) { |
$retour = 'NULL'; |
if ($observation['coord_x'] != 'NULL' && $observation['coord_y'] != 'NULL') { |
$retour = 'WGS84'; |
} |
return $retour; |
} |
|
private function traiterMotsClesTexte($ligne_observation) { |
|
$mail_observation = $ligne_observation['identifiant']; |
$retour = $ligne_observation['mots_cles']; |
if (isset($this->tableau_mots_cles[$mail_observation])) { |
$mots_cles_tableau = $this->parserMotsCles($mail_observation, $ligne_observation['mots_cles'], ';'); |
$retour = join(',',$mots_cles_tableau); |
$retour = ltrim($retour,',,') ; |
$retour = join(',', $mots_cles_tableau); |
$retour = ltrim($retour, ',,') ; |
} |
|
return $retour; |
445,11 → 449,10 |
} |
|
private function parserMotsCles($utilisateur, $mot_cles, $separateur = ',') { |
|
$tableau_mots_cles = explode($separateur,$mot_cles); |
$tableau_mots_cles_formates = array(); |
|
foreach($tableau_mots_cles as $mot_cle) { |
foreach ($tableau_mots_cles as $mot_cle) { |
|
$mot_cle = str_replace($separateur.$separateur,'',$mot_cle); |
$mot_cle = str_replace('null','',$mot_cle); |
568,7 → 571,6 |
} |
|
private function construireIndiceTableauLocalites($nom, $id) { |
|
$nom = htmlentities($nom, ENT_NOQUOTES, 'UTF-8'); |
|
$nom = preg_replace('#&([A-za-z])(?:acute|cedil|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $nom); |