Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.FormDate.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.FormDate.php,v 1.2 2003/08/18 15:46:42 eric Exp $
11  * @package FDL
12  * @subpackage CORE
13  */
14 /**
15  */
16 // ---------------------------------------------------------------------------
17 // $Id: Class.FormDate.php,v 1.2 2003/08/18 15:46:42 eric Exp $
18 // $Source: /home/cvsroot/anakeen/freedom/core/Class/Form/Class.FormDate.php,v $
19 // ---------------------------------------------------------------
20 // $Log: Class.FormDate.php,v $
21 // Revision 1.2 2003/08/18 15:46:42 eric
22 // phpdoc
23 //
24 // Revision 1.1 2002/01/08 12:41:34 eric
25 // first
26 //
27 // Revision 1.2 2001/02/16 11:42:16 marianne
28 // Ajout 'bonne' vieille classe
29 //
30 // ---------------------------------------------------------------
31 //
32 $CLASS_FORMDATE_PHP = '$Id: Class.FormDate.php,v 1.2 2003/08/18 15:46:42 eric Exp $';
33 
34 class FormDate
35 {
36  // This class is used to produce HTML/JS code when you want to
37  // create a separate window which exchange values with its parent
38  // window (for instance an edit/update window or a query window)
39  var $formdate = '
40 <input type="hidden" name="[NOM_DATE]" value="[VALEUR_DATE]">
41 <small>
42 <select size="1"
43  onChange="checkdate(this.form,this.form.[NOM_DATE],this.form.[NOM_DATE]_day,this.form.[NOM_DATE]_month,this.form.[NOM_DATE]_year, 1999, 2009 );"
44  name="[NOM_DATE]_day">
45 [BLOCK JOUR]
46 <option value="[jour]" [selected_jour]>[jour]</option>
47 [ENDBLOCK JOUR]
48 </select>
49 <select size="1"
50  onChange="checkdate(this.form,this.form.[NOM_DATE],this.form.[NOM_DATE]_day,this.form.[NOM_DATE]_month,this.form.[NOM_DATE]_year, 1999, 2009 );"
51  name="[NOM_DATE]_month">
52 [BLOCK MOIS]
53 <option value="[val_mois]" [selected_mois]>[mois]</option>
54 [ENDBLOCK MOIS]
55 </select>
56 <select size="1"
57  onChange="checkdate(this.form,this.form.[NOM_DATE],this.form.[NOM_DATE]_day,this.form.[NOM_DATE]_month,this.form.[NOM_DATE]_year, 1999, 2009 );"
58  name="[NOM_DATE]_year">
59 [BLOCK ANNEE]
60 <option value="[annee]" [selected_annee]>[annee]</option>
61 [ENDBLOCK ANNEE]
62 </select>
63 ';
64 
65  function FormDate($time, $name)
66  {
67  $this->date = $time;
68  $this->name = $name;
69  $this->mois = strftime("%m", $time);
70  $this->jour = strftime("%d", $time);
71  $this->annee = strftime("%Y", $time);
72  }
73 
74  function Get()
75  {
76  $lay = new Layout("", "", $this->formdate);
77  $lay->Set("NOM_DATE", $this->name);
78  $lay->Set("VALEUR_DATE", $this->date);
79  // Jours
80  for ($d = 1; $d <= 31; $d++) {
81  $tab_jour[$d]["jour"] = $d;
82  if ($d == $this->jour) {
83  $tab_jour[$d]["selected_jour"] = "selected";
84  } else {
85  $tab_jour[$d]["selected_jour"] = "";
86  }
87  }
88  $lay->SetBlockCorresp("JOUR", "jour", "jour");
89  $lay->SetBlockCorresp("JOUR", "selected_jour", "selected_jour");
90  $lay->SetBlockData("JOUR", $tab_jour);
91  // Mois
92  for ($d = 1; $d <= 12; $d++) {
93  $mois = mktime(0, 0, 0, $d, 1, $this->annee);
94  $tab_mois[$d]["mois"] = strftime("%B", $mois);;
95  $tab_mois[$d]["val_mois"] = $d;
96  if ($d == $this->mois) {
97  $tab_mois[$d]["selected_mois"] = "selected";
98  } else {
99  $tab_mois[$d]["selected_mois"] = "";
100  }
101  }
102  $lay->SetBlockCorresp("MOIS", "val_mois", "val_mois");
103  $lay->SetBlockCorresp("MOIS", "mois", "mois");
104  $lay->SetBlockCorresp("MOIS", "selected_mois", "selected_mois");
105  $lay->SetBlockData("MOIS", $tab_mois);
106  // Annee
107  $annee_deb = $this->annee - 10;
108  $annee_fin = $this->annee + 5;
109  for ($d = $annee_deb; $d <= $annee_fin; $d++) {
110  $tab_annee[$d]["annee"] = $d;
111  if ($d == $this->annee) {
112  $tab_annee[$d]["selected_annee"] = "selected";
113  } else {
114  $tab_annee[$d]["selected_annee"] = "";
115  }
116  }
117  $lay->SetBlockCorresp("ANNEE", "annee", "annee");
118  $lay->SetBlockCorresp("ANNEE", "selected_annee", "selected_annee");
119  $lay->SetBlockData("ANNEE", $tab_annee);
120  /*
121  $tab=array();
122  reset($this->param);
123  $isel = $c = -1;
124  foreach($this->param as $k => $v) {
125  if ($v["typ"] == "sel" ) {
126  $isel++;
127  $tabsel[$isel]["name"] = $k;
128  } else {
129  $c++;
130  $tab[$c]["name"]=$k;
131  }
132  }
133  if ($isel>-1) {
134  $lay->SetBlockData("SEL",$tabsel);
135  } else {
136  $lay->SetBlockData("SEL",NULL);
137  }
138  if ($c>-1) {
139  $lay->SetBlockData("PAR",$tab);
140  } else {
141  $lay->SetBlockData("PAR",NULL);
142  }
143  $lay->Set("name",$this->name);
144  */
145  return ($lay->gen());
146  }
147  // CLASS END
148 
149 }
150 ?>
Layout is a template generator.
print $fam getTitle() $fam name
$d
Definition: dav.php:77
$CLASS_FORMDATE_PHP
FormDate($time, $name)
← centre documentaire © anakeen