/[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.3 - (hide annotations)
Tue Mar 11 01:22:22 2003 UTC (21 years, 6 months ago) by joko
Branch: MAIN
Changes since 1.2: +27 -1 lines
+ fixed metadata for phpDocumentor

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

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