summaryrefslogtreecommitdiffstats
path: root/app/model
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-06-01 22:08:17 -0400
committerMalf Furious <m@lfurio.us>2016-06-01 22:08:17 -0400
commit8a29936bf03ede5412d83d5541ba802259a3fc7a (patch)
tree9334fda7304fa23f0b6304ea8abc75c309019115 /app/model
parent9a0b71712bf79c22bb2b4c3f3afb2d34c38214c0 (diff)
downloadscrott-8a29936bf03ede5412d83d5541ba802259a3fc7a.tar.gz
scrott-8a29936bf03ede5412d83d5541ba802259a3fc7a.zip
Implement add group form handler
Added handler function to common model to create new use groups from the modal view.
Diffstat (limited to 'app/model')
-rw-r--r--app/model/common.mod.php20
1 files changed, 20 insertions, 0 deletions
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;
@@ -77,6 +79,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
*/
function saveSettingUser($input, $attachment)