Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.Form.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Generated Header (not documented yet)
8  *
9  * @author Anakeen
10  * @version $Id: Class.Form.php,v 1.2 2003/08/18 15:46:42 eric Exp $
11  * @package FDL
12  * @subpackage CORE
13  */
14 /**
15  */
16 // ---------------------------------------------------------------------------
17 // anakeen 2000 - Marianne Le Briquer
18 // ---------------------------------------------------------------------------
19 // This program is free software; you can redistribute it and/or modify
20 // it under the terms of the GNU General Public License as published by
21 // the Free Software Foundation; either version 2 of the License, or (at
22 // your option) any later version.
23 //
24 // This program is distributed in the hope that it will be useful, but
25 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 // for more details.
28 //
29 // You should have received a copy of the GNU General Public License along
30 // with this program; if not, write to the Free Software Foundation, Inc.,
31 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 // ---------------------------------------------------------------------------
33 // $Id: Class.Form.php,v 1.2 2003/08/18 15:46:42 eric Exp $
34 // $Log: Class.Form.php,v $
35 // Revision 1.2 2003/08/18 15:46:42 eric
36 // phpdoc
37 //
38 // Revision 1.1 2002/01/08 12:41:34 eric
39 // first
40 //
41 // Revision 1.2 2001/02/11 10:53:33 marianne
42 // Ajout Img + maj diverses
43 //
44 // Revision 1.9 2000/08/21 10:55:13 marianne
45 // Ajout Newline et Hr
46 //
47 // Revision 1.8 2000/07/29 10:27:15 marc
48 // Ajout attr wrap dans textarea
49 //
50 // Revision 1.7 2000/06/21 18:10:37 yannick
51 // Pas de lignes blanches
52 //
53 // Revision 1.6 2000/06/06 15:12:42 marianne
54 // Nouvelles fonctions...
55 //
56 // Revision 1.1 2000/05/29 08:36:51 yannick
57 // Creation
58 //
59 // ---------------------------------------------------------------------------
61 
62 class Form
63 {
64 
68 
69  function Form($ClassLabel = "label3", $ClassTitre = "titre3", $ClassCell = "tab1")
70  {
71  $this->cell_class = $ClassCell;
72  $this->label_class = $ClassLabel;
73  $this->titre_class = $ClassTitre;
74  return TRUE;
75  }
76 
77  function Hidden($name, $value = '')
78  {
79  $src = "<INPUT TYPE=\"hidden\" NAME=\"$name\" VALUE=\"$value\">\n";
80  return $src;
81  }
82  function Img($src, $alt = "", $border = 0, $vspace = 0, $hspace = 0)
83  {
84  $walt = "";
85  if ($alt != "") $walt = "ALT=\"$alt\"";
86  $src = "<IMG SRC=\"$src\" BORDER=\"$border\" $walt VSPACE=$vspace HSPACE=$hspace>\n";
87  return $src;
88  }
89  function Table($border = 0, $width = "100%", $align = "", $space = 0, $padd = 0)
90  {
91  $walign = "";
92  if ($align != "") $walign = "ALIGN=\"$align\"";
93  $src = "<TABLE BORDER=\"$border\" WIDTH=\"$width\" $walign CELLSPACING=\"$space\" CELLPADDING=\"$padd\">\n";
94  return $src;
95  }
96 
97  function Hr($width = "100%", $align = "")
98  {
99  $walign = "";
100  if ($align != "") $walign = "ALIGN=\"$align\"";
101  $src = "<HR WIDTH=\"$width\" $walign>\n";
102  return $src;
103  }
104 
105  function NewLine($class = "")
106  {
107  if ($class == "") {
108  return "</TR>\n<TR>\n";
109  } else {
110  return "</TR>\n<TR CLASS=\"$class\" >\n";
111  }
112  return $src;
113  }
114 
115  function LibCell($libelle, $value, $class = "", $align = "LEFT", $span = 1)
116  {
117  $src = "\t<TD CLASS=\"{$this->label_class}\" ALIGN=\"$align\" COLSPAN=$span>$libelle\n";
118  if ($class == "") {
119  $src.= "\t<DIV CLASS=\"{$this->titre_class}\" >&nbsp;$value</DIV></TD>\n";
120  } else {
121  $src.= "\t<DIV CLASS=\"$class\" >&nbsp;$value</DIV></TD>\n";
122  }
123  return $src;
124  }
125  function LibCells($libelle, $value, $classval = "", $classlib = "", $align = "LEFT")
126  {
127  if ($classlib == "") $classlib = $this->label_class;
128  if ($classval == "") $classval = $this->cell_class;
129  $src = "\t<TD CLASS=\"$classlib\" ALIGN=\"$align\">$libelle</TD>\n";
130  $src.= "\t<TD CLASS=\"$classval\" ALIGN=\"$align\">$value</TD>\n";
131  return $src;
132  }
133  function Cell($value, $class = "", $align = "LEFT", $span = 1)
134  {
135  if ($align == "") {
136  $align = "LEFT";
137  }
138  if ($class == "") {
139  $src = "\t<TD CLASS=\"{$this->cell_class}\" ALIGN=\"$align\" COLSPAN=$span>&nbsp;$value</TD>\n";
140  } else {
141  $src = "\t<TD CLASS=\"$class\" ALIGN=\"$align\" COLSPAN=$span>&nbsp;$value</TD>\n";
142  }
143  return $src;
144  }
145 
146  function TCell($value, $span = 1, $class = "", $align = "LEFT", $width = "")
147  {
148  $wwidth = "";
149  if ($width != "") {
150  $wwidth = " width=\"$width\"";
151  }
152  if ($class == "") {
153  $src = "\t<TD NOWRAP $wwidth CLASS=\"{$this->titre_class}\" COLSPAN=$span>$value</TD>\n";
154  } else {
155  $src = "\t<TD NOWRAP CLASS=\"$class\" COLSPAN=$span>$value</TD>\n";
156  }
157  return $src;
158  }
159 
160  function CellTextArea($CREATION, $libelle, $rows = 5, $cols = 55, $name, $entite, $span = 1)
161  {
162  if (!$CREATION) {
163  $value = $entite->$name;
164  } else {
165  $value = '';
166  };
167  $src = "\t<TD CLASS=\"{$this->label_class}\" COLSPAN=$span>$libelle\n";
168  $src.= "<DIV CLASS=\"finput\"><FONT SIZE=\"-1\">" . "<TEXTAREA WRAP=\"virtual\" ROWS=$rows COLS=$cols NAME=\"p_$name\">";
169  if (!$CREATION) {
170  $src.= "$value";
171  }
172  $src.= "</TEXTAREA></FONT></TD>\n";
173  return $src;
174  }
175 
176  function CellInput($CREATION, $libelle, $max, $size, $name, $entite, $span = 1)
177  {
178  if (!$CREATION) {
179  $value = $entite->$name;
180  } else {
181  $value = '';
182  };
183  $src = "\t<TD CLASS=\"{$this->label_class}\" COLSPAN=$span>$libelle\n";
184  $src.= "<DIV CLASS=\"finput\"><FONT SIZE=\"-1\">" . "<INPUT MAXLENGTH=$max SIZE=$size NAME=\"p_$name\"";
185  if ($CREATION) {
186  $src.= ">\n";
187  } else {
188  $src.= " VALUE=\"$value\">\n";
189  }
190  $src.= "</FONT></TD>\n";
191  return $src;
192  }
193  function CellInputId($CREATION, $libelle, $max, $size, $name, $id, $entite, $span = 1)
194  {
195  if (!$CREATION) {
196  $value = $entite->$id;
197  } else {
198  $value = '';
199  };
200  $src = "\t<TD CLASS=\"{$this->label_class}\" COLSPAN=$span>$libelle\n";
201  $src.= "<FONT SIZE=\"-1\">" . "<INPUT MAXLENGTH=$max SIZE=$size NAME=\"p_$name\"";
202  if ($CREATION) {
203  $src.= ">\n";
204  } else {
205  $src.= " VALUE=\"$value\">\n";
206  }
207  $src.= "</FONT></TD>\n";
208  return $src;
209  }
210  function CellInputNoDiv($CREATION, $libelle, $max, $size, $name, $entite, $span = 1)
211  {
212  if (!$CREATION) {
213  $value = $entite->$name;
214  } else {
215  $value = '';
216  };
217  $src = "\t<TD CLASS=\"{$this->label_class}\" COLSPAN=$span>$libelle\n";
218  $src.= "<FONT SIZE=\"-1\">" . "<INPUT MAXLENGTH=$max SIZE=$size NAME=\"p_$name\"";
219  if ($CREATION) {
220  $src.= ">\n";
221  } else {
222  $src.= " VALUE=\"$value\">\n";
223  }
224  $src.= "</FONT></TD>\n";
225  return $src;
226  }
227 
228  function Input($CREATION, $libelle, $max, $size, $name, $entite, $span = 1)
229  {
230  if (!$CREATION) {
231  $value = $entite->$name;
232  } else {
233  $value = '';
234  };
235  $src = "<DIV CLASS=\"finput\"><FONT SIZE=\"-1\">" . "<INPUT MAXLENGTH=$max SIZE=$size NAME=\"p_$name\"";
236  if ($CREATION) {
237  $src.= ">\n";
238  } else {
239  $src.= " VALUE=\"$value\">\n";
240  }
241  $src.= "</FONT>\n";
242  return $src;
243  }
244  function InputSimple($max, $size, $name, $value, $span = 1)
245  {
246  $src = "<FONT SIZE=\"-1\">" . "<INPUT MAXLENGTH=$max SIZE=$size NAME=\"p_$name\"";
247  $src.= " VALUE=\"$value\">\n";
248  $src.= "</FONT>\n";
249  return $src;
250  }
251 
252  function Select($libelle, $name, $name_id, $name_lib, $entite, $liste, $vide = "vide")
253  {
254  reset($liste);
255  if (isset($entite->$name) && ($entite->$name == "")) unset($entite->$name);
256  $src = "\t<TD CLASS=\"{$this->label_class}\">$libelle\n";
257  $src.= "<DIV CLASS=\"{$this->titre_class}\">\n";
258  $src.= "<SELECT NAME=\"p_$name\" SIZE=1>\n";
259  if ($vide == "vide") {
260  if (!isset($entite->$name)) {
261  $src.= "<OPTION SELECTED VALUE=\"\">-- vide --\n";
262  } else {
263  $src.= "<OPTION VALUE=\"\">-- vide --\n";
264  }
265  }
266  if (sizeof($liste) > 0) {
267  foreach ($liste as $k => $v) {
268  if ((isset($entite->$name)) && ($entite->$name == $v->$name_id)) {
269  $src.= "<OPTION SELECTED VALUE=\"" . $v->$name_id . "\">" . $v->$name_lib . "\n";
270  } else {
271  if (($vide != "vide") && (!isset($entite->$name)) && ($vide == $v->$name_lib)) {
272  $src.= "<OPTION SELECTED VALUE=\"" . $v->$name_id . "\">" . $v->$name_lib . "\n";
273  } else {
274  $src.= "<OPTION VALUE=\"" . $v->$name_id . "\">" . $v->$name_lib . "\n";
275  }
276  }
277  }
278  }
279  $src.= "</SELECT></DIV></TD> \n";
280  return $src;
281  }
282 
283  function SelectConcat($libelle, $name, $name_id, $name_lib1, $name_lib2, $entite, $liste, $vide = "vide")
284  {
285  reset($liste);
286  if (isset($entite->$name) && ($entite->$name == "")) unset($entite->$name);
287  $src = "\t<TD CLASS=\"{$this->label_class}\">$libelle\n";
288  $src.= "<DIV CLASS=\"{$this->titre_class}\">\n";
289  $src.= "<SELECT NAME=\"p_$name\" SIZE=1>\n";
290  if (($vide == "vide") && (!isset($entite->$name))) {
291  $src.= "<OPTION SELECTED VALUE=\"\">-- vide --\n";
292  }
293  if (sizeof($liste) > 0) {
294  foreach ($liste as $k => $v) {
295  if ((isset($entite->$name)) && ($entite->$name == $v->$name_id)) {
296  $src.= "<OPTION SELECTED VALUE=\"" . $v->$name_id . "\">" . $v->$name_lib1 . " " . $v->$name_lib2 . "\n";
297  } else {
298  if (($vide != "vide") && (!isset($entite->$name)) && ($vide == $v->$name_lib1)) {
299  $src.= "<OPTION SELECTED VALUE=\"" . $v->$name_id . "\">" . $v->$name_lib1 . " " . $v->$name_lib2 . "\n";
300  } else {
301  $src.= "<OPTION VALUE=\"" . $v->$name_id . "\">" . $v->$name_lib1 . " " . $v->$name_lib2 . "\n";
302  }
303  }
304  }
305  }
306  $src.= "</SELECT></DIV></TD> \n";
307  return $src;
308  }
309 
310  function SelectListeSimple($libelle, $name, $entite, $liste, $vide = "OUI")
311  {
312 
313  reset($liste);
314  $src = "\t<TD CLASS=\"{$this->label_class}\">$libelle\n";
315  $src.= "<DIV CLASS=\"{$this->titre_class}\">\n";
316  $src.= "<SELECT NAME=\"p_$name\" SIZE=1>\n";
317  if ($vide == "OUI") {
318  if (!isset($entite->$name)) {
319  $src.= "<OPTION SELECTED VALUE=\"\">-- vide --\n";
320  }
321  if ((isset($entite->$name)) && ($entite->$name == '')) {
322  $src.= "<OPTION SELECTED VALUE=\"\">-- vide --\n";
323  }
324  }
325  if (sizeof($liste) > 0) {
326  foreach ($liste as $k => $v) {
327  if ((isset($entite->$name)) && ($entite->$name == $v)) {
328  $src.= "<OPTION SELECTED VALUE='$v'>$v\n";
329  } else {
330  $src.= "<OPTION VALUE='$v'>$v\n";
331  }
332  }
333  }
334  $src.= "</SELECT></DIV></TD> \n";
335  return $src;
336  }
337 }
338 ?>
CellInput($CREATION, $libelle, $max, $size, $name, $entite, $span=1)
Definition: Class.Form.php:176
CellInputNoDiv($CREATION, $libelle, $max, $size, $name, $entite, $span=1)
Definition: Class.Form.php:210
Select($libelle, $name, $name_id, $name_lib, $entite, $liste, $vide="vide")
Definition: Class.Form.php:252
Input($CREATION, $libelle, $max, $size, $name, $entite, $span=1)
Definition: Class.Form.php:228
$size
Definition: resizeimg.php:110
Img($src, $alt="", $border=0, $vspace=0, $hspace=0)
Definition: Class.Form.php:82
CellTextArea($CREATION, $libelle, $rows=5, $cols=55, $name, $entite, $span=1)
Definition: Class.Form.php:160
NewLine($class="")
Definition: Class.Form.php:105
TCell($value, $span=1, $class="", $align="LEFT", $width="")
Definition: Class.Form.php:146
$CLASS_FORM_PHP
Definition: Class.Form.php:60
CellInputId($CREATION, $libelle, $max, $size, $name, $id, $entite, $span=1)
Definition: Class.Form.php:193
SelectListeSimple($libelle, $name, $entite, $liste, $vide="OUI")
Definition: Class.Form.php:310
SelectConcat($libelle, $name, $name_id, $name_lib1, $name_lib2, $entite, $liste, $vide="vide")
Definition: Class.Form.php:283
Hr($width="100%", $align="")
Definition: Class.Form.php:97
$rows
Definition: Api/ods2csv.php:23
$titre_class
Definition: Class.Form.php:67
LibCell($libelle, $value, $class="", $align="LEFT", $span=1)
Definition: Class.Form.php:115
Hidden($name, $value= '')
Definition: Class.Form.php:77
$cell_class
Definition: Class.Form.php:65
$label_class
Definition: Class.Form.php:66
InputSimple($max, $size, $name, $value, $span=1)
Definition: Class.Form.php:244
LibCells($libelle, $value, $classval="", $classlib="", $align="LEFT")
Definition: Class.Form.php:125
Cell($value, $class="", $align="LEFT", $span=1)
Definition: Class.Form.php:133
$class
Definition: updateclass.php:38
Table($border=0, $width="100%", $align="", $space=0, $padd=0)
Definition: Class.Form.php:89
Form($ClassLabel="label3", $ClassTitre="titre3", $ClassCell="tab1")
Definition: Class.Form.php:69
$value
← centre documentaire © anakeen