diff options
Diffstat (limited to 'app/model')
-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); +} + ?> |