/[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.5 - (hide annotations)
Thu Mar 20 07:20:31 2003 UTC (21 years, 5 months ago) by jonen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +9 -22 lines
+ purged attic code

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

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