You are here

function taxonomy_image_overview in Taxonomy Image 6

Same name and namespace in other branches
  1. 5 taxonomy_image.module \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.admin.inc, line 201
taxonomy_image.admin.inc.

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);

  // Since this is just an overview, I have removed the "op" column.
  $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',
      ),
      '&nbsp;',
    );
    $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(
          'query' => $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;
}