You are here

function taxonomy_manager_export_form in Taxonomy Manager 5

Same name and namespace in other branches
  1. 6.2 taxonomy_manager.admin.inc \taxonomy_manager_export_form()
  2. 6 taxonomy_manager.admin.inc \taxonomy_manager_export_form()
  3. 7 taxonomy_manager.admin.inc \taxonomy_manager_export_form()

form for exporting terms

1 call to taxonomy_manager_export_form()
taxonomy_manager_form in ./taxonomy_manager.module
defines forms for taxonomy manager interface

File

./taxonomy_manager.module, line 586
Taxonomy Manager

Code

function taxonomy_manager_export_form($voc) {
  drupal_add_js(array(
    'hideForm' => array(
      'show_button' => 'edit-export-show',
      'hide_button' => 'edit-export-cancel',
      'div' => 'export-form',
    ),
  ), 'setting');
  $module_path = drupal_get_path('module', 'taxonomy_manager') . '/';
  drupal_add_js($module_path . 'js/csv_export.js');
  drupal_add_js(array(
    'exportCSV' => array(
      'url' => url("admin/content/taxonomy_manager/export"),
    ),
  ), 'setting');
  $form = array();
  $form['export'] = array(
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#title' => t('CSV Export'),
    '#description' => $description,
    '#prefix' => '<div id="export-form">',
    '#suffix' => '</div>',
  );
  $form['export']['delimiter'] = array(
    '#type' => 'textfield',
    '#title' => t('Delimiter for CSV File'),
    '#required' => FALSE,
    '#default_value' => ";",
  );
  $options['whole_voc'] = t('Whole Vocabulary');
  $options['children'] = t('Child terms of a selected term');
  $options['root_terms'] = t('Root level terms only');
  $form['export']['options'] = array(
    '#type' => 'radios',
    '#title' => t('Terms to export'),
    '#options' => $options,
    '#default_value' => 'whole_voc',
    '#prefix' => '<div id="taxonomy_manager_export_options">',
    '#suffix' => '</div>',
  );
  $form['export']['csv'] = array(
    '#type' => 'textarea',
    '#title' => t('Exported CSV'),
    '#description' => t('The generated code will appear here (per AJAX). You can copy and paste the code into a .csv file. The csv has following columns: voc id | term id | term name | description | parent id 1 | ... | parent id n'),
    '#rows' => 8,
  );
  $form['export']['submit'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => 'taxonomy-manager-buttons export',
    ),
    '#value' => t('Export now'),
    '#theme' => 'no_submit_button',
  );
  $form['export']['cancel'] = array(
    '#type' => 'button',
    '#value' => t('Cancel'),
    '#attributes' => array(
      'class' => 'taxonomy-manager-buttons cancel',
    ),
    '#theme' => 'no_submit_button',
  );
  return $form;
}