From f8f8cd372ca2bb6498d96318c159405db13a9fab Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 22 May 2016 00:24:57 -0400 Subject: Add class constructor to Common model There are two functions that need called in the common model whenever a page is rendered. Rather than requiring all of the base MVC controllers to call them, I am placing them in a constructor for this model class. This constructor should fire automatically (since base mvc models inherit this class), unless base classes define their own constructors. I don't antisipate this happening, however in that case, they would just need to call parent::__construct(). --- app/controller/dashboard.control.php | 2 -- app/model/common.mod.php | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/controller/dashboard.control.php b/app/controller/dashboard.control.php index aa1c0bd..4ee4b38 100644 --- a/app/controller/dashboard.control.php +++ b/app/controller/dashboard.control.php @@ -14,8 +14,6 @@ class Dashboard extends Controller function handle($argv) { $mod = new DashboardModel(); - $mod->common_handleFormSubmissions($_REQUEST['input'], $_FILES['attachment']); - $mod->common_deflt(); $this->action_default($mod); } diff --git a/app/model/common.mod.php b/app/model/common.mod.php index 7630dfa..03ed54f 100644 --- a/app/model/common.mod.php +++ b/app/model/common.mod.php @@ -13,6 +13,16 @@ class CommonModel extends MasterModel "image/jpeg" ); + /* + * Constructor + */ + function __construct() + { + parent::__construct(); + $this->common_handleFormSubmissions($_REQUEST['input'], $_FILES['attachment']); + $this->common_deflt(); + } + /* * Default action */ -- cgit v1.2.3