You are here

function _quiz_search_terms in Quiz 6.4

Same name and namespace in other branches
  1. 8.4 quiz.admin.inc \_quiz_search_terms()
  2. 7.6 quiz.admin.inc \_quiz_search_terms()
  3. 7 quiz.admin.inc \_quiz_search_terms()
  4. 7.4 quiz.admin.inc \_quiz_search_terms()
  5. 7.5 quiz.admin.inc \_quiz_search_terms()

Helper function for finding terms...

Parameters

string $start: The start of the string we are looking for

2 calls to _quiz_search_terms()
quiz_categorized_form_validate in ./quiz.admin.inc
Validate the categorized form
quiz_categorized_term_ahah in ./quiz.admin.inc
Ahah function for finding terms...

File

./quiz.admin.inc, line 768
Administrator interface for Quiz module.

Code

function _quiz_search_terms($start, $all = FALSE) {
  $terms = array();
  $sql_args = array_keys(_quiz_get_vocabularies());
  if (empty($sql_args)) {
    return $terms;
  }
  $sql = "SELECT t.name, t.tid\n          FROM {term_data} t\n          WHERE vid IN (" . db_placeholders($sql_args) . ")";
  if (!$all) {
    $sql .= " AND t.name LIKE '%%%s%%'";
    $sql_args[] = $start;
  }
  $res = db_query(db_rewrite_sql($sql, 't', 'tid'), $sql_args);
  while ($res_o = db_fetch_object($res)) {
    $terms[$res_o->tid] = $res_o->name;
  }
  return $terms;
}