/[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.3 by joko, Wed Mar 5 18:54:42 2003 UTC
# Line 5  Line 5 
5   *   *
6   * @author Andreas Motl <andreas.motl@ilo.de>   * @author Andreas Motl <andreas.motl@ilo.de>
7   * @package org.netfrag.glib   * @package org.netfrag.glib
8   * @module Application::Request::HttpController   * @name Application::Request::HttpController
9   *   *
10   */   */
11    
# Line 13  Line 13 
13   * $Id$   * $Id$
14   *   *
15   * $Log$   * $Log$
16     * Revision 1.3  2003/03/05 18:54:42  joko
17     * updated docu - phpDocumentor is very strict about its 'blocks'...
18     *
19     * Revision 1.2  2003/03/03 21:13:59  joko
20     * + request translation
21     * mungled namespaces
22     * - purged old code
23     *
24   * Revision 1.1  2003/03/01 21:11:18  joko   * Revision 1.1  2003/03/01 21:11:18  joko
25   * + initial commit   * + initial commit
26   *   *
# Line 21  Line 29 
29    
30    
31  /**  /**
32   * ---   * This requires the Application::Request::BaseController base class
33     *
34     */
35    loadModule('Application::Request::BaseController');
36    
37    /**
38     * --- Application::Request::HttpController
39   *   *
40     * Responsible for GET and POST argument handling.
41     * Does an array_join_merge for now.
42   *   *
43   * @author Andreas Motl <andreas.motl@ilo.de>   * @author Andreas Motl <andreas.motl@ilo.de>
44   * @copyright (c) 2003 - All Rights reserved.   * @copyright (c) 2003 - All Rights reserved.
45   * @license GNU LGPL (GNU Lesser General Public License)   * @license GNU LGPL (GNU Lesser General Public License)
46   *   *
47   * @author-url http://www.netfrag.org/~joko/   * @link http://www.netfrag.org/~joko/
48   * @license-url http://www.gnu.org/licenses/lgpl.txt   * @link http://www.gnu.org/licenses/lgpl.txt
49   *   *
50   * @package org.netfrag.glib   * @package org.netfrag.glib
51   * @module Application::Request::HttpController   * @subpackage Application
52   *   * @name Application::Request::HttpController
  */  
   
 /**  
  * Todo:  
  *  
  *  o xyz  
  *  o bla, bli, blub  
  *  
53   *   *
54   */   */
   
   
 loadModule('Application::Request::BaseController');  
55  class Application_Request_HttpController extends Application_Request_BaseController {  class Application_Request_HttpController extends Application_Request_BaseController {
56    
57   /**   /**
# 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.3

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