<?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: home.php 260 2004-06-08 18:05:33Z heidi $
define('AC_INCLUDE_PATH', 'include/');
require(AC_INCLUDE_PATH.'vitals.inc.php');
authenticate(USER_CLIENT, USER_GROUP_ADMIN, USER_ADMIN);
$_SECTION[0][0] = _AC('home');
$_SECTION[0][1] = 'home.php';
require(AC_INCLUDE_PATH.'header.inc.php');
?>
<table border="0" width="100%" cellspacing="4" cellpadding="2">
<tr>
<td width="30%" valign="top" style="border: 1px dashed #006699; padding-left: 5px; margin-right: 5px; padding-bottom: 0px;">
<h1><?php echo _AC('news_and_announcements').' ';
if (authenticate(USER_GROUP_ADMIN, USER_RETURN_CHECK)) {
print_popup_help('help_news_and_announcements');
}
?></h1>
<?php
$sql = "SELECT * FROM ".TABLE_PREFIX."news WHERE group_id=$_SESSION[group_id] ORDER BY date DESC LIMIT 4";
$result = mysql_query($sql, $db);
if ($row = mysql_fetch_assoc($result)) {
do {
echo '<h2>'.$row['subject'].'</h2>';
echo '<p><small><small class="date"><i>'.AT_date(_AC('news_date_format'), $row['date'], AT_DATE_MYSQL_DATETIME).'</i></small> ';
echo nl2br($row['body']);
echo '</small></p>';
} while ($row = mysql_fetch_array($result));
} else {
echo '<p><small>'._AC('no_news_found').'</small></p>';
}
echo '<br /><p class="homemore"><a href="archive.php" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"> '._AC('go_to').' '._AC('archive').'</a></p>';
?></td>
<td width="25%" valign="top" style="border: 1px dashed #006699; padding-left: 5px; margin-right: 5px; padding-bottom: 0px;"><h1><?php echo _AC('new_files').' ';
print_popup_help('help_new_files'); ?></h1>
<?php
echo '<h4>'._AC('library').'</h4>';
$sql = "SELECT file_id, title, initial_date FROM ".TABLE_PREFIX."files WHERE group_id=$_SESSION[group_id] AND library_revision_id>0 ORDER BY initial_date DESC LIMIT 5";
$result = mysql_query($sql, $db);
if ($row = mysql_fetch_assoc($result)) {
echo '<ul class="home">';
do {
echo '<li><a href="drafting/revisions.php?id='.$row['file_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'.$row['title'].'</a> <small><small>- '.AT_date(_AC('file_date_format'), $row['initial_date'], AT_DATE_MYSQL_DATETIME).'</small></small></li>';
} while ($row = mysql_fetch_array($result));
echo '</ul>';
} else {
echo '<p><small>'._AC('no_files_found').'</small></p><br />';
}
echo '<p class="homemore"><a href="library/" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"> '._AC('go_to').' '._AC('library').'</a></p>';
echo '<h4>'._AC('drafting_room').'</h4>';
$sql = "SELECT file_id, title, initial_date FROM ".TABLE_PREFIX."files WHERE group_id=$_SESSION[group_id] AND folder_id<>0 ORDER BY initial_date DESC LIMIT 5";
$result = mysql_query($sql, $db);
if ($row = mysql_fetch_assoc($result)) {
echo '<ul class="home">';
do {
echo '<li><a href="drafting/revisions.php?id='.$row['file_id'].SEP.'t='.FILE_DRAFTING.'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'.$row['title'].'</a> <small><small>- '.AT_date(_AC('file_date_format'), $row['initial_date'], AT_DATE_MYSQL_DATETIME).'</small></small></li>';
} while ($row = mysql_fetch_array($result));
echo '</ul>';
} else {
echo '<p><small>'._AC('no_files_found').'</small></p><br />';
}
echo '<p class="homemore"><a href="drafting/" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('go_to').' '._AC('drafting_room').'</a></p>';
echo '<h1>'._AC('upcoming_events').' ';
print_popup_help('help_events'); ?></h1><?php
$event_month = date('Y-m');
$sql = "SELECT
event_id,
start_date,
end_date,
title,
TO_DAYS(start_date) AS s_days,
TO_DAYS(end_date) AS e_days,
TO_DAYS('$event_month-01') AS n_days
FROM ".TABLE_PREFIX."events WHERE
(
(
TO_DAYS(start_date)>=TO_DAYS('$event_month-01')
AND
TO_DAYS(start_date)<=TO_DAYS('$event_month-31')
)
OR
(
TO_DAYS(start_date) < TO_DAYS('$event_month-01')
AND
TO_DAYS(end_date) > TO_DAYS('$event_month-01')
)
)
AND group_id=$_SESSION[group_id]
ORDER BY start_date LIMIT 10";
$result = mysql_query($sql, $db);
if ($row = mysql_fetch_assoc($result)) {
echo '<ul class="home">';
do {
$d = substr($row['start_date'], 8, 2);
$m = substr($row['start_date'], 5, 2);
$y = substr($row['start_date'], 0, 4);
echo '<li><a href="events/events.php?event_id='.$row['event_id'].SEP.'d='.$d.SEP.'m='.$m.SEP.'y='.$y.'#'.$row['event_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'.$row['title'].'</a> <small><small>- '.AT_date(_AC('file_date_format'), $row['start_date'], AT_DATE_MYSQL_DATETIME).'</small></small></li>';
} while ($row = mysql_fetch_array($result));
echo '</ul>';
} else {
echo '<p><small>'._AC('no_upcoming_events_found').'</small></p><br />';
}
echo '<p class="homemore"><a href="events/" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('go_to').' '._AC('events_calendar').'</a></p>';
?></td>
<td width="25%" align="center" valign="top">
<table border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="50%" align="center"><a href="forums/" onfocus="this.className='highlight'" onblur="this.className=''"><img src="images/forums.gif" border="0" height="80" width="80" alt="" class="img3" /><br /><b><?php echo _AC('forums'); ?></b></a></td>
<td width="50%" align="center"><a href="chat/" onfocus="this.className='highlight'" onblur="this.className=''"><img src="images/chat.gif" border="0" height="80" width="80" alt="" class="img3" /><br /><b><?php echo _AC('chat_room'); ?></b></a></td>
</tr>
<tr>
<td width="50%" align="center"><a href="inbox/" onfocus="this.className='highlight'" onblur="this.className=''"><img src="images/inbox.gif" border="0" height="80" width="80" alt="" class="img3" /><br /><b><?php echo _AC('inbox'); ?></b></a> </td>
<td width="50%" align="center"><a href="events/" onfocus="this.className='highlight'" onblur="this.className=''"><img src="images/events.gif" border="0" height="80" width="80" alt="" class="img3" /><br /><b><?php echo _AC('events_calendar'); ?></b></a></td>
</tr>
<tr>
<td width="50%" align="center"><a href="library/" onfocus="this.className='highlight'" onblur="this.className=''"><img src="images/library.gif" border="0" height="80" width="80" alt="" class="img3" /><br /><b><?php echo _AC('library'); ?></b></a></td>
<td width="50%" align="center"><a href="drafting/" onfocus="this.className='highlight'" onblur="this.className=''"><img src="images/drafting.gif" border="0" height="80" width="80" alt="" class="img3" /><br /><b><?php echo _AC('drafting_room'); ?></b></a></td>
</tr>
<tr>
<td width="50%" align="center"> </td>
<td width="50%" align="center"><a href="members/" onfocus="this.className='highlight'" onblur="this.className=''"><img src="images/members.gif" border="0" height="80" width="80" alt="" class="img3" /><br /><b><?php echo _AC('members'); ?></b></a></td>
</tr>
</table>
</td>
</tr>
</table><?php
require(AC_INCLUDE_PATH.'footer.inc.php');
?>