You are here

function taxonomy_image_overview in Taxonomy Image 5

Same name and namespace in other branches
  1. 6 taxonomy_image.admin.inc \taxonomy_image_overview()
1 call to taxonomy_image_overview()
taxonomy_image_admin in ./taxonomy_image.module
1 string reference to 'taxonomy_image_overview'
taxonomy_image_menu in ./taxonomy_image.module
Implementation of hook_menu.

File

./taxonomy_image.module, line 884
taxonomy_image.module Simple module for providing an association between taxonomy terms and images. Written by Jeremy Andrews <jeremy@kerneltrap.org>, May 2004.

Code

function taxonomy_image_overview() {
  $dest = drupal_get_destination();
  $output = '';
  if (variable_get('taxonomy_image_recursive', 0)) {
    $output .= '<h4>' . t('Recursively displaying images.') . '</h4>';
  }
  $admin_preset = variable_get('taxonomy_image_admin_preset', NULL);
  $header = array(
    t('Name'),
    t('Node Types'),
    t('Image'),
    t('Op'),
  );
  $attrs = array(
    'class' => 'taxonomy_image_overview',
  );
  $vocabularies = taxonomy_get_vocabularies();
  foreach ($vocabularies as $vocabulary) {
    $types = array();
    $rows = array();
    $types = $vocabulary->nodes;
    $rows[] = array(
      array(
        'data' => '<strong>' . check_plain($vocabulary->name) . '</strong>',
        'valign' => 'top',
        'class' => 'title',
      ),
      array(
        'data' => implode(', ', $types),
        'align' => 'center',
        'valign' => 'middle',
      ),
      '',
      '',
    );
    $tree = taxonomy_get_tree($vocabulary->vid);
    if ($tree) {
      foreach ($tree as $term) {
        $data = str_repeat('--', $term->depth) . ($term->depth > 0 ? ' ' : NULL) . check_plain($term->name);
        $exists = taxonomy_image_display($term->tid, array(), $admin_preset);
        $op = l(t('edit term'), 'admin/content/taxonomy/edit/term/' . $term->tid, array(), $dest);

        // Use taxonomy_image_display() instead of _taxonomy_image_exists() in
        // case image display recursion is enabled...
        $image = $exists ? $exists : '<em>' . t('none') . '</em>';
        $rows[] = array(
          array(
            'data' => $data,
            'colspan' => 2,
          ),
          array(
            'data' => $image,
            'align' => 'center',
          ),
          $op,
        );
      }
    }
    $output .= '<br/>' . theme('table', $header, $rows, $attrs);
  }
  return $output;
}