MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mindexedform.class
Ir para a documentação deste ficheiro.
1
<?php
2
class
MIndexedForm
extends
MForm
3
{
4
var
$pages
;
5
6
function
__construct
(
$title
=
''
,
$action
=
''
)
7
{
8
parent::__construct(
$title
,
$action
);
9
}
10
11
function
AddPage
(
$title
,
$fields
)
12
{
13
$n = count(
$fields
);
14
15
//Add prefix 'frm_' which identifies form variables and
16
//distinguishes them from other possible variables
17
for
( $i=0; $i<$n; $i++ )
18
{
19
$fields
[$i]->name =
'frm_'
.
$fields
[$i]->name;
20
21
if
(
$fields
[$i]->value ==
''
)
22
$fields
[$i]->value = $GLOBALS[
$fields
[$i]->name];
23
}
24
25
$this->pages[
$title
] =
$fields
;
26
}
27
28
function
GenerateIndexPage
()
29
{
30
foreach
( $this->pages as
$page
=>
$fields
)
31
{
32
$href =
"javascript:document.{$this->name}."
.
33
"frm_currpage_.value='$page';"
.
34
"document.{$this->name}.submit();"
;
35
36
echo
"<a class='fieldLabel' href=\"$href\">$page</a><br/>\n"
;
37
}
38
}
39
40
function
GenerateBody
()
41
{
42
43
$currpage = $GLOBALS[
'frm_currpage_'
];
44
45
if
( ! $currpage )
46
{
47
$this->
GenerateIndexPage
();
48
}
49
else
50
{
51
echo
"<table width=\"100%\">\n"
;
52
53
$fields
= $this->pages[$currpage];
54
55
foreach
(
$fields
as $f )
56
{
57
if
( ! $f->label )
58
{
59
$hidden[] = $f;
60
continue
;
61
}
62
63
echo
" <tr>\n"
;
64
65
$label = $f->label;
66
67
if
( $label !=
' '
)
68
$label .=
':'
;
69
70
echo(
" <td class=\"fieldLabel\"> $label </td>\n"
);
71
echo(
" <td>"
);
72
73
$f->Generate();
74
75
echo(
"</td>\n"
);
76
echo(
" </tr>\n"
);
77
}
78
79
echo(
" <tr>\n"
);
80
echo(
" <td colspan=\"2\"><hr size=\"1\" noshade></td>\n"
);
81
echo(
" </tr>\n"
);
82
echo(
" <tr>\n"
);
83
echo(
" <td colspan=\"2\">\n"
);
84
85
foreach
( $this->buttons as $b )
86
{
87
if
($b->name ==
'submit'
)
88
{
89
$b->name=
'enviar'
;
90
}
91
$b->Generate();
92
}
93
94
if
( $this->reset )
95
{
96
echo(
" <input type=\"reset\">\n"
);
97
}
98
99
if
( $this->
return
)
100
{
101
echo(
" <input name=\"return\" type=\"button\" value=\"Retornar\" onclick=\"javascript:history.go(-1)\">\n"
);
102
}
103
104
if
( $hidden )
105
{
106
echo(
" <!-- HIDDEN FIELDS -->\n"
);
107
108
foreach
( $hidden as $f )
109
{
110
echo(
" "
);
111
$f->Generate();
112
echo(
"\n"
);
113
}
114
}
115
116
foreach
($this->pages as
$page
=>
$fields
)
117
{
118
if
(
$page
!= $currpage)
119
{
120
foreach
(
$fields
as $f)
121
{
122
echo(
" <input type='hidden' name='{$f->name}' value='{$f->value}'>\n"
);
123
}
124
}
125
}
126
127
echo(
" </td>\n"
);
128
echo(
" </tr>\n"
);
129
echo(
"</table>\n"
);
130
}
131
132
echo(
" <input type='hidden' name='frm_currpage_' value='$currpage'>\n"
);
133
echo(
"<br/>\n"
);
134
}
135
136
137
}
138
139
?>
MComponent\$page
$page
Definição
mcomponent.class:12
MForm
Definição
mform.class:9
MForm\$action
$action
Definição
mform.class:18
MForm\$fields
$fields
Definição
mform.class:33
MForm\$title
$title
Definição
mform.class:13
MIndexedForm
Definição
mindexedform.class:3
MIndexedForm\$pages
$pages
Definição
mindexedform.class:4
MIndexedForm\AddPage
AddPage($title, $fields)
Definição
mindexedform.class:11
MIndexedForm\__construct
__construct($title='', $action='')
Definição
mindexedform.class:6
MIndexedForm\GenerateIndexPage
GenerateIndexPage()
Definição
mindexedform.class:28
MIndexedForm\GenerateBody
GenerateBody()
Definição
mindexedform.class:40
classes
ui
controls
mindexedform.class
Gerado por
1.10.0