Projet

Général

Profil

Paste
Télécharger (6,36 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / advanced_forum / styles / naked / advanced-forum.naked.forum-list.tpl.php @ c169e7c4

1
<?php
2
/**
3
 * @file
4
 * Default theme implementation to display a list of forums and containers.
5
 *
6
 * Available variables:
7
 * - $forums: An array of forums and containers to display. It is keyed to the
8
 *   numeric id's of all child forums and containers.
9
 * - $forum_id: Forum id for the current forum. Parent to all items within
10
 *   the $forums array.
11
 *
12
 * Each $forum in $forums contains:
13
 * - $forum->is_container: Is TRUE if the forum can contain other forums. Is
14
 *   FALSE if the forum can contain only topics.
15
 * - $forum->depth: How deep the forum is in the current hierarchy.
16
 * - $forum->zebra: 'even' or 'odd' string used for row class.
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->total_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->forum_image: If used, contains an image to display for the forum.
28
 *
29
 * @see template_preprocess_forum_list()
30
 * @see theme_forum_list()
31
 */
32
?>
33

    
34
<?php
35
/*
36
  The $tables variable holds the individual tables to be shown. A table is
37
  either created from a root level container or added as needed to hold root
38
  level forums. The following code will loop through each of the tables.
39
  In each table, it loops through the items in the table. These items may be
40
  subcontainers or forums. Subcontainers are printed simply with the name
41
  spanning the entire table. Forums are printed out in more detail. Subforums
42
  have already been attached to their parent forums in the preprocessing code
43
  and will display under their parents.
44
 */
45
?>
46

    
47
<?php foreach ($tables as $table_id => $table): ?>
48
  <?php $table_info = $table['table_info']; ?>
49

    
50
  <div class="forum-table-wrap">
51
    <div class="forum-table-superheader">
52
      <div class="forum-table-name">
53
        <?php if (empty($table_info->link)): ?>
54
          <?php print $table_info->name; ?>
55
        <?php else: ?>
56
          <a href="<?php print $table_info->link; ?>"><?php print $table_info->name; ?></a>
57
        <?php endif; ?>
58
      </div>
59
      <?php if ($collapsible): ?>
60
        <span id="forum-collapsible-<?php print $table_info->tid; ?>" class="forum-collapsible" >&nbsp;</span>
61
      <?php endif; ?>
62
      <div class="forum-table-description"><?php print $table_info->description; ?></div>
63

    
64
    </div>
65
    <div id="forum-table-<?php print $table_info->tid; ?>">
66
      <table class="forum-table forum-table-forums">
67
        <thead class="forum-header">
68
          <tr>
69
            <th class="forum-icon">&nbsp;</th>
70
            <th class="forum-name"><?php print t('Forum'); ?></th>
71
            <th class="forum-topics"><?php print t('Topics'); ?></th>
72
            <th class="forum-posts"><?php print t('Posts'); ?></th>
73
            <th class="forum-last-post"><?php print t('Last post'); ?></th>
74
          </tr>
75
        </thead>
76

    
77
        <tbody id="forum-table-<?php print $table_info->tid; ?>-content">
78
          <?php foreach ($table['items'] as $item_id => $item): ?>
79
            <?php if ($item->is_container): ?>
80
              <tr id="subcontainer-<?php print $item_id; ?>" class="forum-row <?php print $item->zebra; ?> container-<?php print $item_id; ?>-child">
81
              <?php else: ?>
82
              <tr id="forum-<?php print $item_id; ?>" class="forum-row <?php print $item->zebra; ?> container-<?php print $item_id; ?>-child">
83
              <?php endif; ?>
84

    
85
              <?php if (!empty($item->forum_image)): ?>
86
                <td class="forum-image forum-image-<?php print $item_id; ?>">
87
                  <?php print $item->forum_image; ?>
88
                </td>
89
              <?php else: ?>
90
                <td class="<?php print $item->icon_classes ?>">
91
                  <span class="forum-list-icon-wrapper"><span><?php print $item->icon_text ?></span></span>
92
                </td>
93
              <?php endif; ?>
94

    
95
              <?php $colspan = ($item->is_container) ? 4 : 1 ?>
96
              <td class="forum-details" colspan="<?php print $colspan ?>">
97
                <div class="forum-name">
98
                  <a href="<?php print $item->link; ?>"><?php print $item->name; ?></a>
99
                </div>
100
                <?php if (!empty($item->description)): ?>
101
                  <div class="forum-description">
102
                    <?php print $item->description; ?>
103
                  </div>
104
                <?php endif; ?>
105

    
106
                <?php if (!empty($item->subcontainers)): ?>
107
                  <div class="forum-subcontainers">
108
                    <span class="forum-subcontainers-label"><?php print t("Subcontainers") ?>:</span> <?php print $item->subcontainers; ?>
109
                  </div>
110
                <?php endif; ?>
111

    
112
                <?php if (!empty($item->subforums)): ?>
113
                  <div class="forum-subforums">
114
                    <span class="forum-subforums-label"><?php print t("Subforums") ?>:</span> <?php print $item->subforums; ?>
115
                  </div>
116
                <?php endif; ?>
117
              </td>
118
              <?php if (!$item->is_container): ?>
119
                <td class="forum-number-topics">
120
                  <div class="forum-number-topics"><?php print $item->total_topics ?>
121
                    <?php if ($item->new_topics): ?>
122
                      <div class="forum-number-new-topics">
123
                        <a href="<?php print $item->new_topics_link; ?>"><?php print $item->new_topics_text; ?></a>
124
                      </div>
125
                    <?php endif; ?>
126
                  </div>
127
                </td>
128

    
129
                <td class="forum-number-posts">
130
                  <?php print $item->total_posts ?>
131

    
132
                  <?php if ($item->new_posts): ?>
133
                    <br />
134
                    <a href="<?php print $item->new_posts_link; ?>"><?php print $item->new_posts_text; ?></a>
135
                  <?php endif; ?>
136
                </td>
137
                <td class="forum-last-reply">
138
                  <?php print $item->last_post ?>
139
                </td>
140
              <?php endif; ?>
141

    
142
            </tr>
143

    
144
          <?php endforeach; ?>
145
        </tbody>
146
      </table>
147
    </div>
148
  </div>
149
<?php endforeach; ?>