You are here

function og_vocab_overview_vocabularies in OG Vocabulary 5

List and manage vocabularies for a given group.

1 string reference to 'og_vocab_overview_vocabularies'
og_vocab_menu in ./og_vocab.module
Implementation of hook_menu().

File

./og_vocab.module, line 270
Give each group its own system controlled vocabularies

Code

function og_vocab_overview_vocabularies($gid) {
  $groupnode = node_load((int) $gid);
  drupal_set_title(check_plain($groupnode->title));

  // i tried fixing breadcrumb here with drupal_set_breadcrumb() and menu_set_location() but neither is satisfactory
  $links[] = l(t('add vocabulary'), "node/{$gid}/og/vocab/add/vocabulary", array(), drupal_get_destination());
  $output = theme('item_list', $links);
  $vocabularies = og_vocab_load_vocabularies($gid);
  foreach ($vocabularies as $vid => $vocabulary) {
    $types = array();
    foreach ($vocabulary->nodes as $type) {
      $node_type = node_get_types('name', $type);
      $types[] = $node_type ? $node_type : $type;
    }
    $rows[] = array(
      check_plain($vocabulary->name),
      implode(', ', $types),
      l(t('edit vocabulary'), "node/{$gid}/og/vocab/edit/vocabulary/{$vocabulary->vid}", array(), drupal_get_destination()),
      l(t('list terms'), "node/{$gid}/og/vocab/terms/{$vocabulary->vid}"),
      l(t('add terms'), "node/{$gid}/og/vocab/terms/{$vocabulary->vid}/add/term"),
    );
  }
  if (!$rows) {
    $rows[] = array(
      array(
        'data' => t('No categories'),
        'colspan' => 5,
      ),
    );
  }
  $header = array(
    t('Name'),
    t('Type'),
    array(
      'data' => 'Operations',
      'colspan' => 3,
    ),
  );
  return $output . theme('table', $header, $rows);
}