MIOLO20
Toggle main menu visibility
Página principal
Estruturas de dados
Estruturas de dados
Hierarquia de classes
Campos de dados
Tudo
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Funções
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variáveis
$
a
b
c
d
e
f
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Ficheiros
Lista de ficheiros
Globais
Tudo
$
_
a
c
d
e
f
g
i
l
m
o
p
r
s
u
Funções
Variáveis
$
_
c
e
f
l
m
o
p
s
Exemplos
•
Tudo
Estruturas de dados
Namespaces
Ficheiros
Funções
Variáveis
Carregando...
Procurando...
Nenhuma entrada encontrada
listcontrols.class
Ir para a documentação deste ficheiro.
1
<?php
2
class
MListControl
extends
MFormControl
3
{
4
var
$options
;
5
var
$showValues
;
6
var
$content
;
7
var
$size
;
8
var
$cols
;
9
10
function
__construct
(
$name
=
''
,
$label
=
''
,
$options
=
''
,
$showValues
=
false
,
$hint
=
''
)
11
{
12
parent::__construct(
$name
,
''
,
$label
);
13
$this->options =
$options
;
14
$this->showValues =
$showValues
;
15
$this->hint =
$hint
;
16
$this->formMode = 1;
17
}
10
function
__construct
(
$name
=
''
,
$label
=
''
,
$options
=
''
,
$showValues
=
false
,
$hint
=
''
) {
…
}
18
19
function
GenerateOptions
()
20
{
21
$content
=
''
;
22
foreach
( array_keys($this->options) as $k )
23
{
24
$o = $this->options[$k];
25
if
( $o instanceof
MOptionGroup
)
26
{
27
foreach
( $o->options as $oo )
28
{
29
$oo->SetControl($this);
30
}
31
$content
.= $o->Generate();
32
}
33
else
34
{
35
if
( $o instanceof
MOption
)
36
{
37
$oo = $o;
38
}
39
elseif ( is_array($o) )
40
{
41
list (
$value
,
$label
) = $o;
42
$oo =
new
MOption
(
''
,
$value
,
$label
);
43
}
44
else
45
{
46
$oo =
new
MOption
(
''
,$k,$o);
47
}
48
$oo->checked = ($oo->value ==
$this->value
);
49
$oo->SetControl($this);
50
$content
.= $oo->Generate();
51
}
52
}
53
return
$content
;
54
}
19
function
GenerateOptions
() {
…
}
55
56
function
getOptions
()
57
{
58
return
$this->options
;
59
}
56
function
getOptions
() {
…
}
60
}
2
class
MListControl
extends
MFormControl
{
…
};
61
62
class
MSelection
extends
MListControl
63
{
64
public
$autoPostBack
;
65
69
public
$event
;
70
public
$validator
;
71
75
private
$allowNullValue =
true
;
76
77
public
function
__construct
(
$name
=
''
,
$value
=
''
,
$label
=
''
,
$options
=array(
'Não'
,
'Sim'
),
$showValues
=
false
,
$hint
=
''
,
$size
=
''
)
78
{
79
parent::__construct(
$name
,
$label
,
$options
,
$showValues
,
$hint
,
$size
);
80
81
$MIOLO
=
MIOLO::getInstance
();
82
83
$_options =
$options
[0] ??
''
;
84
if
( is_array($_options) )
85
{
86
$options
= array_merge(array(
''
=> _M(
'--Select--'
) ),
$options
);
87
}
88
elseif ( is_array(
$options
) )
89
{
90
$options
= array(
''
=> _M(
'--Select--'
) ) +
$options
;
91
}
92
else
93
{
94
$options
= array(
''
=> _M(
'--Select--'
) );
95
}
96
97
$this->options =
$options
;
98
$this->
setValue
(
$value
);
99
$this->size =
$size
;
100
$this->autoPostBack =
false
;
101
$this->
event
=
''
;
102
}
77
public
function
__construct
(
$name
=
''
,
$value
=
''
,
$label
=
''
,
$options
=array(
'Não'
,
'Sim'
),
$showValues
=
false
,
$hint
=
''
,
$size
=
''
) {
…
}
103
104
public
function
GetOption
(
$value
)
105
{
106
foreach
( array_keys($this->options) as $k )
107
{
108
$o = $this->options[$k];
109
if
( is_array($o) )
110
{
111
list(
$id
,
$name
) = $o;
112
if
( trim(
$value
) == trim(
$id
) )
113
{
114
if
( $this->showValues )
115
{
116
$r =
$id
.
' - '
.
$name
;
117
}
118
else
119
{
120
$r =
$name
;
121
}
122
}
123
}
124
else
if
( trim(
$value
) == trim($k) )
125
{
126
if
( $this->showValues )
127
{
128
$r = $k .
' - '
. $o;
129
}
130
else
131
{
132
$r = $o;
133
}
134
}
135
}
136
137
return
$r;
138
}
104
public
function
GetOption
(
$value
) {
…
}
139
140
public
function
SetOption
($option,
$value
)
141
{
142
$this->options[$option] =
$value
;
143
}
140
public
function
SetOption
($option,
$value
) {
…
}
144
145
public
function
SetCols
(
$value
)
146
{
147
$this->cols =
$value
;
148
}
145
public
function
SetCols
(
$value
) {
…
}
149
150
public
function
SetAutoSubmit
($isAuto =
true
)
151
{
152
$this->autoPostBack = $isAuto;
153
}
150
public
function
SetAutoSubmit
($isAuto =
true
) {
…
}
154
158
public
function
setAllowNullValue
($allowNullValue =
false
)
159
{
160
$this->allowNullValue = $allowNullValue;
161
}
158
public
function
setAllowNullValue
($allowNullValue =
false
) {
…
}
162
166
public
function
getAllowNullValue
()
167
{
168
return
$this->allowNullValue;
169
}
166
public
function
getAllowNullValue
() {
…
}
170
171
public
function
GenerateInner
()
172
{
173
$selected =
false
;
174
175
if
( $this->event || $this->autoPostBack )
176
{
177
$this->AddAttribute(
'onChange'
,
" _doPostBack('{$this->event}','');"
.
"document.{$this->page->name}.submit();"
);
178
}
179
180
if
( $this->GetClass() ==
''
)
181
{
182
$this->SetClass(
'm-combo form-control form-select'
);
183
}
184
185
if
( !$this->allowNullValue )
186
{
187
unset($this->options[
''
]);
188
}
189
190
if
( $this->readonly )
191
{
192
$hidden = $this->GetRender(
'inputhidden'
);
193
$this->SetClass(
'm-readonly'
);
194
$this->AddAttribute(
'readonly'
);
195
$this->SetValue($this->
GetOption
($this->GetValue()));
196
$this->size = $this->cols ? $this->cols : strlen(trim($this->
getValue
())) + 10;
197
198
$this->name .=
'_'
;
199
$this->inner = $this->GenerateLabel() . $this->GetRender(
'inputtext'
) . $hidden;
200
}
201
else
202
{
203
$this->content = $this->
GenerateOptions
();
204
if
( $this->size !=
''
)
205
{
206
$this->AddAttribute(
'size'
, $this->size);
207
}
208
$this->inner = $this->GenerateLabel() . $this->GetRender(
'select'
);
209
}
210
}
171
public
function
GenerateInner
() {
…
}
211
212
public
function
setIsRequired
(
$isRequired
)
213
{
214
$this->
setAllowNullValue
(
false
);
215
216
return
parent::setIsRequired(
$isRequired
);
217
}
212
public
function
setIsRequired
(
$isRequired
) {
…
}
218
}
62
class
MSelection
extends
MListControl
{
…
};
219
220
class
MMultiSelection
extends
MListControl
221
{
222
var
$size
;
223
224
function
__construct
(
$name
=
''
, $values=Array(
'1'
,
'2'
,
'3'
),
225
$label
=
' '
,
$options
=Array(
'Option1'
,
'Option2'
,
'Option3'
),
226
$showValues
=
false
,
$hint
=
''
,
$size
=
'3'
)
227
{
228
parent::__construct(
$name
,
$label
,
$options
,
$showValues
,
$hint
);
229
$this->size =
$size
;
230
$this->value = $values;
// is this still necessary?
231
}
224
function
__construct
(
$name
=
''
, $values=Array(
'1'
,
'2'
,
'3'
), {
…
}
232
233
function
getName
()
234
{
235
return
(strpos($this->name,
'[]'
) !==
false
? $this->name : $this->name.
'[]'
);
236
}
233
function
getName
() {
…
}
237
238
function
GenerateInner
()
239
{
240
/*
241
* FIXME: Why does it need to echo warning messages?
242
* I can't simply change them to errors or warnings. Probably the best would be to show them on the javascript
243
* console or something.
244
*/
245
if
( $this->value && !is_array($this->value) )
246
{
247
echo $this->painter->div(
new
Div
(
''
, _M(
'Values must be a single-dimensional array'
),
'alert'
));
248
}
249
250
if
( !is_array($this->options) )
251
{
252
echo $this->painter->div(
new
Div
(
''
, _M(
'Options must be a single or multi-dimensional array'
),
'alert'
));
253
}
254
255
$this->content = $this->
GenerateOptions
();
256
$this->AddAttribute(
'multiple'
,
''
);
257
$this->AddAttribute(
'size'
, $this->size);
258
259
if
( $this->GetClass() ==
''
)
260
{
261
$this->SetClass(
'm-combo m-multi-select'
);
262
}
263
264
$this->inner = $this->GenerateLabel() . $this->GetRender(
'select'
);
265
}
238
function
GenerateInner
() {
…
}
266
}
220
class
MMultiSelection
extends
MListControl
{
…
};
267
268
class
MComboBox
extends
MSelection
269
{
270
var
$size
;
271
272
function
__construct
(
$name
=
''
,
$value
=
''
,
$label
=
''
,
$options
=
''
,
$showValues
=
false
,
$hint
=
''
,
$size
=6)
273
{
274
parent::__construct(
$name
,
$value
,
$label
,
$options
,
$hint
);
275
$this->size =
$size
;
276
if
(is_array($this->options)) {
277
reset($this->options);
278
$o = current($this->options);
279
}
280
}
272
function
__construct
(
$name
=
''
,
$value
=
''
,
$label
=
''
,
$options
=
''
,
$showValues
=
false
,
$hint
=
''
,
$size
=6) {
…
}
281
282
function
GenerateInner
()
283
{
284
285
if
( $this->readonly )
286
{
287
$this->SetClass(
'm-readonly form-control form-select'
);
288
$this->AddAttribute(
'readonly'
);
289
$this->SetValue($this->
GetOption
($this->GetValue()));
290
$this->inner = $this->GenerateLabel() . $this->GetRender(
'inputtext'
);
291
return
;
292
}
293
294
if
( $this->autoPostBack )
295
{
296
$this->AddAttribute(
'onchange'
,
"showLoading();"
.
297
"$('#m-loading-message-bg,#m-loading-message').unbind('click');"
.
298
"$('#m-loading-message-bg,#m-loading-message').prop('onclick',null);"
.
299
"_doPostBack('{$this->event}','');"
.
300
"document.{$this->page->name}.submit();"
301
);
302
}
303
304
$text =
new
MTextField
($this->name,$this->value,
''
,$this->size);
305
$text->SetAttributes($this->Attributes());
306
$text->AddAttribute(
'onChange'
,
"ComboBox_onTextChange('{$this->label}', this.form.elements['{$this->name}'],this.form.elements['{$this->name}_sel']);"
. ( $this->autoPostBack ?
" _doPostBack('{$this->event}',''); document.{$this->page->name}.submit();"
:
''
));
307
//$text->AddAttribute('onClick',"ComboBox_onTextChange('{$this->label}', this.form.elements['{$this->name}'],this.form.elements['{$this->name}_sel'])");
308
309
$select =
new
MSelection
(
"{$this->name}_sel"
,$this->value,
''
,$this->options);
310
$select->SetAttributes($this->Attributes());
311
$select->SetClass(
'm-combo m-combobox form-control form-select'
);
312
$select->AddAttribute(
'onChange'
,
"ComboBox_onSelectionChange('{$this->label}', this.form.elements['{$this->name}_sel'], this.form.elements['{$this->name}']);"
. ( $this->autoPostBack ?
" _doPostBack('{$this->event}',''); document.{$this->page->name}.submit();"
:
''
));
313
$select->AddAttribute(
'onClick'
,
"ComboBox_onSelectionChange('{$this->label}', this.form.elements['{$this->name}_sel'], this.form.elements['{$this->name}'])"
);
314
$select->addStyle(
'width'
,
'70%'
);
315
316
//$span = new Span('',array($text->Generate(),' - ',$select->Generate()));
317
//$this->inner = $this->GenerateLabel() . $span->generate();
318
$container =
new
MHContainer
(
"{$this->name}_hc"
, array($this->GenerateLabel(), $text, $select));
319
$container->addAttribute(
'style'
,
'min-width:500px'
);
320
321
$this->inner = $container->generate();
322
323
}
282
function
GenerateInner
() {
…
}
324
}
268
class
MComboBox
extends
MSelection
{
…
};
325
326
class
MDropdownMenu
extends
MDiv
327
{
328
private
$itensMenu;
329
330
public
function
__construct
(
$name
= NULL, $label =
' '
, $itensMenu = array(), $image = NULL )
331
{
332
parent::__construct(
$name
);
333
334
$this->
addStyleFile
(
'm_boxes.css'
);
335
$this->
setBoxId
( $this->GetId() );
336
$this->
setItensMenu
($itensMenu);
337
338
$buttonInner =
new
MButton
(
'btnDropwon'
.
$name
, $label,
'NONE'
, $image);
339
$buttonInner->setClass(
'dropdown-toggle'
);
340
$buttonInner->addAttribute(
'data-toggle'
,
'dropdown'
);
341
$buttonInner->addAttribute(
'data-bs-toggle'
,
'dropdown'
);
342
$fieldsInner[] = $buttonInner;
343
344
$this->
setInner
($fieldsInner);
345
}
330
public
function
__construct
(
$name
= NULL, $label =
' '
, $itensMenu = array(), $image = NULL ) {
…
}
346
347
public
function
generate
()
348
{
349
$inner
= $this->
getInnerToString
();
350
351
$inner
.=
'<ul class="dropdown-menu">'
;
352
353
foreach
($this->itensMenu as $itemMenu)
354
{
355
$inner
.=
'<li>'
. $itemMenu->generate() .
'</li>'
;
356
}
357
358
$inner
.=
'</ul>'
;
359
360
$class = $this->
getClass
() .
' dropdown'
;
361
return
'<div class="'
.$class.
'">'
.$inner.
'</div>'
;
362
}
347
public
function
generate
() {
…
}
363
364
public
function
getItensMenu
()
365
{
366
return
$this->itensMenu;
367
}
364
public
function
getItensMenu
() {
…
}
368
369
public
function
setItensMenu
($itensMenu)
370
{
371
$this->itensMenu = $itensMenu;
372
}
369
public
function
setItensMenu
($itensMenu) {
…
}
373
}
326
class
MDropdownMenu
extends
MDiv
{
…
};
374
375
class
MTagSelection
extends
MMultiSelection
376
{
377
private
$limitSelect;
378
379
function
__construct
(
$name
=
''
, $values=Array(
'1'
,
'2'
,
'3'
),
380
$label
=
' '
,
$options
=Array(
'Option1'
,
'Option2'
,
'Option3'
),
381
$showValues
=
false
,
$hint
=
''
,
$size
=
'3'
, $limitSelect =
null
)
382
{
383
parent::__construct(
$name
, $values,
$label
,
$options
,
$showValues
,
$hint
,
$size
);
384
385
$this->limitSelect = $limitSelect;
386
387
$this->
setClass
($this->
getClass
() .
' m-tag-select'
);
388
389
$this->
addAttribute
(
'title'
, _M(
"Clique para ver as opções, você pode selecionar mais de uma"
,
MIOLO::getCurrentModule
()));
390
}
379
function
__construct
(
$name
=
''
, $values=Array(
'1'
,
'2'
,
'3'
), {
…
}
391
392
public
function
GenerateInner
()
393
{
394
$options
= array();
395
if
(!is_null($this->limitSelect))
396
{
397
$options
[] =
"maximumSelectionLength: {$this->limitSelect}"
;
398
}
399
400
$optionsString = count(
$options
) > 0 ?
'{'
. implode(
', '
,
$options
) .
'}'
:
''
;
401
$this->manager->getPage()->onload(
"
402
$( document ).ready(function() {\$('#"
. $this->name .
"').select2({$optionsString});});
403
"
);
404
405
return
parent::GenerateInner();
406
}
392
public
function
GenerateInner
() {
…
}
407
408
public
function
getLimitSelect
()
409
{
410
return
$this->limitSelect;
411
}
408
public
function
getLimitSelect
() {
…
}
412
413
public
function
setLimitSelect
($limitSelect)
414
{
415
$this->limitSelect = $limitSelect;
416
}
413
public
function
setLimitSelect
($limitSelect) {
…
}
417
418
}
375
class
MTagSelection
extends
MMultiSelection
{
…
};
419
?>
Div
Definição
compatibility.class:68
MButton
Definição
buttoncontrols.class:4
MComboBox
Definição
listcontrols.class:269
MComboBox\GenerateInner
GenerateInner()
Definição
listcontrols.class:282
MComboBox\__construct
__construct($name='', $value='', $label='', $options='', $showValues=false, $hint='', $size=6)
Definição
listcontrols.class:272
MComboBox\$size
$size
Definição
listcontrols.class:270
MComponent\$name
$name
Definição
mcomponent.class:17
MControl\setBoxId
setBoxId( $id)
Definição
mcontrol.class:791
MControl\getClass
getClass()
Definição
mcontrol.class:421
MControl\setClass
setClass( $cssClass, $add=true)
Definição
mcontrol.class:398
MControl\setInner
setInner($inner)
Definição
mcontrol.class:598
MControl\addStyleFile
addStyleFile( $styleFile)
Definição
mcontrol.class:412
MControl\$inner
$inner
Definição
mcontrol.class:141
MControl\addAttribute
addAttribute( $name, $value='')
Definição
mcontrol.class:443
MControl\getInnerToString
getInnerToString()
Definição
mcontrol.class:839
MControl\$id
$id
Definição
mcontrol.class:69
MDiv
Definição
blockcontrols.class:23
MDropdownMenu
Definição
listcontrols.class:327
MDropdownMenu\__construct
__construct( $name=NULL, $label=' ', $itensMenu=array(), $image=NULL)
Definição
listcontrols.class:330
MDropdownMenu\getItensMenu
getItensMenu()
Definição
listcontrols.class:364
MDropdownMenu\generate
generate()
Definição
listcontrols.class:347
MDropdownMenu\setItensMenu
setItensMenu($itensMenu)
Definição
listcontrols.class:369
MFormControl
Definição
mformcontrol.class:4
MFormControl\$isRequired
$isRequired
Definição
mformcontrol.class:23
MFormControl\$value
$value
Definição
mformcontrol.class:6
MFormControl\$label
$label
Definição
mformcontrol.class:5
MFormControl\getValue
getValue()
Definição
mformcontrol.class:59
MFormControl\$hint
$hint
Definição
mformcontrol.class:7
MFormControl\setValue
setValue( $value)
Definição
mformcontrol.class:53
MHContainer
Definição
mcontainer.class:193
MIOLO\getCurrentModule
static getCurrentModule()
Definição
miolo.class:1066
MIOLO\getInstance
static getInstance()
Definição
miolo.class:134
MListControl
Definição
listcontrols.class:3
MListControl\$options
$options
Definição
listcontrols.class:4
MListControl\getOptions
getOptions()
Definição
listcontrols.class:56
MListControl\$showValues
$showValues
Definição
listcontrols.class:5
MListControl\$content
$content
Definição
listcontrols.class:6
MListControl\__construct
__construct($name='', $label='', $options='', $showValues=false, $hint='')
Definição
listcontrols.class:10
MListControl\$cols
$cols
Definição
listcontrols.class:8
MListControl\GenerateOptions
GenerateOptions()
Definição
listcontrols.class:19
MListControl\$size
$size
Definição
listcontrols.class:7
MMultiSelection
Definição
listcontrols.class:221
MMultiSelection\getName
getName()
Definição
listcontrols.class:233
MMultiSelection\GenerateInner
GenerateInner()
Definição
listcontrols.class:238
MMultiSelection\__construct
__construct($name='', $values=Array('1', '2', '3'), $label=' ', $options=Array('Option1', 'Option2', 'Option3'), $showValues=false, $hint='', $size='3')
Definição
listcontrols.class:224
MMultiSelection\$size
$size
Definição
listcontrols.class:222
MOptionGroup
Definição
optionscontrol.class:57
MOption
Definição
optionscontrol.class:4
MSelection
Definição
listcontrols.class:63
MSelection\SetOption
SetOption($option, $value)
Definição
listcontrols.class:140
MSelection\getAllowNullValue
getAllowNullValue()
Definição
listcontrols.class:166
MSelection\setIsRequired
setIsRequired($isRequired)
Definição
listcontrols.class:212
MSelection\$autoPostBack
$autoPostBack
Definição
listcontrols.class:64
MSelection\GenerateInner
GenerateInner()
Definição
listcontrols.class:171
MSelection\GetOption
GetOption($value)
Definição
listcontrols.class:104
MSelection\SetAutoSubmit
SetAutoSubmit($isAuto=true)
Definição
listcontrols.class:150
MSelection\$event
$event
Definição
listcontrols.class:69
MSelection\__construct
__construct($name='', $value='', $label='', $options=array( 'Não', 'Sim'), $showValues=false, $hint='', $size='')
Definição
listcontrols.class:77
MSelection\$validator
$validator
Definição
listcontrols.class:70
MSelection\setAllowNullValue
setAllowNullValue($allowNullValue=false)
Definição
listcontrols.class:158
MSelection\SetCols
SetCols($value)
Definição
listcontrols.class:145
MTagSelection
Definição
listcontrols.class:376
MTagSelection\setLimitSelect
setLimitSelect($limitSelect)
Definição
listcontrols.class:413
MTagSelection\GenerateInner
GenerateInner()
Definição
listcontrols.class:392
MTagSelection\__construct
__construct($name='', $values=Array('1', '2', '3'), $label=' ', $options=Array('Option1', 'Option2', 'Option3'), $showValues=false, $hint='', $size='3', $limitSelect=null)
Definição
listcontrols.class:379
MTagSelection\getLimitSelect
getLimitSelect()
Definição
listcontrols.class:408
MTextField
Definição
inputcontrols.class:4
$MIOLO
$MIOLO
Definição
mdatetimefield.class:25
classes
ui
controls
listcontrols.class
Gerado por
1.10.0