function date_copy_import_ical_form in Date 5.2
Same name and namespace in other branches
- 5 date_copy.module \date_copy_import_ical_form()
- 6 date_copy/date_copy.module \date_copy_import_ical_form()
iCal import form.
1 string reference to 'date_copy_import_ical_form'
- date_copy_menu in date_copy/
date_copy.module - Implementation of hook_menu()
File
- date_copy/
date_copy.module, line 297
Code
function date_copy_import_ical_form($form_values = NULL) {
if (!empty($form_values)) {
foreach ($form_values as $key => $value) {
$form[$key] = array(
'#type' => 'hidden',
'#default_value' => $value,
);
}
}
$step = intval($form_values['step'] + 1);
$form['step'] = array(
'#type' => 'hidden',
'#value' => $step,
);
$form['#multistep'] = TRUE;
$form['#redirect'] = FALSE;
switch ($step) {
case 1:
// Select a content type to import into.
$form['#prefix'] = t('<p>Create a new CCK content type to import your events into. Make sure it has a date field that can allows a To date so it can accept the From date and To date of the iCal feed. If you are importing dates that have their own timezones, make sure you set the timezone handling of the date to \'date\'. Test the new type by trying to create a node manually and make sure all the right options are available in the form before attempting an import.</p><p><strong>The import will create new nodes and trigger all related hooks, so you may want to turn off automatic email messaging for this node type while performing the import!</strong></p>');
$form['source_file'] = array(
'#type' => 'textfield',
'#title' => t('Source file'),
'#default_value' => '',
);
$form += date_copy_type_form(TRUE);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
case 2:
// Select the fields to import into.
$node_types = node_get_types('names');
$type = $form_values['target_type'];
$form['target_type'] = array(
'#value' => $type,
'#type' => 'hidden',
);
$form['source_file'] = array(
'#value' => $form_values['source_file'],
'#type' => 'hidden',
);
$form['fields'] = array(
'#type' => 'fieldset',
'#title' => t('!type Fields', array(
'!type' => $node_types[$type],
)),
'#weight' => -1,
);
$form['fields'] += date_copy_type_fields_form($type, TRUE);
$form += date_copy_type_misc_form($type);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}
return $form;
}