*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseController extends BaseFrameworkSystem implements Registerable {
+ // Exception constants
+ const EXCEPTION_FILTER_CHAIN_INVALID = 0xf10;
+
+ // Names of controller's own filter chains
+ const FILTER_CHAIN_PRE_COMMAND = 'controller_pre_command';
+ const FILTER_CHAIN_POST_COMMAND = 'controller_post_command';
+
/**
* Generic filter chains
*/
private $filterChains = array();
- // Exception constants
- const EXCEPTION_FILTER_CHAIN_INVALID = 0xf10;
-
/**
* Protected constructor
*
parent::__construct($className);
// Initialize both filter chains
- $this->initFilterChain('pre');
- $this->initFilterChain('post');
+ $this->initFilterChain(self::FILTER_CHAIN_PRE_COMMAND);
+ $this->initFilterChain(self::FILTER_CHAIN_POST_COMMAND);
// Add this controller to the registry
Registry::getRegistry()->addInstance('controller', $this);
*/
public function addPreFilter (Filterable $filterInstance) {
// Add the pre filter
- $this->addFilter('pre', $filterInstance);
+ $this->addFilter(self::FILTER_CHAIN_PRE_COMMAND, $filterInstance);
}
/**
*/
public function addPostFilter (Filterable $filterInstance) {
// Add the post filter
- $this->addFilter('post', $filterInstance);
+ $this->addFilter(self::FILTER_CHAIN_POST_COMMAND, $filterInstance);
}
/**
*/
protected function executePreFilters (Requestable $requestInstance, Responseable $responseInstance) {
// Execute all pre filters
- $this->executeFilters('pre', $requestInstance, $responseInstance);
+ $this->executeFilters(self::FILTER_CHAIN_PRE_COMMAND, $requestInstance, $responseInstance);
}
/**
*/
protected function executePostFilters (Requestable $requestInstance, Responseable $responseInstance) {
// Execute all post filters
- $this->executeFilters('post', $requestInstance, $responseInstance);
+ $this->executeFilters(self::FILTER_CHAIN_POST_COMMAND, $requestInstance, $responseInstance);
}
}