Projet

Général

Profil

Paste
Télécharger (1,7 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / advanced_forum / includes / advanced_forum_preprocess_forums.inc @ c169e7c4

1
<?php
2

    
3
/**
4
 * @file
5
 * Holds the contents of a preprocess function moved into its own file
6
 * to ease memory requirements and having too much code in one file.
7
 */
8

    
9
function _advanced_forum_preprocess_forums(&$variables) {
10
  $variables['forums_defined'] = count($variables['forums']) || count($variables['parents']);
11

    
12
  advanced_forum_add_template_suggestions("forums", $variables);
13
  $tid = intval($variables['tid']);
14

    
15
  if (!empty($variables['forums'])) {
16
    $variables['forums'] = theme('forum_list', $variables);
17
  }
18
  else {
19
    $variables['forums'] = '';
20
  }
21

    
22
  if (intval(arg(1)) == 0) {
23
    // We're on the front page of the forums.
24

    
25
    // Remove forum description.
26
    $variables['forum_description'] = '';
27

    
28
    // This is normally attached to the topic list so we need to create it
29
    // here as well since the main page has no topics.
30
    $variables['forum_tools'] = advanced_forum_forum_tools(0);
31

    
32
    // Fetch the forum statistics.
33
    $variables['forum_statistics'] = '';
34
    if (user_access('view forum statistics')) {
35
      $variables['forum_statistics'] = theme('advanced_forum_statistics');
36
    }
37

    
38
    // Fetch the forum legend.
39
    $variables['forum_legend'] = theme('advanced_forum_forum_legend');
40
  }
41
  else {
42
    // Grab the forum description and make it available to the template file
43
    $forum = taxonomy_term_load($tid);
44
    $variables['forum_description'] = $forum->description;
45

    
46
    // Get the themed list of node types that can be posted in this forum.
47
    $variables['forum_links'] = theme('advanced_forum_node_type_create_list', array('forum_id' => $variables['tid']));
48

    
49
    // Set a variable for displaying the topic legend.
50
    $variables['topic_legend'] = theme('advanced_forum_topic_legend');
51
  }
52
}