egroupware_official/calendar/inc/class.calendar_wizard_import_csv.inc.php

80 lines
1.9 KiB
PHP
Raw Permalink Normal View History

<?php
/**
2016-05-01 19:47:59 +02:00
* EGroupware - Wizard for user CSV import
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package calendar
* @subpackage importexport
* @link http://www.egroupware.org
* @author Nathan Gray
* @version $Id$
*/
2016-05-01 19:47:59 +02:00
use EGroupware\Api;
class calendar_wizard_import_csv extends importexport_wizard_basic_import_csv
{
/**
* constructor
*/
function __construct()
{
parent::__construct();
$this->steps += array(
'wizard_step50' => lang('Manage mapping'),
);
// Override conditions template to add conflict option
$this->step_templates['wizard_step55'] = 'calendar.import.conditions';
// Field mapping
$tracking = new calendar_tracking();
$this->mapping_fields = array('id' => 'Calendar ID') + $tracking->field2label;
2011-11-08 23:33:34 +01:00
// List each custom field
unset($this->mapping_fields['customfields']);
2016-05-01 19:47:59 +02:00
$custom = Api\Storage\Customfields::get('calendar');
2011-11-08 23:33:34 +01:00
foreach($custom as $name => $data) {
$this->mapping_fields['#'.$name] = $data['label'];
}
// Actions
$this->actions = array(
'none' => lang('none'),
'update' => lang('update'),
'insert' => lang('insert'),
);
// Conditions
$this->conditions = array(
2011-04-07 01:51:24 +02:00
'exists' => lang('exists'),
);
}
function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv)
{
$result = parent::wizard_step50($content, $sel_options, $readonlys, $preserv);
2016-05-01 19:47:59 +02:00
return $result;
}
2011-04-07 17:10:05 +02:00
// Conditions
function wizard_step55(&$content, &$sel_options, &$readonlys, &$preserv)
{
$result = parent::wizard_step55($content, $sel_options, $readonlys, $preserv);
// Search can only deal with ID
$sel_options['string'] = array(
'id' => lang('Calendar ID')
2011-04-07 17:10:05 +02:00
);
if(!$content['skip_conflicts'] && $content['plugin_options']['skip_conflicts'])
{
$content['skip_conflicts'] = $content['plugin_options']['skip_conflicts'];
}
2011-04-07 17:10:05 +02:00
return $result;
}
}