| @@ -84,8 +84,22 @@ | ||
| 84 | 84 | * put your comment there... |
| 85 | 85 | * |
| 86 | 86 | * @var mixed |
| 87 | 87 | */ |
| 88 | + protected $overrideControllersPath = null; | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * put your comment there... | |
| 92 | + * | |
| 93 | + * @var mixed | |
| 94 | + */ | |
| 95 | + protected $overrideControllersPrefix = null; | |
| 96 | + | |
| 97 | + /** | |
| 98 | + * put your comment there... | |
| 99 | + * | |
| 100 | + * @var mixed | |
| 101 | + */ | |
| 88 | 102 | protected $pageId = CJTPlugin::PLUGIN_REQUEST_ID; |
| 89 | 103 | |
| 90 | 104 | /** |
| 91 | 105 | * put your comment there... |
| @@ -93,10 +107,16 @@ | ||
| 93 | 107 | */ |
| 94 | 108 | public function __construct($defaultController = 'blocks') { |
| 95 | 109 | // Initialize Hookable. |
| 96 | 110 | parent::__construct(); |
| 111 | + // Overrides controllers path using current Access Point model class path | |
| 112 | + $accessPointClassLoader =& CJT_Framework_Autoload_Loader::findClassLoader(get_class($this)); | |
| 113 | + if ($accessPointClassLoader) { | |
| 114 | + $this->overrideControllersPath = $accessPointClassLoader->getPath() . DIRECTORY_SEPARATOR . 'controllers'; | |
| 115 | + $this->overrideControllersPrefix = $accessPointClassLoader->getPrefix(); | |
| 116 | + } | |
| 97 | 117 | // Initialize! |
| 98 | - $this->controllerName = $this->ongetdefaultcontrollername($_REQUEST['controller'] ? $_REQUEST['controller'] : $defaultController); | |
| 118 | + $this->controllerName = $this->ongetdefaultcontrollername(isset($_REQUEST['controller']) ? $_REQUEST['controller'] : $defaultController); | |
| 99 | 119 | } |
| 100 | 120 | |
| 101 | 121 | /** |
| 102 | 122 | * put your comment there... |
| @@ -176,15 +196,22 @@ | ||
| 176 | 196 | * put your comment there... |
| 177 | 197 | * |
| 178 | 198 | * @param mixed $request |
| 179 | 199 | */ |
| 180 | - public function route($request = null) { | |
| 200 | + public function route($loadView = null, $request = null) { | |
| 181 | 201 | // Only loading one controller is allowed. |
| 182 | 202 | if (!$this->controller) { |
| 183 | 203 | // Import view class. |
| 184 | 204 | require_once CJTOOLBOX_MVC_FRAMEWOK . '/view.inc.php'; |
| 185 | 205 | // Instantiate controller! |
| 186 | - $this->controller = $this->onsetcontroller(CJTController::getInstance($this->controllerName, null, $request)); | |
| 206 | + $this->controller = $this->onsetcontroller( | |
| 207 | + CJTController::getInstance( | |
| 208 | + $this->controllerName, | |
| 209 | + $loadView, | |
| 210 | + $request, | |
| 211 | + $this->overrideControllersPath, | |
| 212 | + $this->overrideControllersPrefix | |
| 213 | + )); | |
| 187 | 214 | } |
| 188 | 215 | return $this->controller; |
| 189 | 216 | } |
| 190 | 217 | |