diff options
Diffstat (limited to 'utils/admin_events.php')
-rw-r--r-- | utils/admin_events.php | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/utils/admin_events.php b/utils/admin_events.php new file mode 100644 index 0000000..058b9de --- /dev/null +++ b/utils/admin_events.php @@ -0,0 +1,85 @@ +<h2>Events</h2> +<?php +include_once($UTIL_DIR."/events.php"); +include_once($UTIL_DIR."/convert.php"); + +if($task == "confirmevent") { + $time = strtotime($month."/" .$day . "/" . $year);// . " " . $hour . ":" . $minute); + + $title = convert($title); + $description = convert($description); + + $event = new Event($title, $time, $description); + $event->show(); +?> +Is this correct?<br/> +<form method="post" action="?page=admin&module=events&task=postevent"> + <input name="title" type="hidden" value="<?php echo $title ?>"/> + <input name="day" type="hidden" value="<?php echo $day ?>"/> + <input name="month" type="hidden" value="<?php echo $month ?>"/> + <input name="year" type="hidden" value="<?php echo $year ?>"/> + <input name="description" type="hidden" value="<?php echo $description ?>"/> + <button type="submit">Yes</button> +</form> +<form method="post" action="?page=admin&module=events"> + <input name="title" type="hidden" value="<?php echo $title ?>"/> + <input name="day" type="hidden" value="<?php echo $day ?>"/> + <input name="month" type="hidden" value="<?php echo $month ?>"/> + <input name="year" type="hidden" value="<?php echo $year ?>"/> + <input name="description" type="hidden" value="<?php echo $description ?>"/> + <button type="submit">No</button> +</form> +<?php + $title = ""; + $day = ""; + $month = ""; + $year = ""; + $hour = ""; + $minute = ""; + $description = ""; +} +?> + +<?php +if($task == "postevent") { + $time = strtotime($month."/" .$day . "/" . $year . " 23:59:00");// . " " . $hour . ":" . $minute); + + $title = convert($title); + $description = convert($description); + + $events = new Events($DATA_DIR."/events.xml"); + $event = new Event($title, $time, $description); + $events->add($event); + $events->write(); + + echo "<p>Event posted successfully.</p>"; + $title = ""; + $day = ""; + $month = ""; + $year = ""; + $description = ""; +} +?> + +<?php +$now = time(); +if($day == "") $day = date("j", $now); +if($month =="") $month = date("n", $now); +if($year == "") $year = date("Y", $now); +?> +<div class="small_header">Post event</div> +<form method="post" action="?page=admin&module=events&task=confirmevent"> + <p> + Title: <input name="title" value="<?php echo convert($title) ?>"/> + </p> + <p> + Date: <input name="day" style="width: 20px;" value="<?php echo $day ?>"/>/ + <input name="month" style="width: 20px;" value="<?php echo $month ?>"/>- + <input name="year" style="width: 40px;" value="<?php echo $year ?>"/> + </p> + <p> + Description:<br/> + <textarea name="description"><?php echo convert($description) ?></textarea> + </p> + <button type="submit">Post event</button> +</form> |