Project

General

Profile

Paste
Download (3.26 KB) Statistics
| Branch: | Revision:

root / drupal7 / modules / forum / forum-list.tpl.php @ db2d93dd

1
<?php
2

    
3
/**
4
 * @file
5
 * Displays a list of forums and containers.
6
 *
7
 * Available variables:
8
 * - $forums: An array of forums and containers to display. It is keyed to the
9
 *   numeric IDs of all child forums and containers. Each $forum in $forums
10
 *   contains:
11
 *   - $forum->is_container: TRUE if the forum can contain other forums. FALSE
12
 *     if the forum can contain only topics.
13
 *   - $forum->depth: How deep the forum is in the current hierarchy.
14
 *   - $forum->zebra: 'even' or 'odd' string used for row class.
15
 *   - $forum->icon_class: 'default' or 'new' string used for forum icon class.
16
 *   - $forum->icon_title: Text alternative for the forum icon.
17
 *   - $forum->name: The name of the forum.
18
 *   - $forum->link: The URL to link to this forum.
19
 *   - $forum->description: The description of this forum.
20
 *   - $forum->new_topics: TRUE if the forum contains unread posts.
21
 *   - $forum->new_url: A URL to the forum's unread posts.
22
 *   - $forum->new_text: Text for the above URL, which tells how many new posts.
23
 *   - $forum->old_topics: A count of posts that have already been read.
24
 *   - $forum->num_posts: The total number of posts in the forum.
25
 *   - $forum->last_reply: Text representing the last time a forum was posted or
26
 *     commented in.
27
 * - $forum_id: Forum ID for the current forum. Parent to all items within the
28
 *   $forums array.
29
 *
30
 * @see template_preprocess_forum_list()
31
 * @see theme_forum_list()
32
 *
33
 * @ingroup themeable
34
 */
35
?>
36
<table id="forum-<?php print $forum_id; ?>">
37
  <thead>
38
    <tr>
39
      <th><?php print t('Forum'); ?></th>
40
      <th><?php print t('Topics');?></th>
41
      <th><?php print t('Posts'); ?></th>
42
      <th><?php print t('Last post'); ?></th>
43
    </tr>
44
  </thead>
45
  <tbody>
46
  <?php foreach ($forums as $child_id => $forum): ?>
47
    <tr id="forum-list-<?php print $child_id; ?>" class="<?php print $forum->zebra; ?>">
48
      <td <?php print $forum->is_container ? 'colspan="4" class="container"' : 'class="forum"'; ?>>
49
        <?php /* Enclose the contents of this cell with X divs, where X is the
50
               * depth this forum resides at. This will allow us to use CSS
51
               * left-margin for indenting.
52
               */ ?>
53
        <?php print str_repeat('<div class="indent">', $forum->depth); ?>
54
          <div class="icon forum-status-<?php print $forum->icon_class; ?>" title="<?php print $forum->icon_title; ?>">
55
            <span class="element-invisible"><?php print $forum->icon_title; ?></span>
56
          </div>
57
          <div class="name"><a href="<?php print $forum->link; ?>"><?php print $forum->name; ?></a></div>
58
          <?php if ($forum->description): ?>
59
            <div class="description"><?php print $forum->description; ?></div>
60
          <?php endif; ?>
61
        <?php print str_repeat('</div>', $forum->depth); ?>
62
      </td>
63
      <?php if (!$forum->is_container): ?>
64
        <td class="topics">
65
          <?php print $forum->num_topics ?>
66
          <?php if ($forum->new_topics): ?>
67
            <br />
68
            <a href="<?php print $forum->new_url; ?>"><?php print $forum->new_text; ?></a>
69
          <?php endif; ?>
70
        </td>
71
        <td class="posts"><?php print $forum->num_posts ?></td>
72
        <td class="last-reply"><?php print $forum->last_reply ?></td>
73
      <?php endif; ?>
74
    </tr>
75
  <?php endforeach; ?>
76
  </tbody>
77
</table>