Subversion Repositories eFlore/Applications.cel

Rev

Rev 984 | Rev 1297 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
416 aurelien 1
<?php
984 aurelien 2
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
3
 
907 aurelien 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>
14
* @link      /doc/jrest/
15
*/
416 aurelien 16
 
907 aurelien 17
/**
18
* in:utf8
19
* out:iso8859
20
*
21
* Export vers feuille de calcul d'une selection de releves
22
*
23
*/
24
class InventoryExport extends Cel  {
416 aurelien 25
 
907 aurelien 26
	private $extendSpreadsheetProductor;
416 aurelien 27
 
28
	function InventoryExport($config) {
29
 
907 aurelien 30
		parent::__construct($config);
416 aurelien 31
 
32
		$this->extendSpreadsheetProductor = new SpreadsheetProductor();
33
		$this->extendSpreadsheetProductor->initSpreadsheet();
34
	}
35
 
36
	function getElement($uid){
37
 
38
		   // Controle detournement utilisateur
624 aurelien 39
		 	$this->controleUtilisateur($uid[0]);
416 aurelien 40
 
907 aurelien 41
			$criteres = array();
42
 
43
			$chercheur_observations = new RechercheObservation($this->config);
416 aurelien 44
 
45
			if(isset($uid[1]))
46
			{
907 aurelien 47
				$criteres = $chercheur_observations->parserRequeteCriteres($uid[1]);
416 aurelien 48
			}
49
 
50
    	    // Creating a workbook
51
			$workbook = new Spreadsheet_Excel_Writer();
52
 
540 david 53
			$workbook->send('liste.xls');
54
 
416 aurelien 55
			// Creating a worksheet
56
			$worksheet = $workbook->addWorksheet('Liste');
624 aurelien 57
 
58
            $worksheet->write(0,0,'Espece');
416 aurelien 59
            $worksheet->write(0,1,'Numero nomenclatural');
60
            $worksheet->write(0,2,'Nom retenu');
61
            $worksheet->write(0,3,'Numero nomenclatural nom retenu');
62
            $worksheet->write(0,4,'Numero taxonomique');
63
            $worksheet->write(0,5,'Famille');
64
            $worksheet->write(0,6,'Commune');
65
            $worksheet->write(0,7,'Identifiant Commune');
624 aurelien 66
            $worksheet->write(0,8,'Date');
67
            $worksheet->write(0,9,'Lieu-dit');
416 aurelien 68
            $worksheet->write(0,10,'Station');
69
            $worksheet->write(0,11,'Milieu');
624 aurelien 70
            $worksheet->write(0,12,'Notes');
71
            $worksheet->write(0,13,'Latitude');
72
            $worksheet->write(0,14,'Longitude');
416 aurelien 73
            $worksheet->write(0,15,'Referentiel Geographique');
907 aurelien 74
 
75
            $numero_page = isset($criteres['numero_page']) ? $criteres['numero_page'] : 0;
76
            $limite = isset($criteres['limite']) ? $criteres['limite'] : 50;
416 aurelien 77
 
907 aurelien 78
			$observations = $chercheur_observations->rechercherObservations($uid[0], $criteres, $numero_page, $limite);
416 aurelien 79
 
80
			$i=1;
907 aurelien 81
			foreach ($observations as $obs) {
416 aurelien 82
 
907 aurelien 83
				$obs = $this->denullifierTableauValeurCel(&$obs);
416 aurelien 84
 
907 aurelien 85
			  	if ($obs['date_observation'] != "0000-00-00 00:00:00") {
86
	                $obs['date_observation'] = $this->formaterDate($obs['date_observation']);
416 aurelien 87
	        	}
88
	        	else {
907 aurelien 89
	                $obs['date_observation']="00/00/0000";
416 aurelien 90
	        	}
91
 
907 aurelien 92
                $worksheet->write($i,0,$obs['nom_sel']);
93
                $worksheet->write($i,1,$obs['nom_sel_nn']);
94
                $worksheet->write($i,2,$obs['nom_ret']);
95
                $worksheet->write($i,3,$obs['nom_ret_nn']);
96
                $worksheet->write($i,4,$obs['nt']);
97
                $worksheet->write($i,5,$obs['famille']);
98
                $worksheet->write($i,6,$obs['zone_geo']);
99
                $worksheet->write($i,7,$this->convertirCodeZoneGeoVersDepartement($obs['ce_zone_geo']));
100
                $worksheet->write($i,8,$obs['date_observation']);
101
                $worksheet->write($i,9,$obs['lieudit']);
102
                $worksheet->write($i,10,$obs['station']);
103
                $worksheet->write($i,11,$obs['milieu']);
104
                $worksheet->write($i,12,$obs['commentaire']);
105
                $worksheet->write($i,13,$obs['latitude']);
106
                $worksheet->write($i,14,$obs['longitude']);
107
                $worksheet->write($i,15,$obs['geodatum']);
416 aurelien 108
                $i++;
109
    	    }
110
 
111
			$workbook->close();
112
 
113
			exit();
114
	}
115
}
116
/* +--Fin du code ---------------------------------------------------------------------------------------+
117
* $Log$
118
* Revision 1.7  2008-11-13 11:29:12  ddelon
119
* Reecriture gwt-ext
120
*
121
* Revision 1.6  2008-01-30 08:57:28  ddelon
122
* fin mise en place mygwt
123
*
124
* Revision 1.5  2007-06-06 13:31:16  ddelon
125
* v0.09
126
*
127
* Revision 1.4  2007-05-22 12:54:09  ddelon
128
* Securisation acces utilisateur
129
*/
907 aurelien 130
?>