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