Ignore:
Timestamp:
08/15/10 18:45:12 (22 months ago)
Author:
vain
Message:
  • several changes to copyright, router, bootstrap, frontcontroller and various other files
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/dispatcher.core.php

    r4568 r4578  
    2424    * 
    2525    * @license    GNU/GPL v2 or (at your option) any later version, see "/doc/LICENSE". 
    26     * 
    27     * @author     Jens-André Koch   <vain@clansuite.com> 
    28     * @copyright  Copyleft: All rights reserved. Jens-André Koch (2005-onwards) 
    29     * 
     26    * @author     Jens-André Koch <vain@clansuite.com> 
     27    * @copyright  Jens-André Koch (2005-onwards) 
    3028    * @link       http://www.clansuite.com 
    31     * @link       http://gna.org/projects/clansuite 
    32     * 
     29    *  
    3330    * @version    SVN: $Id$ 
    3431    */ 
     
    5754class Clansuite_Dispatcher 
    5855{ 
    59     private static $found_route; 
    60  
    61     private static $actionname; 
    62     private static $modulename; 
    63     private static $submodulename; 
    64  
    65     /** 
    66      * Sets the matching route object to the dispatcher 
    67      * 
    68      * @param object $route Route Object implementing Clansuite_Route_Interface 
    69      * @return object Clansuite_Dispatcher 
    70      */ 
    71     public function setFoundRoute($route) # (Clansuite_Route_Interface $route) 
    72     { 
    73         self::$found_route = $route; 
    74  
    75         return $this; 
    76     } 
    77  
    78     /** 
    79      * Gets the matching route object from the dispatcher 
    80      * 
    81      * @return $route Route Object implementing Clansuite_Route_Interface 
    82      */ 
    83     public function getFoundRoute() 
    84     { 
    85         return self::$found_route; 
    86     } 
    87  
    8856    /** 
    8957     * The dispatcher forwards to the pagecontroller = modulecontroller + moduleaction 
    9058     */ 
    91     public function forward() 
     59    public static function forward() 
    9260    { 
    93         $route = $this->getFoundRoute(); 
     61        $route = Clansuite_HttpRequest::getRoute(); 
    9462 
    95         #$event = Clansuite_EventDispatcher::instantiate(); 
     63         #$event = Clansuite_EventDispatcher::instantiate(); 
    9664        #$event->addEventHandler('onBeforeControllerMethodCall', new Clansuite_Event_InitializeModule()); 
    97  
    98         #Clansuite_Debug::firebug($route); 
    9965 
    10066        if($route === null) 
     
    11076        $renderengine = $route->getRenderEngine(); 
    11177 
    112         #Clansuite_Debug::firebug($route); 
     78        Clansuite_Debug::firebug($route); 
    11379        #unset($route); 
    11480 
     
    13096        if(true === class_exists($classname, false)) 
    13197        { 
    132             $controllerInstance = new $classname(); 
     98            # instantiate the module controller and pass request and response object to it 
     99            $controllerInstance = new $classname( 
     100                Clansuite_CMS::getInjector()->instantiate('Clansuite_HttpRequest'), 
     101                Clansuite_CMS::getInjector()->instantiate('Clansuite_HttpResponse') 
     102            ); 
    133103        } 
    134104        else 
     
    140110         * Initialize the Module 
    141111         */ 
    142         $controllerInstance->initializeModule( 
    143                 Clansuite_CMS::getInjector()->instantiate('Clansuite_HttpRequest'), 
    144                 Clansuite_CMS::getInjector()->instantiate('Clansuite_HttpResponse') 
    145         ); 
     112        if(true === method_exists($controllerInstance, 'initializeModule')) 
     113        { 
     114            $controllerInstance->initializeModule(); 
     115        } 
     116 
     117        # @todo fix wrong position 
     118        Clansuite_Breadcrumb::initBreadcrumbs(); 
    146119 
    147120        /** 
     
    168141            throw new Clansuite_Exception('There was no action named "' . $method . '".', 2); 
    169142        } 
    170  
    171         #Clansuite_Loader::callClassMethod($class, $method, $parameters); 
    172     } 
    173  
    174     /** 
    175      * Method to set the Action 
    176      */ 
    177     public static function setActionName($actionName) 
    178     { 
    179         self::$actionName = (string) $actionName; 
    180     } 
    181  
    182     /** 
    183      * Method to get the Action 
    184      * 
    185      * @return $string 
    186      */ 
    187     public static function getActionName() 
    188     { 
    189         return self::$found_route->getMethod(); 
    190     } 
    191  
    192     /** 
    193      * Method to get the DefaultAction 
    194      * 
    195      * @return $string 
    196      */ 
    197     public static function getDefaultActionName() 
    198     { 
    199         return self::$_defaultAction; 
    200     } 
    201  
    202     /** 
    203      * Method to set the ModuleName 
    204      */ 
    205     public static function setModuleName($moduleName) 
    206     { 
    207         self::$_modulename = (string) $moduleName; 
    208     } 
    209  
    210     /** 
    211      * Method to get the ModuleName 
    212      * 
    213      * @return $string 
    214      */ 
    215     public static function getModuleName() 
    216     { 
    217         return self::$found_route->getController(); 
    218     } 
    219  
    220     /** 
    221      * Method to set the SubModuleName 
    222      */ 
    223     private static function setSubModuleName($SubModuleName) 
    224     { 
    225         self::$submodulename = (string) $SubModuleName; 
    226     } 
    227  
    228     /** 
    229      * Method to get the SubModuleName 
    230      * 
    231      * @return $string 
    232      */ 
    233     public static function getSubModuleName() 
    234     { 
    235         return self::$submodulename; 
    236143    } 
    237144} 
Note: See TracChangeset for help on using the changeset viewer.