\n"; $output .= ""; $output .= "". $title ? $title : variable_get(site_name, "drupal") .""; $output .= theme_head($main); $output .= "background; color: $this->foreground;\"". theme_onload_attribute(). "\">"; $output .= "
"; print $output; $this->box(t("Navigation"), @implode("
", link_page())); theme_blocks("all", $this); print "
"; } function links($links, $delimiter = " | ") { return implode($delimiter, $links); } function image($name) { return "misc/$name"; } function breadcrumb($breadcrumb) { print "
". implode($breadcrumb, " » ") ."
"; } function node($node, $main) { if (module_exist("taxonomy")) { $terms = taxonomy_link("taxonomy terms", $node); } $output = "

$node->title

by ". format_name($node); if (count($terms)) { $output .= "(". $this->links($terms) .")
"; } if ($main && $node->teaser) { $output .= $node->teaser; } else { $output .= $node->body; } if ($links = link_node($node, $main)) { $output .= "
[ ". $this->links($links) ." ]"; } $output .= "
"; print $output; } function box($subject, $content, $region = "main") { $output = "

$subject

$content

"; print $output; } /** * Render a block. * * You can style your blocks by defining .block (all blocks), * .block-module (all blocks of module module), * and \#block-module-delta (specific block of * module module with delta delta) in your * theme's CSS. * * @param $block object "indexed with" fields from database * table 'blocks' ($block->module, $block->delta, $block->region, * ...) and fields returned by module_block("view") * ($block->subject, $block->content, ...). */ function block($block) { $output = "
module\" id=\"block-$block->module-$block->delta\">"; $output .= "

$block->subject

"; $output .= "
$block->content
"; $output .= "
"; print $output; } function footer() { $output = "
"; $output .= theme_footer(); $output .= ""; print $output; } } // End of BaseTheme class // /** * Return a marker. Used to indicate new comments or required form * fields. */ function theme_mark() { return "*"; } /** * Return a formatted array of items. */ function theme_item_list($items = array(), $title = NULL) { $output .= "
"; if (isset($title)) { $output .= "

$title

"; } if (isset($items)) { $output .= ""; } $output .= "
"; return $output; } /** * Return an error message. */ function theme_error($message) { return "
$message
"; } function theme_list($refresh = 0) { static $list; if ($refresh) { unset($list); } if (!$list) { $list = array(); $result = db_query("SELECT * FROM {system} where type = 'theme' AND status = '1' ORDER BY name"); while ($theme = db_fetch_object($result)) { if (file_exists($theme->filename)) { $list[$theme->name] = $theme; } } } return $list; } function theme_head($main = 0) { global $base_url; $output .= ""; $output .= "\n"; $output .= "\n"; $head = module_invoke_all("head", $main); $output .= implode($head, "\n"); return $output; } /** * Execute hook _footer() which is run at the end of the page right * before the tag */ function theme_footer($main = 0) { $footer = module_invoke_all("footer", $main); return implode($footer, "\n"); } function theme_init() { global $user; $themes = theme_list(); $name = $user->theme ? $user->theme : variable_get("theme_default", 0); if (is_object($themes[$name])) { include_once($themes[$name]->filename); $class = "Theme_$name"; $instance =& new $class(); $instance->path = dirname($themes[$name]->filename); } else { $instance =& new BaseTheme; } return $instance; } /** * Render blocks available for (global) $user and $region calling $theme->block($block). * * @param $region main|left|right */ function theme_blocks($region) { global $user; $result = db_query("SELECT * FROM {blocks} WHERE (status = '1' OR custom = '1') ". ($region != "all" ? "AND region = %d " : "") ."ORDER BY weight, module", $region == "left" ? 0 : 1); while ($result && ($block = db_fetch_array($result))) { if ((($block['status'] && (!$user->uid || !$block['custom'])) || ($block['custom'] && $user->block[$block['module']][$block['delta']])) && (!$block['path'] || preg_match($block['path'], str_replace("?q=", "", request_uri())))) { $block = array_merge($block, module_invoke($block['module'], 'block', 'view', $block['delta'])); if ($block['content']) { theme('block', (object) $block); } } } } function theme() { global $theme; $args = func_get_args(); $function = array_shift($args); if (method_exists($theme, $function)) { return call_user_method_array($function, $theme, $args); } else { return call_user_func_array($function, $args); } } /** * Call _onload hook in all modules to enable modules to insert javascript * that will get run once the page has been loaded by the browser */ function theme_onload_attribute($theme_onloads = array()) { if (!is_array($theme_onloads)) { $theme_onloads = array($theme_onloads); } // Merge theme onloads (javascript rollovers, image preloads, etc.) // with module onloads (htmlarea, etc.) $onloads = array_merge(module_invoke_all("onload"), $theme_onloads); if (count($onloads)) { return " onload=\"" . implode("; ", $onloads) . "\""; } return; } ?>