You are here

function i18ntaxonomy_vocabulary_get_terms in Internationalization 6

Returns a list for terms for vocabulary, language.

Parameters

$vid: Vocabulary id

$lang: Language code

$status: 'all' (default), 'translated', 'untranslated'

File

i18ntaxonomy/i18ntaxonomy.module, line 892
i18n taxonomy module

Code

function i18ntaxonomy_vocabulary_get_terms($vid, $lang, $status = 'all') {
  switch ($status) {
    case 'translated':
      $result = db_query("SELECT * FROM {term_data} WHERE vid = %d AND language = '%s' AND trid > 0", $vid, $lang);
      break;
    case 'untranslated':
      $result = db_query("SELECT * FROM {term_data} WHERE vid = %d AND language = '%s' AND trid = 0", $vid, $lang);
      break;
    default:
      $result = db_query("SELECT * FROM {term_data} WHERE vid = %d AND language = '%s'", $vid, $lang);
      break;
  }
  $list = array();
  while ($term = db_fetch_object($result)) {
    $list[$term->tid] = $term->name;
  }
  return $list;
}