MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
choicecontrols.class
Ir para a documentação deste ficheiro.
1
<?php
2
3
class
MChoiceControl
extends
MFormControl
4
{
5
public
$checked
;
6
public
$text
;
7
public
$type
;
8
9
public
function
__construct
(
$name
=
''
,
$value
=
''
,
$label
=
''
,
$checked
=
false
,
$text
= NULL,
$hint
=
''
)
10
{
11
parent::__construct(
$name
,
$value
,
$label
,
''
,
$hint
);
12
13
$this->checked =
$checked
;
14
$this->text =
$text
;
15
$this->formMode = 1;
16
}
17
18
public
function
setChecked
(
$checked
)
19
{
20
if
( ! is_bool(
$checked
) )
21
{
22
throw
new
Exception( _M(
'This method expects an boolean as parameter!'
) );
23
}
24
25
$this->checked =
$checked
;
26
}
27
28
}
29
30
31
class
MCheckBox
extends
MChoiceControl
32
{
33
function
generateInner
()
34
{
35
if
( $this->readonly )
36
{
37
return
$this->text
;
38
}
39
40
if
( $this->autoPostBack )
41
{
42
$this->
addAttribute
(
'onclick'
,
"return _doPostBack('{$this->name}:click',''); document.{$this->page->name}.submit()"
);
43
}
44
45
$this->
setClass
(
'm-checkbox-group'
);
46
$this->type =
'checkbox'
;
47
$this->inner = $this->
generateLabel
() . $this->
getRender
(
'inputcheck'
);
48
}
49
}
50
51
52
class
MRadioButton
extends
MChoiceControl
53
{
54
function
generateInner
()
55
{
56
if
( $this->readonly )
57
{
58
return
$this->text
;
59
}
60
61
if
( $this->autoPostBack )
62
{
63
$this->
addAttribute
(
'onclick'
,
"document.{$this->page->name}.submit()"
);
64
}
65
66
$this->
setClass
(
'm-radiobutton-group'
);
67
$this->type =
'radio'
;
68
$this->inner = $this->
generateLabel
() . $this->
getRender
(
'inputcheck'
);
69
}
70
}
71
72
class
MRadioOptions
extends
MHContainer
73
{
74
private
$radioLabels;
75
private
$radioButtons;
76
86
public
function
__construct
(
$name
,
$label
=
null
, $options = array(), $checkedOption =
null
)
87
{
88
if
(!is_null(
$label
))
89
{
90
$fields[] =
new
MCaptionLabel
(
$label
);
91
}
92
foreach
($options as $valueRadio => $labelRadio)
93
{
94
$fields[] = $this->radioButtons[$valueRadio] =
new
MRadioButton
(
$name
, $valueRadio,
null
, ($checkedOption == $valueRadio));
95
96
// Quando clicar na label vai disparar o radio
97
$radioLabel =
new
MLabel
(
"<strong>"
. $labelRadio .
"</strong>"
);
98
$radioLabel->addAttribute(
'onclick'
,
"$('#"
.
$name
.
"[value="
.$valueRadio.
"]').click();"
);
99
$fields[] = $this->radioLabels[] = $radioLabel;
100
}
101
102
parent::__construct(
'hct'
.
$name
, $fields);
103
104
$this->
setClass
(
'm-radio-options'
);
105
}
106
107
public
function
getRadioLabels
()
108
{
109
return
$this->radioLabels;
110
}
111
112
public
function
setRadioLabels
($radioLabels)
113
{
114
$this->radioLabels = $radioLabels;
115
}
116
117
public
function
getButtonByValue
(
$value
)
118
{
119
return
$this->radioButtons[
$value
];
120
}
121
122
public
function
getRadioButtons
()
123
{
124
return
$this->radioButtons;
125
}
126
127
public
function
setRadioButtons
($radioButtons)
128
{
129
$this->radioButtons = $radioButtons;
130
}
131
}
132
133
?>
MCaptionLabel
Definição
labelcontrols.class:104
MCheckBox
Definição
choicecontrols.class:32
MCheckBox\generateInner
generateInner()
Definição
choicecontrols.class:33
MChoiceControl
Definição
choicecontrols.class:4
MChoiceControl\$type
$type
Definição
choicecontrols.class:7
MChoiceControl\$checked
$checked
Definição
choicecontrols.class:5
MChoiceControl\__construct
__construct( $name='', $value='', $label='', $checked=false, $text=NULL, $hint='')
Definição
choicecontrols.class:9
MChoiceControl\setChecked
setChecked( $checked)
Definição
choicecontrols.class:18
MChoiceControl\$text
$text
Definição
choicecontrols.class:6
MComponent\$name
$name
Definição
mcomponent.class:17
MContainer\setClass
setClass($cssClass, $add=true)
Definição
mcontainer.class:41
MControl\setClass
setClass( $cssClass, $add=true)
Definição
mcontrol.class:398
MControl\addAttribute
addAttribute( $name, $value='')
Definição
mcontrol.class:443
MControl\getRender
getRender( $method)
Definição
mcontrol.class:833
MFormControl
Definição
mformcontrol.class:4
MFormControl\$value
$value
Definição
mformcontrol.class:6
MFormControl\$label
$label
Definição
mformcontrol.class:5
MFormControl\generateLabel
generateLabel()
Definição
mformcontrol.class:148
MFormControl\$hint
$hint
Definição
mformcontrol.class:7
MHContainer
Definição
mcontainer.class:193
MLabel
Definição
labelcontrols.class:79
MRadioButton
Definição
choicecontrols.class:53
MRadioButton\generateInner
generateInner()
Definição
choicecontrols.class:54
MRadioOptions
Definição
choicecontrols.class:73
MRadioOptions\setRadioLabels
setRadioLabels($radioLabels)
Definição
choicecontrols.class:112
MRadioOptions\getButtonByValue
getButtonByValue($value)
Definição
choicecontrols.class:117
MRadioOptions\setRadioButtons
setRadioButtons($radioButtons)
Definição
choicecontrols.class:127
MRadioOptions\getRadioButtons
getRadioButtons()
Definição
choicecontrols.class:122
MRadioOptions\getRadioLabels
getRadioLabels()
Definição
choicecontrols.class:107
MRadioOptions\__construct
__construct($name, $label=null, $options=array(), $checkedOption=null)
Definição
choicecontrols.class:86
classes
ui
controls
choicecontrols.class
Gerado por
1.10.0