Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1021 | Rev 1030 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1021 Rev 1029
Line 16... Line 16...
16
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
16
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
17
 * @version		$Id$
17
 * @version		$Id$
18
 */
18
 */
Line 19... Line 19...
19
 
19
 
-
 
20
class PdfExport extends aControleur {
-
 
21
 
-
 
22
	const DUREE_DE_VIE_PDF = 86400;// 3600 * 24 * 2 = 172 800
20
class PdfExport extends aControleur {
23
 
21
	private $Conteneur;
24
	private $Conteneur;
22
	private $parametres = array();
25
	private $parametres = array();
23
	private $chemin_pdf;
26
	private $chemin_pdf;
24
	private $html;
27
	private $html;
Line 172... Line 175...
172
	private function envoyerPdfAuNavigateur() {
175
	private function envoyerPdfAuNavigateur() {
173
		$nom_fichier = $this->getNomFichierValide();
176
		$nom_fichier = $this->getNomFichierValide();
174
		header('Content-type: application/pdf');
177
		header('Content-type: application/pdf');
175
		header('Content-Disposition: attachment; filename='.$nom_fichier.'.pdf');
178
		header('Content-Disposition: attachment; filename='.$nom_fichier.'.pdf');
176
		readfile($this->fichier_pdf);
179
		readfile($this->fichier_pdf);
177
		unlink($this->fichier_html);
180
		$this->nettoyerFichiersTmp();
-
 
181
	}
-
 
182
 
-
 
183
	private function nettoyerFichiersTmp() {
178
		unlink($this->fichier_pdf);
184
		$dossierStockage = $this->chemin_pdf;
-
 
185
		if (is_dir($dossierStockage)) {
-
 
186
			$objets = scandir($dossierStockage);
-
 
187
			if ($objets !== false) {
-
 
188
				foreach ($objets as $objet) {
-
 
189
					$chemin = $dossierStockage.$objet;
-
 
190
					if (is_file($chemin)) {
-
 
191
						$filemtime = @filemtime($chemin);
-
 
192
						if ($filemtime !== false) {
-
 
193
							$suppression = (time() - $filemtime >= self::DUREE_DE_VIE_PDF) ? true : false;
-
 
194
							if ($suppression === true) {
-
 
195
								unlink($chemin);
-
 
196
							}
-
 
197
						}
-
 
198
					}
-
 
199
				}
-
 
200
			}
-
 
201
		}
179
	}
202
	}
Line 180... Line 203...
180
 
203
 
181
	//version WKHTMLtoPDF en ligne de commande
204
	//version WKHTMLtoPDF en ligne de commande
182
	private function transformerHtmlEnPdf() {
205
	private function transformerHtmlEnPdf() {