Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 241 → Rev 242

/trunk/scripts/modules/chorodep/Chorodep.php
1,5 → 1,5
<?php
class Chorodep extends Script {
class Chorodep extends EfloreScript {
protected $nbre_dep = 0;
private $type_donnee = '';
protected $aso_num_nomenc = array();
9,57 → 9,145
protected $nbre_plte_douteux = 0;
protected $nbre_plte_erreur = 0;
protected $nbre_plte_disparue = 0;
protected $nbre_plte_erreur_a_confirmer = 0;
protected $nc_autres_valeur_champ = 0;
protected $nc_nbre_plte_presente = 0;
protected $nc_nbre_plte_a_confirmer = 0;
protected $nc_nbre_plte_douteux = 0;
protected $nc_nbre_plte_disparue = 0;
protected $nc_nbre_plte_erreur = 0;
protected $nc_nbre_plte_erreur_a_confirmer = 0;
 
protected $aso_totaux_dep = array();
private $fichier_verif = './chorodep_verif.html';
 
public function executer() {
try {
$this->initialiserProjet('chorodep');
 
public function __construct($cmd, $parametres = array()) {
parent::__construct($cmd, $parametres);
$this->fichier_verif = './chorodep_verif.html';
// Lancement de l'action demandée
$cmd = $this->getParametre('a');
switch ($cmd) {
 
case 'chargerTous' :
$this->chargerStructureSql();
$this->chargerVersions();
$this->chargerChorodepContributeurs();
$this->chargerChorodepSources();
$this->chargerChorodepOntologies();
break;
case 'chargerStructureSql' :
$this->chargerStructureSql();
break;
case 'chargerVersions' :
$this->chargerVersions();
break;
case 'chargerChorodep' :
$this->chargerChorodepContributeurs();
$this->chargerChorodepSources();
$this->chargerChorodepOntologies();
break;
case 'verifierDonnees' :
$this->initialiserTraitement();
$this->verifierDonnees();
break;
case 'supprimerTous' :
$this->supprimerTous();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
 
public function executer() {
$this->bdd = new Bdd();
$cmd = $this->getParametre('a');
switch ($cmd) {
private function chargerChorodepContributeurs() {
$chemin = Config::get('chemins.chorodepContributeurs');
$table = Config::get('tables.chorodepContributeurs');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' ".
'IGNORE 2 LINES';
$this->getBdd()->requeter($requete);
}
 
case 'verifier-donnees' :
$this->initialiserTraitement();
$this->verifierDonnees();
break;
private function chargerChorodepSources() {
$chemin = Config::get('chemins.chorodepSources');
$table = Config::get('tables.chorodepSources');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' ".
'IGNORE 2 LINES';
$this->getBdd()->requeter($requete);
}
 
default :
echo 'Erreur : la commande "'.$cmd.'" n\'existe pas!'."\n";
}
private function chargerChorodepOntologies() {
$chemin = Config::get('chemins.chorodepOntologies');
$table = Config::get('tables.chorodepOntologies');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' ".
'IGNORE 1 LINES';
$this->getBdd()->requeter($requete);
}
 
private function initialiserTableaux($dep) {
//$departements = new ZgFrDepartements();
//$dep = $departements->get();
//$a = array();
foreach ($dep as $code_dep) {
if ( preg_match('/^\d{2}$/', $code_dep) ) {
$this->aso_totaux_dep[$code_dep]['plte_presente'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_a_confirmer'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_douteux'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_erreur'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_disparue'] = 0;
$this->aso_totaux_dep[$code_dep]['autres_valeur_champ'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_presente'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_a_confirmer'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_douteux'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_erreur'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_disparue'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_autres_valeur_champ'] = 0;
}
private function chargerVersions() {
$versions = explode(',', Config::get('versions'));
$versionsDonnees = explode(',', Config::get('versionsDonnees'));
$tableTpl = Config::get('tables.chorodepTpl');
$fichierSqlTpl = Config::get('chemins.structureSqlVersionTpl');
$fichierTsvTpl = Config::get('chemins.chorodepTpl');
 
foreach ($versions as $id => $version) {
$versionDonnees = $versionsDonnees[$id];
 
$this->chargerStructureSqlVersion($versionDonnees);
$this->chargerDonneesVersion($versionDonnees, $version);
}
}
 
private function chargerStructureSqlVersion($versionDonnees) {
$fichierSql = sprintf($fichierSqlTpl, $versionDonnees, $versionDonnees);
$contenuSql = $this->recupererContenu($fichierSql);
$this->executerScripSql($contenuSql);
}
 
private function chargerDonneesVersion($versionDonnees, $version) {
$fichierTsv = sprintf($fichierTsvTpl, $versionDonnees, $versionDonnees);
$table = sprintf($tableTpl, $version);
$champs = Config::get('chorodepChamps');
$requete = "LOAD DATA INFILE '$fichierTsv' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' ".
'IGNORE 1 LINES '.
"($champs) ";
$this->getBdd()->requeter($requete);
}
 
private function initialiserTraitement() {
//------------------------------------------------------------------------------------------------------------//
// Récupération des informations à vérifier
$table = $this->getNomTableDernierVersion();
$requete = 'SELECT * '.
'FROM chorodep ';
$taxons = $this->bdd->recupererTous($requete);
"FROM $table ";
$taxons = $this->getBdd()->recupererTous($requete);
$tax_col = $taxons[1];
$col = array_keys($tax_col);
$this->initialiserTableaux($col);
147,6 → 235,18
$autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} elseif (preg_match('/^\s*(?:#\?)\s*$/', $val)) {# Erreur à confirmer
# Calcul du nombre de plante ayant un statut "Erreur à confirmer"
$this->nbre_plte_erreur_a_confirmer++;
# Stockage par département du nombre de plante ayant un statut "Erreur à confirmer"
$this->aso_totaux_dep[$nd]['plte_erreur_a_confirmer']++;
# Stockage des informations
$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 6, $this->id_donnee_choro++);
if (preg_match('/^(?:\s+#\?|#\?\s+|\s+#\?\s+)$/', $val)) {# Erreur à confirmer avec espace
# Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#?".
$autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} else {
// Ajout de la valeur dans une variable car elle n'est pas conforme.
$this->autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
194,6 → 294,16
$nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} elseif (preg_match('/^\s*(?:#\?)\s*$/', $val)) {# Erreur à confirmer
# Calcul du nombre de plante 'nc' ayant un statut "Erreur à confirmer"
$this->nc_nbre_plte_erreur_a_confirmer++;
# Stockage par département du nombre de plante 'nc' ayant un statut "Erreur à confirmer"
$this->aso_totaux_dep[$nd]['nc_plte_erreur_a_confirmer']++;
if (preg_match('/^(?:\s+#\?|#\?\s+|\s+#\?\s+)$/', $val)) {# Erreur à confirmer avec espace
# Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#?".
$nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} else {
// Ajout de la valeur dans une variable car elle n'est pas conforme.
$this->nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
210,8 → 320,28
echo "\n";
}
 
private function verifierDonnees()
{
private function initialiserTableaux($dep) {
foreach ($dep as $code_dep) {
if ( preg_match('/^\d{2}$/', $code_dep) ) {
$this->aso_totaux_dep[$code_dep]['plte_presente'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_a_confirmer'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_douteux'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_erreur'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_disparue'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_erreur_a_confirmer'] = 0;
$this->aso_totaux_dep[$code_dep]['autres_valeur_champ'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_presente'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_a_confirmer'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_douteux'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_erreur'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_disparue'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_erreur_a_confirmer'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_autres_valeur_champ'] = 0;
}
}
}
 
private function verifierDonnees() {
// Ouverture du fichier contenant les résultats (sortie)
if (!$handle = fopen($this->fichier_verif, 'w')) {
echo "Impossible d'ouvrir le fichier ($this->fichier_verif)";
221,6 → 351,7
// Création de la page
$page = '<html>'."\n";
$page .= '<head>'."\n";
$page .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'."\n";
$page .= '<title>RESULTAT DE LA VERIFICATION DU FICHIER TABULE DE LA CHOROLOGIE</title>'."\n";
$page .= '</head>'."\n";
$page .= '<body>'."\n";
235,7 → 366,7
'Nom du programme générant ce fichier : '.__FILE__.'<br />'."\n".
'Nombre de lignes analysées : '.$this->nbre_ligne.'<br />'."\n".
'Nbre de départements analysés : '.$this->nbre_dep_analyse.'<br />'."\n".
'Date d\'exécution du programme : '.date('m.d.Y').'<br />'."\n".
'Date d\'exécution du programme : '.date('d.m.Y').'<br />'."\n".
'</p>'."\n";
$page .= '<hr/>'."\n";
$page .= '<h2>RESULTATS ANALYSE CHOROLOGIE</h2>'."\n";
242,8 → 373,8
$page .= '<p>'.
'Nombre de nom "nc" : '.$this->nc_nbre_nom.'<br />'."\n".
'Nombre de nom : '.$this->nbre_nom.'<br />'."\n".
'Valeurs autres que 1, 1?, ?, # et -|- : '.$this->autres_valeur_champ.'<br />'."\n".
'Valeurs autres que 1, 1?, ?, # et -|- pour les plantes nc : <br />'."\n".$this->nc_autres_valeur_champ.'</br>'."\n".
'Valeurs autres que 1, 1?, ?, #, #? et -|- : '.$this->autres_valeur_champ.'<br />'."\n".
'Valeurs autres que 1, 1?, ?, #, #? et -|- pour les plantes nc : <br />'."\n".$this->nc_autres_valeur_champ.'</br>'."\n".
'</p>'."\n";
$page .= '<hr/>'."\n";
$page .= '<h2>RESULTATS ANALYSE des CHAMPS</h2>'."\n";
271,52 → 402,52
}
 
// Tableau des résultats par départements
$table = '<table><thead><tr><th colspan="12">Tableau des résulats par départements</th></tr>';
$table = '<table><thead><tr><th colspan="14">Tableau des résulats par départements</th></tr>';
$table .= '<tr><th>Département</th><th>Nbre pltes présentes</th><th>Nbre pltes à confirmer</th>'.
'<th>Nbre pltes douteuses</th><th>Nbre pltes disparues</th><th>Nbre pltes erreur</th>'.
'<th>Nbre pltes douteuses</th><th>Nbre pltes disparues</th><th>Nbre pltes erreur</th><th>Nbre pltes erreur à confirmer</th>'.
'<th>Total</th><th>Nbre pltes nc présentes</th><th>Nbre pltes nc à confirmer</th>'.
'<th>Nbre nc pltes douteuses</th><th>Nbre nc pltes disparues</th><th>Nbre nc pltes erreur</th></tr></thead>';
'<th>Nbre nc pltes douteuses</th><th>Nbre nc pltes disparues</th><th>Nbre nc pltes erreur</th><th>Nbre nc pltes erreur à confirmer</th></tr></thead>';
$table .= '<tbody style="text-align: center;">';
ksort($this->aso_totaux_dep);
foreach ($this->aso_totaux_dep as $cle_dep => $val ) {
$plt_total = $val{'plte_presente'} + $val{'plte_a_confirmer'} + $val{'plte_douteux'} + $val{'plte_disparue'} + $val{'plte_erreur'};
$plt_total = $val{'plte_presente'} + $val{'plte_a_confirmer'} + $val{'plte_douteux'} + $val{'plte_disparue'} + $val{'plte_erreur'} + $val{'plte_erreur_a_confirmer'};
$table .= '<tr><td>'.ZgFrDepartements::getNom($cle_dep).' ('.ZgFrDepartements::getIdChaine($cle_dep).') </td>'.
'<td>'.$val{'plte_presente'}.'</td><td>'.$val{'plte_a_confirmer'}.'</td><td>'.$val{'plte_douteux'}.'</td>'.
'<td>'.$val{'plte_disparue'}.'</td><td>'.$val{'plte_erreur'}.'</td><td>'.$plt_total.'</td>'.
'<td>'.$val{'plte_disparue'}.'</td><td>'.$val{'plte_erreur'}.'</td><td>'.$val{'plte_erreur_a_confirmer'}.'</td><td>'.$plt_total.'</td>'.
'<td>'.$val{'nc_plte_presente'}.'</td><td>'.$val{'nc_plte_a_confirmer'}.'</td><td>'.$val{'nc_plte_douteux'}.'</td>'.
'<td>'.$val{'nc_plte_disparue'}.'</td><td>'.$val{'nc_plte_erreur'}.'</td></tr>';
'<td>'.$val{'nc_plte_disparue'}.'</td><td>'.$val{'nc_plte_erreur'}.'</td><td>'.$val{'nc_plte_erreur_a_confirmer'}.'</td></tr>';
}
 
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$plt_total = $this->nbre_plte_presente + $this->nbre_plte_a_confirmer + $this->nbre_plte_douteux + $this->nbre_plte_disparue + $this->nbre_plte_erreur;
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$plt_total = $this->nbre_plte_presente + $this->nbre_plte_a_confirmer + $this->nbre_plte_douteux + $this->nbre_plte_disparue + $this->nbre_plte_erreur + $this->nbre_plte_erreur_a_confirmer;
$table .= '<tr><td>Totaux : '.$this->nbre_dep_analyse.' départements</td><td>'.$this->nbre_plte_presente.'</td>'.
'<td>'.$this->nbre_plte_a_confirmer.'</td><td>'.$this->nbre_plte_douteux.'</td><td>'.$this->nbre_plte_disparue.'</td>'.
'<td>'.$this->nbre_plte_erreur.'</td><td>'.$plt_total.'</td>'.
'<td>'.$this->nbre_plte_erreur.'</td><td>'.$this->nbre_plte_erreur_a_confirmer.'</td><td>'.$plt_total.'</td>'.
'<td>'.$this->nc_nbre_plte_presente.'</td>'.'<td>'.$this->nc_nbre_plte_a_confirmer.'</td>'.
'<td>'.$this->nc_nbre_plte_douteux.'</td><td>'.$this->nc_nbre_plte_disparue.'</td><td>'.$this->nc_nbre_plte_erreur.'</td></tr>';
'<td>'.$this->nc_nbre_plte_douteux.'</td><td>'.$this->nc_nbre_plte_disparue.'</td><td>'.$this->nc_nbre_plte_erreur.'</td><td>'.$this->nc_nbre_plte_erreur_a_confirmer.'</td></tr>';
 
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$total_nbre_plte = ($this->nbre_plte_presente + $this->nbre_plte_a_confirmer + $this->nbre_plte_douteux + $this->nbre_plte_disparue + $this->nbre_plte_erreur);
$total_nbre_plte_nc = ($this->nc_nbre_plte_presente + $this->nc_nbre_plte_a_confirmer + $this->nc_nbre_plte_douteux + $this->nc_nbre_plte_disparue + $this->nc_nbre_plte_erreur);
$table .= '<tr><td>Totaux plante / plante nc</td><td colspan="6">'.$total_nbre_plte.'</td>'.
'<td colspan="5">'.$total_nbre_plte_nc.'</td></tr>';
$total_nbre_plte = ($this->nbre_plte_presente + $this->nbre_plte_a_confirmer + $this->nbre_plte_douteux + $this->nbre_plte_disparue + $this->nbre_plte_erreur + $this->nbre_plte_erreur_a_confirmer);
$total_nbre_plte_nc = ($this->nc_nbre_plte_presente + $this->nc_nbre_plte_a_confirmer + $this->nc_nbre_plte_douteux + $this->nc_nbre_plte_disparue + $this->nc_nbre_plte_erreur + $this->nc_nbre_plte_erreur_a_confirmer);
$table .= '<tr><td>Totaux plante / plante nc</td><td colspan="7">'.$total_nbre_plte.'</td>'.
'<td colspan="6">'.$total_nbre_plte_nc.'</td></tr>';
 
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$plt_total = $this->nbre_plte_presente + $this->nc_nbre_plte_presente + $this->nc_nbre_plte_a_confirmer + $this->nbre_plte_a_confirmer;
$table .= '<tr><td>Total plantes présentes et à confirmer</td><td colspan="11">'.$plt_total.'</td></tr>';
$table .= '<tr><td>Total plantes présentes et à confirmer</td><td colspan="13">'.$plt_total.'</td></tr>';
 
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$plt_total = $this->nbre_plte_presente + $this->nc_nbre_plte_presente;
$table .= '<tr><td>Total plantes présentes</td><td colspan="11">'.$plt_total.'</td></tr>';
$table .= '<tr><td>Total plantes présentes</td><td colspan="13">'.$plt_total.'</td></tr>';
 
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$plt_total = $total_nbre_plte + $total_nbre_plte_nc;
$table .= '<tr><td>Total données chorologiques</td><td colspan="11">'.$plt_total.'</td></tr>';
$table .= '<tr><td>Total données chorologiques</td><td colspan="13">'.$plt_total.'</td></tr>';
 
$table .= '</tbody></table>';
$page .= $table;
338,6 → 469,35
fclose($handle);
}
 
private function supprimerTous() {
$tablesChorodep = implode(',', $this->getNomsTablesChorodep());
$tableContributeurs = Config::get('tables.chorodepContributeurs');
$tableSources = Config::get('tables.chorodepSources');
$tableOntologies = Config::get('tables.chorodepOntologies');
$requete = "DROP TABLE chorodep_meta, $tablesChorodep, $tableContributeurs, $tableSources, $tableOntologies";
$this->getBdd()->requeter($requete);
}
 
private function getNomsTablesChorodep() {
$versions = explode(',', Config::get('versions'));
$tableTpl = Config::get('tables.chorodepTpl');
$tablesChorodep = array();
foreach ($versions as $version) {
$tablesChorodep[] = sprintf($tableTpl, $version);
}
return $tablesChorodep;
}
 
private function getNomTableDernierVersion() {
$version = $this->getDerniereVersion();
$table = sprintf(Config::get('tables.chorodepTpl'), $version);
return $table;
}
 
private function getDerniereVersion() {
$version = array_pop(explode(',', Config::get('versions')));
return $version;
}
}
 
class ZgFrDepartements {
/trunk/scripts/modules/chorodep/chorodep.ini
New file
0,0 → 1,34
versions = "2011_04,2012_01"
versionsDonnees="2011-04-05,2012-01-01"
dossierTsv = "{ref:dossierDonneesEflore}chorodep/{ref:versionDonnees}/"
dossierTsvTpl = "{ref:dossierDonneesEflore}chorodep/%s/"
dossierSql = "{ref:dossierDonneesEflore}chorodep/"
chorodepChamps = "rang, catminat, num_tax, num_nom, nom_sci, `01`, `02`, `03`, `04`, `06`, `07`, `08`, `09`, `10`, `11`, `12`, `67`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `79`, `24`, `25`, `26`, `91`, `27`, `28`, `29`, `30`, `32`, `33`, `31`, `43`, `52`, `05`, `70`, `74`, `65`, `87`, `68`, `92`, `34`, `35`, `36`, `37`, `38`, `39`, `40`, `42`, `44`, `45`, `41`, `46`, `47`, `48`, `49`, `50`, `51`, `53`, `54`, `55`, `56`, `57`, `58`, `59`, `60`, `61`, `75`, `62`, `63`, `66`, `64`, `69`, `71`, `72`, `73`, `77`, `76`, `93`, `80`, `81`, `82`, `90`, `94`, `95`, `83`, `84`, `85`, `86`, `88`, `89`, `78`, freq_abs, freq_rel, rare_nat";
 
[tables]
chorodepMeta = "chorodep_meta"
chorodepContributeurs = "chorodep_contributeurs"
chorodepSources = "chorodep_sources"
chorodepOntologies = "chorodep_ontologies"
chorodep = "chorodep_v{ref:version}"
chorodepTpl = "chorodep_v%s"
 
[fichiers]
structureSql = "chorodep.sql"
structureSqlVersion = "chorodep_v{ref:versionDonnees}.sql"
structureSqlVersionTpl = "chorodep_v%s.sql"
chorodepContributeurs = "chorodep_contributeurs.tsv"
chorodepSources = "chorodep_sources.tsv"
chorodepOntologies = "chorodep_ontologies.tsv"
chorodep = "chorodep_v{ref:versionDonnees}.tsv"
chorodepTpl = "chorodep_v%s.tsv"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:fichiers.structureSql}"
structureSqlVersion = "{ref:dossierTsv}{ref:fichiers.structureSqlVersion}"
structureSqlVersionTpl = "{ref:dossierTsvTpl}{ref:fichiers.structureSqlVersionTpl}"
chorodepContributeurs = "{ref:dossierSql}{ref:fichiers.chorodepContributeurs}"
chorodepSources = "{ref:dossierSql}{ref:fichiers.chorodepSources}"
chorodepOntologies = "{ref:dossierSql}{ref:fichiers.chorodepOntologies}"
chorodep = "{ref:dossierTsv}{ref:fichiers.chorodep}"
chorodepTpl = "{ref:dossierTsvTpl}{ref:fichiers.chorodepTpl}"