From 2adba6a387ac93f750cb795bb39a36077aa7b0de Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 12 Jun 2016 20:27:57 -0400 Subject: Move initialization logic from Obj model into Common model Some logic to initialize the current system object, its owner, and members has been moved into the Common model since this code will be relevant to other views and to support a new feature being added to display additional tabs in the setting modal box. --- app/model/common.mod.php | 11 ++++++++++- app/model/obj.mod.php | 9 +++------ 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/model/common.mod.php b/app/model/common.mod.php index e478e9d..232f0c2 100644 --- a/app/model/common.mod.php +++ b/app/model/common.mod.php @@ -17,6 +17,7 @@ require_once "model/master.mod.php"; require_once "class/form.class.php"; require_once "class/setting.class.php"; +require_once "class/object.class.php"; require_once "class/user.class.php"; require_once "class/group.class.php"; @@ -31,12 +32,20 @@ class CommonModel extends MasterModel /* * Constructor */ - function __construct() + function __construct($guid = null) { parent::__construct(); $this->first_setting_tab_active = 0; $this->first_setting_tab_disp = 0; $this->common_handleFormSubmissions($_REQUEST['input'], $_FILES['attachment']); + + if (!is_null($guid)) + { + $this->obj = new DBObject($guid); + $this->owner = $this->obj->getOwner(); + $this->members = $this->obj->getMembers(); + } + $this->common_deflt(); } diff --git a/app/model/obj.mod.php b/app/model/obj.mod.php index 426e1ac..159c962 100644 --- a/app/model/obj.mod.php +++ b/app/model/obj.mod.php @@ -15,18 +15,15 @@ */ require_once "model/common.mod.php"; -require_once "class/group.class.php"; class ObjModel extends CommonModel { /* - * Initialize a group view + * Constructor */ - function initGroup($guid) + function __construct($guid) { - $this->obj = new Group($guid); - $this->owner = $this->obj->getOwner(); - $this->members = $this->obj->getMembers(); + parent::__construct($guid); } } -- cgit v1.2.3