home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 April
/
CMCD0404.ISO
/
Software
/
Freeware
/
Programare
/
groupoffice-com-2.01
/
modules
/
calendar
/
list_view.inc
< prev
next >
Wrap
Text File
|
2004-03-08
|
4KB
|
87 lines
<?php
$calendar_module_url = isset($calendar_module_url) ? $calendar_module_url : $GO_MODULES->url;
//show_days is the number of days to show (defined in index.php)
//max_columns (defined in index.php)
//day_start is the first day of the week (defined in index.php)
$link_back = isset($link_back) ? $link_back : $_SERVER['REQUEST_URI'];
if ($show_days > 29)
{
//display month
$interval_start_time = mktime(0,0,0,$month, 1, $year)-($_SESSION['GO_SESSION']['timezone']*3600);
$interval_end_time = mktime(0,0,0,$month+1, 0, $year)-($_SESSION['GO_SESSION']['timezone']*3600);
}else
{
if ($show_days > 4)
{
//calculate the first day to display in the week view.
$weekday = date("w", $local_browse_time);
$tmpday = $day - $weekday + $_SESSION['GO_SESSION']['first_weekday'];
if ($tmpday > $day)
{
$tmpday = $tmpday -7;
}
$new_time = mktime(0,0,0,$month, $tmpday, $year);
$day = date("j", $new_time);
$month = date('m', $new_time);
$year = date('Y', $new_time);
}
$interval_start_time = mktime(0,0,0,$month, $day, $year)-($_SESSION['GO_SESSION']['timezone']*3600);
$interval_end_time = mktime(0,0,0,$month, $day+$show_days, $year)-($_SESSION['GO_SESSION']['timezone']*3600)-1;
}
$contact_id = isset($contact_id) ? $contact_id : 0;
echo '<input type="hidden" name="contact_id" value="'.$contact_id.'" />';
$events = $cal->get_events_in_array($calendar_id, $contact_id, $interval_start_time, $interval_end_time, $day, $month, $year, $_SESSION['GO_SESSION']['timezone'], 0, $index_date='Ymd', false);
$events = array_merge($events['all_day'], $events['timed']);
krsort($events);
echo '<table border="0"><tr><td><h3>';
echo $sc_view.': </h3></td><td>';
$dropbox = new dropbox();
$dropbox->add_value('1', '1 '.$sc_day);
$dropbox->add_value('2', '2 '.$sc_days);
$dropbox->add_value('5', '5 '.$sc_days);
$dropbox->add_value('7', '1 '.$sc_week);
$dropbox->add_value('14', '2 '.$sc_weeks);
$dropbox->add_value('21', '3 '.$sc_weeks);
$dropbox->add_value('35', '1 '.$sc_month);
$dropbox->print_dropbox("show_days", $show_days, 'onchange="javascript:document.forms[0].submit()"');
echo '</td><td><h3><a href="javascript:goto_date('.($day-$show_days).', '.$month.', '.$year.');"><<</a> ';
echo date($_SESSION['GO_SESSION']['date_format'], $interval_start_time+($_SESSION['GO_SESSION']['timezone']*3600)).' - '.date($_SESSION['GO_SESSION']['date_format'], $interval_end_time+($_SESSION['GO_SESSION']['timezone']*3600));
echo ' <a href="javascript:goto_date('.($day+$show_days).', '.$month.', '.$year.');">>></a>';
echo '</h3></td></tr></table>';
echo '<table cellspacing="0" cellpadding="0">';
echo '<tr height="20">';
echo '<td class="TableHead2" width="100" nowrap>'.$sc_start_time.'</td>';
echo '<td class="TableHead2" width="100" nowrap>'.$sc_end_time.'</td>';
echo '<td class="TableHead2" width="100" nowrap>'.$strName.'</td>';
echo '</tr>';
if (count($events) > 0)
{
while($event_date = array_shift($events))
{
while($event = array_shift($event_date))
{
$link = $event['write_permission'] ? $calendar_module_url.'event.php' : $calendar_module_url.'show_event.php';
$date_format = $event['all_day_event'] == '1' ? $_SESSION['GO_SESSION']['date_format'] : $_SESSION['GO_SESSION']['date_format'].' '.$_SESSION['GO_SESSION']['time_format'];
echo '<tr style="background-color: #'.$event['background'].'" height="16"><td>'.date($date_format, $event['start_time']).' </td>';
echo '<td>'.date($date_format, $event['end_time']).' </td>';
echo '<td><a class="normal" href="'.$link.'?event_id='.$event['id'].'&return_to='.rawurlencode($link_back).'">'.$event['name'].'</a> </td></tr>';
echo '<tr><td colspan="99" height="1"><img src="'.$GO_THEME->images['cccccc'].'" border="0" height="1" width="100%" /></td></tr>';
}
}
}else
{
echo '<tr><td colspan="99">'.$sc_no_events.'</td></tr>';
echo '<tr><td colspan="99" height="1"><img src="'.$GO_THEME->images['cccccc'].'" border="0" height="1" width="100%" /></td></tr>';
}
echo '</table>';