forked from extern/egroupware
Finished all changes from yesterdays partial cleanup. Inching closer to support ICAP and is now even more OOP. I think a little more work on this and it'll be ready for a full ICAP test.
This commit is contained in:
parent
17de668f88
commit
50d363f3cd
@ -50,8 +50,8 @@
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
$cal_stream = $phpgw->calendar->open('INBOX',intval($owner),'');
|
||||
$event = $phpgw->calendar->fetch_event($cal_stream,intval($id));
|
||||
$phpgw->calendar->open('INBOX',intval($owner),'');
|
||||
$event = $phpgw->calendar->fetch_event(intval($id));
|
||||
|
||||
$can_edit = False;
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
{
|
||||
if($event->public != True)
|
||||
{
|
||||
if($phpgw->calendar->check_perms(16) == True)
|
||||
if($phpgw->calendar->check_perms(PHPGW_ACL_PRIVATE) == True)
|
||||
{
|
||||
$can_edit = True;
|
||||
}
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
if($event->owner == 0)
|
||||
{
|
||||
$event->owner = $owner;
|
||||
$phpgw->calendar->add_attribute('owner',$owner);
|
||||
}
|
||||
|
||||
$can_edit = True;
|
||||
@ -93,9 +93,9 @@
|
||||
header('Location: '.$phpgw->link('/calendar/view.php','id='.$id.'&owner='.$owner));
|
||||
}
|
||||
|
||||
$cal_stream = $phpgw->calendar->open('INBOX',intval($cal_info->owner),'');
|
||||
$phpgw->calendar->event_init($cal_stream);
|
||||
$phpgw->calendar->event->id = 0;
|
||||
$phpgw->calendar->open('INBOX',intval($cal_info->owner),'');
|
||||
$phpgw->calendar->event_init();
|
||||
$phpgw->calendar->add_attribute('id',0);
|
||||
|
||||
$can_edit = True;
|
||||
|
||||
@ -117,27 +117,26 @@
|
||||
$thisminute = (int)$minute;
|
||||
}
|
||||
|
||||
$phpgw->calendar->event_set_start($cal_stream,$thisyear,$thismonth,$thisday,$thishour,$this->minute,0);
|
||||
$phpgw->calendar->event_set_end($cal_stream,$thisyear,$thismonth,$thisday,$thishour,$this->minute,0);
|
||||
$phpgw->calendar->event_set_title($cal_stream,'');
|
||||
$phpgw->calendar->event_set_description($cal_stream,'');
|
||||
$phpgw->calendar->event->priority = 2;
|
||||
$phpgw->calendar->set_start($thisyear,$thismonth,$thisday,$thishour,$this->minute,0);
|
||||
$phpgw->calendar->set_end($thisyear,$thismonth,$thisday,$thishour,$this->minute,0);
|
||||
$phpgw->calendar->set_title('');
|
||||
$phpgw->calendar->set_description('');
|
||||
$phpgw->calendar->add_attribute('priority',2);
|
||||
if($phpgw_info['user']['preferences']['calendar']['default_private'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['default_private'] == True)
|
||||
{
|
||||
$phpgw->calendar->event_set_class($cal_stream,False);
|
||||
$phpgw->calendar->set_class(False);
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpgw->calendar->event_set_class($cal_stream,True);
|
||||
$phpgw->calendar->set_class(True);
|
||||
}
|
||||
|
||||
$phpgw->calendar->event_set_recur_none($cal_stream);
|
||||
$phpgw->calendar->set_recur_none();
|
||||
$event = $phpgw->calendar->event;
|
||||
}
|
||||
|
||||
$tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
|
||||
$start = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $tz_offset;
|
||||
$end = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $tz_offset;
|
||||
$start = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $phpgw->calendar->datetime->tz_offset;
|
||||
$end = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $phpgw->calendar->datetime->tz_offset;
|
||||
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
@ -367,8 +366,6 @@
|
||||
|
||||
$str .= '>'.lang('Use End Date').' ';
|
||||
|
||||
|
||||
|
||||
$day_html = $sb->getDays('recur_enddate[mday]',intval($phpgw->common->show_date($recur_end,'d')));
|
||||
$month_html = $sb->getMonthText('recur_enddate[month]',intval($phpgw->common->show_date($recur_end,'n')));
|
||||
$year_html = $sb->getYears('recur_enddate[year]',intval($phpgw->common->show_date($recur_end,'Y')),intval($phpgw->common->show_date($recur_end,'Y')));
|
||||
|
@ -39,17 +39,17 @@
|
||||
{
|
||||
$error = 40;
|
||||
}
|
||||
elseif (($phpgw->calendar->time_valid($event->start->hour,$event->start->min,0) == False) || ($phpgw->calendar->time_valid($event->end->hour,$event->end->min,0) == False))
|
||||
elseif (($phpgw->calendar->datetime->time_valid($event->start->hour,$event->start->min,0) == False) || ($phpgw->calendar->datetime->time_valid($event->end->hour,$event->end->min,0) == False))
|
||||
{
|
||||
$error = 41;
|
||||
}
|
||||
elseif (($phpgw->calendar->date_valid($event->start->year,$event->start->month,$event->start->mday) == False) || ($phpgw->calendar->date_valid($event->end->year,$event->end->month,$event->end->mday) == False) || ($phpgw->calendar->date_compare($event->start->year,$event->start->month,$event->start->mday,$event->end->year,$event->end->month,$event->end->mday) == 1))
|
||||
elseif (($phpgw->calendar->datetime->date_valid($event->start->year,$event->start->month,$event->start->mday) == False) || ($phpgw->calendar->datetime->date_valid($event->end->year,$event->end->month,$event->end->mday) == False) || ($phpgw->calendar->datetime->date_compare($event->start->year,$event->start->month,$event->start->mday,$event->end->year,$event->end->month,$event->end->mday) == 1))
|
||||
{
|
||||
$error = 42;
|
||||
}
|
||||
elseif ($phpgw->calendar->date_compare($event->start->year,$event->start->month,$event->start->mday,$event->end->year,$event->end->month,$event->end->mday) == 0)
|
||||
elseif ($phpgw->calendar->datetime->date_compare($event->start->year,$event->start->month,$event->start->mday,$event->end->year,$event->end->month,$event->end->mday) == 0)
|
||||
{
|
||||
if ($phpgw->calendar->time_compare($event->start->hour,$event->start->min,0,$event->end->hour,$event->end->min,0) == 1)
|
||||
if ($phpgw->calendar->datetime->time_compare($event->start->hour,$event->start->min,0,$event->end->hour,$event->end->min,0) == 1)
|
||||
{
|
||||
$error = 42;
|
||||
}
|
||||
@ -109,18 +109,18 @@
|
||||
}
|
||||
|
||||
$is_public = ($private == 'public'?1:0);
|
||||
$cal_stream = $phpgw->calendar->open('INBOX',intval($owner),'');
|
||||
$phpgw->calendar->event_init($cal_stream);
|
||||
$phpgw->calendar->event_set_category($cal_stream,$category);
|
||||
$phpgw->calendar->event_set_title($cal_stream,$title);
|
||||
$phpgw->calendar->event_set_description($cal_stream,$description);
|
||||
$phpgw->calendar->event_set_start($cal_stream,$start[year],$start[month],$start[mday],$start[hour],$start[min],0);
|
||||
$phpgw->calendar->event_set_end($cal_stream,$end[year],$end[month],$end[mday],$end[hour],$end[min],0);
|
||||
$phpgw->calendar->event_set_class($cal_stream,$is_public);
|
||||
$phpgw->calendar->open('INBOX',intval($owner),'');
|
||||
$phpgw->calendar->event_init();
|
||||
$phpgw->calendar->set_category($category);
|
||||
$phpgw->calendar->set_title($title);
|
||||
$phpgw->calendar->set_description($description);
|
||||
$phpgw->calendar->set_start($start[year],$start[month],$start[mday],$start[hour],$start[min],0);
|
||||
$phpgw->calendar->set_end($end[year],$end[month],$end[mday],$end[hour],$end[min],0);
|
||||
$phpgw->calendar->set_class($is_public);
|
||||
|
||||
if($id != 0)
|
||||
{
|
||||
$phpgw->calendar->event->id = $id;
|
||||
$phpgw->calendar->add_attribute('id',$id);
|
||||
}
|
||||
|
||||
if($rpt_use_end != 'y')
|
||||
@ -135,22 +135,22 @@
|
||||
switch($recur_type)
|
||||
{
|
||||
case RECUR_NONE:
|
||||
$phpgw->calendar->event_set_recur_none($cal_stream);
|
||||
$phpgw->calendar->set_recur_none();
|
||||
break;
|
||||
case RECUR_DAILY:
|
||||
$phpgw->calendar->event_set_recur_daily($cal_stream,$recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
|
||||
$phpgw->calendar->set_recur_daily($recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
|
||||
break;
|
||||
case RECUR_WEEKLY:
|
||||
$phpgw->calendar->event_set_recur_weekly($cal_stream,$recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval,$recur_data);
|
||||
$phpgw->calendar->set_recur_weekly($recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval,$recur_data);
|
||||
break;
|
||||
case RECUR_MONTHLY_MDAY:
|
||||
$phpgw->calendar->event_set_recur_monthly_mday($cal_stream,$recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
|
||||
$phpgw->calendar->set_recur_monthly_mday($recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
|
||||
break;
|
||||
case RECUR_MONTHLY_WDAY:
|
||||
$phpgw->calendar->event_set_recur_monthly_wday($cal_stream,$recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
|
||||
$phpgw->calendar->set_recur_monthly_wday($recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
|
||||
break;
|
||||
case RECUR_YEARLY:
|
||||
$phpgw->calendar->event_set_recur_yearly($cal_stream,$recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
|
||||
$phpgw->calendar->set_recur_yearly($recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -186,25 +186,23 @@
|
||||
}
|
||||
|
||||
reset($participants);
|
||||
$phpgw->calendar->event_set_participants($cal_stream,$participants);
|
||||
|
||||
$phpgw->calendar->event->priority = intval($priority);
|
||||
$phpgw->calendar->add_attribute('participants',$participants);
|
||||
$phpgw->calendar->add_attribute('priority',$priority);
|
||||
$event = $phpgw->calendar->event;
|
||||
|
||||
$phpgw->session->appsession('entry','calendar',$event);
|
||||
|
||||
$datetime_check = validate($event);
|
||||
|
||||
$tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
|
||||
$start = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $tz_offset;
|
||||
$end = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $tz_offset;
|
||||
$start = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $phpgw->calendar->datetime->tz_offset;
|
||||
$end = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $phpgw->calendar->datetime->tz_offset;
|
||||
|
||||
$overlapping_events = $phpgw->calendar->overlap($start,$end,$event->participants,$event->owner,$event->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cal_stream = $phpgw->calendar->open('INBOX',intval($owner),'');
|
||||
$phpgw->calendar->event_init($cal_stream);
|
||||
$phpgw->calendar->open('INBOX',intval($owner),'');
|
||||
$phpgw->calendar->event_init();
|
||||
|
||||
$event = unserialize(str_replace('O:8:"stdClass"','O:13:"calendar_time"',serialize($phpgw->session->appsession('entry','calendar'))));
|
||||
$phpgw->calendar->event = $event;
|
||||
@ -283,8 +281,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$cal_stream = $phpgw->calendar->open('INBOX',intval($owner),'');
|
||||
$phpgw->calendar->store_event($cal_stream);
|
||||
$phpgw->calendar->store_event();
|
||||
Header('Location: '.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/index.php','year='.$event->start->year.'&month='.$event->start->month.'&day='.$event->start->mday.'&cd=14&owner='.$owner));
|
||||
}
|
||||
?>
|
||||
|
@ -226,7 +226,7 @@ class calendar extends calendar_
|
||||
$nextday = mktime(0,0,0,$month,$day + 1,$year) - $this->datetime->tz_offset;
|
||||
if (intval($phpgw->common->show_date($starttime,'Hi')) && $starttime == $endtime)
|
||||
{
|
||||
$time = $phpgw->common->show_date($starttime,'Hi');
|
||||
$time = $phpgw->common->show_date($starttime,'H:i');
|
||||
}
|
||||
elseif ($starttime <= $rawdate_offset && $endtime >= $nextday - 60)
|
||||
{
|
||||
|
@ -282,6 +282,59 @@ class calendar__
|
||||
}
|
||||
}
|
||||
|
||||
function event_init()
|
||||
{
|
||||
$this->event = CreateObject('calendar.calendar_item');
|
||||
$this->add_attribute('owner',intval($this->user));
|
||||
}
|
||||
|
||||
function set_category($category='')
|
||||
{
|
||||
$this->event->category = $category;
|
||||
}
|
||||
|
||||
function set_title($title='')
|
||||
{
|
||||
$this->event->title = $title;
|
||||
}
|
||||
|
||||
function set_description($description='')
|
||||
{
|
||||
$this->event->description = $description;
|
||||
}
|
||||
|
||||
function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
|
||||
{
|
||||
$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);
|
||||
$this->event->start->alarm = 0;
|
||||
}
|
||||
|
||||
function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
|
||||
{
|
||||
$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);
|
||||
$this->event->end->alarm = 0;
|
||||
}
|
||||
|
||||
function set_alarm($alarm)
|
||||
{
|
||||
$this->event->alarm = intval($alarm);
|
||||
}
|
||||
|
||||
function set_class($class)
|
||||
{
|
||||
$this->event->public = $class;
|
||||
}
|
||||
|
||||
function set_common_recur($year,$month,$day,$interval)
|
||||
{
|
||||
$this->event->recur_interval = intval($interval);
|
||||
@ -303,4 +356,55 @@ class calendar__
|
||||
$this->event->recur_enddate->alarm = 0;
|
||||
$this->event->recur_data = 0;
|
||||
}
|
||||
|
||||
function set_recur_none()
|
||||
{
|
||||
$this->set_common_recur(0,0,0,0);
|
||||
$this->event->recur_type = RECUR_NONE;
|
||||
}
|
||||
|
||||
function set_recur_daily($year,$month,$day,$interval)
|
||||
{
|
||||
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
|
||||
$this->event->recur_type = RECUR_DAILY;
|
||||
}
|
||||
|
||||
function set_recur_weekly($year,$month,$day,$interval,$weekdays)
|
||||
{
|
||||
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
|
||||
$this->event->recur_type = RECUR_WEEKLY;
|
||||
$this->event->recur_data = intval($weekdays);
|
||||
}
|
||||
|
||||
function set_recur_monthly_mday($year,$month,$day,$interval)
|
||||
{
|
||||
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
|
||||
$this->event->recur_type = RECUR_MONTHLY_MDAY;
|
||||
}
|
||||
|
||||
function set_recur_monthly_wday($year,$month,$day,$interval)
|
||||
{
|
||||
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
|
||||
$this->event->recur_type = RECUR_MONTHLY_WDAY;
|
||||
}
|
||||
|
||||
function set_recur_yearly($year,$month,$day,$interval)
|
||||
{
|
||||
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
|
||||
$this->event->recur_type = RECUR_YEARLY;
|
||||
}
|
||||
|
||||
function fetch_current_stream_event()
|
||||
{
|
||||
return $this->fetch_event($this->event->id);
|
||||
}
|
||||
|
||||
function add_attribute($attribute,&$value)
|
||||
{
|
||||
if(is_array($value))
|
||||
{
|
||||
reset($value);
|
||||
}
|
||||
$this->event->$attribute = $value;
|
||||
}
|
||||
}
|
||||
|
@ -226,170 +226,48 @@ class calendar_ extends calendar__
|
||||
return mcal_event_init($this->stream);
|
||||
}
|
||||
|
||||
function event_set_category($category='')
|
||||
function set_category($category='')
|
||||
{
|
||||
$this->event->category = $category;
|
||||
return mcal_event_set_category($this->stream,$this->event->category);
|
||||
calendar__::set_category($category);
|
||||
return mcal_event_set_category($this->stream,$category);
|
||||
}
|
||||
|
||||
function event_set_title($title='')
|
||||
function set_title($title='')
|
||||
{
|
||||
$this->event->title = $title;
|
||||
return mcal_event_set_title($this->stream,$this->event->title);
|
||||
calendar__::set_title($title);
|
||||
return mcal_event_set_title($this->stream,$title);
|
||||
}
|
||||
|
||||
function event_set_description($description='')
|
||||
function set_description($description='')
|
||||
{
|
||||
$this->event->description = $description;
|
||||
return mcal_event_set_description($this->stream,$this->event->description);
|
||||
calendar__::set_description($description);
|
||||
return mcal_event_set_description($this->stream,$description);
|
||||
}
|
||||
|
||||
function event_set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
|
||||
function set_start($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->mday = $day;
|
||||
$this->event->start->hour = $hour;
|
||||
$this->event->start->min = $min;
|
||||
$this->event->start->sec = $sec;
|
||||
|
||||
if($sec == 0)
|
||||
{
|
||||
if($min == 0)
|
||||
{
|
||||
if($hour == 0)
|
||||
{
|
||||
if($day == 0)
|
||||
{
|
||||
return mcal_event_set_start($this->stream,$year,$month);
|
||||
}
|
||||
else
|
||||
{
|
||||
return mcal_event_set_start($this->stream,$year,$month,$day);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mcal_event_set_start($this->stream,$year,$month,$day,$hour);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mcal_event_set_start($this->stream,$year,$month,$day,$hour,$min);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mcal_event_set_start($this->stream,$year,$month,$day,$hour,$min,$sec);
|
||||
}
|
||||
calendar__::set_start($year,$month,$day,$hour,$min,$sec);
|
||||
return mcal_event_set_start($this->stream,$year,$month,$day,$hour,$min,$sec);
|
||||
}
|
||||
|
||||
function event_set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
|
||||
function set_end($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->mday = $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)
|
||||
{
|
||||
if($min == 0)
|
||||
{
|
||||
if($hour == 0)
|
||||
{
|
||||
if($day == 0)
|
||||
{
|
||||
return mcal_event_set_end($this->stream,$year,$month);
|
||||
}
|
||||
else
|
||||
{
|
||||
return mcal_event_set_end($this->stream,$year,$month,$day);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mcal_event_set_end($this->stream,$year,$month,$day,$hour);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mcal_event_set_end($this->stream,$year,$month,$day,$hour,$min);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mcal_event_set_end($this->stream,$year,$month,$day,$hour,$min,$sec);
|
||||
}
|
||||
calendar__::set_end($year,$month,$day,$hour,$min,$sec);
|
||||
return mcal_event_set_end($this->stream,$year,$month,$day,$hour,$min,$sec);
|
||||
}
|
||||
|
||||
function event_set_alarm($alarm)
|
||||
function set_alarm($alarm)
|
||||
{
|
||||
calendar__::set_alarm($alarm);
|
||||
return mcal_event_set_alarm ($this->stream,$alarm);
|
||||
}
|
||||
|
||||
function event_set_class($class)
|
||||
function set_class($class)
|
||||
{
|
||||
$this->event->public = $class;
|
||||
calendar__::set_class($class);
|
||||
return mcal_event_set_class($this->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($weekstart,$next)
|
||||
@ -397,44 +275,52 @@ class calendar_ extends calendar__
|
||||
return mcal_next_recurrence($this->stream,$weekstart,$next);
|
||||
}
|
||||
|
||||
function event_set_recur_none()
|
||||
function set_recur_none()
|
||||
{
|
||||
calendar__::set_recur_none();
|
||||
return mcal_event_set_recur_none($this->stream);
|
||||
}
|
||||
|
||||
function event_set_recur_daily($year,$month,$day,$interval)
|
||||
function set_recur_daily($year,$month,$day,$interval)
|
||||
{
|
||||
calendar__::set_recur_daily($year,$month,$day,$interval);
|
||||
return mcal_event_set_recur_daily($this->stream,$year,$month,$day,$interval);
|
||||
}
|
||||
|
||||
function event_set_recur_weekly($year,$month,$day,$interval,$weekdays)
|
||||
function set_recur_weekly($year,$month,$day,$interval,$weekdays)
|
||||
{
|
||||
calendar__::set_recur_weekly($year,$month,$day,$interval,$weekdays);
|
||||
return mcal_event_set_recur_weekly($this->stream,$year,$month,$day,$interval,$weekdays);
|
||||
}
|
||||
|
||||
function event_set_recur_monthly_mday($year,$month,$day,$interval)
|
||||
function set_recur_monthly_mday($year,$month,$day,$interval)
|
||||
{
|
||||
calendar__::set_recur_monthly_mday($year,$month,$day,$interval);
|
||||
return mcal_event_set_recur_monthly_mday($this->stream,$year,$month,$day,$interval);
|
||||
}
|
||||
|
||||
function event_set_recur_monthly_wday($year,$month,$day,$interval)
|
||||
function set_recur_monthly_wday($year,$month,$day,$interval)
|
||||
{
|
||||
calendar__::set_recur_monthly_wday($year,$month,$day,$interval);
|
||||
return mcal_event_set_recur_monthly_wday($this->stream,$year,$month,$day,$interval);
|
||||
}
|
||||
|
||||
function event_set_recur_yearly($year,$month,$day,$interval)
|
||||
function set_recur_yearly($year,$month,$day,$interval)
|
||||
{
|
||||
calendar__::set_recur_yearly($year,$month,$day,$interval);
|
||||
return mcal_event_set_recur_yearly($this->stream,$year,$month,$day,$interval);
|
||||
}
|
||||
|
||||
function fetch_current_stream_event()
|
||||
{
|
||||
return mcal_fetch_current_stream_event($this->stream);
|
||||
$this->event = mcal_fetch_current_stream_event($this->stream);
|
||||
return $this->event
|
||||
}
|
||||
|
||||
function event_add_attribute($attribute,$value)
|
||||
function add_attribute($attribute,$value)
|
||||
{
|
||||
mcal_event_add_attribute($this->stream,$attribute,$value);
|
||||
calendar__::add_attribute($attribute,$value);
|
||||
return mcal_event_add_attribute($this->stream,$attribute,$value);
|
||||
}
|
||||
|
||||
function expunge()
|
||||
@ -444,14 +330,6 @@ class calendar_ extends calendar__
|
||||
|
||||
/**************** Local functions for ICAL based Calendar *****************/
|
||||
|
||||
function event_set_participants($participants)
|
||||
{
|
||||
$this->event->participants = Array();
|
||||
reset($participants);
|
||||
$this->event->participants = $participants;
|
||||
return True;
|
||||
}
|
||||
|
||||
function set_status($id,$owner,$status)
|
||||
{
|
||||
$status_code_short = Array(
|
||||
|
@ -101,7 +101,7 @@ class calendar_ extends calendar__
|
||||
{
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
$this->stream->lock(array('phpgw_cal','phpgw_cal_user','phpgw_cal_repeats'));
|
||||
|
||||
$this->stream->query('SELECT * FROM phpgw_cal WHERE cal_id='.$event_id,__LINE__,__FILE__);
|
||||
@ -117,31 +117,23 @@ class calendar_ extends calendar__
|
||||
$this->stream->next_record();
|
||||
// Load the calendar event data from the db into $event structure
|
||||
// Use http://www.php.net/manual/en/function.mcal-fetch-event.php as the reference
|
||||
|
||||
$this->event->owner = $this->stream->f('owner');
|
||||
$this->event->id = intval($this->stream->f('cal_id'));
|
||||
$this->event->public = intval($this->stream->f('is_public'));
|
||||
$this->event->category = intval($this->stream->f('category'));
|
||||
$this->event->title = $phpgw->strip_html($this->stream->f('title'));
|
||||
$this->event->description = $phpgw->strip_html($this->stream->f('description'));
|
||||
$this->add_attribute('owner',intval($this->stream->f('owner')));
|
||||
$this->add_attribute('id',intval($this->stream->f('cal_id')));
|
||||
$this->set_class(intval($this->stream->f('is_public')));
|
||||
$this->set_category(intval($this->stream->f('category')));
|
||||
$this->set_title($phpgw->strip_html($this->stream->f('title')));
|
||||
$this->set_description($phpgw->strip_html($this->stream->f('description')));
|
||||
|
||||
// This is the preferred method once everything is normalized...
|
||||
//$this->event->alarm = intval($this->stream->f('alarm'));
|
||||
// But until then, do it this way...
|
||||
//Legacy Support (New)
|
||||
$this->event->alarm = 0;
|
||||
|
||||
$this->event->datetime = $this->stream->f('datetime');
|
||||
$datetime = $this->datetime->localdates($this->stream->f('datetime'));
|
||||
$this->event->start->year = $datetime['year'];
|
||||
$this->event->start->month = $datetime['month'];
|
||||
$this->event->start->mday = $datetime['day'];
|
||||
$this->event->start->hour = $datetime['hour'];
|
||||
$this->event->start->min = $datetime['minute'];
|
||||
$this->event->start->sec = $datetime['second'];
|
||||
$this->event->start->alarm = 0;
|
||||
|
||||
$this->event->mdatetime = $this->stream->f('mdatetime');
|
||||
$this->add_attribute('datetime',intval($this->stream->f('datetime')));
|
||||
$datetime = $this->datetime->localdates($this->stream->f('datetime'));
|
||||
$this->set_start($datetime['year'],$datetime['month'],$datetime['day'],$datetime['hour'],$datetime['minute'],$datetime['second']);
|
||||
|
||||
$datetime = $this->datetime->localdates($this->stream->f('mdatetime'));
|
||||
$this->event->mod->year = $datetime['year'];
|
||||
$this->event->mod->month = $datetime['month'];
|
||||
@ -151,18 +143,12 @@ class calendar_ extends calendar__
|
||||
$this->event->mod->sec = $datetime['second'];
|
||||
$this->event->mod->alarm = 0;
|
||||
|
||||
$this->event->edatetime = $this->stream->f('edatetime');
|
||||
$this->add_attribute('edatetime',intval($this->stream->f('edatetime')));
|
||||
$datetime = $this->datetime->localdates($this->stream->f('edatetime'));
|
||||
$this->event->end->year = $datetime['year'];
|
||||
$this->event->end->month = $datetime['month'];
|
||||
$this->event->end->mday = $datetime['day'];
|
||||
$this->event->end->hour = $datetime['hour'];
|
||||
$this->event->end->min = $datetime['minute'];
|
||||
$this->event->end->sec = $datetime['second'];
|
||||
$this->event->end->alarm = 0;
|
||||
$this->set_end($datetime['year'],$datetime['month'],$datetime['day'],$datetime['hour'],$datetime['minute'],$datetime['second']);
|
||||
|
||||
//Legacy Support
|
||||
$this->event->priority = intval($this->stream->f('priority'));
|
||||
$this->add_attribute('priority',intval($this->stream->f('priority')));
|
||||
if($this->stream->f('cal_group') || $this->stream->f('groups') != 'NULL')
|
||||
{
|
||||
$groups = explode(',',$this->stream->f('groups'));
|
||||
@ -171,7 +157,7 @@ class calendar_ extends calendar__
|
||||
$this->event->groups[] = $groups[$j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->stream->query('SELECT * FROM phpgw_cal_repeats WHERE cal_id='.$event_id,__LINE__,__FILE__);
|
||||
if($this->stream->num_rows())
|
||||
{
|
||||
@ -297,131 +283,13 @@ class calendar_ extends calendar__
|
||||
//Returns an array of event ID's
|
||||
}
|
||||
|
||||
function event_init()
|
||||
{
|
||||
$this->event = CreateObject('calendar.calendar_item');
|
||||
$this->event->owner = $this->user;
|
||||
return True;
|
||||
}
|
||||
|
||||
function set_category($stream,$category='')
|
||||
{
|
||||
$this->event->category = $category;
|
||||
return True;
|
||||
}
|
||||
|
||||
function set_title($title='')
|
||||
{
|
||||
$this->event->title = $title;
|
||||
return True;
|
||||
}
|
||||
|
||||
function set_description($description='')
|
||||
{
|
||||
$this->event->description = $description;
|
||||
return True;
|
||||
}
|
||||
|
||||
function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
|
||||
{
|
||||
$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);
|
||||
$this->event->start->alarm = 0;
|
||||
return True;
|
||||
}
|
||||
|
||||
function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
|
||||
{
|
||||
$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);
|
||||
$this->event->end->alarm = 0;
|
||||
return True;
|
||||
}
|
||||
|
||||
function set_alarm($alarm)
|
||||
{
|
||||
$this->event->alarm = intval($alarm);
|
||||
return True;
|
||||
}
|
||||
|
||||
function set_class($class)
|
||||
{
|
||||
$this->event->public = $class;
|
||||
return True;
|
||||
}
|
||||
|
||||
// The function definition doesn't look correct...
|
||||
// Need more information for this function
|
||||
function next_recurrence($stream,$weekstart,$next)
|
||||
function next_recurrence($weekstart,$next)
|
||||
{
|
||||
// return next_recurrence (int stream, int weekstart, array next);
|
||||
}
|
||||
|
||||
function event_set_recur_none($stream)
|
||||
{
|
||||
$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_set_recur_daily($stream,$year,$month,$day,$interval)
|
||||
{
|
||||
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
|
||||
$this->event->recur_type = RECUR_DAILY;
|
||||
}
|
||||
|
||||
function event_set_recur_weekly($stream,$year,$month,$day,$interval,$weekdays)
|
||||
{
|
||||
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
|
||||
$this->event->recur_type = RECUR_WEEKLY;
|
||||
$this->event->recur_data = intval($weekdays);
|
||||
}
|
||||
|
||||
function event_set_recur_monthly_mday($stream,$year,$month,$day,$interval)
|
||||
{
|
||||
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
|
||||
$this->event->recur_type = RECUR_MONTHLY_MDAY;
|
||||
}
|
||||
|
||||
function event_set_recur_monthly_wday($stream,$year,$month,$day,$interval)
|
||||
{
|
||||
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
|
||||
$this->event->recur_type = RECUR_MONTHLY_WDAY;
|
||||
}
|
||||
|
||||
function event_set_recur_yearly($stream,$year,$month,$day,$interval)
|
||||
{
|
||||
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
|
||||
$this->event->recur_type = RECUR_YEARLY;
|
||||
}
|
||||
|
||||
function fetch_current_stream_event($stream)
|
||||
{
|
||||
return $this->fetch_event($stream,$this->event->id);
|
||||
}
|
||||
|
||||
function event_add_attribute($stream,$attribute,$value)
|
||||
{
|
||||
$this->event->$attribute = $value;
|
||||
}
|
||||
|
||||
function expunge($stream)
|
||||
{
|
||||
if(count($this->deleted_events) <= 0)
|
||||
|
@ -35,8 +35,8 @@
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
$cal_stream = $phpgw->calendar->open('INBOX',$owner,'');
|
||||
$event = $phpgw->calendar->fetch_event($cal_stream,$id);
|
||||
$phpgw->calendar->open('INBOX',$owner,'');
|
||||
$event = $phpgw->calendar->fetch_event($id);
|
||||
|
||||
echo $phpgw->calendar->view_event($event);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user