theme_forum_list

5 forum.module theme_forum_list($forums, $parents, $tid)
6 theme.php theme_forum_list()
7 theme.php theme_forum_list($variables)
8 theme.php theme_forum_list($variables)

Format the forum listing.

Related topics

1 theme call to theme_forum_list()

File

modules/forum/forum.module, line 924
Enable threaded discussions about general topics.

Code

function theme_forum_list($forums, $parents, $tid) {
  global $user;

  if ($forums) {

    $header = array(t('Forum'), t('Topics'), t('Posts'), t('Last post'));

    foreach ($forums as $forum) {
      if ($forum->container) {
        $description  = '<div style="margin-left: ' . ($forum->depth * 30) . "px;\">\n";
        $description .= ' <div class="name">' . l($forum->name, "forum/$forum->tid") . "</div>\n";

        if ($forum->description) {
          $description .= ' <div class="description">' . filter_xss_admin($forum->description) . "</div>\n";
        }
        $description .= "</div>\n";

        $rows[] = array(array(
            'data' => $description,
            'class' => 'container',
            'colspan' => '4',
          ));
      }
      else {
        $new_topics = _forum_topics_unread($forum->tid, $user->uid);
        $forum->old_topics = $forum->num_topics - $new_topics;
        if (!$user->uid) {
          $new_topics = 0;
        }

        $description  = '<div style="margin-left: ' . ($forum->depth * 30) . "px;\">\n";
        $description .= ' <div class="name">' . l($forum->name, "forum/$forum->tid") . "</div>\n";

        if ($forum->description) {
          $description .= ' <div class="description">' . filter_xss_admin($forum->description) . "</div>\n";
        }
        $description .= "</div>\n";

        $rows[] = array(
          array(
            'data' => $description,
            'class' => 'forum',
          ),
          array(
            'data' => $forum->num_topics . ($new_topics ? '<br />' . l(format_plural($new_topics, '1 new', '@count new'), "forum/$forum->tid", NULL, NULL, 'new') : ''),
            'class' => 'topics',
          ),
          array(
            'data' => $forum->num_posts,
            'class' => 'posts',
          ),
          array(
            'data' => _forum_format($forum->last_post),
            'class' => 'last-reply',
          ),
        );
      }
    }

    return theme('table', $header, $rows);

  }

}
Login or register to post comments