function regcode_admin_import in Registration codes 5.3
Same name and namespace in other branches
- 6 regcode.admin.php \regcode_admin_import()
Return the form associated with the registration code import admin page
Return value
The import form array
1 string reference to 'regcode_admin_import'
- regcode_menu in ./
regcode.module - Define menu items and page callbacks.
File
- ./
regcode_admin.inc.php, line 233 - regcode_admin.inc.php contains the top-level logic for the administration pages for the registration-code module
Code
function regcode_admin_import() {
$form['#cache'] = FALSE;
$form['#attributes']['enctype'] = 'multipart/form-data';
$form['regcode_import_action'] = array(
'#type' => 'select',
'#title' => t("Action"),
'#default_value' => variable_get('regcode_import_action', 'skip'),
'#options' => array(
'skip' => t('Skip'),
'overwrite' => t('Overwrite'),
'clean' => t('Clean'),
),
'#description' => t('Action to perform when importing the data.<br />
- <b>Skip</b>: Add new codes skipping those which already exists.<br />
- <b>Overwrite</b>: Add new codes overwriting those which already exists.<br />
- <b>Clean</b>: Erases *all* existing codes before importing new codes.<br />
'),
);
if ($form['regcode_import_action']['#default_value'] == 'clean') {
$form['regcode_import_action_check'] = array(
'#type' => 'checkbox',
'#title' => t("Really CLEAN (wipe out) all existing codes with the selected import action?"),
'#default_value' => 0,
'#required' => TRUE,
'#validate' => array(
'regcode_import_action_check_validation' => array(),
),
);
}
$form['regcode_import_file'] = array(
'#type' => 'file',
'#title' => t("File"),
'#description' => t('File upload with data to add/import (plaintext list or CSV format)'),
);
$form['regcode_import_text'] = array(
'#type' => 'textarea',
'#cols' => 80,
'#rows' => 32,
'#title' => t("Data"),
'#description' => t('Direct text input with data to add/import (plaintext list or CSV format)'),
);
regcode_form_add_codetemplate(&$form);
$form['submit'] = array(
'#type' => 'submit',
'#title' => t('Import'),
'#value' => 'submit',
);
return $form;
}