egroupware/calendar/inc/class.calendar_icap.inc.php

228 lines
5.3 KiB
PHP
Raw Normal View History

2001-02-12 05:58:36 +01:00
<?php
/**************************************************************************\
* phpGroupWare - ICal Calendar *
* http://www.phpgroupware.org *
* Created by Mark Peters <skeeter@phpgroupware.org> *
* -------------------------------------------- *
* 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. *
\**************************************************************************/
/* $Id$ */
class calendar_
{
var $stream;
var $user;
var $event;
function open($calendar='',$user='',$passwd='',$options='')
{
global $phpgw, $phpgw_info;
if($user=='')
{
$this->user = $phpgw_info['user']['account_lid'];
}
elseif(is_int($user))
{
$this->user = $phpgw->accounts->id2name($user);
}
elseif(is_string($user))
{
$this->user = $user;
}
if($options != '')
{
$this->stream = mcal_open('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd,$options);
}
else
{
$this->stream = mcal_open('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd);
}
return $this->stream;
}
function popen($calendar='',$user='',$passwd='',$options='')
{
global $phpgw, $phpgw_info;
if($user=='')
{
$this->user = $phpgw_info['user']['account_lid'];
}
elseif(is_int($user))
{
$this->user = $phpgw->accounts->id2name($user);
}
elseif(is_string($user))
{
$this->user = $user;
}
if($options != '')
{
$this->stream = mcal_popen('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd,$options);
}
else
{
$this->stream = mcal_popen('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd);
}
return $this->stream;
}
function reopen($calendar,$options='')
{
if($options != '')
{
$this->stream = mcal_reopen($calendar,$options);
}
else
{
$this->stream = mcal_reopen($calendar);
}
return $this->stream;
}
2001-02-12 05:58:36 +01:00
function close($mcal_stream,$options='')
{
if($options != '')
{
return mcal_close($mcal_stream,$options);
}
else
{
return mcal_close($mcal_stream);
}
2001-02-12 05:58:36 +01:00
}
function create_calendar($stream,$calendar)
{
return mcal_create_calendar($stream,$calendar);
2001-02-12 05:58:36 +01:00
}
function rename_calendar($stream,$old_name,$new_name)
{
return mcal_rename_calendar($stream,$old_name,$new_name);
}
2001-02-12 05:58:36 +01:00
function delete_calendar($stream,$calendar)
{
return mcal_delete_calendar($stream,$calendar);
}
2001-02-12 05:58:36 +01:00
function fetch_event($mcal_stream,$event_id,$options='')
{
if(!isset($this->stream))
{
return False;
}
2001-02-12 05:58:36 +01:00
$this->event = CreateObject('calendar.calendar_item');
2001-02-12 05:58:36 +01:00
if($options != '')
{
$event = mcal_fetch_event($mcal_stream,$event_id,$options);
}
else
{
$event = mcal_fetch_event($mcal_stream,$event_id);
}
// Need to load the $this->event variable with the data from the mcal_fetch_event() call
// Use http://www.php.net/manual/en/function.mcal-fetch-event.phpas the reference
return $this->event;
}
function list_events($mcal_stream,$startYear,$startMonth,$startDay,$endYear='',$endMonth='',$endYear='')
{
if($endYear != '' && $endMonth != '' && $endDay != '')
{
$events = mcal_list_events($mcal_stream,$startYear,$startMonth,$startDay,$endYear,$endMonth,$endYear);
}
else
{
$events = mcal_list_events($mcal_stream,$startYear,$startMonth,$startDay);
}
return $events;
2001-02-12 05:58:36 +01:00
}
2001-03-01 04:49:13 +01:00
function append_event($mcal_stream)
{
return mcal_append_event($mcal_stream);
}
2001-03-01 05:13:30 +01:00
function store_event($mcal_stream)
{
return mcal_store_event($mcal_stream);
}
function delete_event($mcal_stream,$event_id)
{
return mcal_delete_event($mcal_stream,$event_id);
}
function snooze($mcal_stream,$event_id)
{
return mcal_snooze($mcal_stream,$event_id);
}
function list_alarms($mcal_stream,$begin_year='',$begin_month='',$begin_day='',$end_year='',$end_month='',$end_day='')
{
if($end_day == '')
{
if($end_month == '')
{
if($end_year == '')
{
if($begin_day == '')
{
if($begin_month == '')
{
if($begin_year == '')
{
return mcal_list_alarms($mcal_stream);
}
else
{
return mcal_list_alarms($mcal_stream,$begin_year);
}
}
else
{
return mcal_list_alarms($mcal_stream,$begin_year,$begin_month);
}
}
else
{
return mcal_list_alarms($mcal_stream,$begin_year,$begin_month,$begin_day);
}
}
else
{
return mcal_list_alarms($mcal_stream,$begin_year,$begin_month,$begin_day,$end_year);
}
}
else
{
return mcal_list_alarms($mcal_stream,$begin_year,$begin_month,$begin_day,$end_year,$end_month);
}
}
else
{
return mcal_list_alarms($mcal_stream,$begin_year,$begin_month,$begin_day,$end_year,$end_month,$end_day);
}
}
2001-03-01 04:49:13 +01:00
function event_init($stream)
{
return mcal_event_init($stream);
}
}