This brings the hook_email and the hook_deleteaccount in line with the n-tier.

This commit is contained in:
skeeter 2001-08-01 11:06:17 +00:00
parent b90e0c4bf6
commit 77dc66bb77
4 changed files with 48 additions and 26 deletions

View File

@ -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))

View File

@ -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();

View File

@ -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));
}
?>

View File

@ -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."<br>\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."<br>\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 '</td></tr><tr><td>';
echo $phpgw->calendar->view_event($event);
echo $cal->view_event($event);
echo '</td></tr><td align="center"><tr>';
$phpgw->calendar->fetch_event($id);
echo $phpgw->calendar->get_response();
$phpgw_info['server']['app_inc'] = $tmp_app_inc;
echo $cal->get_response($calendar_id);
?>