summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/modules/pages.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/utils/modules/pages.php b/utils/modules/pages.php
index d69b9e9..99c8142 100644
--- a/utils/modules/pages.php
+++ b/utils/modules/pages.php
@@ -57,7 +57,8 @@ class Pages {
// Admin config
public $admin_title = "Pages";
- public $admin_submodules = array("Edit page" => "edit");
+ public $admin_submodules = array("Add page" => "add",
+ "Edit page" => "edit");
public function admin_edit($action, $vars)
{
@@ -115,12 +116,34 @@ class Pages {
}
}
+ public function admin_add($action, $vars)
+ {
+ switch($action) {
+ case "add":
+ $page = new Page($vars["title"], "");
+ $this->add($page);
+ $this->write();
+ echo "The page titled \"" . $page->title . "\" has now been added.";
+ break;
+
+ default:
+ $form = new Form("add");
+ $form->addWidget(new LineEdit("Page title (must not contain spaces or special characters)", "title", ""));
+ $form->addWidget(new Button("Add"));
+ $form->render();
+ break;
+ }
+ }
+
public function admin($sub, $action, $vars)
{
switch($sub) {
case "edit":
$this->admin_edit($action, $vars);
break;
+ case "add":
+ $this->admin_add($action, $vars);
+ break;
}
}