finish with vCAL stubs

This commit is contained in:
skeeter 2001-03-04 04:13:04 +00:00
parent 41a159d0e0
commit c345b4cdf2
6 changed files with 559 additions and 79 deletions

View File

@ -83,8 +83,8 @@
}
elseif(isset($readsess))
{
$data = $phpgw->session->appsession('entry','calendar');
$cal_info = unserialize($data);
// $cal_info = ;
$cal_info = $phpgw->session->appsession('entry','calendar');
if($cal_info->owner == 0)
{

View File

@ -30,46 +30,28 @@
function validate($cal_info)
{
global $phpgw;
$error = 0;
// do a little form verifying
if ($cal_info->name == '')
{
$error = 40;
}
elseif (($cal_info->hour < 0 || $cal_info->hour > 23) || ($cal_info->end_hour < 0 || $cal_info->end_hour > 23))
elseif (($phpgw->calendar->time_valid($cal_info->hour,$cal_info->minute,0) == False) || ($phpgw->calendar->time_valid($cal_info->end_hour,$cal_info->end_minute,0) == False))
{
$error = 41;
}
elseif (($cal_info->minute < 0 || $cal_info->minute > 59) || ($cal_info->end_minute < 0 || $cal_info->minute > 59))
{
$error = 41;
}
elseif(!checkdate($cal_info->month,$cal_info->day,$cal_info->year) || !checkdate($cal_info->end_month,$cal_info->end_day,$cal_info->end_year))
elseif (($phpgw->calendar->date_valid($cal_info->year,$cal_info->month,$cal_info->day) == False) || ($phpgw->calendar->date_valid($cal_info->end_year,$cal_info->end_month,$cal_info->end_day) == False) || ($phpgw->calendar->date_compare($cal_info->year,$cal_info->month,$cal_info->day,$cal_info->end_year,$cal_info->end_month,$cal_info->end_day) == -1))
{
$error = 42;
}
elseif (($cal_info->year == $cal_info->end_year) && ($cal_info->month == $cal_info->end_month) && ($cal_info->day == $cal_info->end_day))
elseif ($phpgw->calendar->date_compare($cal_info->year,$cal_info->month,$cal_info->day,$cal_info->end_year,$cal_info->end_month,$cal_info->end_day) == 0)
{
if ($cal_info->hour > $cal_info->end_hour)
if ($phpgw->calendar->time_compare($cal_info->hour,$cal_info->minute,0,$cal_info->end_hour,$cal_info->end_minute,0) == 1)
{
$error = 42;
}
elseif (($cal_info->hour == $cal_info->end_hour) && ($cal_info->minute > $cal_info->end_minute))
{
$error = 42;
}
}
elseif (($cal_info->year == $cal_info->end_year) && ($cal_info->month == $cal_info->end_month) && ($cal_info->day > $cal_info->end_day))
{
$error = 42;
}
elseif (($cal_info->year == $cal_info->end_year) && ($cal_info->month > $cal_info->end_month))
{
$error = 42;
}
elseif ($cal_info->year > $cal_info->end_year)
{
$error = 42;
}
return $error;
@ -84,7 +66,6 @@
$cal_info->set($key,$data);
}
$cal_info->owner=$owner;
$parts = $cal_info->participants;
$part = Array();
@ -117,6 +98,8 @@
$cal_info->participants[] = $parts[0];
}
$cal_info->owner=$owner;
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{
if ($cal_info->ampm == 'pm')
@ -149,6 +132,7 @@
}
}
}
$datetime = $phpgw->calendar->makegmttime($cal_info->hour,$cal_info->minute,0,$cal_info->month,$cal_info->day,$cal_info->year);
$cal_info->datetime = $datetime['raw'];
$datetime = $phpgw->calendar->makegmttime($cal_info->end_hour,$cal_info->end_minute,0,$cal_info->end_month,$cal_info->end_day,$cal_info->end_year);
@ -179,8 +163,8 @@
}
else
{
$data = $phpgw->session->appsession('entry','calendar');
$cal_info = unserialize($data);
$cal_info = $phpgw->session->appsession('entry','calendar');
// $cal_info = unserialize($phpgw->session->appsession('entry','calendar'));
}
if($datetime_check)
@ -254,7 +238,7 @@
$p->set_var($var);
$var = Array(
'action_url_button' => $phpgw->link('','readsess='.$cal_info->id),
'action_url_button' => $phpgw->link('','readsess='.$cal_info->id.'&year='.$cal_info->year.'&month='.$cal_info->month.'&day='.$cal_info->day),
'action_text_button' => lang('Ignore Conflict'),
'action_confirm_button' => ''
);
@ -263,7 +247,7 @@
$p->parse('resubmit_button','form_button');
$var = Array(
'action_url_button' => $phpgw->link('edit_entry.php','readsess='.$cal_info->id),
'action_url_button' => $phpgw->link('edit_entry.php','readsess='.$cal_info->id.'&year='.$cal_info->year.'&month='.$cal_info->month.'&day='.$cal_info->day),
'action_text_button' => lang('Re-Edit Event'),
'action_confirm_button' => ''
);
@ -276,8 +260,44 @@
}
else
{
$phpgw->calendar->add($cal_info,$cal_info->id);
Header('Location: '.$phpgw->link('index.php','year='.$year.'&month='.$month.'&cd=14&owner='.$owner));
$cal_stream = $phpgw->calendar->open('INBOX',$owner,'');
$phpgw->calendar->event_init($cal_stream);
$phpgw->calendar->event_set_category($cal_stream,'');
$phpgw->calendar->event_set_title($cal_stream,$cal_info->name);
$phpgw->calendar->event_set_description($cal_stream,$cal_info->description);
$phpgw->calendar->event_set_start($cal_stream,$cal_info->year,$cal_info->month,$cal_info->day,$cal_info->hour,$cal_info->minute,0);
$phpgw->calendar->event_set_end($cal_stream,$cal_info->end_year,$cal_info->end_month,$cal_info->end_day,$cal_info->end_hour,$cal_info->end_minute,0);
$phpgw->calendar->event_set_class($cal_stream,($cal_info->access == 'private'));
$phpgw->calendar->event_set_participants($cal_stream,$cal_info->participants);
if($cal_info->id != 0)
{
$phpgw->calendar->event->id = $cal_info->id;
}
switch($cal_info->rpt_type)
{
case 'none':
$phpgw->calendar->event_set_recur_none($cal_stream);
break;
case 'daily':
$phpgw->calendar->event_set_recur_daily($cal_stream,$cal_info->rpt_year,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_freq);
break;
case 'weekly':
$phpgw->calendar->event_set_recur_weekly($cal_stream,$cal_info->rpt_year,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_freq,$cal_freq->rpt_days);
break;
case 'monthlybydate':
$phpgw->calendar->event_set_recur_mday($cal_stream,$cal_info->rpt_year,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_freq);
break;
case 'monthlybyday':
$phpgw->calendar->event_set_recur_wday($cal_stream,$cal_info->rpt_year,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_freq);
break;
case 'yearly':
$phpgw->calendar->event_set_recur_yearly($cal_stream,$cal_info->rpt_year,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_freq);
break;
}
$phpgw->calendar->store_event($cal_stream);
Header('Location: '.$phpgw->link('index.php','year='.$cal_info->year.'&month='.$cal_info->month.'&cd=14&owner='.$owner));
}
$phpgw->common->phpgw_footer();
?>

