diff options
author | Malf Furious <m@lfurio.us> | 2018-09-15 09:55:44 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2018-09-15 09:55:44 -0400 |
commit | 19bf1194556bcc1ba4be4704a297c67d03e58ef5 (patch) | |
tree | f69c7117bd90b280c25e732df974c82303dec109 /app/model/datamods.php | |
parent | 11f83706e5774b417f6d8a52786e925bec88fc43 (diff) | |
download | scrott-19bf1194556bcc1ba4be4704a297c67d03e58ef5.tar.gz scrott-19bf1194556bcc1ba4be4704a297c67d03e58ef5.zip |
Implement dm-pad-add form handler
Diffstat (limited to '')
-rw-r--r-- | app/model/datamods.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/model/datamods.php b/app/model/datamods.php index 01311a8..b658314 100644 --- a/app/model/datamods.php +++ b/app/model/datamods.php @@ -13,7 +13,10 @@ */ require_once "class/form.class.php"; +require_once "class/agent.class.php"; +require_once "class/user.class.php"; require_once "class/group.class.php"; +require_once "class/pad.class.php"; /* * Action: dm-group-add - New group modal @@ -29,4 +32,28 @@ if (isAction("dm-group-add")) $group = group::initNew($form->name, user::getCurrent()); } +/* + * Action: dm-pad-add - New pad modal + */ +if (isAction("dm-pad-add")) +{ + $form = new form(); + $form->text("owner"); + $form->text("name"); + + if (!$form->populate(input())) + return; + + $owner = agent::getAgentObj($form->owner); + $user = user::getCurrent(); + + if (!$user->canCreateSub($owner)) + { + logError(ERROR, "You do not have permission to create a pad for '" . $owner->getDisplayName() . "'"); + return; + } + + $pad = pad::initNew($form->name, $owner); +} + ?> |