Format CSV export data from internal/numeric format into something a little more friendly for normal people

This commit is contained in:
Nathan Gray 2010-11-04 17:27:08 +00:00
parent 70d0e8dad1
commit 9ab9397af7
2 changed files with 13 additions and 2 deletions

View File

@ -44,7 +44,7 @@ class calendar_egw_record implements importexport_iface_egw_record
* @param string $_attribute_name
*/
public function __get($_attribute_name) {
return $this->record[$_attribute_name];
}
/**
@ -54,7 +54,7 @@ class calendar_egw_record implements importexport_iface_egw_record
* @param data $data
*/
public function __set($_attribute_name, $data) {
$this->record[$_attribute_name] = $data;
}
/**

View File

@ -36,12 +36,23 @@ class calendar_export_csv implements importexport_iface_export_plugin {
$export_object = new importexport_export_csv($_stream, (array)$options);
$export_object->set_mapping($options['mapping']);
$convert_fields = importexport_export_csv::$types;
$convert_fields['date-time'][] = 'start';
$convert_fields['date-time'][] = 'end';
// $options['selection'] is array of identifiers as this plugin doesn't
// support other selectors atm.
$record = new calendar_egw_record();
foreach ($events as $event) {
// Add in participants
if($options['mapping']['participants']) {
$event['participants'] = implode(", ",$this->bo->participants($event,true));
}
$record->set_record($event);
// Standard stuff
importexport_export_csv::convert($record, $convert_fields, 'calendar');
$export_object->export_record($record);
}
unset($record);