You are here

function theme_fuzzysearch_results in Fuzzy Search 6

Theme the search results

1 theme call to theme_fuzzysearch_results()
theme_fuzzysearch_show_results in ./fuzzysearch.module
Theme hook for rendering search results.

File

./fuzzysearch.module, line 987
Module file for fuzzysearch module.

Code

function theme_fuzzysearch_results($results) {
  drupal_set_title(t('Search results'));
  $output = '<div class="box">';
  $output .= '<div class="search-results">';
  $i = 0;
  foreach ($results as $result) {
    $i++;
    $odd = $i % 2 ? 'odd' : 'even';
    $output .= '<div class="fuzzysearch-result ' . $odd . '">';
    $output .= theme('fuzzysearch_result', $result);
    if (variable_get('fuzzysearch_debug_search', FALSE) && user_access('access fuzzysearch debugging')) {
      $output .= $result->spelling_debug;
    }
    if (variable_get('fuzzysearch_debug_score', FALSE) && user_access('access fuzzysearch scoring')) {
      if (variable_get('fuzzysearch_sort_score', FALSE)) {
        $output .= '<p>' . t('Score:') . ' ' . number_format($result->score) . ' ' . t('Completeness:') . ' ' . number_format($result->completeness) . '</p>';
      }
      else {
        $output .= '<p>' . t('Completeness:') . ' ' . number_format($result->completeness) . ' ' . t('Score:') . ' ' . number_format($result->score) . '</p>';
      }
    }
    $output .= '</div>';
  }
  $output .= '</div></div>';
  return $output;
}