MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mexpanddiv.class
Ir para a documentação deste ficheiro.
1
<?php
2
26
$MIOLO
=
MIOLO::getInstance
();
27
$MIOLO
->page->addScript(
'm_expanddiv.js'
);
28
29
class
MExpandDiv
extends
MDiv
30
{
34
const
STYLE_COLLAPSED
=
'mExpandDivButton mExpandDivButtonCollapsed'
;
35
const
STYLE_EXPANDED
=
'mExpandDivButton mExpandDivButtonExpanded'
;
36
const
STYLE_TEXT
=
'mExpandDivText'
;
37
41
private
$boxDiv;
42
46
private
$collapsedHeight;
47
51
private
$content;
52
56
private
$expandButton;
57
61
private
$expandedOnLoad =
false
;
62
72
public
function
__construct
(
$name
, $content, $class=NULL,
$attributes
=NULL, $collapsedHeight=
null
,
$title
=
null
)
73
{
74
$id
=
$name
?
"{$name}box"
:
'box'
. rand();
75
76
if
( !$collapsedHeight )
77
{
78
$collapsedHeight = 15;
79
}
80
81
if
(
$title
)
82
{
83
$label =
new
MLabel
(
$title
);
84
$label->setBold(
true
);
85
86
$content = array( $label,
new
MSeparator
(), $content );
87
}
88
89
// $this->setContent($content);
90
$this->collapsedHeight = $collapsedHeight;
91
$this->boxDiv =
new
MDiv
(
$id
, $content, self::STYLE_TEXT);
92
93
$onclick =
"mexpanddiv.expand('{$this->boxDiv->id}', '{$this->collapsedHeight}');"
;
94
$this->expandButton =
new
MDiv
(
"{$id}Button"
,
''
, self::STYLE_COLLAPSED, array(
'onclick'
=> $onclick));
95
96
$div[] =
new
MDiv
(
"{$id}Div"
, array( $this->expandButton, $this->boxDiv ));
97
98
parent::__construct(
$name
, $div, $class,
$attributes
);
99
}
100
104
public
function
getBox
()
105
{
106
return
$this->boxDiv;
107
}
108
112
public
function
setBox
(
$box
)
113
{
114
$this->boxDiv =
$box
;
115
}
116
120
public
function
getCollapsedHeight
()
121
{
122
return
$this->collapsedHeight;
123
}
124
128
public
function
setCollapsedHeight
($collapsedHeight)
129
{
130
$this->collapsedHeight = $collapsedHeight;
131
}
132
136
public
function
getContent2
()
137
{
138
return
$this->content;
139
}
140
148
public
function
setContent2
($content)
149
{
150
// $this->content = $content;
151
$this->content = nl2br(trim((
string
) $content));
152
}
153
157
public
function
getExpandButton
()
158
{
159
return
$this->expandButton;
160
}
161
165
public
function
setExpandButton
($expandButton)
166
{
167
$this->expandButton = $expandButton;
168
}
169
173
public
function
getExpandedOnLoad
()
174
{
175
return
$this->expandedOnLoad;
176
}
177
181
public
function
setExpandedOnLoad
($expandedOnLoad)
182
{
183
$this->expandedOnLoad = $expandedOnLoad;
184
}
185
189
public
function
generate
()
190
{
191
if
( !$this->expandedOnLoad )
192
{
193
$this->boxDiv->addStyle(
'height'
,
"{$this->collapsedHeight}px"
);
194
}
195
else
196
{
197
$this->expandButton->setClass(self::STYLE_EXPANDED);
198
}
199
200
// $this->boxDiv->setInner($this->content);
201
// $this->expandButton->addAttribute('onclick', "mexpanddiv.expand('{$this->boxDiv->id}', '{$this->collapsedHeight}');");
202
203
return
parent::generate();
204
}
205
}
206
207
?>
MComponent\$name
$name
Definição
mcomponent.class:17
MControl\$box
$box
Definição
mcontrol.class:148
MControl\$attributes
$attributes
Definição
mcontrol.class:106
MControl\$id
$id
Definição
mcontrol.class:69
MDiv
Definição
blockcontrols.class:23
MExpandDiv
Definição
mexpanddiv.class:30
MExpandDiv\setExpandedOnLoad
setExpandedOnLoad($expandedOnLoad)
Definição
mexpanddiv.class:181
MExpandDiv\getBox
getBox()
Definição
mexpanddiv.class:104
MExpandDiv\getCollapsedHeight
getCollapsedHeight()
Definição
mexpanddiv.class:120
MExpandDiv\__construct
__construct($name, $content, $class=NULL, $attributes=NULL, $collapsedHeight=null, $title=null)
Definição
mexpanddiv.class:72
MExpandDiv\setContent2
setContent2($content)
Definição
mexpanddiv.class:148
MExpandDiv\STYLE_TEXT
const STYLE_TEXT
Definição
mexpanddiv.class:36
MExpandDiv\getExpandedOnLoad
getExpandedOnLoad()
Definição
mexpanddiv.class:173
MExpandDiv\setBox
setBox($box)
Definição
mexpanddiv.class:112
MExpandDiv\setCollapsedHeight
setCollapsedHeight($collapsedHeight)
Definição
mexpanddiv.class:128
MExpandDiv\STYLE_COLLAPSED
const STYLE_COLLAPSED
Definição
mexpanddiv.class:34
MExpandDiv\STYLE_EXPANDED
const STYLE_EXPANDED
Definição
mexpanddiv.class:35
MExpandDiv\generate
generate()
Definição
mexpanddiv.class:189
MExpandDiv\getExpandButton
getExpandButton()
Definição
mexpanddiv.class:157
MExpandDiv\getContent2
getContent2()
Definição
mexpanddiv.class:136
MExpandDiv\setExpandButton
setExpandButton($expandButton)
Definição
mexpanddiv.class:165
MIOLO\getInstance
static getInstance()
Definição
miolo.class:134
MLabel
Definição
labelcontrols.class:79
MSeparator
Definição
labelcontrols.class:42
$MIOLO
$MIOLO
Definição
mexpanddiv.class:26
$title
$title
Definição
base.php:3
classes
ui
controls
mexpanddiv.class
Gerado por
1.10.0