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

Diff of /nfo/php/libs/org.netfrag.glib/Application/Request/BaseController.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:12:55 2003 UTC
# Line 13  Line 13 
13   * $Id$   * $Id$
14   *   *
15   * $Log$   * $Log$
16     * Revision 1.2  2003/03/03 21:12:55  joko
17     * split up processing into more steps
18     *
19   * Revision 1.1  2003/03/01 21:11:18  joko   * Revision 1.1  2003/03/01 21:11:18  joko
20   * + initial commit   * + initial commit
21   *   *
# Line 78  class Application_Request_BaseController Line 81  class Application_Request_BaseController
81    }    }
82    */    */
83    
84      function get_request() {
85        $this->_abstract_method('get_request');
86      }
87    
88      function get_request_translated() {
89        $this->_abstract_method('get_request_translated');
90      }
91    
92      /*
93      function translate_request() {
94        $this->_abstract_method('translate_request');
95      }
96      */
97    
98      function translate_request($request_raw) {
99    
100        // 1. map it! mungle request and model together - generic processing here!
101        // now: translate it! (done in concrete mvc controller now)
102        
103        $request_translated = array();
104          
105          $metadata = $this->metadata;
106          
107          // check all areas
108          foreach ($metadata[request_args] as $area_name) {
109            $area_metadata = $metadata[request_arg][$area_name];
110            if ($http_arg_key = $area_metadata[query_arg]) {
111              $this->translate_to($request_raw, $http_arg_key, $request_translated, $area_name);
112            }
113            if ($http_arg_keys = $area_metadata[query_args]) {
114              foreach ($http_arg_keys as $key) {
115                $this->translate_to($request_raw, $key, $request_translated, $area_name);
116              }
117            }
118          }
119    
120        if (!sizeof($request_translated)) {
121          user_error("MVC Error - HttpController: mapped request is empty!");
122        }
123        
124        return $request_translated;
125    
126      }
127    
128      function translate_to(&$source, $source_key, &$target, $target_key) {
129        if (in_array($source_key, array_keys($source))) {
130          $target[$target_key] = $source[$source_key];
131        }
132      }
133    
134    // called from parent context    // called from parent context
135    function set_request(&$request) {    function set_request(&$request) {
136      $this->_request = &$request;      $this->_request = &$request;
# Line 88  class Application_Request_BaseController Line 141  class Application_Request_BaseController
141      $this->_rules = &$rules;      $this->_rules = &$rules;
142    }    }
143        
144      /*
145    function &get_request() {    function &get_request() {
146      return $this->_request;      return $this->_request;
147    }    }
148      */
149            
150  }  }
151    

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