summaryrefslogtreecommitdiff
path: root/utils/admin_events.php
blob: 058b9deeb90f994729cc385c5e71eb65eb0b9bf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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&amp;module=events&amp;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&amp;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&amp;module=events&amp;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>