Location: PHPKode > projects > O - OpenSource GroupWare > osgw/calendar/event_list.php
<?php
/**************************************************************************
   This program is free software; you can 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.

   @Authors:	Ryan Thompson(hide@address.com)
***************************************************************************/
/*$Id: event_list.php,v 1.24 2004/05/30 05:42:17 rthomp Exp $*/
include("./data.php");
$service['add_header'] = TRUE;
include("../config.inc.php");
//Define month first. The events class inherits Calendar which is declared in the month class file
require('classes/class.calendar.php');

$cal = new calendar('event', $_GET['d'], $_GET['m'], $_GET['y']);

echo $layout->page_header;
echo $cal->nav_buttons($_GET['v']);

$events = new events();



if(isset($_POST['confirm_delete']))
{
	$events->delete($_POST['delete_values']);
}

$sql = "SELECT * FROM o_calendar WHERE user_id='". $user->user_id ."'";

if(isset($_GET['ts']))
{
	//+24 hours
	$next_day = $_GET['ts'] + 86400;

	$sql .= " AND evt_start > '". $_GET['ts'] ."' AND evt_start < '". $next_day ."'";
}

$sql .= " ORDER BY evt_start ASC";




if(isset($_POST['delete_events']))
{
	echo $html->delete_confirm($O->create_link('/calendar/event_list.php'), 'cl', $_POST['event_id']);
} else {
echo $html->create_list(
	array("FORM_LINK"=>$_SERVER['PHP_SELF'],
		"SUBJECT"=>$lang->msgs['subject'],
		"LOCATION"=>$lang->msgs['location'],
		"START_DATE"=>$lang->msgs['start_date'],
		"START_TIME"=>$lang->msgs['start_time'],
		"END_DATE"=>$lang->msgs['end_date'],
		"END_TIME"=>$lang->msgs['end_time'],
		"RECURING"=>$lang->msgs['recuring']),
	$O->dir ."/calendar/html/events_header.html");
	
	

$i = 0;
$db->query($sql);

while($db->fetch_results())
{

	$class = $html->list_class($class);
	if($db->record['recurring'] > 0)
	{
		$recur = "Y";
	} else {
		$recur = "N";
	}
	echo $html->create_list(
		array("EVENT_ID"=>$db->record['event_id'],
			"STYLE"=>$class,
			"SUBJECT"=>$O->create_link("/calendar/edit_event.php?id=". $db->record['event_id'], $db->record['subject'], $class),
			"LOCATION"=>$db->record['location'],
			"START_DATE"=>date('d-M-Y',$db->record['evt_start']),
			"START_TIME"=>date('H:i:s',$db->record['evt_start']),
			"END_DATE"=>date('d-M-Y',$db->record['evt_end']),
			"END_TIME"=>date('H:i:s',$db->record['evt_end']),
			"RECURRING"=>$recur),
		$O->dir ."/calendar/html/event_list.html");
	

	$i++;
}
$results = $share->run_share_query('cl', $user->user_id,'o_calendar', 'event_id', '');

foreach($results AS $key => $value)
{

	$class = $html->list_class($class);
	if($value['recurring'] > 0)
	{
		$recur = "Y";
	} else {
		$recur = "N";
	}
	echo $html->create_list(
		array("EVENT_ID"=>$values['event_id'],
			"STYLE"=>$class,
			"SUBJECT"=>$O->create_link("/calendar/edit_event.php?id=". $value['event_id'], $value['subject'], $class) ."({$value['username']})",
			"LOCATION"=>$value['location'],
			"START_DATE"=>date('d-M-Y',$value['evt_start']),
			"START_TIME"=>date('H:i:s',$value['evt_start']),
			"END_DATE"=>date('d-M-Y',$value['evt_end']),
			"END_TIME"=>date('H:i:s',$value['evt_end']),
			"RECURRING"=>$recur),
		$O->dir ."/calendar/html/event_list.html");
	

	$i++;
}

echo $html->create_list(
	array("DELETE_EVENTS"=>$lang->msgs['delete_events']),
	$O->dir ."/calendar/html/event_footer.html");
}
echo $layout->create_footer();
?>
Return current item: O - OpenSource GroupWare