1 |
<? |
2 |
/* |
3 |
## ----------------------------------------------------------------------------- |
4 |
## $Id: TsPageBuilder.php,v 1.3 2003/02/27 18:06:40 joko Exp $ |
5 |
## ----------------------------------------------------------------------------- |
6 |
## $Log: TsPageBuilder.php,v $ |
7 |
## ----------------------------------------------------------------------------- |
8 |
*/ |
9 |
|
10 |
|
11 |
class Application_RequestTracker { |
12 |
|
13 |
var $data; |
14 |
|
15 |
function Application_RequestTracker() { |
16 |
session_register_safe('Application_RequestTracker_data'); |
17 |
$this->load(); |
18 |
} |
19 |
|
20 |
function load() { |
21 |
global $Application_RequestTracker_data; |
22 |
$this->data = $Application_RequestTracker_data; |
23 |
if (!is_array($this->data)) { |
24 |
$this->data = array(); |
25 |
} |
26 |
} |
27 |
|
28 |
function save() { |
29 |
global $Application_RequestTracker_data; |
30 |
$Application_RequestTracker_data = $this->data; |
31 |
} |
32 |
|
33 |
function setMark($data) { |
34 |
$this->data[history][] = $data; |
35 |
$this->setPointer(); |
36 |
$this->save(); |
37 |
} |
38 |
|
39 |
function getHistory() { |
40 |
return $this->data[history]; |
41 |
} |
42 |
|
43 |
function setPointer($explicit = null) { |
44 |
if (!$explicit) { |
45 |
$this->data[pointer] = $this->data[history][sizeof($this->data[history]) - 1]; |
46 |
} |
47 |
//print "pointer: " . Dumper($this->data[pointer]) . "<br/>"; |
48 |
} |
49 |
|
50 |
function _resetPointer() { |
51 |
unset($this->data[pointer]); |
52 |
} |
53 |
|
54 |
function getPointer() { |
55 |
return $this->data[pointer]; |
56 |
} |
57 |
|
58 |
function getPointerAsString($pointer = null) { |
59 |
if (!$pointer) { |
60 |
$pointer = $this->data[pointer]; |
61 |
} |
62 |
if (is_array($pointer[component])) { |
63 |
$s_component = "<b>component:</b> " . join(', ', $pointer[component]); |
64 |
} |
65 |
if (is_array($pointer[request])) { |
66 |
$s_request = "<b>request:</b> " . join(', ', $pointer[request]); |
67 |
} |
68 |
unset($pointer[component]); |
69 |
unset($pointer[request]); |
70 |
$buf = array(); |
71 |
foreach ($pointer as $key => $val) { |
72 |
array_push($buf, "$key=$val"); |
73 |
} |
74 |
$s_keys = "<b>keys:</b> " . join(', ', $buf); |
75 |
$pser = join( '<br/>', array( $s_keys, $s_component, $s_request ) ); |
76 |
return $pser; |
77 |
} |
78 |
|
79 |
} |
80 |
|
81 |
?> |