| 1 |
<?php
|
| 2 |
// $Id: template.php,v 1.1.6.2 2008/11/28 06:14:30 andregriffin 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 |
// uncomment the next line to enable current page in the breadcrumb trail
|
| 37 |
// $breadcrumb[] = drupal_get_title();
|
| 38 |
return '<div class="breadcrumb">'. implode(' ยป ', $breadcrumb) .'</div>';
|
| 39 |
}
|
| 40 |
}
|
| 41 |
|
| 42 |
/**
|
| 43 |
* Allow themable wrapping of all comments.
|
| 44 |
*/
|
| 45 |
function phptemplate_comment_wrapper($content, $node) {
|
| 46 |
if (!$content || $node->type == 'forum') {
|
| 47 |
return '<div id="comments">'. $content .'</div>';
|
| 48 |
}
|
| 49 |
else {
|
| 50 |
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
|
| 51 |
}
|
| 52 |
}
|
| 53 |
|
| 54 |
/**
|
| 55 |
* Override or insert PHPTemplate variables into the templates.
|
| 56 |
*/
|
| 57 |
function phptemplate_preprocess_page(&$vars) {
|
| 58 |
$vars['tabs2'] = menu_secondary_local_tasks();
|
| 59 |
|
| 60 |
// Hook into color.module
|
| 61 |
if (module_exists('color')) {
|
| 62 |
_color_page_alter($vars);
|
| 63 |
}
|
| 64 |
}
|
| 65 |
|
| 66 |
/**
|
| 67 |
* Returns the rendered local tasks. The default implementation renders
|
| 68 |
* them as tabs. Overridden to split the secondary tasks.
|
| 69 |
*
|
| 70 |
* @ingroup themeable
|
| 71 |
*/
|
| 72 |
function phptemplate_menu_local_tasks() {
|
| 73 |
return menu_primary_local_tasks();
|
| 74 |
}
|
| 75 |
|
| 76 |
function phptemplate_comment_submitted($comment) {
|
| 77 |
return t('by <strong>!username</strong> | !datetime',
|
| 78 |
array(
|
| 79 |
'!username' => theme('username', $comment),
|
| 80 |
'!datetime' => format_date($comment->timestamp)
|
| 81 |
));
|
| 82 |
}
|
| 83 |
|
| 84 |
function phptemplate_node_submitted($node) {
|
| 85 |
return t('by <strong>!username</strong> | !datetime',
|
| 86 |
array(
|
| 87 |
'!username' => theme('username', $node),
|
| 88 |
'!datetime' => format_date($node->created),
|
| 89 |
));
|
| 90 |
}
|
| 91 |
|
| 92 |
/**
|
| 93 |
* Generates IE CSS links.
|
| 94 |
*/
|
| 95 |
function phptemplate_get_ie_styles() {
|
| 96 |
$iecss = '<link type="text/css" rel="stylesheet" media="all" href="'. base_path() . path_to_theme() .'/fix-ie.css" />';
|
| 97 |
return $iecss;
|
| 98 |
}
|
| 99 |
|
| 100 |
function phptemplate_get_ie6_styles() {
|
| 101 |
$iecss = '<link type="text/css" rel="stylesheet" media="all" href="'. base_path() . path_to_theme() .'/fix-ie6.css" />';
|
| 102 |
return $iecss;
|
| 103 |
}
|
| 104 |
|
| 105 |
/**
|
| 106 |
* Adds even and odd classes to <li> tags in ul.menu lists
|
| 107 |
*/
|
| 108 |
function phptemplate_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) {
|
| 109 |
static $zebra = FALSE;
|
| 110 |
$zebra = !$zebra;
|
| 111 |
$class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf'));
|
| 112 |
if (!empty($extra_class)) {
|
| 113 |
$class .= ' '. $extra_class;
|
| 114 |
}
|
| 115 |
if ($in_active_trail) {
|
| 116 |
$class .= ' active-trail';
|
| 117 |
}
|
| 118 |
if ($zebra) {
|
| 119 |
$class .= ' even';
|
| 120 |
}
|
| 121 |
else {
|
| 122 |
$class .= ' odd';
|
| 123 |
}
|
| 124 |
return '<li class="'. $class .'">'. $link . $menu ."</li>\n";
|
| 125 |
}
|