diff options
author | Malf Furious <m@lfurio.us> | 2016-06-12 20:27:57 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2016-06-12 20:27:57 -0400 |
commit | 2adba6a387ac93f750cb795bb39a36077aa7b0de (patch) | |
tree | 2e1f6fb0a02e6945685b782dbcb689ef80a4a219 /app | |
parent | 16f84185fb4d27ffc1668ec7eeaa339428b03f83 (diff) | |
download | scrott-2adba6a387ac93f750cb795bb39a36077aa7b0de.tar.gz scrott-2adba6a387ac93f750cb795bb39a36077aa7b0de.zip |
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.
Diffstat (limited to 'app')
-rw-r--r-- | app/model/common.mod.php | 11 | ||||
-rw-r--r-- | app/model/obj.mod.php | 9 |
2 files changed, 13 insertions, 7 deletions
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); } } |