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

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

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


Revision 1.1 - (show annotations) (download) (as text)
Thu Jun 26 16:36:45 2008 UTC (17 months ago) by krishikesh
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
Initial Release for Drupal 6
1 <?php
2 // colorart 3.x
3 // $Id: template.php,v 1.6.2.1.6.3.2.7 2007/12/07 23:05:15 jwolf Exp $
4
5 /**
6 * Adjust content width according to the absence or presence of sidebars.
7 *
8 * If only one sidebar is active, the mainContent width will expand to fill
9 * the space of the missing sidebar.
10 */
11 function colorart_get_mainContent_width($sidebar_left, $sidebar_right) {
12 $width = 500;
13 if (!$sidebar_left) {
14 $width = $width + 180;
15 }
16 if (!$sidebar_right) {
17 $width = $width + 180;
18 }
19 return $width;
20 }
21 function colorart_get_sideBars_width($sidebar_left, $sidebar_right) {
22 $width = 400;
23 if (!$sidebar_left) {
24 $width = $width - 205;
25 }
26 if (!$sidebar_right) {
27 $width = $width - 205;
28 }
29 return $width;
30 }
31
32 /**
33 * Return a themed breadcrumb trail.
34 *
35 * @param $breadcrumb
36 * An array containing the breadcrumb links.
37 * @return a string containing the breadcrumb output.
38 */
39 function phptemplate_breadcrumb($breadcrumb) {
40 if (!empty($breadcrumb)) {
41 return '<div class="breadcrumb">'. implode(' :: ', $breadcrumb) .'</div>';
42 }
43 }
44
45 /**
46 * Catch the theme_links function
47 */
48 function phptemplate_links($links, $attributes = array('class' => 'links')) {
49 $output = '';
50
51 if (count($links) > 0) {
52 $output = '<ul'. drupal_attributes($attributes) .'>';
53
54 $num_links = count($links);
55 $i = 1;
56
57 foreach ($links as $key => $link) {
58 $class = '';
59
60 // Automatically add a class to each link and also to each LI
61 if (isset($link['attributes']) && isset($link['attributes']['class'])) {
62 $link['attributes']['class'] .= ' ' . $key;
63 $class = $key;
64 }
65 else {
66 $link['attributes']['class'] = $key;
67 $class = $key;
68 }
69
70 // Add first and last classes to the list of links to help out themers.
71 $extra_class = '';
72 if ($i == 1) {
73 $extra_class .= 'first ';
74 }
75 if ($i == $num_links) {
76 $extra_class .= 'last ';
77 }
78 $output .= '<li class="'. $extra_class . $class .'">';
79
80 // Is the title HTML?
81 $html = isset($link['html']) && $link['html'];
82
83 // Initialize fragment and query variables.
84 $link['query'] = isset($link['query']) ? $link['query'] : NULL;
85 $link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
86
87 if (isset($link['href'])) {
88 $output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html);
89 }
90 else if ($link['title']) {
91 //Some links are actually not links, but we wrap these in <span> for adding title and class attributes
92 if (!$html) {
93 $link['title'] = check_plain($link['title']);
94 }
95 $output .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>';
96 }
97
98 $i++;
99 $output .= "</li>\n";
100 }
101
102 $output .= '</ul>';
103 }
104
105 return $output;
106 }
107
108 /**
109 * Customize a TinyMCE theme.
110 *
111 * @param init
112 * An array of settings TinyMCE should invoke a theme. You may override any
113 * of the TinyMCE settings. Details here:
114 *
115 * http://tinymce.moxiecode.com/wrapper.php?url=tinymce/docs/using.htm
116 *
117 * @param textarea_name
118 * The name of the textarea TinyMCE wants to enable.
119 *
120 * @param theme_name
121 * The default tinymce theme name to be enabled for this textarea. The
122 * sitewide default is 'simple', but the user may also override this.
123 *
124 * @param is_running
125 * A boolean flag that identifies id TinyMCE is currently running for this
126 * request life cycle. It can be ignored.
127 */
128 function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {
129
130 switch ($textarea_name) {
131 // Disable tinymce for these textareas
132 case 'log': // book and page log
133 case 'img_assist_pages':
134 case 'caption': // signature
135 case 'pages':
136 case 'access_pages': //TinyMCE profile settings.
137 case 'user_mail_welcome_body': // user config settings
138 case 'user_mail_approval_body': // user config settings
139 case 'user_mail_pass_body': // user config settings
140 case 'synonyms': // taxonomy terms
141 case 'description': // taxonomy terms
142 unset($init);
143 break;
144
145 // Force the 'simple' theme for some of the smaller textareas.
146 case 'signature':
147 case 'site_mission':
148 case 'site_footer':
149 case 'site_offline_message':
150 case 'page_help':
151 case 'user_registration_help':
152 case 'user_picture_guidelines':
153 $init['theme'] = 'simple';
154 foreach ($init as $k => $v) {
155 if (strstr($k, 'theme_advanced_')) unset($init[$k]);
156 }
157 break;
158 }
159
160 // Add some extra features when using the advanced theme.
161 // If $init is available, we can extend it
162 if (isset($init)) {
163 switch ($theme_name) {
164 case 'advanced':
165 $init['width'] = '100%';
166 break;
167
168 }
169 }
170
171 // Always return $init
172 return $init;
173 }
174
175
176

  ViewVC Help
Powered by ViewVC 1.1.2