/[cvs]/nfo/php/libs/org.netfrag.glib/Application/Request/Tracker.php
ViewVC logotype

Annotation of /nfo/php/libs/org.netfrag.glib/Application/Request/Tracker.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Mon Mar 3 21:16:41 2003 UTC (21 years, 6 months ago) by joko
Branch: MAIN
Changes since 1.1: +6 -3 lines
mungled namespaces

1 joko 1.1 <?
2     /*
3     ## -----------------------------------------------------------------------------
4 joko 1.2 ## $Id: Tracker.php,v 1.1 2003/03/01 15:30:38 joko Exp $
5 joko 1.1 ## -----------------------------------------------------------------------------
6 joko 1.2 ## $Log: Tracker.php,v $
7     ## Revision 1.1 2003/03/01 15:30:38 joko
8     ## + initial commit, refactored from Application::RequestTracker
9     ##
10 joko 1.1 ## Revision 1.2 2003/03/01 15:17:26 jonen
11     ## + explorer pointers
12     ## + new proposal for internal data structure
13     ##
14     ## Revision 1.1 2003/02/28 04:14:48 joko
15     ## + initial commit
16     ##
17     ## -----------------------------------------------------------------------------
18     */
19    
20    
21     class Application_Request_Tracker {
22    
23     // raw - $_GET and $_POST (merged)
24     var $request;
25    
26     // variables to hold some stacks and pointers - two features / specs
27     // 1. are kept persistent (session!) under the hood (automagically)
28     // 2. plugin-namespace - this applies:
29     // $this->pointers[$name][...][...] =
30     // $this->stacks[$name][...][...] =
31     //var $pointers;
32     //var $stacks;
33     var $data;
34    
35     function Application_Request_Tracker() {
36 joko 1.2 php::session_register_safe('Application_Request_Tracker_data');
37 joko 1.1 $this->load();
38     }
39    
40     function load() {
41     global $Application_Request_Tracker_data;
42     $this->data = $Application_Request_Tracker_data;
43     if (!is_array($this->data)) {
44     $this->data = array();
45     }
46     }
47    
48     function save() {
49     global $Application_Request_Tracker_data;
50     $Application_Request_Tracker_data = $this->data;
51     }
52    
53     function setMark($data) {
54     $this->data[history][] = $data;
55     $this->setPointer();
56     $this->save();
57     }
58    
59     function getHistory() {
60     return $this->data[history];
61     }
62    
63     function setPointer($explicit = null) {
64     if (!$explicit) {
65     $this->data['pointer'] = $this->data[history][sizeof($this->data[history]) - 1];
66     }
67     //print "pointer: " . Dumper($this->data[pointer]) . "<br/>";
68     }
69    
70     function _resetPointer() {
71     unset($this->data[pointer]);
72     }
73    
74     function getPointer() {
75     return $this->data[pointer];
76     }
77    
78     function getPointerAsString($pointer = null) {
79     if (!$pointer) {
80     $pointer = $this->data[pointer];
81     }
82     if (is_array($pointer[component])) {
83     $s_component = "<b>component:</b> " . join(', ', $pointer[component]);
84     }
85     if (is_array($pointer[request])) {
86     $s_request = "<b>request:</b> " . join(', ', $pointer[request]);
87     }
88     unset($pointer[component]);
89     unset($pointer[request]);
90     $buf = array();
91     foreach ($pointer as $key => $val) {
92     array_push($buf, "$key=$val");
93     }
94     $s_keys = "<b>keys:</b> " . join(', ', $buf);
95     $pser = join( '<br/>', array( $s_keys, $s_component, $s_request ) );
96     return $pser;
97     }
98    
99     function addExplorer($data) {
100     $this->data['explorer'][] = $data;
101     $this->setExplorerPointer();
102     $this->save();
103     }
104    
105     function setExplorerPointer($explicit = null) {
106     if (!$explicit) {
107     $this->data['explorer_pointer'] = $this->data['explorer'][sizeof($this->data['explorer']) - 1];
108     }
109     }
110    
111     function getExplorerPointer($pointer = null) {
112     if(!$pointer) {
113     return $this->data['explorer_pointer'];
114     }
115     }
116    
117     function resetExplorer() {
118     unset($this->data['explorer']);
119     unset($this->data['explorer_pointer']);
120     }
121    
122    
123    
124     /*
125     function register_plugin($name) {
126     // reserve slot for plugin
127     $this->pointers[$name][...][...] =
128     $this->stacks[$name][...][...] =
129     }
130     */
131    
132     }
133    
134     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed