Changeset 4578 for trunk/core/dispatcher.core.php
- Timestamp:
- 08/15/10 18:45:12 (22 months ago)
- File:
-
- 1 edited
-
trunk/core/dispatcher.core.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/dispatcher.core.php
r4568 r4578 24 24 * 25 25 * @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) 30 28 * @link http://www.clansuite.com 31 * @link http://gna.org/projects/clansuite 32 * 29 * 33 30 * @version SVN: $Id$ 34 31 */ … … 57 54 class Clansuite_Dispatcher 58 55 { 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 dispatcher67 *68 * @param object $route Route Object implementing Clansuite_Route_Interface69 * @return object Clansuite_Dispatcher70 */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 dispatcher80 *81 * @return $route Route Object implementing Clansuite_Route_Interface82 */83 public function getFoundRoute()84 {85 return self::$found_route;86 }87 88 56 /** 89 57 * The dispatcher forwards to the pagecontroller = modulecontroller + moduleaction 90 58 */ 91 public function forward()59 public static function forward() 92 60 { 93 $route = $this->getFoundRoute();61 $route = Clansuite_HttpRequest::getRoute(); 94 62 95 #$event = Clansuite_EventDispatcher::instantiate();63 #$event = Clansuite_EventDispatcher::instantiate(); 96 64 #$event->addEventHandler('onBeforeControllerMethodCall', new Clansuite_Event_InitializeModule()); 97 98 #Clansuite_Debug::firebug($route);99 65 100 66 if($route === null) … … 110 76 $renderengine = $route->getRenderEngine(); 111 77 112 #Clansuite_Debug::firebug($route);78 Clansuite_Debug::firebug($route); 113 79 #unset($route); 114 80 … … 130 96 if(true === class_exists($classname, false)) 131 97 { 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 ); 133 103 } 134 104 else … … 140 110 * Initialize the Module 141 111 */ 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(); 146 119 147 120 /** … … 168 141 throw new Clansuite_Exception('There was no action named "' . $method . '".', 2); 169 142 } 170 171 #Clansuite_Loader::callClassMethod($class, $method, $parameters);172 }173 174 /**175 * Method to set the Action176 */177 public static function setActionName($actionName)178 {179 self::$actionName = (string) $actionName;180 }181 182 /**183 * Method to get the Action184 *185 * @return $string186 */187 public static function getActionName()188 {189 return self::$found_route->getMethod();190 }191 192 /**193 * Method to get the DefaultAction194 *195 * @return $string196 */197 public static function getDefaultActionName()198 {199 return self::$_defaultAction;200 }201 202 /**203 * Method to set the ModuleName204 */205 public static function setModuleName($moduleName)206 {207 self::$_modulename = (string) $moduleName;208 }209 210 /**211 * Method to get the ModuleName212 *213 * @return $string214 */215 public static function getModuleName()216 {217 return self::$found_route->getController();218 }219 220 /**221 * Method to set the SubModuleName222 */223 private static function setSubModuleName($SubModuleName)224 {225 self::$submodulename = (string) $SubModuleName;226 }227 228 /**229 * Method to get the SubModuleName230 *231 * @return $string232 */233 public static function getSubModuleName()234 {235 return self::$submodulename;236 143 } 237 144 }
Note: See TracChangeset
for help on using the changeset viewer.
