Subversion Repositories eFlore/Applications.cel

Rev

Rev 1398 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //

/**
* PHP Version 5
*
* @category  PHP
* @package   jrest
* @author    David Delon <david@tela-botania.org>
* @author    Aurélien Peronnet <aurelien@tela-botania.org>
* @copyright 2010 Tela-Botanica
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version   SVN: <svn_id>
* @link      /doc/jrest/
*/

/**
* in:utf8
* out:iso8859
* 
* Export vers feuille de calcul d'une selection de releves
* 
*/
class InventoryExport extends Cel  {

        private $extendSpreadsheetProductor;

        function InventoryExport($config) {

                parent::__construct($config);

                $this->extendSpreadsheetProductor = new SpreadsheetProductor();
                $this->extendSpreadsheetProductor->initSpreadsheet();
        }

        function getElement($uid){

                   // Controle detournement utilisateur
                        $this->controleUtilisateur($uid[0]);

                        $criteres = $_GET;      
                        $chercheur_observations = new RechercheObservation($this->config);

            // Creating a workbook
                        $workbook = new Spreadsheet_Excel_Writer();

                        $workbook->send('liste.xls');

                        // Creating a worksheet
                        $worksheet = $workbook->addWorksheet('Liste');
                        
            $worksheet->write(0,0,'Espece');
            $worksheet->write(0,1,'Numero nomenclatural');
            $worksheet->write(0,2,'Nom retenu');
            $worksheet->write(0,3,'Numero nomenclatural nom retenu');
            $worksheet->write(0,4,'Numero taxonomique');
            $worksheet->write(0,5,'Famille');
            $worksheet->write(0,6,'Referentiel taxonomique');
            $worksheet->write(0,7,'Commune');
            $worksheet->write(0,8,'Identifiant Commune');
            $worksheet->write(0,9,'Date');
            $worksheet->write(0,10,'Lieu-dit');
            $worksheet->write(0,11,'Station');
            $worksheet->write(0,12,'Milieu');
            $worksheet->write(0,13,'Notes');
            $worksheet->write(0,14,'Latitude');
            $worksheet->write(0,15,'Longitude');
            $worksheet->write(0,16,'Referentiel Geographique');
            $worksheet->write(0,17,'Ordre');
            $worksheet->write(0,18,'Identifiant');
            
            $numero_page = isset($criteres['numero_page']) ? $criteres['numero_page'] : 0;
            $limite = isset($criteres['limite']) ? $criteres['limite'] : 0;

                        $observations = $chercheur_observations->rechercherObservations($uid[0], $criteres, $numero_page, $limite);

                        $i=1;
                        foreach ($observations as $obs) {

                                $obs = $this->denullifierTableauValeurCel(&$obs);

                                if ($obs['date_observation'] != "0000-00-00 00:00:00") {
                        $obs['date_observation'] = $this->formaterDate($obs['date_observation']);
                        }
                        else {
                        $obs['date_observation']="00/00/0000";
                        }

                $worksheet->write($i,0,$obs['nom_sel']);
                $worksheet->write($i,1,$obs['nom_sel_nn']);
                $worksheet->write($i,2,$obs['nom_ret']);
                $worksheet->write($i,3,$obs['nom_ret_nn']);
                $worksheet->write($i,4,$obs['nt']);
                $worksheet->write($i,5,$obs['famille']);
                $worksheet->write($i,6,$obs['nom_referentiel']);
                $worksheet->write($i,7,$obs['zone_geo']);
                $worksheet->write($i,8,$this->convertirCodeZoneGeoVersDepartement($obs['ce_zone_geo']));
                $worksheet->write($i,9,$obs['date_observation']);
                $worksheet->write($i,10,$obs['lieudit']);
                $worksheet->write($i,11,$obs['station']);
                $worksheet->write($i,12,$obs['milieu']);
                $worksheet->write($i,13,$obs['commentaire']);
                $worksheet->write($i,14,$obs['latitude']);
                $worksheet->write($i,15,$obs['longitude']);
                $worksheet->write($i,16,$obs['geodatum']);
                $worksheet->write($i,17,$obs['ordre']);
                $worksheet->write($i,18,$obs['id_observation']);
                $i++;
            }

                        $workbook->close();

                        exit();
        }
}
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* Revision 1.7  2008-11-13 11:29:12  ddelon
* Reecriture gwt-ext
*
* Revision 1.6  2008-01-30 08:57:28  ddelon
* fin mise en place mygwt
*
* Revision 1.5  2007-06-06 13:31:16  ddelon
* v0.09
*
* Revision 1.4  2007-05-22 12:54:09  ddelon
* Securisation acces utilisateur
*/
?>