diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php
index a20472e95e..03f1ffb873 100755
--- a/calendar/inc/class.bocalendar.inc.php
+++ b/calendar/inc/class.bocalendar.inc.php
@@ -19,6 +19,7 @@
var $public_functions = Array(
'read_entry' => True,
'delete_entry' => True,
+ 'delete_calendar' => True,
'update' => True,
'preferences' => True,
'store_to_cache' => True
@@ -249,6 +250,24 @@
return $cd;
}
+ function delete_calendar($owner)
+ {
+ global $phpgw_info;
+ if($phpgw_info['user']['apps']['admin'])
+ {
+ $this->so->delete_calendar($owner);
+ }
+ }
+
+ function change_owner($account_id,$new_owner)
+ {
+ global $phpgw_info;
+ if($phpgw_info['server']['calendar_type'] == 'sql')
+ {
+ $this->so->change_owner($account_id,$new_owner);
+ }
+ }
+
function expunge()
{
if($this->check_perms(PHPGW_ACL_DELETE))
diff --git a/calendar/inc/class.socalendar.inc.php b/calendar/inc/class.socalendar.inc.php
index 20bddc3906..49e35c2047 100755
--- a/calendar/inc/class.socalendar.inc.php
+++ b/calendar/inc/class.socalendar.inc.php
@@ -202,6 +202,22 @@
$this->cal->expunge();
}
+ function delete_calendar($owner)
+ {
+ $this->makeobj();
+ $this->cal->delete_calendar($owner);
+ }
+
+ function change_owner($account_id,$new_owner)
+ {
+ global $phpgw_info;
+ if($phpgw_info['server']['calendar_type'] == 'sql')
+ {
+ $this->so->cal->query('UPDATE phpgw_cal SET owner='.$new_owner.' WHERE owner='.$account_id,__LINE__,__FILE__);
+ $this->so->cal->query('UPDATE phpgw_cal_user SET cal_login='.$new_owner.' WHERE cal_login='.$account_id);
+ }
+ }
+
function set_status($id,$status)
{
$this->makeobj();
diff --git a/calendar/inc/hook_deleteaccount.inc.php b/calendar/inc/hook_deleteaccount.inc.php
index 7cceafec0c..73ee2728be 100755
--- a/calendar/inc/hook_deleteaccount.inc.php
+++ b/calendar/inc/hook_deleteaccount.inc.php
@@ -17,15 +17,14 @@
global $account_id, $new_owner;
}
- $calendar = CreateObject('calendar.calendar');
- $calendar->open('INBOX',$account_id,'');
+ $cal = CreateObject('calendar.bocalendar');
if(intval($new_owner)==0)
{
- $calendar->delete_calendar(intval($account_id));
+ $cal->delete_calendar(intval($account_id));
}
else
{
- $calendar->change_owner(intval($account_id),intval($new_owner));
+ $cal->change_owner(intval($account_id),intval($new_owner));
}
?>
diff --git a/calendar/inc/hook_email.inc.php b/calendar/inc/hook_email.inc.php
index 7205d8596f..57bb54be78 100755
--- a/calendar/inc/hook_email.inc.php
+++ b/calendar/inc/hook_email.inc.php
@@ -14,7 +14,7 @@
/* $Id$ */
- global $owner, $rights, $calendar_id;
+ global $calendar_id;
$d1 = strtolower(substr($phpgw_info['server']['app_inc'],0,3));
if($d1 == 'htt' || $d1 == 'ftp')
@@ -24,38 +24,26 @@
}
unset($d1);
- $tmp_app_inc = $phpgw_info['server']['app_inc'];
- $phpgw_info['server']['app_inc'] = $phpgw->common->get_inc_dir('calendar');
+ $cal = CreateObject('calendar.uicalendar');
+ echo 'Event ID: '.$calendar_id."
\n";
- include($phpgw_info['server']['app_inc'].'/functions.inc.php');
+ $event = $cal->bo->read_entry($calendar_id);
- $str = '';
-
- $id = $calendar_id;
-
- echo 'Event ID: '.$id."
\n";
-
- $cal_stream = $phpgw->calendar->open('INBOX',$owner,'');
- $event = $phpgw->calendar->fetch_event($id);
-
- reset($event->participants);
- while(list($particpants,$status) = each($event->participants))
+ reset($event['participants']);
+ while(list($particpants,$status) = each($event['participants']))
{
$parts[] = $participants;
}
@reset($parts);
- $freetime = $phpgw->calendar->localdates(mktime(0,0,0,$event->start->month,$event->start->mday,$event->start->year) - $phpgw->calendar->tz_offset);
- echo $phpgw->calendar->timematrix($freetime,$phpgw->calendar->splittime('000000',False),0,$parts);
+ $freetime = $cal->bo->datetime->localdates(mktime(0,0,0,$event['start']['month'],$event['start']['mday'],$event['start']['year']) - $phpgw->calendar->tz_offset);
+ echo $cal->timematrix($freetime,$cal->bo->splittime('000000',False),0,$parts);
echo '