cms/drupal/modules/forum/forum.pages.inc
changeset 541 e756a8c72c3d
equal deleted inserted replaced
540:07239de796bb 541:e756a8c72c3d
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * @file
       
     5  * User page callbacks for the Forum module.
       
     6  */
       
     7 
       
     8 /**
       
     9  * Page callback: Prints a forum listing.
       
    10  *
       
    11  * @param $forum_term
       
    12  *   A tree of all forums for a given taxonomy term ID. Defaults to NULL. See
       
    13  *   the return object of forum_forum_load() for a complete definition.
       
    14  *
       
    15  * @return
       
    16  *   A string containing HTML representing the themed forum listing.
       
    17  *
       
    18  * @see forum_menu()
       
    19  */
       
    20 function forum_page($forum_term = NULL) {
       
    21   if (!isset($forum_term)) {
       
    22     // On the main page, display all the top-level forums.
       
    23     $forum_term = forum_forum_load(0);
       
    24   }
       
    25 
       
    26   $forum_per_page = variable_get('forum_per_page', 25);
       
    27   $sortby = variable_get('forum_order', 1);
       
    28 
       
    29   if (empty($forum_term->container)) {
       
    30     $topics = forum_get_topics($forum_term->tid, $sortby, $forum_per_page);
       
    31   }
       
    32   else {
       
    33     $topics = '';
       
    34   }
       
    35 
       
    36   return theme('forums', array('forums' => $forum_term->forums, 'topics' => $topics, 'parents' => $forum_term->parents, 'tid' => $forum_term->tid, 'sortby' => $sortby, 'forums_per_page' => $forum_per_page));
       
    37 }