<?PHP
//Filename : index.php
//Description : List of upcoming events on calendar.
//Author : darc, Marty
//Last modified : 2006.12.20
include '../includes/auth.php';
include '../includes/db.php';
?>
<html>
<head>
<title>Gsys :: Calendar of Events</title>
<link href="../includes/index.css" rel="stylesheet" type="text/css">
</head>
<body class="body">
<br />
<table width="810" height="626" border="0" align="center" cellpadding="15">
<tr>
<td height="128" colspan="2"><img src="../images/eg_banner.gif" width="810" height="172"></td>
</tr>
<tr>
<td width="27%" height="488" valign="top"> <?php include '../includes/nav.inc'; ?></td>
<td width="53%">
<?php
$sql = "SELECT * FROM calendar WHERE calendar.date_time >= NOW() ORDER BY date_time";
$result = mysql_query($sql,$connection) or die(mysql_error());
?>
<center><strong>Upcoming Events</strong></center><br /><br />
<center>
<table border="1" cellpadding="4" bordercolor="#000000">
<tr>
<td align="center"><strong>Date & Time</strong></td>
<td align="center"><strong>Event</strong></td>
<td align="center"><strong>Description</strong></td>
<td align="center"><strong>Posted By</strong></td>
<td align="center"><strong>Man?</strong></td>
</tr>
<?php
while ($row =mysql_fetch_array($result))
{
$date_time = $row['date_time'];
$title = $row['title'];
$description = $row['description'];
$posted_by = $row['posted_by'];
$mandatory = $row['mandatory'];
$event_id = $row['event_id'];
echo "<tr><td align=\"center\">";
echo($date_time);
if($_SESSION[current_user] == $posted_by || $_SESSION[auth] == EC || $_SESSION[auth] == ADMIN)
echo "
<form method=\"post\" action=\"calendar_functions.php?cat=del_event\">
<input type=\"hidden\" name=\"event_id\" value=\"$event_id\">
<INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Delete\">
</form>
</td>";
echo "</td><td align=\"center\">";
echo($title);
echo "</td><td>";
echo($description);
echo "</td><td>";
echo($posted_by);
echo "</td><td>";
if($mandatory == 1)
echo "YES";
else
echo "No";
// echo "<td>
//<form method=\"post\" action=\"calendar_functions.php?cat=edit_event\">
//<input type=\"hidden\" name=\"event_id\" value=\"$event_id\">
//<INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Edit\">
//</form>
//</td>";
echo "</tr>";
}
echo "</table>";
?>
<br /><br /><br /><br />
<?php
$sql = "SELECT * FROM calendar WHERE calendar.date_time < NOW() ORDER BY date_time DESC";
$result = mysql_query($sql,$connection) or die(mysql_error());
?>
<center><strong>Past Events</strong></center><br /><br />
<center>
<center>
<table border="1" cellpadding="0" bordercolor="#000000">
<tr>
<td align="center"><strong>Date & Time</strong></td>
<td align="center"><strong>Event</strong></td>
<td align="center"><strong>Description</strong></td>
<td align="center"><strong>Posted By</strong></td>
<td align="center"><strong>Man?</strong></td>
</tr>
<?php
while ($row =mysql_fetch_array($result))
{
$date_time = $row['date_time'];
$title = $row['title'];
$description = $row['description'];
$posted_by = $row['posted_by'];
$mandatory = $row['mandatory'];
$event_id = $row['event_id'];
echo "<tr><td align=\"center\">";
echo($date_time);
if($_SESSION[current_user] == $posted_by || $_SESSION[auth] == EC || $_SESSION[auth] == ADMIN)
echo "
<form method=\"post\" action=\"calendar_functions.php?cat=del_event\">
<input type=\"hidden\" name=\"event_id\" value=\"$event_id\">
<INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Delete\">
</form>
</td>";
echo "</td><td align=\"center\">";
echo($title);
echo "</td><td>";
echo($description);
echo "</td><td>";
echo($posted_by);
echo "</td><td>";
if($mandatory == 1)
echo "YES";
else
echo "No";
// echo "<td>
//<form method=\"post\" action=\"edit_event.php\">
//<input type=\"hidden\" name=\"event_id\" value=\"$event_id\">
//<INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Edit\">
//</form>
//</td>";
echo "</tr>";
}
echo "</table>";
?>
</td>
</tr>
</table>
</body>
</html>