Started adding support for iCal exports from the view screen.

This commit is contained in:
skeeter 2001-08-29 19:18:32 +00:00
parent fe32e5d89e
commit 9bd1f18cd4
2 changed files with 76 additions and 4 deletions

View File

@ -22,7 +22,8 @@
'delete_calendar' => True,
'update' => True,
'preferences' => True,
'store_to_cache' => True
'store_to_cache' => True,
'export_event' => True
);
var $soap_functions = Array(
@ -69,6 +70,14 @@
'out' => Array(
'SOAPStruct'
)
),
'store_to_cache' => Array(
'in' => Array(
'array'
),
'out' => Array(
'string'
)
)
);
@ -256,6 +265,11 @@
'function' => 'store_to_cache',
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
'docstring' => lang('Read a list of entries.')
),
'export_event' => array(
'function' => 'export_event',
'signature' => array(array(xmlrpcString,xmlrpcStruct)),
'docstring' => lang('Export a list of entries in iCal format.')
)
);
return $xml_functions;
@ -1635,6 +1649,47 @@
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $temp_dateformat;
}
function export_event($l_event_id=0)
{
$event_id = ($l_event_id?$l_event_id:$GLOBALS['HTTP_GET_VARS']['cal_id']);
include(PHPGW_APP_INC.'/../setup/setup.inc.php');
$icalendar = CreateObject('calendar.boicalendar');
if(!is_array($event_id))
{
$ids[] = $event_id;
}
else
{
$ids = $event_id;
}
$ical = $icalendar->new_ical();
$icalendar->set_var($ical['prodid'],'value','-//phpGroupWare//phpGroupWare '.$setup_info['calendar']['version'].' MIMEDIR//'.strtoupper($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']));
$icalendar->set_var($ical['version'],'value','2.0');
$icalendar->set_var($ical['method'],'value',strtoupper('publish'));
while(list($key,$value) = each($ids))
{
$ical_event = Array();
$event = $this->so->read_entry($event_id);
$icalendar->set_var($ical_event['uid'],'value','phpGW/'.$event['id']);
$icalendar->set_var($ical_event['description'],'value',$event['title']);
$icalendar->set_var($ical_event['summary'],'value',$event['description']);
$dtstart_mktime = $this->maketime($event['start']) - $this->datetime->tz_offset;
$icalendar->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'event');
$dtend_mktime = $this->maketime($event['end']) - $this->datetime->tz_offset;
$icalendar->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'event');
$ical_events[] = $ical_event;
}
$ical['event'] = $ical_events;
return $icalendar->build_ical($ical);
}
function prepare_recipients(&$new_event,$old_event)
{
// Find modified and deleted users.....

View File

@ -40,6 +40,7 @@
'year' => True,
'view' => True,
'edit' => True,
'export' => True,
'add' => True,
'delete' => True,
'preferences' => True,
@ -477,15 +478,13 @@
function view($vcal_id=0)
{
global $HTTP_GET_VARS;
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
echo '<center>';
$cal_id = $vcal_id?$vcal_id:$HTTP_GET_VARS['cal_id'];
$cal_id = $vcal_id?$vcal_id:$GLOBALS['HTTP_GET_VARS']['cal_id'];
// First, make sure they have permission to this entry
if ($cal_id < 1)
@ -566,6 +565,16 @@
echo $p->fp('out','form_button');
}
}
$var = Array(
'action_url_button' => $this->page('export','&cal_id='.$cal_id),
'action_text_button' => lang('Export'),
'action_confirm_button' => '',
'action_extra_field' => ''
);
$p->set_var($var);
echo $p->fp('out','form_button');
echo '</center>';
}
@ -623,6 +632,14 @@
}
}
function export($vcal_id=0)
{
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
echo nl2br($this->bo->export_event($cal_id));
}
function add($cd=0,$readsess=0)
{
global $HTTP_GET_VARS;