From f074bce5455ba386adc9689d4bc9e8c8287cd61a Mon Sep 17 00:00:00 2001 From: Abel Hoogeveen Date: Wed, 29 Apr 2015 19:36:38 +0200 Subject: [PATCH] Added Controller Abstract for multiple parent classes of controller --- .../Controller/controller.standard.php | 4 +- Core/System/class.abstract.controller.php | 78 +++++++++++++++++++ Core/System/class.core.php | 1 + 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 Core/System/class.abstract.controller.php diff --git a/Application/Controller/controller.standard.php b/Application/Controller/controller.standard.php index a17d212..90ebfc5 100644 --- a/Application/Controller/controller.standard.php +++ b/Application/Controller/controller.standard.php @@ -1,9 +1,9 @@ core->loadMod($module_name); + $this->parentClass = $mod->giveController($controller_type); + } + + /** + * Retrieves a value from the controller class + * @access public + * @param Any key + * @return Any value from the controller class + */ + public function __get($name) { + return $this->parentClass->$name; + } + + /** + * Sets a value in the controller class + * @access public + * @param Any key + * @param Any value + */ + public function __set($name, $value) { + $this->parentClass->$name = $value; + } + + /** + * Calls a function in the controller class + * @access public + * @param String function_name + * @param Array values + * @return Function return + */ + public function __call($name, $params) { + return call_user_func_array(array($this->parentClass, $name), $params); + } +} \ No newline at end of file diff --git a/Core/System/class.core.php b/Core/System/class.core.php index 5d40ed3..7aae968 100644 --- a/Core/System/class.core.php +++ b/Core/System/class.core.php @@ -55,6 +55,7 @@ class Core { require_once(FUZESYSPATH . "/class.abstract.event.php"); require_once(FUZESYSPATH . "/class.abstract.module.php"); require_once(FUZESYSPATH . "/class.abstract.model.php"); + require_once(FUZESYSPATH . "/class.abstract.controller.php"); require_once(FUZESYSPATH . "/class.abstract.eventPriority.php"); // Load the core classes