*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* Setter for controller name
*
- * @param $controllerName Last validated controller name
+ * @param $controllerName Last validated controller name
* @return void
*/
protected final function setControllerName ($controllerName) {
*
* @return $controllerName Last validated controller name
*/
- protected final function getControllerName () {
+ public final function getControllerName () {
return $this->controllerName;
}
/**
* Checks wether the given controller is valid
*
- * @param $controllerName The default controller we shall execute
- * @return $isValid Wether the given controller is valid
- * @throws EmptyVariableException Thrown if the given controller is not set
+ * @param $controllerName The default controller we shall execute
+ * @return $isValid Wether the given controller is valid
+ * @throws EmptyVariableException Thrown if given controller is not set
+ * @throws DefaultControllerException Thrown if default controller was not found
*/
public function isControllerValid ($controllerName) {
// By default nothing shall be valid
));
// Try it hard to get an controller
- while (!$isValid) {
+ while ($isValid === false) {
// Is this class already loaded?
if (class_exists($this->getClassName())) {
// This class does exist. :-)
$isValid = true;
- } elseif (($this->getClassName() != "WebDefaultController") && ($this->getClassName() != "WebDefaultNewsController")) {
+ } elseif (($this->getClassName() != $this->controllerPrefix.'DefaultController') && ($this->getClassName() != $this->controllerPrefix.'DefaultNewsController')) {
// Do we have news?
if ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
// Yes, display news in home then set default controller with news
- $this->setClassName("WebDefaultNewsController");
+ $this->setClassName($this->controllerPrefix . 'DefaultNewsController');
} else {
- // No news at "home" page or non-news page
- $this->setClassName("WebDefaultController");
+ // No news at home page or non-news page
+ $this->setClassName($this->controllerPrefix . 'DefaultController');
}
} else {
// All is tried, give it up here
- throw new DefaultControllerException($this, self::EXCEPTION_DEFAUL_CONTROLLER_GONE);
+ throw new DefaultControllerException($this, self::EXCEPTION_DEFAULT_CONTROLLER_GONE);
}
} // END - while
- // Debug output
- //* DEBUG: */ $this->debugBackTrace();
-
// Return the result
return $isValid;
}