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