Correction after release
This commit is contained in:
parent
fb444fea84
commit
489adb4b93
@ -58,8 +58,8 @@ echo $this->partial('identite/fiche-item.phtml', $this->dBlock['AutreSiren']);
|
||||
|
||||
<h2>Raison sociale & Coordonnées</h2>
|
||||
<div class="paragraph">
|
||||
<div style="float:right;">
|
||||
<?php if($this->permission) { ?>
|
||||
<div style="float:right;">
|
||||
<img class="wcheck" src='/themes/default/images/worldcheck/wc.png'/>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -1,34 +1,34 @@
|
||||
<?php
|
||||
class ExportCSV
|
||||
class ExportCSV
|
||||
{
|
||||
protected $entete = array();
|
||||
protected $enteteKey = array();
|
||||
protected $data = array();
|
||||
protected $type = '';
|
||||
protected $list = array();
|
||||
|
||||
|
||||
public function __construct($data = array(), $type = '')
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->type = $type;
|
||||
|
||||
$this->structure();
|
||||
|
||||
$this->structure();
|
||||
$this->prepareData();
|
||||
}
|
||||
|
||||
|
||||
protected function prepareData()
|
||||
{
|
||||
$row = 0;
|
||||
foreach($this->data as $itemKey => $itemVal)
|
||||
{
|
||||
{
|
||||
foreach($this->enteteKey as $key){
|
||||
$val = html_entity_decode($itemVal->$key);
|
||||
$this->list[$row][] = $val;
|
||||
$this->list[$row][] = $val;
|
||||
}
|
||||
$row++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function structure()
|
||||
{
|
||||
switch($this->type) {
|
||||
@ -41,31 +41,32 @@ class ExportCSV
|
||||
'Adresse' => 'Adresse',
|
||||
'Adresse2' => 'Adresse2',
|
||||
'CP' => 'CP',
|
||||
'Ville' => 'Ville',
|
||||
'Sigle' => 'Sigle',
|
||||
'Siege' => 'Siege',
|
||||
'Actif' => 'Actif',
|
||||
'FJ' => 'FJ',
|
||||
'FJLib' => 'FJLib',
|
||||
'NafEnt' => 'NafEntLib',
|
||||
);
|
||||
'NafEnt' => 'NafEntLib',
|
||||
);
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$this->entete = array_values($structure);
|
||||
$this->enteteKey = array_keys($structure);
|
||||
}
|
||||
|
||||
|
||||
public function writeFile($filename)
|
||||
{
|
||||
{
|
||||
$fp = fopen($filename, 'w');
|
||||
if (count($this->entete)>0){
|
||||
fputcsv($fp, $this->entete);
|
||||
}
|
||||
}
|
||||
foreach ($this->list as $fields) {
|
||||
$fields = array_map('htmlspecialchars_decode', $fields);
|
||||
fputcsv($fp, $fields);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user