<?php
/****************************************************************************************/
/* ACollab */
/****************************************************************************************/
/* Copyright (c) 2002-2004 Adaptive Technology Resource Centre / University of Toronto */
/* */
/* http://atutor.ca/acollab */
/* */
/* This program is free software. You may redistribute it and/or */
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation; either version 2 of the License, */
/* or (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, but */
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
/* See the GNU General Public License for more details. */
/* */
/* You may access the GNU General Public License at: */
/* http://www.opensource.org/licenses/gpl-license.php */
/* */
/* You may contact the Adaptive Technology Resource Centre at */
/* Robarts Library, University of Toronto */
/* 130 St. George Street, Toronto, Ontario, Canada M5S 1A5 */
/* Further contact information is available at http://www.utoronto.ca/atrc/ */
/****************************************************************************************/
/* Programmer: */
/* Joel Kronenberg - ATRC */
/****************************************************************************************/
// $Id: events.php 347 2005-02-03 21:38:42Z shozubq $
define('AC_INCLUDE_PATH', '../include/');
require(AC_INCLUDE_PATH.'vitals.inc.php');
require(AC_INCLUDE_PATH.'lib/calendar.class.php');
authenticate(USER_CLIENT, USER_GROUP_ADMIN, USER_ADMIN);
$y = intval($_GET['y']);
$m = intval($_GET['m']);
$d = intval($_GET['d']);
$m = str_pad($m, 2, '0', STR_PAD_LEFT);
$d = str_pad($d, 2, '0', STR_PAD_LEFT);
$_SECTION[0][0] = _AC('home');
$_SECTION[0][1] = 'home.php';
$_SECTION[1][0] = _AC('events_calendar');
$_SECTION[1][1] = 'events/';
$_SECTION[2][0] = AT_date(_AC('event_date_format'), $y.'-'.$m.'-'.$d, AT_DATE_MYSQL_DATETIME);
$_SECTION[2][1] = 'events/';
require(AC_INCLUDE_PATH.'header.inc.php');
echo '<p align="center"><a href="events/add_event.php?d='.$d.SEP.'m='.$m.SEP.'y='.$y.'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">ยป '._AC('add_event').'</a></p>';
$sql = "SELECT * FROM ".TABLE_PREFIX."events WHERE group_id=$_SESSION[group_id] AND (TO_DAYS(start_date)=TO_DAYS('$y-$m-$d') OR (TO_DAYS(start_date) <= TO_DAYS('$y-$m-$d') AND TO_DAYS(end_date) >= TO_DAYS('$y-$m-$d') AND end_date<>'0000-00-00 00:00:00')) ORDER BY start_date, title";
$result = mysql_query($sql, $db);
if ($row = mysql_fetch_array($result)) {
do {
echo '<a name="'.$row['event_id'].'"></a><table cellspacing="0" cellpadding="2" width="70%" border="0" bgcolor="white" align="center" summary="" class="box2">';
echo '<tr>';
echo '<th scope="col" class="box" align="left" colspan="2">'.$row['title'].'</th>';
echo '</tr>';
echo '<tr>';
echo '<td class="row1" valign="top">'._AC('date').':</td>';
echo '<td class="row1">';
if (substr($row['start_date'], 11) == '00:00:00') {
echo AT_date(_AC('event_date_format'), $row['start_date'], AT_DATE_MYSQL_DATETIME);
} else {
echo AT_date(_AC('event_date_format_time'), $row['start_date'], AT_DATE_MYSQL_DATETIME);
}
if ($row['end_date'] != '0000-00-00 00:00:00') {
echo ' - ';
if (substr($row['end_date'], 11) == '00:00:00') {
echo AT_date(_AC('event_date_format'), $row['end_date'], AT_DATE_MYSQL_DATETIME);
} else {
echo AT_date(_AC('event_date_format_time'), $row['end_date'], AT_DATE_MYSQL_DATETIME);
}
}
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="row1" valign="top">'._AC('description').':</td>';
echo '<td class="row1" width="80%">'.$row['description'].'</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="row1" valign="top" nowrap="nowrap">'._AC('attached_files').':</td>';
echo '<td class="row1" width="80%">';
$sql = "SELECT E.file_id, F.file_name FROM ".TABLE_PREFIX."events_files E INNER JOIN ".TABLE_PREFIX."files_revisions F ON E.file_id=F.revision_id WHERE E.event_id=$row[event_id] ORDER BY file_name";
$result2 = mysql_query($sql, $db);
if ($row2 = mysql_fetch_assoc($result2)) {
echo '<a href="get_file.php?id='.$row2['file_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><img src="images/download.gif" height="24" width="20" alt="download: '.$row2['file_name'].'" class="img" border="0" /><img src="images/clr.gif" height="2" width="2" alt="" border="0" />';
echo $row2['file_name'].'</a>';
while($row2 = mysql_fetch_assoc($result2)) {
echo ', <a href="get_file.php?id='.$row2['file_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><img src="images/download.gif" height="24" width="20" alt="download: '.$row2['file_name'].'" class="img" border="0" /><img src="images/clr.gif" height="2" width="2" alt="" border="0" />';
echo $row2['file_name'].'</a>';
}
} else {
echo _AC('none');
}
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="row1" colspan="2" align="right"><small>';
if (($row['member_id'] == $_SESSION['member_id']) || authenticate(USER_GROUP_ADMIN, USER_RETURN_CHECK)) {
echo '<a href="events/edit_event.php?eid='.$row['event_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">Edit</a> | <a href="events/delete_event.php?eid='.$row['event_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">Delete</a>';
}
echo ' </small></td>';
echo '</tr>';
echo '</table><br />';
} while ($row = mysql_fetch_assoc($result));
} else {
echo '<p>'._AC('no_events_found').'</p>';
}
require(AC_INCLUDE_PATH.'footer.inc.php');
?>