summaryrefslogtreecommitdiffstats
path: root/app/model/datamods.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/model/datamods.php')
-rw-r--r--app/model/datamods.php27
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);
+}
+
?>