Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
/**
|
2 |
/**
|
3 |
* Classe PdfExport, réalise des exportations pdf des fiches de taxons.
|
3 |
* Classe PdfExport, réalise des exportations pdf des fiches de taxons.
|
- |
|
4 |
* Les fonctionnalités proposées sont l'export de toutes les parties de la fiche pdf
|
- |
|
5 |
* ou bien des parties choisies.
|
- |
|
6 |
* (voir le squelette fiche_pdf_lien.tpl.html pour le formulaire dans le module fiche.)
|
- |
|
7 |
*
|
- |
|
8 |
* manuel wkhtmltopdf : http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltopdf_0.10.0_rc2-doc.html
|
- |
|
9 |
* pour changer de librairie : changer la fonction transformerHtmlEnPdf()
|
4 |
*
|
10 |
*
|
5 |
* @category php 5.2
|
11 |
* @category php 5.2
|
6 |
* @package eflore-consultation
|
12 |
* @package eflore-consultation
|
7 |
* @author Mathilde Salthun-Lassalle <mathilde@tela-botanica.org>
|
13 |
* @author Mathilde Salthun-Lassalle <mathilde@tela-botanica.org>
|
8 |
* @copyright 2012 Tela-Botanica
|
14 |
* @copyright 2012 Tela-Botanica
|
9 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
15 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
10 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
16 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
11 |
* @version $Id$
|
17 |
* @version $Id$
|
12 |
*
|
18 |
*
|
13 |
* manuel wkhtmltopdf : http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltopdf_0.10.0_rc2-doc.html
|
- |
|
14 |
* pour changer de librairie : changer la fonction transformerHtmlEnPdf()
|
- |
|
- |
|
19 |
*
|
15 |
*/
|
20 |
*/
|
Line 16... |
Line 21... |
16 |
|
21 |
|
17 |
require_once( Config::get('chemin_modules').'fiche/formateurs/Description.php');
|
22 |
require_once( Config::get('chemin_modules').'fiche/formateurs/Description.php');
|
18 |
require_once( Config::get('chemin_modules').'fiche/formateurs/Ecologie.php');
|
23 |
require_once( Config::get('chemin_modules').'fiche/formateurs/Ecologie.php');
|
Line 145... |
Line 150... |
145 |
return $donnees;
|
150 |
return $donnees;
|
146 |
}
|
151 |
}
|
Line 147... |
Line 152... |
147 |
|
152 |
|
Line -... |
Line 153... |
- |
|
153 |
//++ ------------------------------------------------export en pdf--------------------------------------++
|
148 |
//++ ------------------------------------------------export en pdf--------------------------------------++
|
154 |
|
149 |
|
155 |
|
150 |
private function envoyerPdfAuNavigateur() {
|
156 |
private function envoyerPdfAuNavigateur() {
|
151 |
header('Content-type: application/pdf');
|
157 |
header('Content-type: application/pdf');
|
- |
|
158 |
header('Content-Disposition: attachment; filename="'.$this->parametres['nom'].'.pdf"');
|
- |
|
159 |
readfile($this->fichier_pdf);
|
152 |
header('Content-Disposition: attachment; filename="'.$this->parametres['nom'].'.pdf"');
|
160 |
unlink($this->fichier_html);
|
Line 153... |
Line 161... |
153 |
readfile($this->fichier_pdf);
|
161 |
unlink($this->fichier_pdf);
|
154 |
}
|
162 |
}
|
155 |
|
- |
|
156 |
|
163 |
|
157 |
|
164 |
|
158 |
//version WKHTMLtoPDF en ligne de commande
|
165 |
|
159 |
private function transformerHtmlEnPdf() {
|
166 |
//version WKHTMLtoPDF en ligne de commande
|
160 |
//il peut y avoir des pdfs differents pour une même fiche (on peut choisir ses parties)
|
167 |
private function transformerHtmlEnPdf() {
|
161 |
$time = $_SERVER['REQUEST_TIME'] ;
|
168 |
$time = $_SERVER['REQUEST_TIME'] ;
|
162 |
$fichier_html = $this->chemin_pdf.''.str_replace(' ','_',$this->parametres['nom']).'-'.$time.'.html';
|
169 |
$this->fichier_html = $this->chemin_pdf.''.str_replace(' ','_',$this->parametres['nom']).'-'.$time.'.html';
|
163 |
$this->fichier_pdf = $this->chemin_pdf.''.str_replace(' ','_',$this->parametres['nom']).'-'.$time.'.pdf';
|
170 |
$this->fichier_pdf = $this->chemin_pdf.''.str_replace(' ','_',$this->parametres['nom']).'-'.$time.'.pdf';
|
164 |
$nom = $this->parametres['nom'];
|
171 |
$nom = $this->parametres['nom'];
|
165 |
file_put_contents($fichier_html, $this->html);
|
172 |
file_put_contents($this->fichier_html, $this->html);
|