/[drupal]/contributions/themes/absynthe/template.php
ViewVC logotype

Contents of /contributions/themes/absynthe/template.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Wed Mar 18 09:32:52 2009 UTC (8 months, 1 week ago) by hoainam12k
Branch: MAIN
CVS Tags: DRUPAL-6--1-2, HEAD
Branch point for: DRUPAL-6--1
File MIME type: text/x-php
For Drupal 6.0
1 <?php
2 // $Id: template.php,v 1.16 2007/10/11 09:51:29 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 * Allow themable wrapping of all comments.
42 */
43 function phptemplate_comment_wrapper($content, $node) {
44 if (!$content || $node->type == 'forum') {
45 return '<div id="comments">'. $content .'</div>';
46 }
47 else {
48 return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
49 }
50 }
51
52 /**
53 * Override or insert PHPTemplate variables into the templates.
54 */
55 function phptemplate_preprocess_page(&$vars) {
56 $vars['tabs2'] = menu_secondary_local_tasks();
57
58 // Hook into color.module
59 if (module_exists('color')) {
60 _color_page_alter($vars);
61 }
62 }
63
64 /**
65 * Returns the rendered local tasks. The default implementation renders
66 * them as tabs. Overridden to split the secondary tasks.
67 *
68 * @ingroup themeable
69 */
70 function phptemplate_menu_local_tasks() {
71 return menu_primary_local_tasks();
72 }
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 function phptemplate_node_submitted($node) {
83 return t('!datetime — !username',
84 array(
85 '!username' => theme('username', $node),
86 '!datetime' => format_date($node->created),
87 ));
88 }
89
90 /**
91 * Generates IE CSS links for LTR and RTL languages.
92 */
93 function phptemplate_get_ie_styles() {
94 global $language;
95
96 $iecss = '<link type="text/css" rel="stylesheet" media="screen" href="'. base_path() . path_to_theme() .'/ie.css" />';
97 $iecss .= '<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>';
98 return $iecss;
99 }
100
101 function absynthe_preprocess_search_theme_form(&$vars, $hook) {
102
103 // Modify elements of the search form
104 $vars['form']['search_theme_form']['#title'] = t('');
105
106 // Set a default value for the search box
107 $vars['form']['search_theme_form']['#value'] = t('');
108
109 // Add a custom class to the search box
110 $vars['form']['search_theme_form']['#attributes'] = array('class' => t('cleardefault'));
111
112 // Change the text on the submit button
113 $vars['form']['submit']['#value'] = t('Search');
114
115 // Rebuild the rendered version (search form only, rest remains unchanged)
116 unset($vars['form']['search_theme_form']['#printed']);
117 $vars['search']['search_theme_form'] = drupal_render($vars['form']['search_theme_form']);
118
119 // Rebuild the rendered version (submit button, rest remains unchanged)
120 unset($vars['form']['submit']['#printed']);
121 $vars['search']['submit'] = drupal_render($vars['form']['submit']);
122
123 // Collect all form elements to make it easier to print the whole form.
124 $vars['search_form'] = implode($vars['search']);
125 }
126
127 ?>

  ViewVC Help
Powered by ViewVC 1.1.2