You are here

function feeds_xls_download_populated_template in Feeds XLS 7

Callback function to provide the populated template.

1 string reference to 'feeds_xls_download_populated_template'
feeds_xls_menu in ./feeds_xls.module
Implementation of hook_menu().

File

./feeds_xls.template.inc, line 64

Code

function feeds_xls_download_populated_template($feeds_importer, $bid = FALSE) {
  get_class($feeds_importer->processor);
  if (get_class($feeds_importer->parser) == 'FeedsExcelParser') {
    if (empty($feeds_importer->parser->config['no_headers'])) {

      // We can go ahead, so here we create the batch and start it.
      $batch = array(
        'title' => t('Creating Populated Excel template'),
        'operations' => array(
          array(
            'feeds_xls_create_csv_of_data',
            array(
              $feeds_importer,
            ),
          ),
        ),
        'finished' => 'feeds_xls_redirect_to_populated_file',
        'file' => drupal_get_path('module', 'feeds_xls') . '/feeds_xls.template.inc',
      );
      batch_set($batch);
      batch_process();
    }
    else {
      drupal_set_message(t('The current configuration for this importer is set to use no headers.'), 'error');
      drupal_goto(arg(0) . '/' . arg(1));
    }
  }
  else {

    // This isn't an Excel importer. Give an error message.
    drupal_set_message(t('The requested Feeds importer does not appear to be using the Excel parser.'), 'error');
    drupal_goto(arg(0) . '/' . arg(1));
  }
}