Subversion Repositories Sites.obs-saisons.fr

Rev

Rev 94 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
93 aurelien 1
<?php
2
// $Id: template.php,v 1.16.2.3 2010/05/11 09:41:22 goba Exp $
3
 
4
/**
5
 * Sets the body-tag class attribute.
6
 *
7
 * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
8
 */
9
function phptemplate_body_class($left, $right) {
10
  if ($left != '' && $right != '') {
11
    $class = 'sidebars';
12
  }
13
  else {
14
    if ($left != '') {
15
      $class = 'sidebar-left';
16
    }
17
    if ($right != '') {
18
      $class = 'sidebar-right';
19
    }
20
  }
21
 
22
  if (isset($class)) {
23
    print ' class="'. $class .'"';
24
  }
25
}
26
 
27
/**
28
 * Return a themed breadcrumb trail.
29
 *
30
 * @param $breadcrumb
31
 *   An array containing the breadcrumb links.
32
 * @return a string containing the breadcrumb output.
33
 */
34
function phptemplate_breadcrumb($breadcrumb) {
35
  if (!empty($breadcrumb)) {
36
    return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
37
  }
38
}
39
 
40
/**
41
 * Override or insert PHPTemplate variables into the templates.
42
 */
43
function phptemplate_preprocess_page(&$vars) {
44
  $vars['tabs2'] = menu_secondary_local_tasks();
45
 
46
  // Hook into color.module
47
  if (module_exists('color')) {
48
    _color_page_alter($vars);
49
  }
50
}
51
 
52
/**
53
 * Add a "Comments" heading above comments except on forum pages.
54
 */
55
function garland_preprocess_comment_wrapper(&$vars) {
56
  if ($vars['content'] && $vars['node']->type != 'forum') {
57
    $vars['content'] = '<h2 class="comments">'. t('Comments') .'</h2>'.  $vars['content'];
58
  }
59
}
60
 
61
/**
62
 * Returns the rendered local tasks. The default implementation renders
63
 * them as tabs. Overridden to split the secondary tasks.
64
 *
65
 * @ingroup themeable
66
 */
67
function phptemplate_menu_local_tasks() {
68
  return menu_primary_local_tasks();
69
}
70
 
71
/**
72
 * Returns the themed submitted-by string for the comment.
73
 */
74
function phptemplate_comment_submitted($comment) {
75
  return t('!datetime — !username',
76
    array(
77
      '!username' => theme('username', $comment),
78
      '!datetime' => format_date($comment->timestamp)
79
    ));
80
}
81
 
82
/**
83
 * Returns the themed submitted-by string for the node.
84
 */
85
function phptemplate_node_submitted($node) {
86
  return t('!datetime — !username',
87
    array(
88
      '!username' => theme('username', $node),
89
      '!datetime' => format_date($node->created),
90
    ));
91
}
92
 
93
/**
94
 * Generates IE CSS links for LTR and RTL languages.
95
 */
96
function phptemplate_get_ie_styles() {
97
  global $language;
98
 
99
  $iecss = '<link type="text/css" rel="stylesheet" media="all" href="'. base_path() . path_to_theme() .'/fix-ie.css" />';
100
  if ($language->direction == LANGUAGE_RTL) {
101
    $iecss .= '<style type="text/css" media="all">@import "'. base_path() . path_to_theme() .'/fix-ie-rtl.css";</style>';
102
  }
103
 
104
  return $iecss;
105
}