Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 756 → Rev 757

/trunk/scripts/modules/bdtfx/Bdtfx.php
151,13 → 151,7
}
}
 
private function genererChpFamille() {
$this->initialiserGenerationChamps();
$this->preparerTablePrChpFamille();
$resultats = $this->recupererTuplesPrChpFamille();
$noms = array();
$introuvables = array();
$introuvablesSyno = array();
private function traiterResultatsFamille(&$resultats, &$noms, &$introuvables, &$introuvablesSyno) {
foreach ($resultats as $id => $nom) {
$nn = $nom['num_nom'];
$nnr = $nom['num_nom_retenu'];
169,15 → 163,19
} else {
if ($nn == $nnr) {// nom retenu
if (isset($noms[$nts])) {
// signifie que recupererTuplesPrChpFamille() devrait
// récupérer ce record *avant*
$noms[$nn] = $noms[$nts];
} else {
$introuvables[] = $nn;
}
} else {// nom synonyme
if (isset($noms[$nnr])) {
$noms[$nn] = $noms[$nnr];
} else {
$introuvablesSyno[] = $nom;
if (isset($noms[$nnr])) {
// signifie que recupererTuplesPrChpFamille() devrait
// récupérer ce record *avant*
$noms[$nn] = $noms[$nnr];
} else {
$introuvablesSyno[] = $nom;
}
}
}
186,8 → 184,29
$this->afficherAvancement("Attribution de leur famille aux noms en cours");
if ($this->stopperLaBoucle($this->getParametre('t'))) break;
}
echo "\n";
}
 
private function genererChpFamille() {
$this->initialiserGenerationChamps();
$this->preparerTablePrChpFamille();
$resultats = $this->recupererTuplesPrChpFamille();
$noms = array();
$introuvables = array();
$introuvablesSyno = array();
$i = 1;
 
while(true) {
printf("passe n°%d:\n", $i);
$this->traiterResultatsFamille($resultats, $noms, $introuvables, $introuvablesSyno);
echo "\n\n";
// printf("noms: %d, introuvables: %d, introuvablesSyno: %d\n", count($noms), count($introuvables), count($introuvablesSyno));
// XXX, au 22/07/2013, 3 passes sont suffisantes
// TODO: MySQL procédure stockée !
if($i++ == 3) break;
$resultats = array_merge($resultats, $introuvables, $introuvablesSyno);
$introuvables = $introuvablesSyno = array();
}
 
foreach ($introuvablesSyno as $id => $nom) {
$nn = $nom['num_nom'];
$nnr = $nom['num_nom_retenu'];