You are here

function advanced_forum_forum_tools in Advanced Forum 6.2

Same name and namespace in other branches
  1. 7.2 advanced_forum.module \advanced_forum_forum_tools()

Create a drop down list of forum actions.

3 calls to advanced_forum_forum_tools()
advanced_forum_forum_tools_content_type_render in plugins/content_types/forum_tools.inc
Render the content.
advanced_forum_preprocess_views_view__advanced_forum_topic_list in includes/theme.inc
_advanced_forum_preprocess_forums in includes/advanced_forum_preprocess_forums.inc
@file Holds the contents of a preprocess function moved into its own file to ease memory requirements and having too much code in one file.

File

./advanced_forum.module, line 1165
Enables the look and feel of other popular forum software.

Code

function advanced_forum_forum_tools($tid = 0) {
  global $user;
  if ($tid > 0) {
    $targets[url("forum/active", array(
      'query' => "forum[]={$tid}",
    ))] = t('View active posts in this forum');
    $targets[url("forum/unanswered", array(
      'query' => "forum[]={$tid}",
    ))] = t('View unanswered posts in this forum');
    if ($user->uid) {
      $targets[url("forum/new", array(
        'query' => "forum[]={$tid}",
      ))] = t('View new posts in this forum');
      if (module_exists('nodecomment')) {
        $targets[url("forum/user", array(
          'query' => "forum[]={$tid}",
        ))] = t('View your posts in this forum');
      }
    }
  }
  else {
    $targets[url("forum/active")] = t('View active forum posts');
    $targets[url("forum/unanswered")] = t('View unanswered forum posts');
    if ($user->uid) {
      $targets[url("forum/new")] = t('View new forum posts');
      if (module_exists('nodecomment')) {
        $targets[url("forum/user")] = t('View your forum posts');
      }
    }
  }

  // Add mark as read to the jump list.
  // This code is a little odd and needs explaining. The return value of
  // the mark_as_read function is already formed HTML and so is unsuitable
  // for the jump list. The function already has built in the ability
  // to add to an existing $links array, which has the URL and title text
  // separated. Rather than add a third method just for the jump menu, I
  // reused that functionality here.
  $mark_as_read = array();
  advanced_forum_get_mark_read_link($tid, $mark_as_read);
  if (!empty($mark_as_read['mark-read']['href'])) {
    $targets[url($mark_as_read['mark-read']['href'])] = $mark_as_read['mark-read']['title'];
  }
  $options['choose'] = t("- Forum Tools -");

  // Create and return the jump menu.
  ctools_include('jump-menu');
  return drupal_get_form('ctools_jump_menu', $targets, $options);
}