You are here

function taxonomy_csv_term_count_in_vocabulary in Taxonomy CSV import/export 6.3

Same name and namespace in other branches
  1. 6.2 taxonomy_csv.term.api.inc \taxonomy_csv_term_count_in_vocabulary()
  2. 6.4 taxonomy_csv.term.api.inc \taxonomy_csv_term_count_in_vocabulary()
  3. 7.4 taxonomy_csv.term.api.inc \taxonomy_csv_term_count_in_vocabulary()

Calculate number of terms in a vocabulary or in all vocabularies.

@todo Regular query.

Parameters

$vocabulary_id: (Optional) Id of the chosen vocabulary. If not specified, count terms in all vocabularies.

Return value

Number of terms in specified vocabulary or in all vocabularies.

2 calls to taxonomy_csv_term_count_in_vocabulary()
taxonomy_csv_vocabulary_export in export/taxonomy_csv.export.api.inc
Prepare the export of a vocabulary. If not used in a form, don't forget to use batch_process().
_taxonomy_csv_export_check_options in export/taxonomy_csv.export.admin.inc
Validate options of exported vocabulary.

File

./taxonomy_csv.term.api.inc, line 306
Find, get and set full or detail term items.

Code

function taxonomy_csv_term_count_in_vocabulary($vocabulary_id = 0) {
  $sql = "\n    SELECT COUNT(*)\n    FROM {term_data}\n  ";
  $args = array();
  if ($vocabulary_id) {
    $sql .= ' WHERE vid = %d ';
    $args[] = $vocabulary_id;
  }
  return array_shift(db_fetch_array(db_query($sql, $args)));
}