| 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() .'/andreas09/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() .'/andreas09/fix-ie6.css" />';
|
| 102 |
return $iecss;
|
| 103 |
}
|
| 104 |
|
| 105 |
function phptemplate_get_basecolour_style() {
|
| 106 |
/* Only do this if we are using the base theme*/
|
| 107 |
global $theme;
|
| 108 |
$path = drupal_get_path('theme', $theme);
|
| 109 |
|
| 110 |
$basecss="";
|
| 111 |
|
| 112 |
if (preg_match ( "/andreas0/" ,$path )):
|
| 113 |
return $basecss;
|
| 114 |
endif;
|
| 115 |
$basecolour = strtolower(theme_get_setting('andreas_basecolour'));
|
| 116 |
$basecss = '<link type="text/css" rel="stylesheet" media="all" href="'. base_path() . path_to_theme() . '/andreas09/' . $basecolour . '.css" />';
|
| 117 |
return $basecss;
|
| 118 |
}
|
| 119 |
|
| 120 |
function phptemplate_get_layout_style() {
|
| 121 |
$layout = strtolower(theme_get_setting('andreas_layout'));
|
| 122 |
if ($layout == "fixed"):
|
| 123 |
$layout = '<link type="text/css" rel="stylesheet" media="all" href="'. base_path() . path_to_theme() . '/andreas09/' . $layout . '.css" />';
|
| 124 |
else:
|
| 125 |
$layout="";
|
| 126 |
endif;
|
| 127 |
return $layout;
|
| 128 |
}
|
| 129 |
|
| 130 |
/**
|
| 131 |
* Adds even and odd classes to <li> tags in ul.menu lists
|
| 132 |
*/
|
| 133 |
function phptemplate_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) {
|
| 134 |
static $zebra = FALSE;
|
| 135 |
$zebra = !$zebra;
|
| 136 |
$class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf'));
|
| 137 |
if (!empty($extra_class)) {
|
| 138 |
$class .= ' '. $extra_class;
|
| 139 |
}
|
| 140 |
if ($in_active_trail) {
|
| 141 |
$class .= ' active-trail';
|
| 142 |
}
|
| 143 |
if ($zebra) {
|
| 144 |
$class .= ' even';
|
| 145 |
}
|
| 146 |
else {
|
| 147 |
$class .= ' odd';
|
| 148 |
}
|
| 149 |
return '<li class="'. $class .'">'. $link . $menu ."</li>\n";
|
| 150 |
}
|
| 151 |
|
| 152 |
/**************************************************************************************/
|
| 153 |
/*
|
| 154 |
*
|
| 155 |
* Initialize theme settings
|
| 156 |
*/
|
| 157 |
if (is_null(theme_get_setting('andreas_basecolour'))) { // <-- change this line
|
| 158 |
global $theme_key;
|
| 159 |
|
| 160 |
/*
|
| 161 |
* The default values for the theme variables. Make sure $defaults exactly
|
| 162 |
* matches the $defaults in the theme-settings.php file.
|
| 163 |
*/
|
| 164 |
$defaults = array( // <-- change this array
|
| 165 |
'andreas_basecolour' => 'Blue',
|
| 166 |
);
|
| 167 |
|
| 168 |
// Get default theme settings.
|
| 169 |
$settings = theme_get_settings($theme_key);
|
| 170 |
// Don't save the toggle_node_info_ variables.
|
| 171 |
if (module_exists('node')) {
|
| 172 |
foreach (node_get_types() as $type => $name) {
|
| 173 |
unset($settings['toggle_node_info_' . $type]);
|
| 174 |
}
|
| 175 |
}
|
| 176 |
// Save default theme settings.
|
| 177 |
variable_set(
|
| 178 |
str_replace('/', '_', 'theme_'. $theme_key .'_settings'),
|
| 179 |
array_merge($defaults, $settings)
|
| 180 |
);
|
| 181 |
// Force refresh of Drupal internals.
|
| 182 |
theme_get_setting('', TRUE);
|
| 183 |
}
|
| 184 |
|
| 185 |
if (is_null(theme_get_setting('andreas_layout'))) { // <-- change this line
|
| 186 |
global $theme_key;
|
| 187 |
|
| 188 |
/*
|
| 189 |
* The default values for the theme variables. Make sure $defaults exactly
|
| 190 |
* matches the $defaults in the theme-settings.php file.
|
| 191 |
*/
|
| 192 |
$defaults = array( // <-- change this array
|
| 193 |
'andreas_layout' => 'Liquid',
|
| 194 |
);
|
| 195 |
|
| 196 |
// Get default theme settings.
|
| 197 |
$settings = theme_get_settings($theme_key);
|
| 198 |
// Don't save the toggle_node_info_ variables.
|
| 199 |
if (module_exists('node')) {
|
| 200 |
foreach (node_get_types() as $type => $name) {
|
| 201 |
unset($settings['toggle_node_info_' . $type]);
|
| 202 |
}
|
| 203 |
}
|
| 204 |
// Save default theme settings.
|
| 205 |
variable_set(
|
| 206 |
str_replace('/', '_', 'theme_'. $theme_key .'_settings'),
|
| 207 |
array_merge($defaults, $settings)
|
| 208 |
);
|
| 209 |
// Force refresh of Drupal internals.
|
| 210 |
theme_get_setting('', TRUE);
|
| 211 |
}
|