From 8a29936bf03ede5412d83d5541ba802259a3fc7a Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 1 Jun 2016 22:08:17 -0400 Subject: Implement add group form handler Added handler function to common model to create new use groups from the modal view. --- app/model/common.mod.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'app') diff --git a/app/model/common.mod.php b/app/model/common.mod.php index 3d8c200..07b86df 100644 --- a/app/model/common.mod.php +++ b/app/model/common.mod.php @@ -18,6 +18,7 @@ require_once "model/master.mod.php"; require_once "class/form.class.php"; require_once "class/setting.class.php"; require_once "class/user.class.php"; +require_once "class/group.class.php"; class CommonModel extends MasterModel { @@ -68,6 +69,7 @@ class CommonModel extends MasterModel { switch ($input['action']) { + case "common-group-add": $this->addNewGroup($input); break; case "common-setting-user": $this->saveSettingUser($input, $attachment); break; case "common-setting-admin": $this->saveSettingAdmin($input); break; case "common-setting-allusers-adduser": $this->saveSettingAllusersAdduser($input); break; @@ -76,6 +78,24 @@ class CommonModel extends MasterModel } } + /* + * Create a new user group + */ + function addNewGroup($input) + { + $form = new Form(); + $form->field_text("name"); + + if (!$form->populate($input)) + { + $this->logFormErrors($form); + return; + } + + $group = new Group(); + $group->createNewGroup($form->name, $this->getCurrentUser()); + } + /* * Save changes to user account settings */ -- cgit v1.2.3