You are here

function theme_glossary_overview_item in Glossary 5

Same name and namespace in other branches
  1. 5.2 glossary.module \theme_glossary_overview_item()
  2. 6 glossary.module \theme_glossary_overview_item()
  3. 7 glossary.module \theme_glossary_overview_item()
3 theme calls to theme_glossary_overview_item()
glossary_overview in ./glossary.module
glossary_search_results in ./glossary.module
glossary_term in ./glossary.module

File

./glossary.module, line 619

Code

function theme_glossary_overview_item($term, $show_desc = true, $dest = null) {
  $click_option = variable_get('glossary_click_option', 0);
  if (isset($term->firstletter)) {
    $output .= "\n" . '<a id="letter' . $term->firstletter . '"></a>';
  }
  $output .= '<a id="term' . $term->tid . '"></a>';
  if (module_exists('taxonomy_image') && $show_desc) {
    $img = taxonomy_image_display($term->tid);
    if (!$img && variable_get('taxonomy_image_wrapper', false)) {
      $mypath = '/' . drupal_get_path('module', 'glossary') . '/empty.gif';
      $img = '<div class="taxonomy_image_wrapper"><img src="' . $mypath . '" /></div>';
    }
  }
  else {
    $img = null;
  }
  $output .= '<dt class="depth' . $term->depth . '">' . $img;
  if ($show_desc) {
    $output .= $term->name;
  }
  else {
    $output .= l($term->name, 'glossary/term/' . $term->tid);
  }
  if (user_access('administer taxonomy')) {
    $output .= l(t('edit term'), "admin/content/taxonomy/edit/term/{$term->tid}", array(
      'title' => t('edit this term and definition.'),
      'class' => 'glossary-edit-term',
    ), $dest);
  }
  $output .= '</dt><dd class="depth' . $term->depth . '">';
  if ($show_desc) {
    $detailed_exists = db_result(db_query('SELECT COUNT(t.nid) FROM {term_node} t JOIN {node} n USING (nid) WHERE t.tid=%d AND n.status=1', $term->tid));
    if ($detailed_exists) {
      $output .= l(t('Detailed definition of @term', array(
        '@term' => $term->name,
      )), "taxonomy/term/{$term->tid}");
    }
    else {
      $output .= $term->description;
    }
    if ($relations = taxonomy_get_related($term->tid, "name")) {
      $output .= "<span class=\"glossary-related\">" . t("See also") . ": ";
      foreach ($relations as $related) {
        if ($click_option == 1) {
          $items[] .= l($related->name, 'glossary/' . $term->vid, null, null, "term" . $related->tid);
        }
        else {
          $items[] .= l($related->name, 'glossary/term/' . $related->tid);
        }
      }
      $output .= implode(', ', $items) . "</span>\n";
      unset($items);
    }
  }
  $output .= "</dd>\n";
  return $output;
}