13 |
* $Id$ |
* $Id$ |
14 |
* |
* |
15 |
* $Log$ |
* $Log$ |
16 |
|
* Revision 1.2 2003/03/03 21:13:59 joko |
17 |
|
* + request translation |
18 |
|
* mungled namespaces |
19 |
|
* - purged old code |
20 |
|
* |
21 |
* Revision 1.1 2003/03/01 21:11:18 joko |
* Revision 1.1 2003/03/01 21:11:18 joko |
22 |
* + initial commit |
* + initial commit |
23 |
* |
* |
68 |
} |
} |
69 |
|
|
70 |
function get_request() { |
function get_request() { |
71 |
return array_join_merge($_GET, $_POST); |
return php::array_join_merge($_GET, $_POST); |
72 |
|
} |
73 |
|
|
74 |
|
function get_request_translated() { |
75 |
|
return $this->translate_request($this->get_request()); |
76 |
} |
} |
77 |
|
|
78 |
function perform(&$metadata) { |
function perform(&$metadata) { |
79 |
|
|
80 |
|
$this->metadata = &$metadata; |
81 |
|
|
82 |
//print "model: " . Dumper($metadata); |
//print "model: " . Dumper($metadata); |
83 |
//print "request: " . Dumper($this->get_request()); |
//print "request: " . Dumper($this->get_request()); |
84 |
$request_raw = $this->get_request(); |
$request_translated = $this->get_request_translated(); |
85 |
|
|
|
// 1. map it! mungle request and model together - generic processing here! |
|
|
$request_mapped = array(); |
|
|
|
|
|
// check all areas |
|
|
foreach ($metadata[areas] as $area_name) { |
|
|
$area_metadata = $metadata[area][$area_name]; |
|
|
$http_arg_key = $area_metadata[query_arg]; |
|
|
if (in_array($http_arg_key, array_keys($request_raw))) { |
|
|
$request_mapped[$area_name] = $request_raw[$http_arg_key]; |
|
|
} |
|
|
} |
|
|
|
|
86 |
// trace |
// trace |
87 |
//print Dumper($request_mapped); |
//print Dumper($request_mapped); |
88 |
//exit; |
//exit; |
89 |
|
|
|
/* |
|
|
|
|
|
// set default identifier if still empty |
|
|
if ($page_ident = $this->request['ap']) { |
|
|
$this->_pageIdent = $page_ident; |
|
|
|
|
|
} elseif ($topic_ident = $this->request['t']) { |
|
|
$this->_topicIdent = $topic_ident; |
|
|
|
|
|
} else { |
|
|
$this->_pageIdent = 'overview'; |
|
|
$this->_topicIdent = ''; |
|
|
} |
|
|
|
|
|
//print "ident: " . $this->_pageIdent . "<br>"; |
|
|
|
|
|
*/ |
|
|
|
|
90 |
// 2. rule it! mungle request through dispatching rules - lambda-style callbacks |
// 2. rule it! mungle request through dispatching rules - lambda-style callbacks |
91 |
$results = array(); |
$results = array(); |
92 |
foreach ($this->_rules as $rule) { |
foreach ($this->_rules as $rule) { |
93 |
//$in = array(); |
//$in = array(); |
94 |
$in = $request_mapped; |
$in = $request_translated; |
95 |
$out = array(); |
$out = array(); |
96 |
call_user_func($rule, &$in, &$out); |
call_user_func($rule, &$in, &$out); |
97 |
array_push($results, array( in => $in, out => $out)); |
array_push($results, array( in => $in, out => $out)); |
105 |
$final = array(); |
$final = array(); |
106 |
foreach ($results as $result) { |
foreach ($results as $result) { |
107 |
//print Dumper($result[out]); |
//print Dumper($result[out]); |
108 |
$final = array_join_merge($final, $result[out]); |
$final = php::array_join_merge($final, $result[out]); |
109 |
} |
} |
110 |
|
|
111 |
// trace |
// trace |
112 |
//print Dumper($final); |
//print "final: " . Dumper($final); |
113 |
//exit; |
//exit; |
114 |
|
|
115 |
return $final; |
return $final; |