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 {
$opts = new Zend_Console_Getopt(array(
'help|?' => "Aide.",
'list' => "List item.",
'generate|g=s' => "Generate the specify cache.",
'list' => "List item.",
'generate|g=s' => "Generate the specify cache.",
));
$opts->parse();
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
$displayUsage = true;
}
@ -38,313 +38,291 @@ if ($displayUsage) {
exit;
}
if ( $opts->list ) {
$tabItems = array(
'tribunaux' => "Tribunaux",
'FctDir' => "Fonctions de direction",
'Evenements' => "Table des evenements bodacc",
'Devises' => "Table des devises bodacc",
'RncsTribunaux' => "Table des tribunaux",
'PaysInpi' => "PaysInpi",
'Jugements' => "Jugements",
'CodesNaf' => "Codes Naf",
'CodeNace' => "Codes Nace",
);
echo "\n";
foreach ( $tabItems as $code => $label ) {
echo "\t" . $code . " => ". $label . PHP_EOL;
}
if ($opts->list) {
$tabItems = array(
'tribunaux' => "Tribunaux",
'FctDir' => "Fonctions de direction",
'Evenements' => "Table des evenements bodacc",
'Devises' => "Table des devises bodacc",
'RncsTribunaux' => "Table des tribunaux",
'PaysInpi' => "PaysInpi",
'Jugements' => "Jugements",
'CodesNaf' => "Codes Naf",
'CodeNace' => "Codes Nace",
);
echo "\n";
foreach ($tabItems as $code => $label) {
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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT triCode, triNom, triCP, triSiret FROM jo.tribunaux WHERE triCode IS NOT NULL");
$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");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$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");
$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 ( $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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT codeFct, libelle FROM jo.bodacc_fonctions");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codeFct, libelle FROM jo.bodacc_fonctions");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$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");
$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 ( $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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT codEven, libEven, Bodacc_Code, Rubrique, version, lienEtab FROM jo.tabEvenements");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codEven, libEven, Bodacc_Code, Rubrique, version, lienEtab FROM jo.tabEvenements");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheEvenements.php', 'w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheEvenements.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "return array(\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t'" . intval($item->codEven) . "' => array(\n");
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t'" . intval($item->codEven) . "' => array(\n");
fwrite($fp, "\t\t'libEven' => \"" . $item->libEven . "\",\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\t'libEven' => \"" . $item->libEven . "\",\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");
}
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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT libDeviseBodacc, devIso FROM jo.bodacc_devises");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT libDeviseBodacc, devIso FROM jo.bodacc_devises");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$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");
$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 ( $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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT triNumGreffe, triNom, triId, triCode FROM jo.tribunaux WHERE triNumGreffe IS NOT NULL");
$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");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$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");
$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 ( $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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT devInpi, devIso FROM jo.tabDevises WHERE devInpi>0 ORDER BY devInpi ASC");
$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");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$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");
$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 ( $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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT codJugement, codEven FROM jo.tabJugeRncs");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codJugement, codEven FROM jo.tabJugeRncs");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$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");
$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 ( $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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT codePaysInpi, codPays FROM jo.tabPays WHERE codePaysInpi>0 ORDER BY codePaysInpi ASC");
$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");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$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");
$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 ( $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());
$db = Zend_Db::factory($c->profil->db->metier);
$fp=fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CacheCodesNaf.php','w');
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->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codNaf700 AS naf, libNaf700 AS LibNaf FROM jo.tabNaf4");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf . "\",\n");
}
}
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf . "\",\n");
}
}
$result = $db->query("SELECT codNaf5 AS naf, libNaf5 AS LibNaf FROM jo.tabNaf5");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codNaf5 AS naf, libNaf5 AS LibNaf FROM jo.tabNaf5");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
if ( count($rows) > 0 ) {
foreach($rows as $item) {
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf. "\",\n");
}
}
fwrite($fp, ");\n");
if (count($rows) > 0) {
foreach ($rows as $item) {
fwrite($fp, "\t'" . $item->naf . "' => \"" . $item->LibNaf. "\",\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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1 FROM jo.tabNaf5");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1 FROM jo.tabNaf5");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$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");
$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 ( $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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT codNafa AS nafa, libNafa FROM jo.tabNafa");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$result = $db->query("SELECT codNafa AS nafa, libNafa FROM jo.tabNafa");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$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");
$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 ( $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());
$db = Zend_Db::factory($c->profil->db->metier);
$result = $db->query("SELECT code AS FJ, libelle AS libFJ FROM jo.tabFJur WHERE code>=1000");
$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");
$result->setFetchMode(Zend_Db::FETCH_OBJ);
$rows = $result->fetchAll();
$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");
$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");
}

View File

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

View File

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

View File

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