| Current Path : /var/www/cesa.co.za/members/inc/ |
| Current File : /var/www/cesa.co.za/members/inc/viewcal.inc |
<?php
if(!$currYear) { $currYear = gmdate ("Y", time()+7200); }
if(!$currMonth) { $currMonth = gmdate ("n", time()+7200); }
if(!$currDay) { $currDay = gmdate ("j", time()+7200); }
$this_date = $currYear . "-" . sprintf("%02d", $currMonth) . "-" . sprintf("%02d", $currDay);
?>
<table border="0" cellpadding="5" cellspacing="1" width="500">
<?
$connection = mysql_connect($server, $user, $pass);
$query = "SELECT * from calendar WHERE date='$this_date' AND (userid='$loginid' OR userid='saace_evt') order by time";
$result = mysql_db_query($db,$query,$connection);
if(mysql_num_rows($result) > 0)
{
?>
<tr>
<td class=tablerow><i>Action</i></td><td align=center class=tablerow>
<i>Time</i>
</td>
<td align=left class=tablerow>
<i>Description</i>
</td>
</tr>
<?
// get the list of appointments
while($row = mysql_fetch_array($result))
{
$thisuserid = $row["userid"];
$this_time = $row["time"];
$comment = $row["comment"];
$comment = str_replace("\n", "<br>", $comment);
$id = $row["id"];
?>
<tr>
<?php
if ($loginid == $thisuserid) {
?>
<td class=tablerow><a href="calendar.php4?cfun=edit&id=<? echo $id; ?>&currYear=<? echo $currYear; ?>&currMonth=<? echo $currMonth; ?>&currDay=<? echo $currDay; ?>">edit</a> <a href="calendar.php4?cfun=delete&id=<? echo $id; ?>&currYear=<? echo $currYear; ?>&currMonth=<? echo $currMonth; ?>&currDay=<? echo $currDay; ?>">delete</a></td>
<?php
} else {
?>
<td class=tablerow>none allowed</td>
<?php
}
?>
<td class=tablerow align=center valign=top><? echo substr($this_time,0,5); ?></td>
<td class=tablerow align=left valign=top><? echo $comment; ?></td>
</tr>
<?
}
// close connection
mysql_close($connection);
}
else
{
?>
<tr>
<td class=tablerow align=center colspan=2>
<i>Nothing scheduled</i>
</td>
</tr>
<?
}
?>
<tr>
<td></td><td></td>
<td class=tablerow align=left>
<a href="calendar.php4?cfun=add&currYear=<? echo $currYear; ?>&currMonth=<? echo $currMonth; ?>&currDay=<? echo $currDay; ?>">add an appointment for <?php echo $currYear."-".$currMonth."-".$currDay; ?></a>
</td>
</tr>
<tr><td width="50"><img src="/pics/spacer.gif" height="1" width="50" alt=""></td><td width="50"><img src="/pics/spacer.gif" height="1" width="50" alt=""></td><td width="400"><img src="/pics/spacer.gif" height="1" width="400" alt=""></td></tr>
</table>