You are here

function glossary_search_results in Glossary 5.2

Same name and namespace in other branches
  1. 5 glossary.module \glossary_search_results()
  2. 6 glossary.module \glossary_search_results()
  3. 7 glossary.module \glossary_search_results()
1 string reference to 'glossary_search_results'
glossary_menu in ./glossary.module
Implementation of hook_menu().

File

./glossary.module, line 319
Glossary terms will be automatically marked with links to their descriptions.

Code

function glossary_search_results($keys = NULL) {
  $vids = _glossary_get_filter_vids();
  $output = '<div class="glossary-list">';
  $sql = db_rewrite_sql("SELECT td.tid FROM {term_data} td WHERE td.vid IN (" . implode(',', $vids) . ") AND (td.description LIKE '%%%s%%' OR td.name LIKE '%%%s%%')", 'td', 'tid');
  $result = db_query($sql, $keys, $keys);
  $found = NULL;
  while ($row = db_fetch_object($result)) {
    ++$count;
    $term = taxonomy_get_term($row->tid);
    $found .= '<dl>' . theme('glossary_overview_item', $term, TRUE) . '</dl>';
  }
  if (!$found) {
    $found = drupal_get_form('glossary_search_form', $keys) . '<p>' . t('Your search yielded no results') . glossary_help('glossary_search#noresults') . '</p>';
  }
  $output .= theme('box', t('Glossary search results'), $found);
  return $output . "</div>\n";
}