You are here

function _taxonomy_menu_get_term_sets_options in Taxonomy menu 6.3

Get all of the term sets and format for a select

Parameters

mgid menu group id so we do not pull the already assocated term sets:

1 call to _taxonomy_menu_get_term_sets_options()
taxonomy_menu_group_form in ./taxonomy_menu.admin.inc
Implementation of hook_form().

File

./taxonomy_menu.admin.inc, line 803
admin section for taxonomy menu

Code

function _taxonomy_menu_get_term_sets_options($mgid) {
  $term_sets = array();
  $result = db_query('SELECT * FROM {taxonomy_menu_group_term_set} WHERE mgid = %d', $mgid);
  while ($data = db_fetch_object($result)) {
    $term_sets[] = $data->tsid;
  }
  $output = array();
  $result = db_query('SELECT * FROM {taxonomy_menu_term_set}');
  while ($data = db_fetch_object($result)) {

    // If the term set is not already associated to the menu group
    // then add it to the output array.
    if (!in_array($data->tsid, $term_sets)) {
      $output[$data->tsid] = $data->name;
    }
  }
  return $output;
}