MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mtabbedform2.class
Ir para a documentação deste ficheiro.
1
<?php
2
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3
# @title
4
# Tabbed Form 2
5
#
6
# @description
7
#
8
#
9
#
10
# @topics form, tabbedform
11
#
12
# @created
13
# 2003/06/11
14
#
15
# @organisation
16
# MIOLO - Miolo Development Team - SOLIS/UNIVATES
17
#
18
# @legal
19
# CopyLeft (L) 2003 SOLIS - Cooperativa de Solucoes Livres
20
# Licensed under GPL (see COPYING.TXT or FSF at www.fsf.org for
21
# further details)
22
#
23
# @contributors
24
# Vilson Cristiano Gartner [author] [vgartner@univates.br]
25
#
26
# @maintainers
27
# Vilson Cristiano Gartner [author] [vgartner@univates.br]
28
# Thomas Spriestersbach [author] [ts@interact2000.com.br]
29
#
30
# @history
31
# See history in CVS repository:
32
# http:
//codigolivre.org.br/cvs/?group_id=70
33
#
34
# @Id $Id: tabbedform2.class,v 1.1 2003/06/17 20:04:57 vgartner Exp $
35
#---------------------------------------------------------------------
36
41
class
MTabbedForm2
extends
MForm
42
{
43
// member variables
47
var
$pages
;
48
52
var
$css
=
'tab'
;
53
54
59
// class constructor
70
function
__construct
(
$title
=
''
,
$action
=
''
)
71
{
72
parent::__construct(
$title
,
$action
);
73
$this->css =
'tab'
;
74
}
75
85
function
SetCSS
($file=
''
)
86
{
87
if
( ! $file )
88
{
89
$file =
'tab'
;
90
}
91
92
$this->css = $file;
93
}
94
95
106
function
AddPage
(
$title
,
$fields
)
107
{
108
$n = count(
$fields
);
109
110
//Add prefix 'frm_' which identifies form variables and
111
//distinguishes them from other possible variables
112
for
( $i=0; $i<$n; $i++ )
113
{
114
if
(
$fields
[$i]->name )
115
{
116
$fields
[$i]->name =
$fields
[$i]->name;
117
118
if
( is_subclass_of(
$fields
[$i],
'radiobutton'
) || is_subclass_of(
$fields
[$i],
'checkbox'
) )
119
{
120
$fields
[$i]->checked = ( $_REQUEST[
$fields
[$i]->name] ==
"{$fields[$i]->value}"
);
121
}
122
else
if
( !
$fields
[$i]->value )
123
{
124
$fields
[$i]->value = $_REQUEST[
$fields
[$i]->name];
125
}
126
127
$fields
[$i]->value = $this->EscapeValue(
$fields
[$i]->value);
128
}
129
}
130
131
$this->pages[
$title
] =
$fields
;
132
}
133
134
135
//
136
// returns a plain list of all fields contained in the form
137
//
145
function
GetFieldList
()
146
{
147
$fields
= array();
148
149
foreach
($this->pages as
$page
)
150
{
151
$fields
= array_merge(
$fields
,$this->_GetFieldList(
$page
));
152
}
153
154
return
$fields
;
155
}
156
157
158
//
159
// Generate form body
160
//
168
function
GenerateBody
()
169
{
170
// optionally generate errors
171
if
( $this->
HasErrors
() )
172
{
173
$this->
GenerateErrors
();
174
}
175
176
$hidden =
null
;
177
178
echo
'<script type="text/javascript" src="scripts/tabpane.js"></script>'
;
179
echo
"<link type=\"text/css\" rel=\"StyleSheet\" href=\"/theme/miolo/{$this->css}.css\" />"
;
180
181
echo
"<form name=\"{$this->name}\" method=\"{$this->method}\" action=\"{$this->action}\""
.
182
" onSubmit=\"return {$this->name}_onSubmit();\">\n"
;
183
184
echo
"<div class=\"tab-pane\" id=\"tab-pane-1\">\n"
;
185
$n = 0;
186
187
foreach
($this->pages as
$page
)
188
{
189
$title
= array_keys($this->pages);
190
191
echo
"<div class=\"tab-page\">\n"
;
192
echo
"<h2 class=\"tab\">"
.
$title
[$n] .
"</h2>\n"
;
193
194
//$this->LayoutFormFields($page,$hidden);
195
$this->
GenerateLayoutFields
($hidden);
196
vaR_dump($hidden);
197
198
echo
"</div>\n"
;
199
$n += 1;
200
}
201
202
echo
'<script type="text/javascript">'
;
203
echo
' setupAllTabs();'
;
204
echo
'</script>'
;
205
206
if
( $this->buttons )
207
{
208
foreach
( $this->buttons as $b )
209
{
210
$b->Generate();
211
}
212
}
213
214
if
( $this->reset )
215
{
216
echo(
" <input type=\"reset\">\n"
);
217
}
218
219
if
( $this->
return
)
220
{
221
echo(
" <input name=\"return\" type=\"button\" value=\"Retornar\" onclick=\"javascript:history.go(-1)\">\n"
);
222
}
223
224
if
( $hidden )
225
{
226
echo
" <!-- START OF HIDDEN FIELDS -->\n"
;
227
228
foreach
( $hidden as $h )
229
{
230
echo
" "
;
231
$h->Generate();
232
echo
"\n"
;
233
}
234
235
echo
" <!-- END OF HIDDEN FIELDS -->\n"
;
236
}
237
238
echo
"</form>\n"
;
239
240
$this->
GenerateScript
();
241
242
}
243
251
function
generateInner
()
252
{ global
$MIOLO
;
253
254
if
( !isset($this->buttons) )
255
{
256
if
($this->defaultButton)
257
{
258
$this->buttons[] =
new
FormButton
(
FORM_SUBMIT_BTN_NAME
,
'Enviar'
,
'SUBMIT'
);
259
}
260
}
261
//$title = HtmlPainter::GenerateToString($this->GenerateTitle());
262
$body = HtmlPainter::GenerateToString($this->
GenerateBody
());
263
$footer
= HtmlPainter::GenerateToString($this->
GenerateFooter
());
264
265
$f =
new
Div
(
''
, array(
$title
,$body,
$footer
),
'formBox'
);
266
MHtmlPainter::GenerateElements
($f);
267
}
268
269
function
generate
()
270
{
271
$this->
generateInner
();
272
}
273
274
function
generateElements
()
275
{
276
}
277
278
279
function
setCurrentPage
()
280
{
281
}
282
283
284
}
285
286
?>
Div
Definição
compatibility.class:68
FormButton
Definição
compatibility.class:72
MBasePainter\GenerateElements
GenerateElements($elements, $separator='', $method='Generate')
Definição
mbasepainter.class:29
MComponent\$page
$page
Definição
mcomponent.class:12
MForm
Definição
mform.class:9
MForm\GenerateLayoutFields
GenerateLayoutFields(&$hidden)
Definição
mform.class:1968
MForm\GenerateScript
GenerateScript()
Definição
mform.class:2242
MForm\HasErrors
HasErrors()
Definição
mform.class:1325
MForm\$action
$action
Definição
mform.class:18
MForm\$fields
$fields
Definição
mform.class:33
MForm\$footer
$footer
Definição
mform.class:58
MForm\GenerateFooter
GenerateFooter()
Definição
mform.class:1954
MForm\$title
$title
Definição
mform.class:13
MForm\GenerateErrors
GenerateErrors()
Definição
mform.class:1855
MTabbedForm2
Definição
mtabbedform2.class:42
MTabbedForm2\GetFieldList
GetFieldList()
Definição
mtabbedform2.class:145
MTabbedForm2\generateElements
generateElements()
Definição
mtabbedform2.class:274
MTabbedForm2\$pages
$pages
Definição
mtabbedform2.class:47
MTabbedForm2\SetCSS
SetCSS($file='')
Definição
mtabbedform2.class:85
MTabbedForm2\generateInner
generateInner()
Definição
mtabbedform2.class:251
MTabbedForm2\$css
$css
Definição
mtabbedform2.class:52
MTabbedForm2\setCurrentPage
setCurrentPage()
Definição
mtabbedform2.class:279
MTabbedForm2\AddPage
AddPage($title, $fields)
Definição
mtabbedform2.class:106
MTabbedForm2\generate
generate()
Definição
mtabbedform2.class:269
MTabbedForm2\__construct
__construct($title='', $action='')
Definição
mtabbedform2.class:70
MTabbedForm2\GenerateBody
GenerateBody()
Definição
mtabbedform2.class:168
$MIOLO
$MIOLO
Definição
mdatetimefield.class:25
FORM_SUBMIT_BTN_NAME
const FORM_SUBMIT_BTN_NAME
Definição
mform.class:2
classes
ui
controls
mtabbedform2.class
Gerado por
1.10.0