noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
export_fiche_csv.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00020 /*! \file
00021  * \brief Send a CSV file with card
00022  */
00023 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00024 header('Pragma: public');
00025 header('Content-type: application/csv');
00026 header('Content-Disposition: attachment;filename="fiche.csv"',FALSE);
00027 include_once ("ac_common.php");
00028 include_once('class_fiche.php');
00029 require_once('class_database.php');
00030 require_once('class_dossier.php');
00031 $gDossier=dossier::id();
00032 
00033 $cn=new Database($gDossier);
00034 
00035 require_once ('class_user.php');
00036 
00037 
00038 
00039 if  ( isset ($_GET['fd_id']))
00040 {
00041     $fiche_def=new Fiche_Def($cn,$_GET ['fd_id']);
00042     $fiche=new Fiche($cn);
00043     $e=$fiche_def->get_by_type();
00044     $o=0;
00045     //  Heading
00046     $fiche_def->GetAttribut();
00047     foreach ($fiche_def->attribut as $attribut)
00048     {
00049         if ( $o == 0 )
00050         {
00051             printf("%s",$attribut->ad_text);
00052             $o=1;
00053         }
00054         else
00055         {
00056             printf(";%s",$attribut->ad_text);
00057         }
00058     }
00059     printf("\n");
00060     $o=0;
00061     // Details
00062 
00063     foreach ($e as $fiche)
00064       {
00065         $detail=new Fiche($cn,$fiche['f_id']);
00066 
00067         $detail->getAttribut();
00068 
00069         foreach ( $detail->attribut as $dattribut )
00070         {
00071             if ( $o == 0 )
00072             {
00073                 printf("%s",$dattribut->av_text);
00074                 $o=1;
00075             }
00076             else
00077             {
00078                 printf (";%s",$dattribut->av_text);
00079 
00080             }
00081         }
00082         printf("\n");
00083         $o=0;
00084     }
00085 
00086 
00087 }
00088 exit;
00089 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations