Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.DownLoad.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: Class.DownLoad.php,v 1.2 2003/08/18 15:46:42 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage CORE
15  */
16 /**
17  */
18 // ---------------------------------------------------------------------------
19 // PHP PROMAN Task Class
20 // ---------------------------------------------------------------------------
21 // anakeen 2000 - Marianne Le Briquer
22 // ---------------------------------------------------------------------------
23 // This program is free software; you can redistribute it and/or modify
24 // it under the terms of the GNU General Public License as published by
25 // the Free Software Foundation; either version 2 of the License, or (at
26 // your option) any later version.
27 //
28 // This program is distributed in the hope that it will be useful, but
29 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
30 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
31 // for more details.
32 //
33 // You should have received a copy of the GNU General Public License along
34 // with this program; if not, write to the Free Software Foundation, Inc.,
35 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36 // ---------------------------------------------------------------------------
37 // $Id:
38 // $Log:
39 // ---------------------------------------------------------------------------
40 // DownLoad
41 // Generer
42 // ---------------------------------------------------------------------------
43 //
45 
46 class DownLoad
47 {
48  var $dbid = - 1;
49 
51  var $FileType;
52 
53  var $array; // THE Array (2 dimensionnal)
54  var $fields; // array of the field names to show
55  var $NomModele = "";
56  var $Application = "";
57 
58  var $white = 0;
59  var $black = 0;
60  var $im = 0;
61  var $liste_extract = array();
62  // ---------------------------------------------------------------------------
63  // NOM : DownLoad
64  //
65  // DESCRIPTION : Constructeur, connexion à la base.
66  //
67  // PARAMETRES : entree: aucun.
68  //
69  // ---------------------------------------------------------------------------
70  function DownLoad()
71  {
72  $this->liste_extract["all"]["content"] = "application/vnd.ms-excel";
73  $this->liste_extract["all"]["extension"] = "";
74  $this->liste_extract["cvs"]["content"] = "application/vnd.ms-excel";
75  $this->liste_extract["cvs"]["extension"] = "cvs";
76  $this->liste_extract["rtf"]["content"] = "application/rtf";
77  $this->liste_extract["rtf"]["extension"] = "rtf";
78 
79  return TRUE;
80  }
81  // ---------------------------------------------------------------------------
82  function Generer($src, $p_type_file = "cvs", $p_filename = "extract", $add_ext = "OUI")
83  {
84  $this->FileType = $p_type_file;
85  $this->ConstruireFichier($src, $p_filename, $add_ext);
86  exit;
87  return (TRUE);
88  }
89  function ConstruireFichier($src, $p_filename, $add_ext)
90  {
91  $this->InitFile($p_filename, $add_ext);
92  $this->ShowContent($src);
93  $this->EndFile();
94 
95  return;
96  }
97  function InitFile($p_filename, $add_ext)
98  {
99  $name = $p_filename;
100  ###$this->ContentType=$this->liste_extract["{$this->FileType}"]["content"];
101  if ($add_ext == "OUI") {
102  $ext = $this->liste_extract["{$this->FileType}"]["extension"];
103  $name . "." . $ext;
104  }
105 
106  header("Content-Disposition: form-data;filename=$name");
107  header("CONTENT-TYPE: " . $this->FileType);
108  switch ($this->FileType) {
109  case "html":
110  $this->InitHtml();
111  break;
112  }
113  }
114  function InitHtml()
115  {
116  echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n" . " <HTML>\n" . "<HEAD>" . "<LINK REL=STYLESHEET TYPE=\"text/css\" HREF=\"../Style1/Css/style.css\">" . "<TITLE>Extraction</TITLE></HEAD>";
117  echo '<BODY BGCOLOR="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FF0000">';
118  }
119  function ShowContent($src)
120  {
121  echo $src;
122  }
123 
124  function EndFile()
125  {
126  switch ($this->FileType) {
127  case "html":
128  $this->EndHtml();
129  break;
130  }
131  }
132 
133  function EndHtml()
134  {
135  echo "</BODY>\n";
136  echo "</HTML>\n";
137  }
138 }
139 ?>
← centre documentaire © anakeen - published under CC License - Dynacase