Plugins  LAST
 All Data Structures Files Functions Variables Pages
raw.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of NOALYSS.
5  *
6  * NOALYSS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * NOALYSS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with NOALYSS; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 /* $Revision$ */
21 
22 // Copyright (c) 2002 Author Dany De Bontridder dany@alchimerys.be
23 
24 /*!\file
25  * \brief raw file for PDF ewa
26  */
27 require_once 'include/class_formulaire_param.php';
28 require_once 'include/class_rapav_declaration.php';
29 
30 extract($_REQUEST);
31 if ($act == 'rapav_form_export')
32 {
34  exit();
35 }
36 if ($act == 'export_decla_csv')
37 {
38  $decl= new Rapav_Declaration();
39  $decl->d_id=$d_id;
40  $decl->load();
41  $orient=($decl->d_step==0)?"list":"table";
42  Rapav_Declaration::to_csv($d_id,$orient);
43  exit();
44 }
45 if ($act == 'export_decla_document')
46 {
47  $decl = new Rapav_Declaration();
48  $decl->d_id = $id;
49  $decl->load();
50 
51  $cn->start();
52  if ($decl->d_filename == "")
53  {
54  ini_set('zlib.output_compression', 'Off');
55  header("Pragma: public");
56  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
57  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
58  header("Cache-Control: must-revalidate");
59  header('Content-type: ' . 'text/plain');
60  header('Content-Disposition: attachment;filename=vide.txt', FALSE);
61  header("Accept-Ranges: bytes");
62  echo "******************";
63  echo _("Fichier effacĂ©");
64  echo "******************";
65  exit();
66  }
67  $tmp = tempnam($_ENV['TMP'], 'document_');
68 
69  $cn->lo_export($decl->d_lob, $tmp);
70 
71  ini_set('zlib.output_compression', 'Off');
72  header("Pragma: public");
73  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
74  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
75  header("Cache-Control: must-revalidate");
76  header('Content-type: ' . $decl->d_mimetype);
77  header('Content-Disposition: attachment;filename="' . $decl->d_filename . '"', FALSE);
78  header("Accept-Ranges: bytes");
79  $file = fopen($tmp, 'r');
80  while (!feof($file))
81  echo fread($file, 8192);
82 
83  fclose($file);
84 
85  unlink($tmp);
86 
87  $cn->commit();
88 }
89 if ($act == 'export_definition_modele')
90 {
91  $decl = new RAPAV_Formulaire();
92  $decl->f_id = $id;
93  $decl->load();
94 
95  $cn->start();
96  if ($decl->f_filename == "")
97  {
98  ini_set('zlib.output_compression', 'Off');
99  header("Pragma: public");
100  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
101  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
102  header("Cache-Control: must-revalidate");
103  header('Content-type: ' . 'text/plain');
104  header('Content-Disposition: attachment;filename=vide.txt', FALSE);
105  header("Accept-Ranges: bytes");
106  echo "******************";
107  echo _("Fichier effacĂ©");
108  echo "******************";
109  exit();
110  }
111  $tmp = tempnam($_ENV['TMP'], 'document_');
112 
113  $cn->lo_export($decl->f_lob, $tmp);
114 
115  ini_set('zlib.output_compression', 'Off');
116  header("Pragma: public");
117  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
118  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
119  header("Cache-Control: must-revalidate");
120  header('Content-type: ' . $decl->f_mimetype);
121  header('Content-Disposition: attachment;filename="' . $decl->f_filename . '"', FALSE);
122  header("Accept-Ranges: bytes");
123  $file = fopen($tmp, 'r');
124  while (!feof($file))
125  echo fread($file, 8192);
126 
127  fclose($file);
128 
129  unlink($tmp);
130 
131  $cn->commit();
132 }
133 ?>
static to_csv($p_id)
export a form to CSV to stdout type $cn database connx
compute, save and display a declaration
$cn
Definition: raw.php:26
static to_csv($p_id, $p_orient="list")
export a declaration to CSV $cn database conx
$_REQUEST['sb']
Definition: am_print.php:39
$file
Definition: import_bank.php:60
$act
Definition: raw.php:29