View File

@ -74,7 +74,7 @@ class calendar extends calendar_
{
global $phpgw, $phpgw_info;
if(gettype($params)=="array")
if(gettype($params)=='array')
{
while(list($key,$value) = each($params))
{
@ -106,6 +106,26 @@ class calendar extends calendar_
$this->set_filter();
}
// Generic functions that are derived from mcal functions.
// NOT PART OF THE ORIGINAL MCAL SPECS.
function time_compare($a_hour,$a_minute,$a_second,$b_hour,$b_minute,$b_second)
{
$a_time = mktime(intval($a_hour),intval($a_minute),intval($a_second),0,0,0);
$b_time = mktime(intval($b_hour),intval($b_minute),intval($b_second),0,0,0);
if($a_time == $b_time)
{
return 0;
}
elseif($a_time > $b_time)
{
return 1;
}
elseif($a_time < $b_time)
{
return -1;
}
}
function set_filter()
{
global $phpgw_info, $phpgw, $filter;

View File

@ -247,6 +247,15 @@ class calendar_
function event_set_start($stream,$year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
// Legacy Support
$this->event->year = $year;
$this->event->month = $month;
$this->event->day = $day;
$this->event->hour = $hour;
$this->event->minute = $min;
$this->event->datetime = mktime($hour,$min,$sec,$month,$day,$year);
// Legacy Support (New)
$this->event->start->year = $year;
$this->event->start->month = $month;
$this->event->start->day = $day;
@ -287,12 +296,23 @@ class calendar_
function event_set_end($stream,$year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
// Legacy Support
$this->event->end_year = $year;
$this->event->end_month = $month;
$this->event->end_day = $day;
$this->event->end_hour = $hour;
$this->event->end_minute = $min;
$this->event->end_second = $sec;
$this->event->edatetime = mktime($hour,$min,$sec,$month,$day,$year);
// Legacy Support (New)
$this->event->end->year = $year;
$this->event->end->month = $month;
$this->event->end->day = $day;
$this->event->end->hour = $hour;
$this->event->end->min = $min;
$this->event->end->sec = $sec;
$this->event->edatetime = mktime($hour,$min,$sec,$month,$day,$year);
if($sec == 0)
{
@ -324,4 +344,113 @@ class calendar_
return mcal_event_set_end($stream,$year,$month,$day,$hour,$min,$sec);
}
}
function event_set_alarm($stream,$alarm)
{
return mcal_event_set_alarm ($stream,$alarm);
}
function event_set_class($stream,$class)
{
return mcal_event_set_class($stream,$class);
}
function is_leap_year($year)
{
return mcal_is_leap_year($year);
}
function days_in_month($month,$year)
{
return mcal_days_in_month($month,$year);
}
function date_valid($year,$month,$day)
{
return mcal_date_valid($year,$month,$day);
}
function time_valid($hour,$minutes,$seconds)
{
return mcal_time_valid($hour,$minutes,$seconds);
}
function day_of_week($year,$month,$day)
{
return mcal_day_of_week($year,$month,$day);
}
function day_of_year($year,$month,$day)
{
return mcal_day_of_year($year,$month,$day);
}
function date_compare($a_year,$a_month,$a_day,$b_year,$b_month,$b_day)
{
return mcal_date_compare($a_year,$a_month,$a_day,$b_year,$b_month,$b_day);
}
// The function definition doesn't look correct...
// Need more information for this function
function next_recurrence($stream,$weekstart,$next)
{
return mcal_next_recurrence($stream,$weekstart,$next);
}
function event_set_recur_none($stream)
{
return mcal_event_set_recur_none($stream);
}
function event_set_recur_daily($stream,$year,$month,$day,$interval)
{
return mcal_event_set_recur_daily($stream,$year,$month,$day,$interval);
}
function event_set_recur_weekly($stream,$year,$month,$day,$interval,$weekdays)
{
return mcal_event_set_recur_weekly($stream,$year,$month,$day,$interval,$weekdays);
}
function event_set_recur_monthly_mday($stream,$year,$month,$day,$interval)
{
return mcal_event_set_recur_monthly_mday($stream,$year,$month,$day,$interval);
}
function event_set_recur_monthly_wday($stream,$year,$month,$day,$interval)
{
return mcal_event_set_recur_monthly_wday($stream,$year,$month,$day,$interval);
}
function event_set_recur_yearly($stream,$year,$month,$day,$interval)
{
return mcal_event_set_recur_yearly($stream,$year,$month,$day,$interval);
}
function fetch_current_stream_event($stream)
{
return mcal_fetch_current_stream_event($stream);
}
function event_add_attribute($stream,$attribute,$value)
{
mcal_event_add_attribute($stream,$attribute,$value);
}
function expunge($stream)
{
return mcal_expunge($stream);
}
/**************** Local functions for ICAL based Calendar *****************/
function event_set_participants($stream,$participants)
{
$this->event->participants = Array();
reset($participants);
$this->event->participants = $participants;
return True;
}
}

View File

@ -332,6 +332,7 @@ class calendar_
$this->event->rpt_sat = (substr($rpt_days,6,1)=='Y'?1:0);
//Legacy Support (New)
$rpt_days = strtoupper($this->stream->f('cal_rpt_days'));
$this->event->recur_data = 0;
$this->event->recur_data += (substr($rpt_days,0,1)=='Y'?M_SUNDAY:0);
$this->event->recur_data += (substr($rpt_days,1,1)=='Y'?M_MONDAY:0);
@ -421,49 +422,355 @@ class calendar_
function event_init($stream)
{
$this->event = CreateObject('calendar.calendar_item');
$this->event->owner = $this->user;
// echo 'Initializing Calendar Event<br>'."\n";
return True;
}
function event_set_category($stream,$category='')
{
$this->event->category = $category;
// echo 'Setting Calendar Category = '.$this->event->category.'<br>'."\n";
return True;
}
function event_set_title($stream,$title='')
{
$this->event->title = $title;
$this->event->name = $title;
// echo 'Setting Calendar Title = '.$this->event->title.'<br>'."\n";
return True;
}
function event_set_description($stream,$description='')
{
$this->event->description = $description;
// echo 'Setting Calendar Description = '.$this->event->description.'<br>'."\n";
return True;
}
function event_set_start($stream,$year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
$this->event->start->year = $year;
$this->event->start->month = $month;
$this->event->start->day = $day;
$this->event->start->hour = $hour;
$this->event->start->min = $min;
$this->event->start->sec = $sec;
global $phpgw_info;
// Legacy Support
$this->event->year = intval($year);
$this->event->month = intval($month);
$this->event->day = intval($day);
$this->event->hour = intval($hour);
$this->event->minute = intval($min);
$this->event->datetime = mktime(intval($hour),intval($min),intval($sec),intval($month),intval($day),intval($year));
$this->event->datetime -= ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
// Legacy Support (New)
$this->event->start->year = intval($year);
$this->event->start->month = intval($month);
$this->event->start->mday = intval($day);
$this->event->start->hour = intval($hour);
$this->event->start->min = intval($min);
$this->event->start->sec = intval($sec);
// echo 'Setting Calendar Start = '.$this->event->start->year.$this->event->start->month.$this->event->start->mday.':'.$this->event->start->hour.$this->event->start->min.$this->event->start->sec.'<br>'."\n";
return True;
}
function event_set_end($stream,$year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
$this->event->end->year = $year;
$this->event->end->month = $month;
$this->event->end->day = $day;
$this->event->end->hour = $hour;
$this->event->end->min = $min;
$this->event->end->sec = $sec;
global $phpgw_info;
// Legacy Support
$this->event->end_year = intval($year);
$this->event->end_month = intval($month);
$this->event->end_day = intval($day);
$this->event->end_hour = intval($hour);
$this->event->end_minute = intval($min);
$this->event->end_second = intval($sec);
$this->event->edatetime = mktime(intval($hour),intval($min),intval($sec),intval($month),intval($day),intval($year));
$this->event->edatetime -= ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
// Legacy Support (New)
$this->event->end->year = intval($year);
$this->event->end->month = intval($month);
$this->event->end->mday = intval($day);
$this->event->end->hour = intval($hour);
$this->event->end->min = intval($min);
$this->event->end->sec = intval($sec);
// echo 'Setting Calendar End = '.$this->event->end->year.$this->event->end->month.$this->event->end->mday.':'.$this->event->end->hour.$this->event->end->min.$this->event->end->sec.'<br>'."\n";
return True;
}
function event_set_alarm($stream,$alarm)
{
$this->event->alarm = intval($alarm);
return True;
}
function event_set_class($stream,$class)
{
$this->event->public = $class;
return True;
}
function is_leap_year($year)
{
if ((intval($year) % 4 == 0) && (intval($year) % 100 != 0) || (intval($year) % 400 == 0))
return 1;
else
return 0;
}
function days_in_month($month,$year)
{
$days = Array(
1 => 31,
2 => 28 + $this->is_leap_year(intval($year)),
3 => 31,
4 => 30,
5 => 31,
6 => 30,
7 => 31,
8 => 31,
9 => 30,
10 => 31,
11 => 30,
12 => 31
);
return $days[intval($month)];
}
function date_valid($year,$month,$day)
{
return checkdate(intval($month),intval($day),intval($year));
}
function time_valid($hour,$minutes,$seconds)
{
if(intval($hour) < 0 || intval($hour) > 24)
{
return False;
}
if(intval($minutes) < 0 || intval($minutes) > 59)
{
return False;
}
if(intval($seconds) < 0 || intval($seconds) > 59)
{
return False;
}
return True;
}
function day_of_week($year,$month,$day)
{
return date('w',mktime(0,0,0,intval($month),intval($day),intval($year)));
}
function day_of_year($year,$month,$day)
{
return date('w',mktime(0,0,0,intval($month),intval($day),intval($year)));
}
function date_compare($a_year,$a_month,$a_day,$b_year,$b_month,$b_day)
{
$a_date = mktime(0,0,0,intval($a_month),intval($a_day),intval($a_year));
$b_date = mktime(0,0,0,intval($b_month),intval($b_day),intval($b_year));
if($a_date == $b_date)
{
return 0;
}
elseif($a_date > $b_date)
{
return 1;
}
elseif($a_date < $b_date)
{
return -1;
}
}
// The function definition doesn't look correct...
// Need more information for this function
function next_recurrence($stream,$weekstart,$next)
{
// return next_recurrence (int stream, int weekstart, array next);
}
function event_set_recur_none($stream)
{
// Legacy Support
$this->event->rpt_type = 'none';
$this->event->rpt_end_use = 0;
$this->event->rpt_end = 0;
$this->event->rpt_end_day = 0;
$this->event->rpt_end_month = 0;
$this->event->rpt_end_year = 0;
$this->event->rpt_days = 'nnnnnnn';
$this->event->rpt_sun = 0;
$this->event->rpt_mon = 0;
$this->event->rpt_tue = 0;
$this->event->rpt_wed = 0;
$this->event->rpt_thu = 0;
$this->event->rpt_fri = 0;
$this->event->rpt_sat = 0;
$this->event->rpt_freq = 0;
// Legacy Support (New)
$this->event->recur_type = RECUR_NONE;
$this->event->recur_interval = 0;
$this->event->recur_enddate->year = 0;
$this->event->recur_enddate->month = 0;
$this->event->recur_enddate->mday = 0;
$this->event->recur_enddate->hour = 0;
$this->event->recur_enddate->min = 0;
$this->event->recur_enddate->sec = 0;
$this->event->recur_enddate->alarm = 0;
$this->event->recur_data = 0;
return True;
}
function event_recur_daily($stream,$year,$monh,$day,$interval)
{
// Legacy Support
$this->event->rpt_type = 'daily';
// Legacy Support (New)
$this->event->recur_type = RECUR_DAILY;
$this->set_common_recur(intval($year),intval($month),intval($day));
}
function event_set_recur_weekly($stream,$year,$month,$day,$interval,$weekdays)
{
// Legacy Support
$this->event->rpt_type = 'weekly';
$this->set_common_recur(intval($year),intval($month),intval($day));
$this->event->rpt_sun = (intval($weekdays) & M_SUNDAY ?1:0);
$this->event->rpt_mon = (intval($weekdays) & M_MONDAY ?1:0);
$this->event->rpt_tue = (intval($weekdays) & M_TUESDAY ?1:0);
$this->event->rpt_wed = (intval($weekdays) & M_WEDNESDAY?1:0);
$this->event->rpt_thu = (intval($weekdays) & M_THURSDAY ?1:0);
$this->event->rpt_fri = (intval($weekdays) & M_FRIDAY ?1:0);
$this->event->rpt_sat = (intval($weekdays) & M_SATURDAY ?1:0);
$this->event->rpt_days =
($this->event->rpt_sun == 1?'y':'n')
. ($this->event->rpt_mon == 1?'y':'n')
. ($this->event->rpt_tue == 1?'y':'n')
. ($this->event->rpt_wed == 1?'y':'n')
. ($this->event->rpt_thu == 1?'y':'n')
. ($this->event->rpt_fri == 1?'y':'n')
. ($this->event->rpt_sat == 1?'y':'n');
// Legacy Support (New)
$this->event->recur_type = RECUR_WEEKLY;
$this->event->recur_data = intval($weekdays);
}
function event_set_recur_monthly_mday($stream,$year,$month,$day,$interval)
{
// Legacy Support
$this->event->rpt_type = 'monthlybydate';
// Legacy Support
$this->event->recur_type = RECUR_MONTHLY_MDAY;
$this->set_common_recur(intval($year),intval($month),intval($day));
}
function event_set_recur_monthly_wday($stream,$year,$month,$day,$interval)
{
// Legacy Support
$this->event->rpt_type = 'monthlybyday';
// Legacy Support (New)
$this->event->recur_type = RECUR_MONTHLY_WDAY;
$this->set_common_recur(intval($year),intval($month),intval($day));
}
function event_set_recur_yearly($stream,$year,$month,$day,$interval)
{
// Legacy Support
$this->event->rpt_type = 'yearly';
// Legacy Support (New)
$this->event->recur_type = RECUR_YEARLY;
$this->set_common_recur(intval($year),intval($month),intval($day));
}
function fetch_current_stream_event($stream)
{
return $this->fetch_event($this->event->id);
}
function event_add_attribute($stream,$attribute,$value)
{
$this->event->$attribute = $value;
}
function expunge($stream)
{
return 1;
}
/***************** Local functions for SQL based Calendar *****************/
function set_common_recur($year,$month,$day)
{
if(intval($day) == 0 && intval($month) == 0 && intval($year) == 0)
{
$this->event->rpt_end_use = 0;
$this->event->rpt_end = 0;
$this->event->rpt_end_day = 0;
$this->event->rpt_end_month = 0;
$this->event->rpt_end_year = 0;
}
else
{
$this->event->rpt_end_use = 1;
$this->event->rpt_end = mktime(0,0,0,intval($month),intval($day),intval($year));
$this->event->rpt_end -= ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$this->event->rpt_end_day = intval($day);
$this->event->rpt_end_month = intval($month);
$this->event->rpt_end_year = intval($year);
}
$this->event->rpt_sun = 0;
$this->event->rpt_mon = 0;
$this->event->rpt_tue = 0;
$this->event->rpt_wed = 0;
$this->event->rpt_thu = 0;
$this->event->rpt_fri = 0;
$this->event->rpt_sat = 0;
$this->event->rpt_days = 'nnnnnnn';
$this->event->rpt_freq = intval($interval);
// Legacy Support (New)
$this->event->recur_interval = intval($interval);
if(intval($day) == 0 && intval($month) == 0 && intval($year) == 0)
{
$this->event->recur_enddate->year = 0;
$this->event->recur_enddate->month = 0;
$this->event->recur_enddate->mday = 0;
}
else
{
$this->event->recur_enddate->year = intval($year);
$this->event->recur_enddate->month = intval($month);
$this->event->recur_enddate->mday = intval($day);
}
$this->event->recur_enddate->hour = 0;
$this->event->recur_enddate->min = 0;
$this->event->recur_enddate->sec = 0;
$this->event->recur_enddate->alarm = 0;
$this->event->recur_data = 0;
}
function get_event_ids($search_repeats=False,$extra='')
{
$retval = Array();
@ -529,11 +836,12 @@ class calendar_
$event->end_hour += 12;
}
}
$date = $this->makegmttime($event->hour,$event->minute,0,$event->month,$event->day,$event->year);
$enddate = $this->makegmttime($event->end_hour,$event->end_minute,0,$event->end_month,$event->end_day,$event->end_year);
$today = $this->gmtdate(time());
$tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$date = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $tz_offset;
$enddate = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $tz_offset;
$today = time() - $tz_offset;
if($event->rpt_type != 'none')
if($event->recur_type != RECUR_NONE)
{
$type = 'M';
}
@ -542,11 +850,20 @@ class calendar_
$type = 'E';
}
$sql = 'UPDATE calendar_entry SET cal_id='.$event->id.', '
if($event->public == True)
{
$event->access = 'public';
}
else
{
$event->access = 'private';
}
$sql = 'UPDATE calendar_entry SET '
. 'cal_owner='.$event->owner.', '
. 'cal_datetime='.$date['raw'].', '
. 'cal_mdatetime='.$today['raw'].', '
. 'cal_edatetime='.$enddate['raw'].', '
. 'cal_datetime='.$date.', '
. 'cal_mdatetime='.$today.', '
. 'cal_edatetime='.$enddate.', '
. 'cal_priority='.$event->priority.', '
. "cal_type='".$type."', "
. "cal_access='".$event->access."', "
@ -564,13 +881,11 @@ class calendar_
. 'VALUES('.$event->id.','.$participant[1].",'A')",__LINE__,__FILE__);
}
if(strcmp($event->rpt_type,'none') <> 0)
if($event->recur_type != RECUR_NONE)
{
$freq = ($event->rpt_freq?$event->rpt_freq:0);
if($event->rpt_use_end)
{
$end = $this->makegmttime(0,0,0,$event->rpt_month,$event->rpt_day,$event->rpt_year);
$end = mktime($event->recur_enddate->hour,$event->recur_enddate->min,$event->recur_enddate->sec,$event->recur_enddate->month,$event->recur_enddate->mday,$event->recur_enddate->year) - $tz_offset;
$use_end = 1;
}
else
@ -579,20 +894,7 @@ class calendar_
$use_end = 0;
}
if($event->rpt_type == 'weekly' || $event->rpt_type == 'daily')
{
$days = ($event->rpt_sun?'y':'n')
. ($event->rpt_mon?'y':'n')
. ($event->rpt_tue?'y':'n')
. ($event->rpt_wed?'y':'n')
. ($event->rpt_thu?'y':'n')
. ($event->rpt_fri?'y':'n')
. ($event->rpt_sat?'y':'n');
}
else
{
$days = 'nnnnnnn';
}
$days = $event->rpt_days;
$this->stream->query('SELECT count(cal_id) FROM calendar_entry_repeats WHERE cal_id='.$event->id,__LINE__,__FILE__);
$this->stream->next_record();
@ -602,14 +904,14 @@ class calendar_
$this->stream->query('INSERT INTO calendar_entry_repeats(cal_id,'
.'cal_type,cal_use_end,cal_end,cal_days,cal_frequency) '
.'VALUES('.$event->id.",'".$event->rpt_type."',".$use_end.','
.$end['raw'].",'$days',$freq)",__LINE__,__FILE__);
.$end.",'".$days."',".$event->recur_interval.')',__LINE__,__FILE__);
}
else
{
$this->stream->query('UPDATE calendar_entry_repeats '
."SET cal_type='".$event->rpt_type."', "
.'cal_use_end='.$use_end.", cal_end='".$end['raw']."', "
."cal_days='".$days."', cal_frequency=".$freq.' '
.'cal_use_end='.$use_end.", cal_end='".$end."', "
."cal_days='".$days."', cal_frequency=".$event->recur_interval.' '
.'WHERE cal_id='.$event->id,__LINE__,__FILE__);
}
}
@ -621,6 +923,15 @@ class calendar_
$this->stream->unlock();
return True;
}
function event_set_participants($stream,$participants)
{
$this->event->participants = Array();
reset($participants);
$this->event->participants = $participants;
return True;
}
// End of ICal style support.......
function group_search($owner=0)

View File

@ -19,7 +19,7 @@
if(!isset($filter) || !$filter)
{
$filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"];
$filter = $phpgw_info['user']['preferences']['calendar']['defaultfilter'];
}
// This is the initialization of the ACL usage
@ -31,7 +31,7 @@
$owner = 0;
}
if(!isset($owner) || !$owner)
if(!isset($owner) || !$owner || ($owner == $phpgw_info['user']['account_id']))
{
$owner = $phpgw_info['user']['account_id'];
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;