Changeset 4597 for trunk/core/dispatcher.core.php
- Timestamp:
- 08/22/10 19:35:26 (21 months ago)
- File:
-
- 1 edited
-
trunk/core/dispatcher.core.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/dispatcher.core.php
r4578 r4597 27 27 * @copyright Jens-André Koch (2005-onwards) 28 28 * @link http://www.clansuite.com 29 * 29 * 30 30 * @version SVN: $Id$ 31 31 */ … … 61 61 $route = Clansuite_HttpRequest::getRoute(); 62 62 63 #$event = Clansuite_EventDispatcher::instantiate();63 #$event = Clansuite_EventDispatcher::instantiate(); 64 64 #$event->addEventHandler('onBeforeControllerMethodCall', new Clansuite_Event_InitializeModule()); 65 65 … … 69 69 } 70 70 71 $filename = $route->getFilename();72 71 $classname = $route->getClassname(); 73 72 $method = $route->getMethod(); 74 73 $parameters = $route->getParameters(); 75 $request_meth = Clansuite_HttpRequest::getRequestMethod();76 $renderengine = $route->getRenderEngine();74 #$request_meth = Clansuite_HttpRequest::getRequestMethod(); 75 #$renderengine = $route->getRenderEngine(); 77 76 78 77 Clansuite_Debug::firebug($route); 79 78 #unset($route); 80 79 81 /** 82 * The file we want to call has to exists 83 */ 84 if(false === is_file($filename) ) 85 { 86 throw new Clansuite_Exception('File not found "' . $filename .'".'); 87 } 88 else 89 { 90 include $filename; 91 } 80 $controllerInstance = new $classname( 81 Clansuite_CMS::getInjector()->instantiate('Clansuite_HttpRequest'), 82 Clansuite_CMS::getInjector()->instantiate('Clansuite_HttpResponse') 83 ); 92 84 93 /** 94 * Inside this file, the correct class has to exist 95 */ 96 if(true === class_exists($classname, false)) 97 { 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 ); 103 } 104 else 105 { 106 throw new Clansuite_Exception('There was no controller named "' . $classname . '".'); 107 } 108 109 /** 110 * Initialize the Module 111 */ 85 # Initialize the Module 112 86 if(true === method_exists($controllerInstance, 'initializeModule')) 113 87 { … … 115 89 } 116 90 117 # @todo fix wrong position118 91 Clansuite_Breadcrumb::initBreadcrumbs(); 119 92 120 /** 121 * Handle Method 122 * 123 * 1) check if method exists in class (meaning the module file) -> CALL 124 * 2) check if method exists in module/actions path (command factory) -> CALL 125 * 3) if not found display error -> ERROR 126 */ 93 # Finally: dispatch to the requested controller method 127 94 if(true === method_exists($controllerInstance, $method)) 128 95 { 129 96 $controllerInstance->$method($parameters); 130 97 } 131 /*132 elseif(is_file(ROOT_MOD . $modulename.'/controller/commands/'.$methodname.'.php') === true)133 {134 # command controller factory135 # create command (by including the file of the actioncontroller)136 # example: 'modulename/controller/commands/action_show.php'137 return ROOT_MOD . $modulename.'/controller/commands/'.$methodname.'.php';138 }*/139 else # error140 {141 throw new Clansuite_Exception('There was no action named "' . $method . '".', 2);142 }143 98 } 144 99 }
Note: See TracChangeset
for help on using the changeset viewer.
