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

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

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


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

  ViewVC Help
Powered by ViewVC 1.1.2