function import_admin_form_submit in Import 6
Submit handler for the import_admin_form
File
- ./
import.module, line 119
Code
function import_admin_form_submit($form, &$form_state) {
if ($form_state['clicked_button']['#value'] == t('Stage Data for Import')) {
import_stage_import();
$import = db_fetch_object(db_query("SELECT count(impid) as total FROM {import}"));
drupal_set_message(t('%total items are staged for Import', array(
'%total' => $import->total,
)));
}
else {
$type_array = explode(' ', $form_state['clicked_button']['#value']);
$type = array_pop($type_array);
$import = db_fetch_object(db_query("SELECT count(impid) as total FROM {import} WHERE type = '%s'", $type));
if ($import->total > 0) {
$operations = array();
$result = db_query("Select impid, type from {import} WHERE type = '%s'", $type);
while ($row = db_fetch_object($result)) {
$operations[] = array(
'import_process_import',
array(
$row,
),
);
}
$batch = array(
'operations' => $operations,
'title' => t('Importing'),
'init_message' => t('Import is starting to process %total %type items', array(
'%total' => $import->total,
'%type' => $type,
)),
'progress_message' => t('Processed @current out of @total.'),
'error_message' => t('Import has encountered an error.'),
);
batch_set($batch);
}
else {
drupal_set_message(t('%total items are staged for Import', array(
'%total' => $import->total,
)));
}
}
}