forked from extern/egroupware
* InfoLog: fix export of multiple InfoLogs (no METHOD, only one VERSION, PRODID and correct dates)
This commit is contained in:
parent
d1941b57e9
commit
71d669e951
@ -24,8 +24,6 @@ class infolog_export_ical extends infolog_export_csv {
|
||||
public function export( $_stream, importexport_definition $_definition) {
|
||||
$options = $_definition->plugin_options;
|
||||
$this->bo = new infolog_bo();
|
||||
$boical = new infolog_ical();
|
||||
$horde = new Horde_iCalendar();
|
||||
|
||||
$limit_exception = bo_merge::is_export_limit_excepted();
|
||||
if (!$limit_exception) $export_limit = bo_merge::getExportLimit('infolog');
|
||||
@ -48,17 +46,8 @@ class infolog_export_ical extends infolog_export_csv {
|
||||
break;
|
||||
}
|
||||
|
||||
$horde->clear();
|
||||
foreach($selection as $_selection) {
|
||||
$result = $boical->exportVTODO($_selection,'2.0','PUBLISH',false);
|
||||
|
||||
// infolog_ical doesn't allow a nice call to get just the VTODO
|
||||
if($result)
|
||||
{
|
||||
$horde->parsevCalendar($result, 'VCALENDAR', 'utf-8', false);
|
||||
}
|
||||
}
|
||||
fwrite($_stream, $horde->exportvCalendar());
|
||||
$boical = new infolog_ical();
|
||||
fwrite($_stream, $boical->exportvCalendar($selection));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,6 +108,29 @@ class infolog_ical extends infolog_bo
|
||||
$this->clientProperties = $_clientProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports multiple InfoLogs
|
||||
*
|
||||
* @param array $tasks array of info_ids or task arrays
|
||||
* @param string $_version='2.0'
|
||||
* @param string $_method=null only set for iTip messages
|
||||
* @param string $charset='UTF-8'
|
||||
* @return string|boolean string with vCal or false on error (eg. no permission to read the event)
|
||||
*/
|
||||
function exportVCalendar(array $tasks, $_version='2.0', $_method=null, $charset='UTF-8')
|
||||
{
|
||||
$vcal = new Horde_iCalendar;
|
||||
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if (!$this->exportVTODO($task, $_version, $_method, $charset, $vcal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $vcal->exportVCalendar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports one InfoLog tast to an iCalendar VTODO
|
||||
*
|
||||
@ -115,10 +138,11 @@ class infolog_ical extends infolog_bo
|
||||
* @param string $_version='2.0' could be '1.0' too
|
||||
* @param string $_method='PUBLISH'
|
||||
* @param string $charset='UTF-8' encoding of the vcalendar, default UTF-8
|
||||
* @param Horde_iCalendar $vcal=null optional iCalendar object to add vtodo to
|
||||
*
|
||||
* @return string|boolean string with vCal or false on error (eg. no permission to read the event)
|
||||
*/
|
||||
function exportVTODO($task, $_version='2.0',$_method='PUBLISH', $charset='UTF-8')
|
||||
function exportVTODO($task, $_version='2.0',$_method='PUBLISH', $charset='UTF-8',Horde_iCalendar $vcal=null)
|
||||
{
|
||||
if (is_array($task))
|
||||
{
|
||||
@ -166,11 +190,11 @@ class infolog_ical extends infolog_bo
|
||||
array2string($taskData)."\n",3,$this->logfile);
|
||||
}
|
||||
|
||||
$vcal = new Horde_iCalendar;
|
||||
if (!isset($vcal)) $vcal = new Horde_iCalendar;
|
||||
$vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'.
|
||||
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
|
||||
$vcal->setAttribute('VERSION',$_version);
|
||||
if ($_method) $vcal->setAttribute('METHOD',$_method);
|
||||
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']),array(),false);
|
||||
$vcal->setAttribute('VERSION',$_version,array(),false);
|
||||
if ($_method) $vcal->setAttribute('METHOD',$_method,array(),false);
|
||||
|
||||
$tzid = $this->tzid;
|
||||
if ($tzid && $tzid != 'UTC')
|
||||
|
@ -1224,18 +1224,8 @@ class infolog_ui
|
||||
case 'ical':
|
||||
// infolog_ical lets horde be auto-loaded, so it must go first
|
||||
$boical = new infolog_ical();
|
||||
$horde = new Horde_iCalendar();
|
||||
foreach($checked as $_selection) {
|
||||
$result = $boical->exportVTODO($_selection,'2.0','PUBLISH',false);
|
||||
|
||||
// infolog_ical doesn't allow a nice call to get just the VTODO
|
||||
if($result)
|
||||
{
|
||||
$horde->parsevCalendar($result, 'VCALENDAR', 'utf-8', false);
|
||||
}
|
||||
}
|
||||
ExecMethod2('phpgwapi.browser.content_header','todo.ics','text/calendar');
|
||||
echo $horde->exportvCalendar();
|
||||
echo $boical->exportvCalendar($checked);
|
||||
common::egw_exit();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user