MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mpage.class
Ir para a documentação deste ficheiro.
1
<?php
2
3
define(
'PAGE_ISPOSTBACK'
,
'__ISPOSTBACK'
);
4
5
class
MPage
extends
MWindow
6
{
7
public
$compliant
;
8
public
$styles
;
9
public
$styleCode
;
10
public
$scripts
;
11
public
$conditionalScripts
;
12
public
$metas
;
13
public
$favicon
;
14
public
$title
;
15
public
$action
;
16
public
$enctype
;
17
public
$isPostBack
=
false
;
18
public
$onload
;
19
public
$onsubmit
;
20
public
$hasReport
;
21
public
$state
;
22
public
$jscode
;
23
public
$goto
;
24
public
$generateMethod
=
'GenerateDefault'
;
25
public
$theme
;
26
27
function
__construct
()
28
{
29
global
$state
;
30
31
parent::__construct(
'frm'
. uniqid());
32
$this->compliant =
true
;
33
$this->enctype =
''
;
34
$this->onsubmit =
new
MStringList
();
35
$this->onload =
new
MStringList
();
36
$this->jscode =
new
MStringList
();
37
$this->styles =
new
MStringList
(
false
);
38
$this->styleCode =
new
MStringList
();
39
$this->scripts =
new
MStringList
(
false
);
40
$this->metas =
new
MStringList
();
41
42
$busTransaction =
MIOLO::getInstance
()->getBusiness(
'admin'
,
'transaction'
);
43
$nameTransaction = $busTransaction->getByAction(
MIOLO::_REQUEST
(
'action'
),
MIOLO::_REQUEST
(
'module'
));
44
$pageTitle = $this->manager->GetConf(
'theme.title'
);
45
if
(
MIOLO::getInstance
()->getConf(
'theme.main'
) !=
'smodern'
)
46
{
47
if
(strlen($nameTransaction) > 0 )
48
{
49
$pageTitle = $nameTransaction .
' - '
. $pageTitle;
50
}
51
else
if
(
MIOLO::_REQUEST
(
'action'
) ==
'main'
|| strlen(
MIOLO::_REQUEST
(
'action'
)) == 0)
52
{
53
$pageTitle =
'Home - '
. $pageTitle;
54
}
55
}
56
$this->title = $pageTitle;
57
58
$state
=
new
MState
();
59
$this->state =
$state
;
60
$this->action = $this->manager->GetCurrentURL();
61
62
$this->conditionalScripts =
new
MStringList
(
false
);
63
64
if
(
MIOLO::_REQUEST
(
'renderMethod'
) ==
'ajax'
)
65
{
66
$this->generateMethod =
'GenerateAJAX'
;
67
}
68
69
$back = $this->manager->GetHistory()->Back(
'context'
);
70
$top = $this->manager->GetHistory()->Top(
'context'
);
71
$this->
isPostBack
= ($back === $top) && (
MIOLO::_REQUEST
(
PAGE_ISPOSTBACK
) !=
''
);
72
$this->
LoadViewState
();
73
$this->
LoadPostData
();
74
$this->AddScript(
'm_common.js'
);
75
}
76
77
function
AddStyle
(
$url
, $value =
null
)
78
{
79
$url
= $this->manager->GetThemeURL(
$url
);
80
$this->styles->add(
$url
);
81
}
82
83
function
AddStyleURL
(
$url
)
84
{
85
$this->styles->add(
$url
);
86
}
87
88
function
AddStyleCode
($code)
89
{
90
$this->styleCode->add($code);
91
}
92
99
public
function
addScript
(
$url
, $module=NULL)
100
{
101
if
( $module )
102
{
103
$url
= $this->manager->getActionURL($module,
'html:scripts:'
.
$url
);
104
}
105
else
106
{
107
$url
= $this->manager->getAbsoluteURL(
'scripts/'
.
$url
);
108
}
109
110
$this->scripts->add(
$url
);
111
}
112
119
public
function
addScriptForOlderIEs
(
$url
, $module=NULL)
120
{
121
if
( $module )
122
{
123
$url
= $this->manager->getActionURL($module,
'html:scripts:'
.
$url
);
124
}
125
else
126
{
127
$url
= $this->manager->getAbsoluteURL(
'scripts/'
.
$url
);
128
}
129
130
$this->conditionalScripts->add(
"<!--[if lt IE 9]><script language=\"javascript\" type=\"text/javascript\" src=\"$url\"></script><![endif]-->"
);
131
}
132
133
function
AddMeta
(
$name
, $content)
134
{
135
$this->metas->add(
"<meta name=\"$name\" content=\"$content\">"
);
136
}
137
138
function
AddHttpEquiv
(
$name
, $content)
139
{
140
$this->metas->add(
"<meta http-equiv=\"$name\" content=\"$content\">"
);
141
}
142
143
function
GetStyles
()
144
{
145
return
$this->styles
;
146
}
147
148
function
GetStyleCode
()
149
{
150
return
$this->styleCode
;
151
}
152
153
function
SetStyles
($value)
154
{
155
$this->styles->items = is_array($value) ? $value : array( $this->manager->GetThemeURL($value) );
156
}
157
158
function
GetScripts
()
159
{
160
return
$this->scripts
;
161
}
162
163
public
function
getConditionalScripts
()
164
{
165
return
$this->conditionalScripts
;
166
}
167
168
function
GetMetas
()
169
{
170
return
$this->metas
;
171
}
172
173
function
GetOnLoad
()
174
{
175
return
$this->onload
;
176
}
177
178
function
GetOnSubmit
()
179
{
180
return
$this->onsubmit
;
181
}
182
183
function
GetJsCode
()
184
{
185
return
$this->jscode
;
186
}
187
188
function
GetTitle
()
189
{
190
return
$this->title
;
191
}
192
193
function
SetTitle
(
$title
)
194
{
195
$this->title =
$title
;
196
}
197
198
function
OnSubmit
(
$jscode
)
199
{
200
$this->onsubmit->add(
$jscode
);
201
}
202
203
function
OnLoad
(
$jscode
)
204
{
205
$this->onload->add(
$jscode
);
206
}
207
208
function
AddJsCode
(
$jscode
)
209
{
210
$this->jscode->add(
$jscode
);
211
}
212
213
function
isPostBack
()
214
{
215
return
$this->isPostBack
;
216
}
217
218
function
SetPostBack
($postback)
219
{
220
$this->
isPostBack
= $postback;
221
}
222
223
function
SetAction
(
$action
)
224
{
225
$this->action =
$action
;
226
}
227
228
function
SetEnctype
(
$enctype
)
229
{
230
$this->enctype =
$enctype
;
231
}
232
233
function
SetCompliant
($value =
true
)
234
{
235
$this->compliant = $value;
236
}
237
238
function
GetFavicon
()
239
{
240
$favicon
=
""
;
241
242
$path =
"{$this->manager->getConf('theme.favicon')}"
;
243
244
if
( file_exists($path) )
245
{
246
$favicon
=
"<link rel='icon' href='$path' />"
;
247
}
248
else
249
{
250
$path =
"{$this->manager->getConf('home.html')}/themes/{$this->id}/images/favicon.ico"
;
251
252
if
( file_exists($path) )
253
{
254
$url
= $this->manager->GetThemeURL(
"images/favicon.ico"
);
255
256
$favicon
=
"<link rel='icon' href='$url' />"
;
257
}
258
}
259
return
$favicon
;
260
}
261
262
function
Request
($vars, $component_name =
''
, $from =
'ALL'
)
263
{
264
$value =
''
;
265
if
( ($vars !=
''
) )
266
{
267
$value =
MIOLO::_REQUEST
($vars, $from);
268
if
( !isset($value) )
269
{
270
if
( !$component_name )
271
{
272
$value = $this->state->get($vars);
273
}
274
else
275
{
276
$value = $this->state->get($vars, $component_name);
277
}
278
}
279
}
280
return
$value;
281
}
282
283
function
SetViewState
($var, $value, $component_name =
''
)
284
{
285
if
( !$component_name )
286
{
287
$this->state->set($var, $value);
288
}
289
else
290
{
291
$this->state->set($var, $value, $component_name);
292
}
293
}
294
295
function
GetViewState
($var, $component_name =
''
)
296
{
297
if
( !$component_name )
298
{
299
return
$this->state->get($var);
300
}
301
else
302
{
303
return
$this->state->get($var, $component_name);
304
}
305
}
306
307
function
LoadViewState
()
308
{
309
$this->state->LoadViewState();
310
}
311
312
function
SaveViewState
()
313
{
314
$this->state->SaveViewState();
315
}
316
317
function
LoadPostData
()
318
{
319
320
}
321
322
// Set a value for a client element, using DOM
323
// This method use a javascript code that is execute on response
324
public
function
setElementValue
($element, $value, $ajax =
true
)
325
{
326
$jsCode =
"document.getElementById('{$element}').value = \"{$value}\";"
;
327
$this->
addAJAXJsCode
($jsCode);
328
}
329
330
public
function
addAJAXJsCode
($jsCode)
331
{
332
echo
"<script type=\"text/javascript\"> {$jsCode} </script>"
;
333
}
334
335
function
Transfer
($module,
$action
, $item =
''
)
336
{
337
global
$MIOLO
, $context;
338
339
$this->
isPostBack
=
false
;
340
$context->Create($module,
$action
, $item);
341
$result =
$MIOLO
->InvokeHandler($module,
$action
, $item);
342
return
$result;
343
}
344
348
function
_GoTo
(
$url
)
349
{
350
$this->manager->GetSession()->freeze();
351
$this->
goto
= str_replace(
'&'
,
'&'
,
$url
);
352
$this->generateMethod =
'GenerateRedirect'
;
353
}
354
355
function
Redirect
(
$url
)
356
{
357
$this->manager->GetSession()->freeze();
358
$this->
goto
= str_replace(
'&'
,
'&'
,
$url
);
359
$this->generateMethod =
'GenerateRedirect'
;
360
}
361
362
function
Refresh
()
363
{
364
$this->
OnLoad
(
'document.'
. $this->name .
'.submit();'
);
365
}
366
367
function
Generate
()
368
{
369
$this->theme = $this->manager->GetTheme();
370
$this->
SaveViewState
();
371
$this->{$this->generateMethod}();
372
}
373
374
function
GenerateRedirect
()
375
{
376
header(
'Location:'
. $this->
goto
);
377
}
378
379
function
GenerateHeader
()
380
{
381
$this->manager->Trace(
'Page::Generate'
);
382
$this->manager->ProfileEnter(
"Page::Generate"
);
383
$this->
AddHttpEquiv
(
'Content-Type'
,
'text/html; charset=UTF-8'
);
384
$this->
AddMeta
(
'Generator'
,
'MIOLO Version '
.
MIOLO_VERSION
.
'; http://www.miolo.org.br'
);
385
386
echo $this->painter->GenerateHeader($this);
387
388
}
389
390
function
GenerateDefault
()
391
{
392
// Se não é informado para gerar o header anteriormente
393
$generateHeadersFirst = $_REQUEST[
"__GENERATEHEADERFIRST"
] ??
null
;
394
if
( $generateHeadersFirst !==
"yes"
)
395
{
396
$this->
GenerateHeader
();
397
}
398
399
$this->
AddStyle
(
'm_common.css'
);
400
401
if
( $this->manager->getConf(
'options.performance.uri_images'
) ==
'true'
)
402
{
403
$themesDir = $this->manager->getConf(
'home.themes'
);
404
$theme
= $this->manager->theme->getId();
405
$uriImagesCSS =
'm_uriimages.css'
;
406
407
if
( file_exists(
"$themesDir/$theme/$uriImagesCSS"
) )
408
{
409
$this->
addStyle
($uriImagesCSS);
410
}
411
}
412
$this->
OnLoad
(
" MIOLO_SetTitle('"
. $this->title .
"');"
);
413
$this->
OnLoad
(
" MIOLO_SetBoxPositions( );"
);
414
415
$VIEWSTATE =
new
MHiddenField
(
'__VIEWSTATE'
, $this->state->GetViewState());
416
$this->theme->AppendContent($VIEWSTATE);
417
418
$ISPOSTBACK =
new
MHiddenField
(
'__ISPOSTBACK'
);
419
$this->theme->AppendContent($ISPOSTBACK);
420
421
$EVENTTARGETVALUE =
new
MHiddenField
(
'__EVENTTARGETVALUE'
);
422
$this->theme->AppendContent($EVENTTARGETVALUE);
423
424
$EVENTARGUMENT =
new
MHiddenField
(
'__EVENTARGUMENT'
);
425
$this->theme->AppendContent($EVENTARGUMENT);
426
427
echo $this->painter->Page($this);
428
$this->manager->ProfileExit(
"Page::Generate"
);
429
$this->manager->ProfileDump();
430
}
431
432
function
GenerateAJAX
()
433
{
434
if
( $this->request(
'cpaint_returnxml'
) ==
"true"
)
435
{
436
header(
"Content-Type: text/xml"
);
437
print($this->theme->getContent()->generate());
438
}
439
elseif ( $this->theme->getContent() !=
''
)
440
{
441
$this->theme->SetElementId(
'content'
,
''
);
442
print($this->theme->GenerateElement(
'content'
));
443
}
444
}
445
}
446
447
?>
MComponent\$name
$name
Definição
mcomponent.class:17
MControl\addStyle
addStyle($name, $value)
Definição
mcontrol.class:427
MHiddenField
Definição
inputcontrols.class:123
MIOLO\_REQUEST
static _REQUEST( $vars, $from='ALL')
Definição
miolo.class:1109
MIOLO\getInstance
static getInstance()
Definição
miolo.class:134
MPage
Definição
mpage.class:6
MPage\addScriptForOlderIEs
addScriptForOlderIEs($url, $module=NULL)
Definição
mpage.class:119
MPage\GetStyles
GetStyles()
Definição
mpage.class:143
MPage\__construct
__construct()
Definição
mpage.class:27
MPage\isPostBack
isPostBack()
Definição
mpage.class:213
MPage\AddStyleCode
AddStyleCode($code)
Definição
mpage.class:88
MPage\GenerateDefault
GenerateDefault()
Definição
mpage.class:390
MPage\AddMeta
AddMeta($name, $content)
Definição
mpage.class:133
MPage\$jscode
$jscode
Definição
mpage.class:22
MPage\SetAction
SetAction($action)
Definição
mpage.class:223
MPage\SetStyles
SetStyles($value)
Definição
mpage.class:153
MPage\$favicon
$favicon
Definição
mpage.class:13
MPage\$theme
$theme
Definição
mpage.class:25
MPage\_GoTo
_GoTo($url)
Definição
mpage.class:348
MPage\GetViewState
GetViewState($var, $component_name='')
Definição
mpage.class:295
MPage\$scripts
$scripts
Definição
mpage.class:10
MPage\OnLoad
OnLoad($jscode)
Definição
mpage.class:203
MPage\OnSubmit
OnSubmit($jscode)
Definição
mpage.class:198
MPage\GetJsCode
GetJsCode()
Definição
mpage.class:183
MPage\$goto
$goto
Definição
mpage.class:23
MPage\Request
Request($vars, $component_name='', $from='ALL')
Definição
mpage.class:262
MPage\GenerateHeader
GenerateHeader()
Definição
mpage.class:379
MPage\Generate
Generate()
Definição
mpage.class:367
MPage\GetFavicon
GetFavicon()
Definição
mpage.class:238
MPage\$metas
$metas
Definição
mpage.class:12
MPage\SaveViewState
SaveViewState()
Definição
mpage.class:312
MPage\$generateMethod
$generateMethod
Definição
mpage.class:24
MPage\LoadViewState
LoadViewState()
Definição
mpage.class:307
MPage\GetOnLoad
GetOnLoad()
Definição
mpage.class:173
MPage\GetMetas
GetMetas()
Definição
mpage.class:168
MPage\GenerateRedirect
GenerateRedirect()
Definição
mpage.class:374
MPage\$hasReport
$hasReport
Definição
mpage.class:20
MPage\GetStyleCode
GetStyleCode()
Definição
mpage.class:148
MPage\Redirect
Redirect($url)
Definição
mpage.class:355
MPage\SetViewState
SetViewState($var, $value, $component_name='')
Definição
mpage.class:283
MPage\$compliant
$compliant
Definição
mpage.class:7
MPage\GetScripts
GetScripts()
Definição
mpage.class:158
MPage\getConditionalScripts
getConditionalScripts()
Definição
mpage.class:163
MPage\AddStyle
AddStyle($url, $value=null)
Definição
mpage.class:77
MPage\GetTitle
GetTitle()
Definição
mpage.class:188
MPage\$styles
$styles
Definição
mpage.class:8
MPage\Transfer
Transfer($module, $action, $item='')
Definição
mpage.class:335
MPage\SetCompliant
SetCompliant($value=true)
Definição
mpage.class:233
MPage\SetTitle
SetTitle($title)
Definição
mpage.class:193
MPage\addScript
addScript($url, $module=NULL)
Definição
mpage.class:99
MPage\setElementValue
setElementValue($element, $value, $ajax=true)
Definição
mpage.class:324
MPage\$action
$action
Definição
mpage.class:15
MPage\$conditionalScripts
$conditionalScripts
Definição
mpage.class:11
MPage\GenerateAJAX
GenerateAJAX()
Definição
mpage.class:432
MPage\Refresh
Refresh()
Definição
mpage.class:362
MPage\addAJAXJsCode
addAJAXJsCode($jsCode)
Definição
mpage.class:330
MPage\GetOnSubmit
GetOnSubmit()
Definição
mpage.class:178
MPage\$onsubmit
$onsubmit
Definição
mpage.class:19
MPage\$onload
$onload
Definição
mpage.class:18
MPage\$enctype
$enctype
Definição
mpage.class:16
MPage\SetPostBack
SetPostBack($postback)
Definição
mpage.class:218
MPage\$title
$title
Definição
mpage.class:14
MPage\$isPostBack
$isPostBack
Definição
mpage.class:17
MPage\SetEnctype
SetEnctype($enctype)
Definição
mpage.class:228
MPage\$state
$state
Definição
mpage.class:21
MPage\$styleCode
$styleCode
Definição
mpage.class:9
MPage\AddHttpEquiv
AddHttpEquiv($name, $content)
Definição
mpage.class:138
MPage\AddJsCode
AddJsCode($jscode)
Definição
mpage.class:208
MPage\LoadPostData
LoadPostData()
Definição
mpage.class:317
MPage\AddStyleURL
AddStyleURL($url)
Definição
mpage.class:83
MState
Definição
mstate.class:3
MStringList
Definição
mlist.class:99
MWindow
Definição
mwindow.class:3
$MIOLO
$MIOLO
Definição
mdatetimefield.class:25
MIOLO_VERSION
const MIOLO_VERSION
Definição
miolo.class:3
PAGE_ISPOSTBACK
const PAGE_ISPOSTBACK
Definição
mpage.class:3
$url
$url
Definição
base.php:2
classes
ui
controls
mpage.class
Gerado por
1.10.0