summaryrefslogtreecommitdiff
path: root/utils/modules/events.php
diff options
context:
space:
mode:
authordeva <deva>2011-11-01 09:32:21 +0000
committerdeva <deva>2011-11-01 09:32:21 +0000
commit42c62cb041a2b2b95c9cda0c20fcf70334fd244c (patch)
tree38371eb37ff7348585ee84438b326c25055e2cbe /utils/modules/events.php
parent208e3b642149a9ac701a43397d31990f9b27ca79 (diff)
Rewl og krat... needs cleaning up - after port to GIT.origin
Diffstat (limited to 'utils/modules/events.php')
-rw-r--r--utils/modules/events.php47
1 files changed, 42 insertions, 5 deletions
diff --git a/utils/modules/events.php b/utils/modules/events.php
index 3bccce6..1bfcd5c 100644
--- a/utils/modules/events.php
+++ b/utils/modules/events.php
@@ -5,20 +5,23 @@ global $UTIL_DIR, $MODULES_DIR;
include_once($UTIL_DIR . "/convert.php");
include_once($UTIL_DIR . "/markdown.php");
include_once($MODULES_DIR . "/icons.php");
+include_once($UTIL_DIR . "/refs.php");
class Event {
public $title;
public $time;
public $description;
public $flyer;
+ public $refs;
public function write($fp)
{
fwrite($fp, " <event title=\"" .xmlenc($this->title) . "\"\n");
fwrite($fp, " time=\"" . xmlenc($this->time) . "\"\n");
- fwrite($fp, " flyer=\"" . xmlenc($this->flyer) . "\">");
- fwrite($fp, xmlenc($this->description));
- fwrite($fp, "</event>\n");
+ fwrite($fp, " flyer=\"" . xmlenc($this->flyer) . "\">\n");
+ fwrite($fp, " <description>".xmlenc($this->description)."</description>\n");
+ if($this->refs) $this->refs->write($fp, " ");
+ fwrite($fp, " </event>\n");
}
public function show($eventpage)
@@ -40,10 +43,17 @@ class Event {
$str .= " <img class=\"event_flyer\" alt=\"flyer\" src=\"".$icon->prefix.$icon->file."\"/>\n";
}
*/
+ if($this->refs) $str .= $this->refs->show();
+
$str .= "</div>\n";
return $str;
}
+ public function addRefs($refs)
+ {
+ $this->refs = $refs;
+ }
+
public function Event($title, $time, $description, $flyer = "")
{
$this->title = $title;
@@ -144,6 +154,8 @@ class Events {
$this->events[$vars["eventid"]]->time = DateTimeEdit::toTimestamp($vars, "time");
$this->events[$vars["eventid"]]->description = $vars["description"];
$this->events[$vars["eventid"]]->flyer = $vars["icon"];
+ $refs = refsGetRefsFromHidden($vars);
+ $this->events[$vars["eventid"]]->refs = $refs;
$this->write();
echo "\"" . $this->events[$vars["eventid"]]->title . "\" has now been edited.";
break;
@@ -151,6 +163,9 @@ class Events {
case "preview":
$event = new Event($vars["title"], DatetimeEdit::toTimestamp($vars, "time"),
$vars["description"], $vars["icon"]);
+ $refs = refsGetRefsFromWidget();
+ $event->addRefs($refs);
+
echo "<div class=\"preview\">\n";
echo "<div class=\"content\">\n";
echo $event->show($this->eventpage);
@@ -159,11 +174,13 @@ class Events {
echo "<p>Looking ok?</p>";
$form = new Form("add");
$form->addWidget(new Hidden($vars));
+ refsAddHiddenWidget($form, $refs);
$form->addWidget(new Button("yes"));
$form->render();
$form = new Form("retry");
$form->addWidget(new Hidden($vars));
+ refsAddHiddenWidget($form, $refs);
$form->addWidget(new Button("no"));
$form->render();
break;
@@ -178,13 +195,18 @@ class Events {
else $description = $this->events[$vars["eventid"]]->description;
if(isset($vars["icon"])) $icon = $vars["icon"];
else $icon = $this->events[$vars["eventid"]]->flyer;
-
+ if(isset($vars["refslist_hidden"])) $refs = refsGetFromHidden($vars);
+ else {
+ $refs = refsGetCommaListFromRefs($this->events[$vars["eventid"]]->refs);
+ }
+
$form = new Form("preview");
$form->addWidget(new Hidden($vars));
$form->addWidget(new LineEdit("Title", "title", $title));
$form->addWidget(new DateTimeEdit("Time", "time", $time));
$form->addWidget(new TextEdit("Description", "description", $description));
$form->addWidget(new ImageComboBox("Icon", "icon", $icon, new Icons($ICONS_DIR."/")));
+ refsAddWidget($form, $refs);
$form->addWidget(new Button("Update event"));
$form->render();
break;
@@ -415,10 +437,25 @@ class Events {
$this->eventpage = $events->getAttribute('eventpage');
foreach ($params as $param) {
+
+ $description = "";
+ $dess = $param->getElementsByTagName('description');
+ foreach($dess as $des) {
+ $description = $des->textContent;
+ }
+
$event = new Event($param->getAttribute('title'),
$param->getAttribute('time'),
- $param->textContent,
+ $description,
$param->getAttribute('flyer'));
+
+ $rs = $param->getElementsByTagName('refs');
+ foreach($rs as $r) {
+ $refs = new Refs($r);
+ $event->addRefs($refs);
+ break;
+ }
+
$this->add($event);
}
}