Projet

Général

Profil

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

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

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
/**
10
 * Preprocess forum.
11
 */
12
function _advanced_forum_preprocess_forums(&$variables) {
13
  $variables['forums_defined'] = count($variables['forums']) || count($variables['parents']);
14

    
15
  advanced_forum_add_template_suggestions("forums", $variables);
16
  $tid = intval($variables['tid']);
17

    
18
  if (!empty($variables['forums'])) {
19
    $variables['forums'] = theme('forum_list', $variables);
20
  }
21
  else {
22
    $variables['forums'] = '';
23
  }
24

    
25
  if (intval(arg(1)) == 0) {
26
    // We're on the front page of the forums.
27

    
28
    // Remove forum description.
29
    $variables['forum_description'] = '';
30

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

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

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

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

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