Correction after release

This commit is contained in:
Michael RICOIS 2013-09-23 14:06:16 +00:00
parent fb444fea84
commit 489adb4b93
2 changed files with 18 additions and 17 deletions

View File

@ -58,8 +58,8 @@ echo $this->partial('identite/fiche-item.phtml', $this->dBlock['AutreSiren']);
<h2>Raison sociale &amp; 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>

View File

@ -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);
}
}
}