PHP-CS-Fixer

This commit is contained in:
Michael RICOIS 2016-11-29 16:59:35 +01:00
parent fb816070c0
commit 627c5f1f56
4 changed files with 236 additions and 261 deletions

View File

@ -18,10 +18,10 @@ $displayUsage = false;
try { try {
$opts = new Zend_Console_Getopt(array( $opts = new Zend_Console_Getopt(array(
'help|?' => "Aide.", 'help|?' => "Aide.",
'list' => "List item.", 'list' => "List item.",
'generate|g=s' => "Generate the specify cache.", 'generate|g=s' => "Generate the specify cache.",
)); ));
$opts->parse(); $opts->parse();
} catch (Zend_Console_Getopt_Exception $e) { } catch (Zend_Console_Getopt_Exception $e) {
$displayUsage = true; $displayUsage = true;
} }
@ -38,313 +38,291 @@ if ($displayUsage) {
exit; exit;
} }
if ( $opts->list ) { if ($opts->list) {
$tabItems = array( $tabItems = array(
'tribunaux' => "Tribunaux", 'tribunaux' => "Tribunaux",
'FctDir' => "Fonctions de direction", 'FctDir' => "Fonctions de direction",
'Evenements' => "Table des evenements bodacc", 'Evenements' => "Table des evenements bodacc",
'Devises' => "Table des devises bodacc", 'Devises' => "Table des devises bodacc",
'RncsTribunaux' => "Table des tribunaux", 'RncsTribunaux' => "Table des tribunaux",
'PaysInpi' => "PaysInpi", 'PaysInpi' => "PaysInpi",
'Jugements' => "Jugements", 'Jugements' => "Jugements",
'CodesNaf' => "Codes Naf", 'CodesNaf' => "Codes Naf",
'CodeNace' => "Codes Nace", 'CodeNace' => "Codes Nace",
); );
echo "\n"; echo "\n";
foreach ( $tabItems as $code => $label ) { foreach ($tabItems as $code => $label) {
echo "\t" . $code . " => ". $label . PHP_EOL; echo "\t" . $code . " => ". $label . PHP_EOL;
} }
exit; exit;
} }
if( $opts->generate == 'tribunaux' ) { if ($opts->generate == 'tribunaux') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT triCode, triNom, triCP, triSiret FROM jo.tribunaux WHERE triCode IS NOT NULL");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT triCode, triNom, triCP, triSiret FROM jo.tribunaux WHERE triCode IS NOT NULL"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheTribunaux.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheTribunaux.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
$dep = intval(substr($item->triCP,0,2));
if ($dep==97 || $dep==98) $dep=intval(substr($item->triCP,0,3));
fwrite($fp, "\t'" . $item->triCode . "' => array(");
fwrite($fp, "'nom'=>\"" . $item->triNom . "\", 'siret'=>\"".$item->triSiret."\", 'dep'=>\"".$dep."\"");
fwrite($fp, "),\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
$dep = intval(substr($item->triCP, 0, 2));
if ($dep==97 || $dep==98) {
$dep=intval(substr($item->triCP, 0, 3));
}
fwrite($fp, "\t'" . $item->triCode . "' => array(");
fwrite($fp, "'nom'=>\"" . $item->triNom . "\", 'siret'=>\"".$item->triSiret."\", 'dep'=>\"".$dep."\"");
fwrite($fp, "),\n");
}
}
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'FctDir' ) { if ($opts->generate == 'FctDir') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT codeFct, libelle FROM jo.bodacc_fonctions");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codeFct, libelle FROM jo.bodacc_fonctions"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheFctDir.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheFctDir.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t'" . intval($item->codeFct) . "' => \"". $item->libelle . "\",\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t'" . intval($item->codeFct) . "' => \"". $item->libelle . "\",\n");
}
}
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'Evenements' ) { if ($opts->generate == 'Evenements') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT codEven, libEven, Bodacc_Code, Rubrique, version, lienEtab FROM jo.tabEvenements");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codEven, libEven, Bodacc_Code, Rubrique, version, lienEtab FROM jo.tabEvenements"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheEvenements.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheEvenements.php','w'); if (count($rows) > 0) {
fwrite($fp, "<?php\n"); foreach ($rows as $item) {
fwrite($fp, "return array(\n"); fwrite($fp, "\t'" . intval($item->codEven) . "' => array(\n");
if ( count($rows) > 0 ) { fwrite($fp, "\t\t'libEven' => \"" . $item->libEven . "\",\n");
foreach($rows as $item) { fwrite($fp, "\t\t'Bodacc_Code' => \"" . $item->Bodacc_Code . "\",\n");
fwrite($fp, "\t'" . intval($item->codEven) . "' => array(\n"); fwrite($fp, "\t\t'Rubrique' => \"" . $item->Rubrique . "\",\n");
fwrite($fp, "\t\t'Version' => " . $item->version . ",\n");
fwrite($fp, "\t\t'libEven' => \"" . $item->libEven . "\",\n"); fwrite($fp, "\t\t'LienEtab' => " . $item->lienEtab . ",\n");
fwrite($fp, "\t\t'Bodacc_Code' => \"" . $item->Bodacc_Code . "\",\n");
fwrite($fp, "\t\t'Rubrique' => \"" . $item->Rubrique . "\",\n");
fwrite($fp, "\t\t'Version' => " . $item->version . ",\n");
fwrite($fp, "\t\t'LienEtab' => " . $item->lienEtab . ",\n");
fwrite($fp, "\t),\n");
}
}
fwrite($fp, ");\n");
fwrite($fp, "\t),\n");
}
}
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'Devises' ) { if ($opts->generate == 'Devises') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT libDeviseBodacc, devIso FROM jo.bodacc_devises");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT libDeviseBodacc, devIso FROM jo.bodacc_devises"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheDevises.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheDevises.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t\"" . $item->libDeviseBodacc . "\" => \"" . $item->devIso ."\",\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t\"" . $item->libDeviseBodacc . "\" => \"" . $item->devIso ."\",\n");
}
}
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'RncsTribunaux' ) { if ($opts->generate == 'RncsTribunaux') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT triNumGreffe, triNom, triId, triCode FROM jo.tribunaux WHERE triNumGreffe IS NOT NULL");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT triNumGreffe, triNom, triId, triCode FROM jo.tribunaux WHERE triNumGreffe IS NOT NULL"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheTribunaux.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheTribunaux.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t" . intval($item->triNumGreffe) . " => array(");
fwrite($fp, "'Id'=>\"" . $item->triId . "\", 'Nom'=>\"".$item->triNom."\", 'Code'=>\"".$item->triCode."\"");
fwrite($fp, "),\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t" . intval($item->triNumGreffe) . " => array(");
fwrite($fp, "'Id'=>\"" . $item->triId . "\", 'Nom'=>\"".$item->triNom."\", 'Code'=>\"".$item->triCode."\"");
fwrite($fp, "),\n");
}
}
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'DevisesInpi' ) { if ($opts->generate == 'DevisesInpi') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT devInpi, devIso FROM jo.tabDevises WHERE devInpi>0 ORDER BY devInpi ASC");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT devInpi, devIso FROM jo.tabDevises WHERE devInpi>0 ORDER BY devInpi ASC"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheDevisesInpi.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheDevisesInpi.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t" . intval($item->devInpi) . " => \"" . $item->devIso . "\",\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t" . intval($item->devInpi) . " => \"" . $item->devIso . "\",\n");
}
}
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'Jugements' ) { if ($opts->generate == 'Jugements') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT codJugement, codEven FROM jo.tabJugeRncs");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codJugement, codEven FROM jo.tabJugeRncs"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheJugements.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheJugements.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t" . intval($item->codJugement) . " => " . $item->codEven . ",\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t" . intval($item->codJugement) . " => " . $item->codEven . ",\n");
}
}
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'PaysInpi' ) { if ($opts->generate == 'PaysInpi') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT codePaysInpi, codPays FROM jo.tabPays WHERE codePaysInpi>0 ORDER BY codePaysInpi ASC");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codePaysInpi, codPays FROM jo.tabPays WHERE codePaysInpi>0 ORDER BY codePaysInpi ASC"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CachePaysInpi.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CachePaysInpi.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t" . intval($item->codePaysInpi) . " => \"" . $item->codPays . "\",\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t" . intval($item->codePaysInpi) . " => \"" . $item->codPays . "\",\n");
}
}
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'CodesNaf' ) { if ($opts->generate == 'CodesNaf') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheCodesNaf.php', 'w');
$db = Zend_Db::factory($c->profil->db->metier); fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheCodesNaf.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
$result = $db->query("SELECT codNaf700 AS naf, libNaf700 AS LibNaf FROM jo.tabNaf4"); $result = $db->query("SELECT codNaf700 AS naf, libNaf700 AS LibNaf FROM jo.tabNaf4");
$result->setFetchMode(Zend_Db::FETCH_OBJ); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll(); $rows = $result->fetchAll();
if ( count($rows) > 0 ) { if (count($rows) > 0) {
foreach($rows as $item) { foreach ($rows as $item) {
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf . "\",\n"); fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf . "\",\n");
} }
} }
$result = $db->query("SELECT codNaf5 AS naf, libNaf5 AS LibNaf FROM jo.tabNaf5"); $result = $db->query("SELECT codNaf5 AS naf, libNaf5 AS LibNaf FROM jo.tabNaf5");
$result->setFetchMode(Zend_Db::FETCH_OBJ); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll(); $rows = $result->fetchAll();
if ( count($rows) > 0 ) { if (count($rows) > 0) {
foreach($rows as $item) { foreach ($rows as $item) {
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf. "\",\n"); fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf. "\",\n");
} }
} }
fwrite($fp, ");\n");
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'CodesNace' ) { if ($opts->generate == 'CodesNace') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1 FROM jo.tabNaf5");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1 FROM jo.tabNaf5"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheCodesNace.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheCodesNace.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->codNaf1 . preg_replace('/^0/','',substr($item->naf,0,4)) . "\",\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->codNaf1 . preg_replace('/^0/', '', substr($item->naf, 0, 4)) . "\",\n");
}
}
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'CodesNafa' ) { if ($opts->generate == 'CodesNafa') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT codNafa AS nafa, libNafa FROM jo.tabNafa");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codNafa AS nafa, libNafa FROM jo.tabNafa"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheCodesNafa.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheCodesNafa.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t'" . $item->nafa . "' => \"" . $item->libNafa ."\",\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t'" . $item->nafa . "' => \"" . $item->libNafa ."\",\n");
}
}
fwrite($fp, ");\n");
} }
if ( $opts->generate == 'CodesFJ' ) { if ($opts->generate == 'CodesFJ') {
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->metier);
$c = new Zend_Config($application->getOptions()); $result = $db->query("SELECT code AS FJ, libelle AS libFJ FROM jo.tabFJur WHERE code>=1000");
$db = Zend_Db::factory($c->profil->db->metier); $result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT code AS FJ, libelle AS libFJ FROM jo.tabFJur WHERE code>=1000"); $fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheCodesFJ.php', 'w');
$result->setFetchMode(Zend_Db::FETCH_OBJ); fwrite($fp, "<?php\n");
$rows = $result->fetchAll(); fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheCodesFJ.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t" . $item->FJ . " => \"" . str_replace('"','\"',$item->libFJ) ."\",\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t" . $item->FJ . " => \"" . str_replace('"', '\"', $item->libFJ) ."\",\n");
}
}
fwrite($fp, ");\n");
} }

