Use Horde to export multiple infologs

This commit is contained in:
Nathan Gray 2012-04-05 15:57:06 +00:00
parent db196bd739
commit f6ac7b8419
3 changed files with 20 additions and 11 deletions

View File

@ -25,6 +25,7 @@ class infolog_export_ical extends infolog_export_csv {
$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');
@ -47,15 +48,17 @@ class infolog_export_ical extends infolog_export_csv {
break;
}
$ical = '';
$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)
{
$ical .= $result;
$horde->parsevCalendar($result, 'VCALENDAR', 'utf-8', false);
}
}
fwrite($_stream, $ical);
fwrite($_stream, $horde->exportvCalendar());
}
/**
@ -64,7 +67,7 @@ class infolog_export_ical extends infolog_export_csv {
* @return string name
*/
public static function get_name() {
return lang('iCal export');
return lang('Infolog iCal export');
}
/**

View File

@ -116,7 +116,7 @@ class infolog_import_ical implements importexport_iface_import_plugin {
* @return string name
*/
public static function get_name() {
return lang('iCal import');
return lang('Infolog iCal import');
}
/**

View File

@ -1222,14 +1222,20 @@ class infolog_ui
if ($query['filter']) egw_cache::setSession('infolog', 'filter_reset_from', $query['filter']);
return $this->index(array(),'sp',$checked,0);
case 'ical':
// infolog_ical lets horde be auto-loaded, so it must go first
$boical = new infolog_ical();
$result = '';
foreach($checked as $id)
{
$result .= $boical->exportVTODO($id,'2.0','PUBLISH',false);
$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.ical','text/calendar');
echo $result;
ExecMethod2('phpgwapi.browser.content_header','todo.ics','text/calendar');
echo $horde->exportvCalendar();
common::egw_exit();
}