mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 09:53:20 +01:00
Started adding support for iCal exports from the view screen.
This commit is contained in:
parent
fe32e5d89e
commit
9bd1f18cd4
@ -22,7 +22,8 @@
|
|||||||
'delete_calendar' => True,
|
'delete_calendar' => True,
|
||||||
'update' => True,
|
'update' => True,
|
||||||
'preferences' => True,
|
'preferences' => True,
|
||||||
'store_to_cache' => True
|
'store_to_cache' => True,
|
||||||
|
'export_event' => True
|
||||||
);
|
);
|
||||||
|
|
||||||
var $soap_functions = Array(
|
var $soap_functions = Array(
|
||||||
@ -69,6 +70,14 @@
|
|||||||
'out' => Array(
|
'out' => Array(
|
||||||
'SOAPStruct'
|
'SOAPStruct'
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
'store_to_cache' => Array(
|
||||||
|
'in' => Array(
|
||||||
|
'array'
|
||||||
|
),
|
||||||
|
'out' => Array(
|
||||||
|
'string'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -256,6 +265,11 @@
|
|||||||
'function' => 'store_to_cache',
|
'function' => 'store_to_cache',
|
||||||
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||||
'docstring' => lang('Read a list of entries.')
|
'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;
|
return $xml_functions;
|
||||||
@ -1635,6 +1649,47 @@
|
|||||||
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $temp_dateformat;
|
$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)
|
function prepare_recipients(&$new_event,$old_event)
|
||||||
{
|
{
|
||||||
// Find modified and deleted users.....
|
// Find modified and deleted users.....
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
'year' => True,
|
'year' => True,
|
||||||
'view' => True,
|
'view' => True,
|
||||||
'edit' => True,
|
'edit' => True,
|
||||||
|
'export' => True,
|
||||||
'add' => True,
|
'add' => True,
|
||||||
'delete' => True,
|
'delete' => True,
|
||||||
'preferences' => True,
|
'preferences' => True,
|
||||||
@ -477,15 +478,13 @@
|
|||||||
|
|
||||||
function view($vcal_id=0)
|
function view($vcal_id=0)
|
||||||
{
|
{
|
||||||
global $HTTP_GET_VARS;
|
|
||||||
|
|
||||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||||
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
||||||
$GLOBALS['phpgw']->common->phpgw_header();
|
$GLOBALS['phpgw']->common->phpgw_header();
|
||||||
|
|
||||||
echo '<center>';
|
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
|
// First, make sure they have permission to this entry
|
||||||
if ($cal_id < 1)
|
if ($cal_id < 1)
|
||||||
@ -566,6 +565,16 @@
|
|||||||
echo $p->fp('out','form_button');
|
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>';
|
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)
|
function add($cd=0,$readsess=0)
|
||||||
{
|
{
|
||||||
global $HTTP_GET_VARS;
|
global $HTTP_GET_VARS;
|
||||||
|
Loading…
Reference in New Issue
Block a user