Same name and namespace in other branches
  1. 4.7.x modules/forum.module \theme_forum_topic_list()
  2. 5.x modules/forum/forum.module \theme_forum_topic_list()
  3. 6.x developer/theme.php \theme_forum_topic_list()

Format the topic listing.

Related topics

1 theme call to theme_forum_topic_list()
theme_forum_display in modules/forum.module
Format the forum body.

File

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

Code

function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page) {
  global $forum_topic_list_header;
  if ($topics) {
    foreach ($topics as $topic) {

      // folder is new if topic is new or there are new comments since last visit
      if ($topic->tid != $tid) {
        $rows[] = array(
          array(
            'data' => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky),
            'class' => 'icon',
          ),
          array(
            'data' => check_plain($topic->title),
            'class' => 'title',
          ),
          array(
            'data' => l(t('This topic has been moved'), "forum/{$topic->tid}"),
            'colspan' => '3',
          ),
        );
      }
      else {
        $rows[] = array(
          array(
            'data' => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky),
            'class' => 'icon',
          ),
          array(
            'data' => l($topic->title, "node/{$topic->nid}"),
            'class' => 'topic',
          ),
          array(
            'data' => $topic->num_comments . ($topic->new_replies ? '<br />' . l(t('%a new', array(
              '%a' => $topic->new_replies,
            )), "node/{$topic->nid}", NULL, NULL, 'new') : ''),
            'class' => 'replies',
          ),
          array(
            'data' => _forum_format($topic),
            'class' => 'created',
          ),
          array(
            'data' => _forum_format($topic->last_reply),
            'class' => 'last-reply',
          ),
        );
      }
    }
    if ($pager = theme('pager', NULL, $forum_per_page, 0, tablesort_pager())) {
      $rows[] = array(
        array(
          'data' => $pager,
          'colspan' => '5',
          'class' => 'pager',
        ),
      );
    }
  }
  $output .= theme('table', $forum_topic_list_header, $rows);
  return $output;
}