mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
* 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) {
|
public function export( $_stream, importexport_definition $_definition) {
|
||||||
$options = $_definition->plugin_options;
|
$options = $_definition->plugin_options;
|
||||||
$this->bo = new infolog_bo();
|
$this->bo = new infolog_bo();
|
||||||
$boical = new infolog_ical();
|
|
||||||
$horde = new Horde_iCalendar();
|
|
||||||
|
|
||||||
$limit_exception = bo_merge::is_export_limit_excepted();
|
$limit_exception = bo_merge::is_export_limit_excepted();
|
||||||
if (!$limit_exception) $export_limit = bo_merge::getExportLimit('infolog');
|
if (!$limit_exception) $export_limit = bo_merge::getExportLimit('infolog');
|
||||||
@ -48,17 +46,8 @@ class infolog_export_ical extends infolog_export_csv {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$horde->clear();
|
$boical = new infolog_ical();
|
||||||
foreach($selection as $_selection) {
|
fwrite($_stream, $boical->exportvCalendar($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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,6 +108,29 @@ class infolog_ical extends infolog_bo
|
|||||||
$this->clientProperties = $_clientProperties;
|
$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
|
* 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 $_version='2.0' could be '1.0' too
|
||||||
* @param string $_method='PUBLISH'
|
* @param string $_method='PUBLISH'
|
||||||
* @param string $charset='UTF-8' encoding of the vcalendar, default UTF-8
|
* @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)
|
* @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))
|
if (is_array($task))
|
||||||
{
|
{
|
||||||
@ -166,11 +190,11 @@ class infolog_ical extends infolog_bo
|
|||||||
array2string($taskData)."\n",3,$this->logfile);
|
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'].'//'.
|
$vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'.
|
||||||
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
|
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']),array(),false);
|
||||||
$vcal->setAttribute('VERSION',$_version);
|
$vcal->setAttribute('VERSION',$_version,array(),false);
|
||||||
if ($_method) $vcal->setAttribute('METHOD',$_method);
|
if ($_method) $vcal->setAttribute('METHOD',$_method,array(),false);
|
||||||
|
|
||||||
$tzid = $this->tzid;
|
$tzid = $this->tzid;
|
||||||
if ($tzid && $tzid != 'UTC')
|
if ($tzid && $tzid != 'UTC')
|
||||||
|
@ -1224,20 +1224,10 @@ class infolog_ui
|
|||||||
case 'ical':
|
case 'ical':
|
||||||
// infolog_ical lets horde be auto-loaded, so it must go first
|
// infolog_ical lets horde be auto-loaded, so it must go first
|
||||||
$boical = new infolog_ical();
|
$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');
|
ExecMethod2('phpgwapi.browser.content_header','todo.ics','text/calendar');
|
||||||
echo $horde->exportvCalendar();
|
echo $boical->exportvCalendar($checked);
|
||||||
common::egw_exit();
|
common::egw_exit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions that need to loop
|
// Actions that need to loop
|
||||||
|
Loading…
Reference in New Issue
Block a user