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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by joko, Sat Mar 1 21:11:18 2003 UTC revision 1.2 by joko, Mon Mar 3 21:13:59 2003 UTC
# Line 13  Line 13 
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   *   *
# Line 63  class Application_Request_HttpController Line 68  class Application_Request_HttpController
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));
# Line 124  class Application_Request_HttpController Line 105  class Application_Request_HttpController
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;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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