View File

@ -29,7 +29,7 @@ $fp = fopen('return.csv', 'w');
if (($handle = fopen('sfrFeuBicolore201511.csv', 'r')) !== false) { if (($handle = fopen('sfrFeuBicolore201511.csv', 'r')) !== false) {
$row = 0; $row = 0;
while (($data = fgetcsv($handle, 0, ",",'"')) !== false) { while (($data = fgetcsv($handle, 0, ",", '"')) !== false) {
$row++; $row++;
echo date('Y-m-d H:i:s')." - Ligne $row : "; echo date('Y-m-d H:i:s')." - Ligne $row : ";
//Set values from file //Set values from file
@ -49,8 +49,7 @@ if (($handle = fopen('sfrFeuBicolore201511.csv', 'r')) !== false) {
echo "\n"; echo "\n";
} }
} }
fclose($handle); fclose($handle);
fclose($fp); fclose($fp);

View File

@ -19,7 +19,7 @@ $c = new Zend_Config($application->getOptions());
$displayUsage = false; $displayUsage = false;
try { try {
$opts = new Zend_Console_Getopt(array( $opts = new Zend_Console_Getopt(array(
'help|?' => "Displays usage information.", 'help|?' => "Displays usage information.",
'siren=s' => "SIREN", 'siren=s' => "SIREN",
)); ));
$opts->parse(); $opts->parse();
@ -58,5 +58,3 @@ echo "NOTE/20 = ".$tabIndiscore['Indiscore20'];
echo "\n"; echo "\n";
echo "ENCOURS = ".$tabIndiscore['encours']; echo "ENCOURS = ".$tabIndiscore['encours'];
echo "\n"; echo "\n";

View File

@ -31,18 +31,18 @@ if (!$result = $mysqli->query($sql)) {
exit; exit;
} }
if ($result->num_rows > 0) { if ($result->num_rows > 0) {
$rTotal = $result->num_rows; $rTotal = $result->num_rows;
$r = 0; $r = 0;
while ($row = $result->fetch_object()) { while ($row = $result->fetch_object()) {
$r++; $r++;
$fline = array(); $fline = array();
foreach($header as $h) { foreach ($header as $h) {
$fline[] = $row->$h; $fline[] = $row->$h;
} }
fputcsv($fp, $fline, $delimiter, $enclosure); fputcsv($fp, $fline, $delimiter, $enclosure);
echo str_pad($r, strlen($rTotal), ' ', STR_PAD_LEFT)." / ".$rTotal."\n"; echo str_pad($r, strlen($rTotal), ' ', STR_PAD_LEFT)." / ".$rTotal."\n";
} }
$result->close(); $result->close();
} }
fclose($fp); fclose($fp);