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

Contents of /nfo/php/libs/org.netfrag.glib/Application/Request/HttpController.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Sun Apr 6 01:39:32 2003 UTC (21 years, 4 months ago) by jonen
Branch: MAIN
Changes since 1.4: +12 -2 lines
+ now, ask LinkBuilder for GET vars if linkbuilder-ID exists at GET var(s)

1 <?php
2
3 /**
4 * This file contains the concrete Application::Request::Http Controller class.
5 *
6 * @author Andreas Motl <andreas.motl@ilo.de>
7 * @package org.netfrag.glib
8 * @name Application::Request::HttpController
9 *
10 */
11
12 /**
13 * <b>Cvs-Log:</b>
14 *
15 * <pre>
16 * $Id: HttpController.php,v 1.4 2003/03/11 01:22:22 joko Exp $
17 *
18 * $Log: HttpController.php,v $
19 * Revision 1.4 2003/03/11 01:22:22 joko
20 * + fixed metadata for phpDocumentor
21 *
22 * Revision 1.3 2003/03/05 18:54:42 joko
23 * updated docu - phpDocumentor is very strict about its 'blocks'...
24 *
25 * Revision 1.2 2003/03/03 21:13:59 joko
26 * + request translation
27 * mungled namespaces
28 * - purged old code
29 *
30 * Revision 1.1 2003/03/01 21:11:18 joko
31 * + initial commit
32 * </pre>
33 *
34 */
35
36
37 /**
38 * This requires the Application::Request::BaseController base class
39 *
40 */
41 loadModule('Application::Request::BaseController');
42
43 /**
44 * --- Application::Request::HttpController
45 *
46 * Responsible for GET and POST argument handling.
47 * Does an array_join_merge for now.
48 *
49 * @author Andreas Motl <andreas.motl@ilo.de>
50 * @copyright (c) 2003 - All Rights reserved.
51 * @license GNU LGPL (GNU Lesser General Public License)
52 *
53 * @link http://www.netfrag.org/~joko/
54 * @link http://www.gnu.org/licenses/lgpl.txt
55 *
56 * @package org.netfrag.glib
57 * @subpackage Application
58 * @name Application::Request::HttpController
59 *
60 */
61 class Application_Request_HttpController extends Application_Request_BaseController {
62
63 /**
64 * The constructor ...
65 * ... just does nothing.
66 *
67 * @param registry
68 */
69 function Application_Request_HttpController(&$request) {
70 //print Dumper($request);
71 //exit;
72 // propagate request data
73 $this->set_request($request);
74 }
75
76 function get_request() {
77 // FIXME!?
78 if ($lbid = $_GET[lbid]) {
79 // talk to LinkBuilder...
80 $linkbuilder = new LinkBuilder();
81 return $linkbuilder->load($lbid);
82 } else {
83 return php::array_join_merge($_GET, $_POST);
84 }
85 }
86
87 function get_request_translated() {
88 return $this->translate_request($this->get_request());
89 }
90
91 function perform(&$metadata) {
92
93 $this->metadata = &$metadata;
94
95 //print "model: " . Dumper($metadata);
96 //print "request: " . Dumper($this->get_request());
97 $request_translated = $this->get_request_translated();
98
99 // trace
100 //print Dumper($request_mapped);
101 //exit;
102
103 // 2. rule it! mungle request through dispatching rules - lambda-style callbacks
104 $results = array();
105 foreach ($this->_rules as $rule) {
106 //$in = array();
107 $in = $request_translated;
108 $out = array();
109 call_user_func($rule, &$in, &$out);
110 array_push($results, array( in => $in, out => $out));
111 }
112
113 // trace
114 //print Dumper($results);
115 //exit;
116
117 // 3. merge it! merge dispatching output ($_out!)
118 $final = array();
119 foreach ($results as $result) {
120 //print Dumper($result[out]);
121 $final = php::array_join_merge($final, $result[out]);
122 }
123
124 // trace
125 //print "final: " . Dumper($final);
126 //exit;
127
128 return $final;
129
130 }
131
132
133
134 }
135
136 ?>

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