MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mhistory.class
Ir para a documentação deste ficheiro.
1
<?php
2
3
class
MStackHistory
4
{
5
var
$limit
= 10;
6
var
$name
;
7
var
$base
= 0;
8
var
$top
;
9
var
$stack
;
10
11
function
__construct
(
$name
)
12
{
13
global
$MIOLO
, $$name;
14
15
$this->name =
$name
;
16
$s =
$MIOLO
->GetSession()->getValue(
$name
);
17
if
($s == NULL)
18
{
19
$this->top = -1;
20
$this->stack = array();
21
}
22
else
23
{
24
$this->top = count($s) - 1;
25
$this->stack = $s;
26
}
27
}
28
29
function
Push
($value)
30
{
31
if
(++$this->top > $this->limit)
32
{
33
++
$this->base
;
34
}
35
$this->stack[
$this->top
] = $value;
36
}
37
38
function
Pop
()
39
{
40
$value = $this->stack[
$this->top
];
41
if
(--$this->top < $this->base)
42
{
43
$this->top =
$this->base
;
44
}
45
return
$value;
46
}
47
48
function
Top
($offset = 0)
49
{
50
$n = $this->top - $offset;
51
return
($n >= $this->base) ? $this->stack[$n] : NULL;
52
}
53
54
function
Count
()
55
{
56
return
$this->top - $this->base + 1;
57
}
58
59
function
Save
()
60
{
61
global
$MIOLO
;
62
63
$this->stack = array_slice($this->stack, $this->base, $this->
Count
());
64
$this->top = $this->
Count
() - 1;
65
$MIOLO->GetSession()->setValue($this->name, $this->stack);
66
}
67
}
68
69
class
MHistory
extends
MService
70
{
71
var
$stackContext
;
72
var
$stackHistory
;
73
var
$context
;
74
75
function
__construct
(
$manager
)
76
{
77
parent::__construct();
78
$this->context =
new
StdClass;
79
$this->stackContext =
new
MStackHistory
(
'_stackContext'
);
80
$this->stackHistory =
new
MStackHistory
(
'_stackAction'
);
81
if
($this->stackContext->Count() == 0)
82
{
83
$this->context->action =
''
;
84
}
85
else
86
{
87
$this->context =
new
MContext
($this->stackContext->Top());
88
}
89
$this->
Push
($this->manager->GetCurrentUrl());
90
}
91
92
function
Push
(
$action
)
93
{
94
$this->stackHistory->Push(
$action
);
95
$context
=
new
MContext
(
$action
);
96
$this->stackContext->Push(
$context
->ComposeURL($this->manager->dispatch));
97
}
98
99
function
Pop
($stack = NULL)
100
{
101
if
(is_null($stack) || ($stack ==
'action'
))
102
{
103
$this->stackHistory->Pop();
104
}
105
if
(is_null($stack) || ($stack ==
'context'
))
106
{
107
$this->stackContext->Pop();
108
}
109
}
110
111
function
Top
($stack =
'action'
)
112
{
113
if
($stack ==
'action'
)
114
{
115
return
$this->stackHistory->Top();
116
}
117
elseif ($stack ==
'context'
)
118
{
119
return
$this->stackContext->Top();
120
}
121
}
122
123
function
Back
($stack =
'action'
)
124
{
125
if
($stack ==
'action'
)
126
{
127
return
$this->stackHistory->Top(1);
128
}
129
elseif ($stack ==
'context'
)
130
{
131
return
$this->stackContext->Top(1);
132
}
133
}
134
135
function
Close
()
136
{
137
$this->stackContext->Save();
138
$this->stackHistory->Save();
139
}
140
}
141
?>
MContext
Definição
mcontext.class:3
MHistory
Definição
mhistory.class:70
MHistory\Push
Push($action)
Definição
mhistory.class:92
MHistory\Close
Close()
Definição
mhistory.class:135
MHistory\Top
Top($stack='action')
Definição
mhistory.class:111
MHistory\Pop
Pop($stack=NULL)
Definição
mhistory.class:99
MHistory\$stackContext
$stackContext
Definição
mhistory.class:71
MHistory\$stackHistory
$stackHistory
Definição
mhistory.class:72
MHistory\Back
Back($stack='action')
Definição
mhistory.class:123
MHistory\__construct
__construct($manager)
Definição
mhistory.class:75
MHistory\$context
$context
Definição
mhistory.class:73
MService
Definição
mservice.class:7
MService\$manager
$manager
Definição
mservice.class:11
MStackHistory
Definição
mhistory.class:4
MStackHistory\__construct
__construct($name)
Definição
mhistory.class:11
MStackHistory\$stack
$stack
Definição
mhistory.class:9
MStackHistory\Count
Count()
Definição
mhistory.class:54
MStackHistory\Pop
Pop()
Definição
mhistory.class:38
MStackHistory\Push
Push($value)
Definição
mhistory.class:29
MStackHistory\$name
$name
Definição
mhistory.class:6
MStackHistory\$base
$base
Definição
mhistory.class:7
MStackHistory\$limit
$limit
Definição
mhistory.class:5
MStackHistory\Top
Top($offset=0)
Definição
mhistory.class:48
MStackHistory\Save
Save()
Definição
mhistory.class:59
MStackHistory\$top
$top
Definição
mhistory.class:8
$MIOLO
$MIOLO
Definição
mdatetimefield.class:25
$action
$action
Definição
base.php:4
classes
services
mhistory.class
Gerado por
1.10.0