Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2459 Rev 2462
Line 1... Line 1...
1
<?php
1
<?php
2
 
-
 
-
 
2
// declare(encoding='UTF-8');
3
/**
3
/**
-
 
4
 * Classe permettant de générer des PDFs.
-
 
5
 *
-
 
6
 * @internal   Mininum PHP version : 5.2
4
* @category  PHP
7
 * @category   CEL
5
* @package   jrest
8
 * @package    Services
-
 
9
 * @subpackage Bibliothèques
-
 
10
 * @version    0.1
-
 
11
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
6
* @author    Raphaël Droz <raphael@tela-botania.org>
12
 * @author     Raphaël Droz <raphael@tela-botania.org>
7
* @copyright 2013 Tela-Botanica
13
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
14
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
9
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
15
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
-
 
16
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
-
 
17
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
10
*/
18
 */
11
 
-
 
12
// Include the main TCPDF library (search for installation path).
19
// Include the main TCPDF library (search for installation path).
13
date_default_timezone_set("Europe/Paris");
20
date_default_timezone_set('Europe/Paris');
14
require_once('tcpdf_config.php');
21
require_once('tcpdf_config.php');
15
require_once('tcpdf/tcpdf.php');
22
require_once('tcpdf/tcpdf.php');
Line 16... Line 23...
16
 
23
 
Line 27... Line 34...
27
		$pdf->SetAuthor($utilisateur ? $utilisateur['prenom'] . ' ' . $utilisateur['nom'] : 'CEL - Tela Botanica');
34
		$pdf->SetAuthor($utilisateur ? $utilisateur['prenom'] . ' ' . $utilisateur['nom'] : 'CEL - Tela Botanica');
28
		$pdf->SetTitle('Observations en étiquettes');
35
		$pdf->SetTitle('Observations en étiquettes');
29
		$pdf->SetSubject('Étiquettes des observations');
36
		$pdf->SetSubject('Étiquettes des observations');
30
		$pdf->SetKeywords('botaniques, observations, étiquettes, cel, tela-botanica');
37
		$pdf->SetKeywords('botaniques, observations, étiquettes, cel, tela-botanica');
Line 31... Line -...
31
 
-
 
32
		// set default header data
-
 
33
		// $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 005', PDF_HEADER_STRING);
-
 
34
 
-
 
35
		// set header and footer fonts
-
 
36
		// $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
-
 
37
		// $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
-
 
38
 
-
 
39
		// set default monospaced font
38
 
Line 40... Line 39...
40
		$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
39
		$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
41
 
40
 
42
		// set margins
41
		// set margins
43
		$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
42
		$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
Line 44... Line -...
44
		$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
-
 
45
		$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
-
 
46
 
43
		$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
Line 47... Line 44...
47
		// set auto page breaks
44
		$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
48
		// $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
45
 
49
		$pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM);
46
		$pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM);
Line 56... Line 53...
56
		$pdf->setEqualColumns(2);
53
		$pdf->setEqualColumns(2);
Line 57... Line 54...
57
 
54
 
58
		$this->pdf = $pdf;
55
		$this->pdf = $pdf;
Line 59... Line -...
59
	}
-
 
60
 
-
 
61
 
56
	}
62
 
57
 
Line 63... Line 58...
63
	function export($obs) {
58
	public function export($obs) {
64
		$pdf = &$this->pdf;
59
		$pdf = &$this->pdf;
65
 
60
 
Line 126... Line 121...
126
		return $this->pdf->getStringHeight($this->column_width, $txt);
121
		return $this->pdf->getStringHeight($this->column_width, $txt);
127
	}
122
	}
Line 128... Line 123...
128
 
123
 
129
	function getlinenb2($txt) {
124
	function getlinenb2($txt) {
130
		//var_dump($line, $this->pdf->GetStringWidth($line));
125
		//var_dump($line, $this->pdf->GetStringWidth($line));
131
		return ceil($this->pdf->GetStringWidth($txt)  / $this->column_width);		
126
		return ceil($this->pdf->GetStringWidth($txt)  / $this->column_width);
Line 132... Line 127...
132
	}
127
	}
133
 
128
 
134
	function getlinenb($txt) {
129
	function getlinenb($txt) {
Line 363... Line 358...
363
						 $txt = sprintf("Latitude, Longitude : %s  /  %s", $obs['latitude'], $obs['longitude']),
358
						 $txt = sprintf("Latitude, Longitude : %s  /  %s", $obs['latitude'], $obs['longitude']),
364
						 $border = 'RL', $ln = 1, $align = 'L', $fill = false, $link = false, $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
359
						 $border = 'RL', $ln = 1, $align = 'L', $fill = false, $link = false, $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
Line 365... Line 360...
365
 
360
 
366
		$this->pdf->MultiCell(80, 20,
361
		$this->pdf->MultiCell(80, 20,
367
							  $txt = 'Observation : ' . self::elude('Observation : ', $obs['commentaire']),
362
							  $txt = 'Observation : ' . self::elude('Observation : ', $obs['commentaire']),
Line 368... Line 363...
368
							  $border = 'RL', 'L', 0, 1, '', '', true); 
363
							  $border = 'RL', 'L', 0, 1, '', '', true);
369
 
364
 
370
		$this->pdf->Cell($w = 80, '',
365
		$this->pdf->Cell($w = 80, '',
371
						 $txt = 'Date : ' . strftime("%d/%m/%Y", strtotime($obs['date_observation'])),
366
						 $txt = 'Date : ' . strftime("%d/%m/%Y", strtotime($obs['date_observation'])),
Line 426... Line 421...
426
					   $obs['prenom_utilisateur'] . ' ' . $obs['nom_utilisateur'],
421
					   $obs['prenom_utilisateur'] . ' ' . $obs['nom_utilisateur'],
427
					   $obs['zone_geo'],
422
					   $obs['zone_geo'],
428
					   $obs['commentaire'],
423
					   $obs['commentaire'],
429
					   strftime("%Y-%m-%d", strtotime($obs['date_observation']))
424
					   strftime("%Y-%m-%d", strtotime($obs['date_observation']))
430
		);
425
		);
431
					  
426
 
432
	}
427
	}
Line 433... Line 428...
433
 
428
 
Line 478... Line 473...
478
					   $obs['prenom_utilisateur'] . ' ' . $obs['nom_utilisateur'],
473
					   $obs['prenom_utilisateur'] . ' ' . $obs['nom_utilisateur'],
479
					   $obs['zone_geo'],
474
					   $obs['zone_geo'],
480
					   $obs['commentaire'],
475
					   $obs['commentaire'],
481
					   strftime("%Y-%m-%d", strtotime($obs['date_observation']))
476
					   strftime("%Y-%m-%d", strtotime($obs['date_observation']))
482
		);
477
		);
483
					  
478
 
484
	}
479
	}
Line 485... Line 480...
485
 
480