Changeset 59760 in spip-zone for _plugins_/Association/Associaspip/exec/export_compteresultats_tsv.php
- Timestamp:
- Mar 26, 2012, 5:10:58 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/Association/Associaspip/exec/export_compteresultats_tsv.php
r59668 r59760 15 15 return; 16 16 17 // Export du Compte de Resultat en .tsv ou .tab 17 include_spip('exec/compte_resultat'); // c'est pour la definition de classe ExportCompteResultats 18 19 // Export du Compte de Resultat au format TSV 20 // http://fr.wikipedia.org/wiki/Format_TSV 18 21 function exec_export_compteresultats_tsv() { 19 22 if (!autoriser('associer', 'export_compteresultats')) { … … 21 24 echo minipres(); 22 25 } else { 23 include_spip('inc/charsets'); 24 include_spip('inc/association_plan_comptable'); 25 $tsv = new TSV(_request('var')); 26 $tsv->EnTete(); 26 $tsv = new ExportCompteResultats(_request('var')); 27 $tsv->LignesSimplesEntete("\t", "\n", array("\t"=>'\t',"\n"=>'\n'), '"', '"'); 27 28 foreach (array('charges', 'produits', 'contributions_volontaires') as $key) { 28 $tsv->L esEcritures($key);29 $tsv->LignesSimplesCorps($key, ',', "\n", array("\t"=>'\t',"\n"=>'\n'), '"', '"'); 29 30 } 30 $tsv-> Enregistre();31 $tsv->leFichier('tab'); 31 32 } 32 33 } … … 35 36 * Utilisation d'une classe tres tres tres simple !!! 36 37 */ 37 class TSV { 38 39 var $exercice; 40 var $join; 41 var $sel; 42 var $where; 43 var $having; 44 var $order; 45 var $out; 46 47 function __construct($var) { 48 $tableau = unserialize(rawurldecode($var)); 49 $this->exercice = $tableau[0]; 50 $this->join = $tableau[1]; 51 $this->sel = $tableau[2]; 52 $this->where = $tableau[3]; 53 $this->having = $tableau[4]; 54 $this->order = $tableau[5]; 55 $this->out = ''; 56 } 38 class TSV extends ExportCompteResultats { 57 39 58 40 function EnTete() { … … 107 89 } 108 90 109 function Enregistre() {110 $fichier = _DIR_RACINE.'/'._NOM_TEMPORAIRES_ACCESSIBLES.'compte_resultats_'.$this->exercice.'.tab';111 $f = fopen($fichier, 'w');112 fputs($f, $this->out);113 fclose($f);114 header('Content-type: application/tsv');115 header('Content-Disposition: attachment; filename="'.$fichier.'"');116 readfile($fichier);117 }118 119 91 } 120 92
Note: See TracChangeset
for help on using the changeset viewer.