summaryrefslogtreecommitdiff
path: root/utils/modules
diff options
context:
space:
mode:
authordeva <deva>2009-04-30 06:46:41 +0000
committerdeva <deva>2009-04-30 06:46:41 +0000
commit812d62229a633dd93c2235e40efa84e611cc4911 (patch)
tree10f018edf5fe2973300f181615447700ba902282 /utils/modules
parente7d40c7d7f3716515cc51400704702f1dd215f7c (diff)
Editable members.
Diffstat (limited to 'utils/modules')
-rw-r--r--utils/modules/members.php76
1 files changed, 75 insertions, 1 deletions
diff --git a/utils/modules/members.php b/utils/modules/members.php
index 9877007..e5e4d91 100644
--- a/utils/modules/members.php
+++ b/utils/modules/members.php
@@ -117,6 +117,80 @@ class Members {
}
}
+ public function admin_edit($action, $vars)
+ {
+ global $MEMBERS_DIR;
+
+ switch($action) {
+ case "add":
+ $tags = array();
+ $this->members[$vars["memberid"]]->show();
+ $this->members[$vars["memberid"]]->name = $vars["name"];
+ $this->members[$vars["memberid"]]->image = $vars["image"];
+ $this->members[$vars["memberid"]]->startyear = $vars["startyear"];
+ $this->members[$vars["memberid"]]->stopyear = $vars["stopyear"];
+ $this->members[$vars["memberid"]]->tags = $tags;
+ $this->write();
+ echo "\"" . $this->members[$vars["memberid"]]->name . "\" has now been edited.";
+ break;
+
+ case "preview":
+ $tags = array();
+ $member = new Member($vars["memberid"], $vars["name"], $vars["image"],
+ $vars["startyear"], $vars["stopyear"], $tags);
+ echo "<div class=\"preview\">\n";
+ echo "<div class=\"content\">\n";
+ echo $member->show();
+ echo "</div>\n";
+ echo "</div>\n";
+ echo "<p>Looking ok?</p>";
+ $form = new Form("add");
+ $form->addWidget(new Hidden($vars));
+ $form->addWidget(new Button("yes"));
+ $form->render();
+
+ $form = new Form("retry");
+ $form->addWidget(new Hidden($vars));
+ $form->addWidget(new Button("no"));
+ $form->render();
+ break;
+
+ case "edit":
+ case "retry":
+ if(isset($vars["name"])) $name = $vars["name"];
+ else $name = $this->members[$vars["memberid"]]->name;
+ if(isset($vars["image"])) $image = $vars["image"];
+ else $image = $this->members[$vars["memberid"]]->image;
+ if(isset($vars["startyear"])) $startyear = $vars["startyear"];
+ else $startyear = $this->members[$vars["memberid"]]->startyear;
+ if(isset($vars["stopyear"])) $stopyear = $vars["stopyear"];
+ else $stopyear = $this->members[$vars["memberid"]]->stopyear;
+
+ $form = new Form("preview");
+ $form->addWidget(new Hidden($vars));
+ $form->addWidget(new LineEdit("Name", "name", $name));
+ $form->addWidget(new LineEdit("Start Year", "startyear", $startyear));
+ $form->addWidget(new LineEdit("Stop Year (if no longer a member)", "stopyear", $stopyear));
+ $form->addWidget(new ImageComboBox("Image", "image", $image, new Icons($MEMBERS_DIR."/")));
+ $form->addWidget(new Button("Preview"));
+ $form->render();
+ break;
+
+ case "select":
+ default:
+ $memberlist = array();
+ foreach($this->members as $member) {
+ $memberlist[$member->name] = sprintf("%d", $member->id);
+ }
+
+ $form = new Form("edit");
+ $form->addWidget(new ComboBox("Edit this member:", "memberid", "", $memberlist));
+ $form->addWidget(new Button("Edit..."));
+ $form->render();
+ break;
+ }
+ }
+
public function admin($sub, $action, $vars)
{
switch($sub) {
@@ -125,7 +199,7 @@ class Members {
break;
case "edit":
- // $this->admin_edit($action, $vars);
+ $this->admin_edit($action, $vars);
break;
}
}