95,20 → 95,11 |
} |
} |
|
private function obtenirLois(Array $id_lois) { |
$id_lois = array_map(array($this->bdd, 'proteger'), $id_lois); |
$requete = "SELECT * FROM ".Config::get('bdd_table_lois').' '. |
"WHERE cd_protection IN (".implode(',',$id_lois).") ORDER BY zone_application ASC"; |
$lois = $this->bdd->recupererTous($requete, 'ASSOC'); |
foreach ($lois as $loi) { |
$retour[$loi['cd_protection']] = $loi; |
} |
return $retour; |
} |
|
|
private function obtenirLoisZoneGeo(Array $id_lois) { |
$id_lois = array_map(array($this->bdd, 'proteger'), $id_lois); |
$requete = "SELECT DISTINCT zone_application, code_zone_application, type_protection FROM ".Config::get('bdd_table_lois').' '. |
$requete = "SELECT DISTINCT zone_application, code_zone_application, type_protection FROM ".Config::get('bdd_table_especes').' '. |
"WHERE cd_protection IN (".implode(',',$id_lois).") ORDER BY zone_application ASC"; |
return $this->bdd->recupererTous($requete); |
} |
122,8 → 113,7 |
|
$requete = "SELECT * FROM ".Config::get('bdd_table_especes'); |
if ($this->nn_demande != null) { |
$requete .= " WHERE num_nom_retenu IN (".implode(', ', $conditions_taxons).") OR " |
. "num_nom IN (".implode(', ', $conditions_taxons).") "; |
$requete .= " WHERE num_nom_retenu IN (".implode(', ', $conditions_taxons).")"; |
} |
// pagination |
$requete .= " LIMIT " . $this->navigation_depart . ", " . $this->navigation_limite; |
139,36 → 129,34 |
//+---------------------------FONCTIONS DE FORMATAGE---------------------------------------------------------+ |
|
private function formaterRetour($statuts_taxon) { |
$retour = ""; |
$retour = array(); |
if ($statuts_taxon) { |
foreach ($statuts_taxon as $nom) { |
$f[$nom['cd_protection']][$nom['num_nom']] = $nom['nom_sci']; |
$lois_statuts[] = $nom['cd_protection']; |
} |
switch($this->retour_format) { |
case 'zone_geo': |
$retour = $this->obtenirLoisZoneGeo($lois_statuts); |
$retour = $this->obtenirLoisZoneGeo(array_column($statuts_taxon, "cd_protection")); |
break; |
|
case 'nom': |
$lois = $this->obtenirLois($lois_statuts); |
foreach ($statuts_taxon as $nom) { |
$retour[$nom['num_nom']]['num_nom'] = $nom['num_nom']; |
foreach ($statuts_taxon as $nom) {//print_r($nom); |
$retour[$nom['num_nom']]['num_nom'] = $nom['num_nom_retenu']; |
$retour[$nom['num_nom']]['nom_sci'] = $nom['nom_sci']; |
$retour[$nom['num_nom']]['lois'][$nom['cd_protection']] = $lois[$nom['cd_protection']]; |
$retour[$nom['num_nom']]['lois'][$nom['cd_protection']] = $nom; |
|
} |
break; |
case 'complet': |
$lois = $this->obtenirLois($lois_statuts); |
foreach ($lois as $id => $loi) { |
$retour[$loi['zone_application']][$id] = $loi; |
if (isset($f[$id])) { |
foreach ($f[$id] as $num_nom => $nom_sci) { |
$retour[$loi['zone_application']][$id]['nom_sci'][$num_nom] = $nom_sci; |
foreach ($statuts_taxon as $nom) { //print_r($nom); |
$retour[$nom['zone_application']][$nom['cd_protection']]['cd_type_statut'] = $nom['cd_type_statut']; |
$retour[$nom['zone_application']][$nom['cd_protection']]['type_protection'] = $nom['type_protection']; |
$retour[$nom['zone_application']][$nom['cd_protection']]['rg_type_statut'] = $nom['rg_type_statut']; |
$retour[$nom['zone_application']][$nom['cd_protection']]['cd_protection'] = $nom['cd_protection']; |
$retour[$nom['zone_application']][$nom['cd_protection']]['intitule'] = $nom['intitule']; |
$retour[$nom['zone_application']][$nom['cd_protection']]['rq_statut'] = $nom['rq_statut']; |
$retour[$nom['zone_application']][$nom['cd_protection']]['zone_application'] = $nom['zone_application']; |
$retour[$nom['zone_application']][$nom['cd_protection']]['citation'] = $nom['citation']; |
$retour[$nom['zone_application']][$nom['cd_protection']]['hyperlien'] = $nom['hyperlien']; |
$retour[$nom['zone_application']][$nom['cd_protection']]['nom_sci'][$nom['num_nom_retenu']] = $nom['nom_sci']; |
} |
} |
} |
break; |
|
default: |