Subversion Repositories eFlore/Applications.cel

Rev

Rev 1755 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1755 Rev 2458
Line 1... Line 1...
1
<?php
1
<?php
2
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
-
 
3
 
-
 
4
/**
-
 
5
* PHP Version 5
-
 
6
*
-
 
7
* @category  PHP
-
 
8
* @package   jrest
-
 
9
* @author    David Delon <david@tela-botania.org>
-
 
10
* @author    Aurélien Peronnet <aurelien@tela-botania.org>
-
 
11
* @copyright 2010 Tela-Botanica
-
 
12
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
-
 
13
* @version   SVN: <svn_id>
2
// declare(encoding='UTF-8');
14
* @link      /doc/jrest/
-
 
15
*/
-
 
16
 
-
 
17
/**
3
/**
18
* in:utf8
-
 
19
* out:iso8859
-
 
20
* 
-
 
21
* Export vers feuille de calcul d'une selection de releves
4
 * Service d'export vers feuille de calcul d'une sélection de relevés.
22
* 
5
 *
-
 
6
 * @internal   Mininum PHP version : 5.2
-
 
7
 * @category   CEL
-
 
8
 * @package    Services
-
 
9
 * @subpackage Observations
-
 
10
 * @version    0.1
-
 
11
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
-
 
12
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
-
 
13
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
-
 
14
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
-
 
15
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
-
 
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
23
*/
17
 */
Line 24... Line 18...
24
 
18
 
25
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(realpath(__FILE__))) . '/lib');
19
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(realpath(__FILE__))) . '/lib');
26
// la sortie est binaire (xls), mais OLE n'est pas compatible E_ALL en PHP-5.4
20
// la sortie est binaire (xls), mais OLE n'est pas compatible E_ALL en PHP-5.4
27
error_reporting(error_reporting() ^ E_STRICT);
21
error_reporting(error_reporting() ^ E_STRICT);
28
require_once("lib/OLE.php");
22
require_once 'lib/OLE.php';
Line 29... Line 23...
29
require_once("lib/Spreadsheet/Excel/Writer.php");
23
require_once 'lib/Spreadsheet/Excel/Writer.php';
Line 30... Line 24...
30
 
24
 
Line 31... Line 25...
31
class InventoryExport extends Cel  {
25
class InventoryExport extends Cel  {
32
 
-
 
33
	private $extendSpreadsheetProductor;
26
 
Line 34... Line 27...
34
 
27
	private $extendSpreadsheetProductor;
35
	function InventoryExport($config) {
28
 
36
 
29
	public function __construct($config) {
Line 37... Line 30...
37
		parent::__construct($config);
30
		parent::__construct($config);
38
 
-
 
39
		$this->extendSpreadsheetProductor = new SpreadsheetProductor();
31
 
40
		$this->extendSpreadsheetProductor->initSpreadsheet();
32
		$this->extendSpreadsheetProductor = new SpreadsheetProductor();
Line 41... Line 33...
41
	}
33
		$this->extendSpreadsheetProductor->initSpreadsheet();
42
 
34
	}
Line 43... Line 35...
43
	function getElement($uid){
35
 
44
 
36
	public function getElement($uid){
45
		   // Controle detournement utilisateur
37
		// Controle detournement utilisateur
46
		 	$this->controleUtilisateur($uid[0]);
-
 
47
 
38
		$this->controleUtilisateur($uid[0]);
Line 48... Line 39...
48
			$criteres = $_GET;	
39
 
49
			$chercheur_observations = new RechercheObservation($this->config);
40
		$criteres = $_GET;
50
 
41
		$chercheur_observations = new RechercheObservation($this->config);
51
    	    // Creating a workbook
-
 
52
			$workbook = new Spreadsheet_Excel_Writer();
42
 
53
			$workbook->setVersion(8);
43
		// Creating a workbook
54
 
44
		$workbook = new Spreadsheet_Excel_Writer();
55
			$workbook->send('liste.xls');
45
		$workbook->setVersion(8);
56
 
46
		$workbook->send('liste.xls');
Line 90... Line 80...
90
			$ids_obs = array();
80
		$ids_obs = array();
91
			$indices_lignes_obs = array();
81
		$indices_lignes_obs = array();
Line 92... Line 82...
92
			
82
 
93
			$i=1;
83
		$i = 1;
94
			foreach ($observations as &$obs) {
-
 
95
 
84
		foreach ($observations as &$obs) {
96
				$obs = $this->denullifierTableauValeurCel($obs);
85
			$obs = $this->denullifierTableauValeurCel($obs);
97
				$ids_obs[] = $obs['id_observation'];
86
			$ids_obs[] = $obs['id_observation'];
Line 98... Line 87...
98
				$indices_lignes_obs[$obs['id_observation']] = $i;
87
			$indices_lignes_obs[$obs['id_observation']] = $i;
99
				
88
 
100
			  	if ($obs['date_observation'] != "0000-00-00 00:00:00") {
-
 
101
	                $obs['date_observation'] = $this->formaterDate($obs['date_observation']);
89
			if ($obs['date_observation'] != '0000-00-00 00:00:00') {
102
	        	}
90
				$obs['date_observation'] = $this->formaterDate($obs['date_observation']);
103
	        	else {
91
			} else {
Line 104... Line 92...
104
	                $obs['date_observation']="00/00/0000";
92
				$obs['date_observation'] = '00/00/0000';
105
	        	}
93
			}
106
 
94
 
Line 148... Line 136...
148
    	    
136
 
149
			$workbook->close();
137
		$workbook->close();
150
			exit();
138
		exit();
151
	}
139
	}
152
}
-
 
153
/* +--Fin du code ---------------------------------------------------------------------------------------+
-
 
154
* $Log$
-
 
155
* Revision 1.7  2008-11-13 11:29:12  ddelon
-
 
156
* Reecriture gwt-ext
-
 
157
*
-
 
158
* Revision 1.6  2008-01-30 08:57:28  ddelon
-
 
159
* fin mise en place mygwt
-
 
160
*
-
 
161
* Revision 1.5  2007-06-06 13:31:16  ddelon
-
 
162
* v0.09
-
 
163
*
-
 
164
* Revision 1.4  2007-05-22 12:54:09  ddelon
-
 
165
* Securisation acces utilisateur
-
 
166
*/
-
 
167
?>
140
}