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

Annotation of /nfo/php/libs/org.netfrag.glib/Application/RequestTracker.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Sat Mar 1 21:18:00 2003 UTC (21 years, 6 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +7 -1 lines
FILE REMOVED
- moved to Application::Request::Tracker

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

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