SCENARIO TEST : rename function CSV2TABLE
This commit is contained in:
parent
6e27a21ea9
commit
03da6c8cdb
3 changed files with 29 additions and 30 deletions
|
|
@ -1802,32 +1802,3 @@ function sanitize_filename($filename)
|
||||||
return $new_filename;
|
return $new_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief convert some csv string (content of a file) into HTML table,
|
|
||||||
* @param $string CSV files
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function csv2table ($string)
|
|
||||||
{
|
|
||||||
$a_field=[';',','];
|
|
||||||
$sep_field=$a_field[$_SESSION[SESSION_KEY.'csv_fieldsep']];
|
|
||||||
$a_field=['.',','];
|
|
||||||
$sep_dec=$a_field[$_SESSION[SESSION_KEY.'csv_decimal']];
|
|
||||||
$encoding=$_SESSION[SESSION_KEY.'csv_encoding'];
|
|
||||||
|
|
||||||
$aRow=explode("\r\n", $string);
|
|
||||||
|
|
||||||
echo '<table class="result">';
|
|
||||||
foreach ($aRow as $row) {
|
|
||||||
echo '<tr>';
|
|
||||||
$aCol=explode($sep_field, $row);
|
|
||||||
foreach ($aCol as $col) {
|
|
||||||
echo '<td>';
|
|
||||||
echo h($col);
|
|
||||||
echo '</td>';
|
|
||||||
}
|
|
||||||
echo '</tr>';
|
|
||||||
|
|
||||||
}
|
|
||||||
echo '</table>';
|
|
||||||
}
|
|
||||||
|
|
@ -297,5 +297,32 @@ class Noalyss_Csv
|
||||||
$this->size = $size;
|
$this->size = $size;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief convert CSV strings (content of a file) into HTML table,
|
||||||
|
* @param $string CSV files
|
||||||
|
*/
|
||||||
|
static function csv2table ($string)
|
||||||
|
{
|
||||||
|
$a_field=[';',','];
|
||||||
|
$sep_field=$a_field[$_SESSION[SESSION_KEY.'csv_fieldsep']];
|
||||||
|
$a_field=['.',','];
|
||||||
|
$sep_dec=$a_field[$_SESSION[SESSION_KEY.'csv_decimal']];
|
||||||
|
$encoding=$_SESSION[SESSION_KEY.'csv_encoding'];
|
||||||
|
|
||||||
|
$aRow=explode("\r\n", $string);
|
||||||
|
|
||||||
|
echo '<table class="result">';
|
||||||
|
foreach ($aRow as $row) {
|
||||||
|
echo '<tr>';
|
||||||
|
$aCol=explode($sep_field, $row);
|
||||||
|
foreach ($aCol as $col) {
|
||||||
|
echo '<td>';
|
||||||
|
echo h($col);
|
||||||
|
echo '</td>';
|
||||||
|
}
|
||||||
|
echo '</tr>';
|
||||||
|
|
||||||
|
}
|
||||||
|
echo '</table>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@ if (trim($result) != '') {
|
||||||
echo p('result failed','class="notice"');
|
echo p('result failed','class="notice"');
|
||||||
}
|
}
|
||||||
echo h1('Tous les journaux');
|
echo h1('Tous les journaux');
|
||||||
csv2table($result);
|
|
||||||
|
\Noalyss_Csv::csv2table($result);
|
||||||
|
|
||||||
|
|
||||||
echo h1('Achat 01.01.2019 - 31.12.2019');
|
echo h1('Achat 01.01.2019 - 31.12.2019');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue