Subversion Repositories eFlore/Applications.cel

Rev

Rev 996 | 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 = array();
                        
                        $chercheur_observations = new RechercheObservation($this->config);

                        if(isset($uid[1]))
                        {
                                $criteres = $chercheur_observations->parserRequeteCriteres($uid[1]);
                        }

            // 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,'Commune');
            $worksheet->write(0,7,'Identifiant Commune');
            $worksheet->write(0,8,'Date');
            $worksheet->write(0,9,'Lieu-dit');
            $worksheet->write(0,10,'Station');
            $worksheet->write(0,11,'Milieu');
            $worksheet->write(0,12,'Notes');
            $worksheet->write(0,13,'Latitude');
            $worksheet->write(0,14,'Longitude');
            $worksheet->write(0,15,'Referentiel Geographique');
            $worksheet->write(0,16,'Ordre');
            $worksheet->write(0,17,'Identifiant');
            
            $numero_page = isset($criteres['numero_page']) ? $criteres['numero_page'] : 0;
            $limite = isset($criteres['limite']) ? $criteres['limite'] : 50;

                        $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['zone_geo']);
                $worksheet->write($i,7,$this->convertirCodeZoneGeoVersDepartement($obs['ce_zone_geo']));
                $worksheet->write($i,8,$obs['date_observation']);
                $worksheet->write($i,9,$obs['lieudit']);
                $worksheet->write($i,10,$obs['station']);
                $worksheet->write($i,11,$obs['milieu']);
                $worksheet->write($i,12,$obs['commentaire']);
                $worksheet->write($i,13,$obs['latitude']);
                $worksheet->write($i,14,$obs['longitude']);
                $worksheet->write($i,15,$obs['geodatum']);
                $worksheet->write($i,16,$obs['ordre']);
                $worksheet->write($i,17,$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
*/
?>