You are here

function taxonomy_xml_export in Taxonomy import/export via XML 6

Same name and namespace in other branches
  1. 5.2 taxonomy_xml.module \taxonomy_xml_export()
  2. 5 taxonomy_xml.module \taxonomy_xml_export()
  3. 6.2 taxonomy_xml.module \taxonomy_xml_export()
  4. 7 taxonomy_xml.export.inc \taxonomy_xml_export()

taxonomy_xml_export

Page callback. Displays an unordered list of all available vocabularies for export

Return value

An unordered HTML list

1 string reference to 'taxonomy_xml_export'
taxonomy_xml_menu in ./taxonomy_xml.module
Implementation of hook_menu: Define menu links.

File

./taxonomy_xml.module, line 163
taxonomy_xml.module This module makes it possible to import and export taxonomies as XML documents.

Code

function taxonomy_xml_export() {

  // return the list of vocabularies
  $output = '';
  $vocabularies = module_invoke('taxonomy', 'get_vocabularies');
  if (empty($vocabularies)) {
    $output .= t('There are no vocabularies present');
  }
  else {
    foreach ($vocabularies as $vocabulary) {
      $vocablist[$vocabulary->vid] = $vocabulary->name;
      $vocabcount = db_result(db_query("SELECT count(*) FROM {term_data} WHERE vid=%n", $vocabulary->vid));
      $vocablist[$vocabulary->vid] .= t(' (%vocabcount terms) ', array(
        '%vocabcount' => $vocabcount,
      ));
      $vocablist[$vocabulary->vid] .= ' ' . l('XML', "taxonomy_xml/{$vocabulary->vid}", array(
        'attributes' => array(
          'title' => "This format is Drupal-only. It closely matches the internal data structure, but is not portable outside of Drupal without work.",
        ),
      ));
      $vocablist[$vocabulary->vid] .= ' ' . l("RDF", "taxonomy_xml/{$vocabulary->vid}/rdf", array(
        'attributes' => array(
          'title' => "RDF is recommended for portability with external databases, although it is verbose and sometimes unreadable to humans.",
        ),
      ));
      $vocablist[$vocabulary->vid] .= ' ' . l("TCS", "taxonomy_xml/{$vocabulary->vid}/tcs", array(
        'attributes' => array(
          'title' => "The Taxon Concept Schema is used in Life Sciences to notate biological families of living things.",
        ),
      ));
    }
    $output = theme_item_list($vocablist);
  }
  return $output;
}