comparison template.php @ 0:65b7937bab7b

intertial
author dwinter
date Fri, 20 Jun 2014 09:39:25 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:65b7937bab7b
1 <?php
2
3 /**
4 * Override of theme_breadcrumb().
5 */
6
7 function mpiwg_breadcrumb($variables) {
8 $breadcrumb = $variables['breadcrumb'];
9
10 if (!empty($breadcrumb)) {
11 // Provide a navigational heading to give context for breadcrumb links to
12 // screen-reader users. Make the heading invisible with .element-invisible.
13 $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
14
15 $output .= '<div class="breadcrumb">' . implode(' › ', $breadcrumb) . '</div>';
16 return $output;
17 }
18 }
19
20 /**
21 * Override or insert variables into the maintenance page template.
22 */
23 function mpiwg_preprocess_maintenance_page(&$vars) {
24 // While markup for normal pages is split into page.tpl.php and html.tpl.php,
25 // the markup for the maintenance page is all in the single
26 // maintenance-page.tpl.php template. So, to have what's done in
27 // mpiwg_preprocess_html() also happen on the maintenance page, it has to be
28 // called here.
29 mpiwg_preprocess_html($vars);
30 }
31
32 /**
33 * Override or insert variables into the html template.
34 */
35 function mpiwg_preprocess_html(&$vars) {
36 // Toggle fixed or fluid width.
37 if (theme_get_setting('mpiwg_width') == 'fluid') {
38 $vars['classes_array'][] = 'fluid-width';
39 }
40 // Add conditional CSS for IE6.
41 drupal_add_css(path_to_theme() . '/fix-ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
42 }
43
44 /**
45 * Override or insert variables into the html template.
46 */
47 function mpiwg_process_html(&$vars) {
48 // Hook into color.module
49 if (module_exists('color')) {
50 _color_html_alter($vars);
51 }
52 }
53
54 /**
55 * Override or insert variables into the page template.
56 */
57 function mpiwg_preprocess_page(&$vars) {
58 // Move secondary tabs into a separate variable.
59
60
61 $vars['MPIWGlogo'] = base_path() . path_to_theme() . '/logo.png';
62 $vars['tabs2'] = array(
63 '#theme' => 'menu_local_tasks',
64 '#secondary' => $vars['tabs']['#secondary'],
65 );
66 unset($vars['tabs']['#secondary']);
67
68 if (isset($vars['main_menu'])) {
69 /* $vars['primary_nav'] = theme('mpiwg_links__system__main_menu', array(
70 'links' => $vars['main_menu'],
71 'attributes' => array(
72 'class' => array('links', 'inline', 'main-menu'),
73 ),
74 'heading' => array(
75 'text' => t('Main menu'),
76 'level' => 'h2',
77 'class' => array('element-invisible'),
78 )
79 ));*/
80 $vars['primary_nav'] = mpiwg_links__system__main_menu($vars['main_menu']);
81
82 }
83 else {
84 $vars['primary_nav'] = FALSE;
85 }
86 if (isset($vars['secondary_menu'])) {
87 $vars['secondary_nav'] = theme('links__system_secondary_menu', array(
88 'links' => $vars['secondary_menu'],
89 'attributes' => array(
90 'class' => array('links', 'inline', 'secondary-menu'),
91 ),
92 'heading' => array(
93 'text' => t('Secondary menu'),
94 'level' => 'h2',
95 'class' => array('element-invisible'),
96 )
97 ));
98 }
99 else {
100 $vars['secondary_nav'] = FALSE;
101 }
102
103 // Prepare header.
104 $site_fields = array();
105 if (!empty($vars['site_name'])) {
106 $site_fields[] = $vars['site_name'];
107 }
108 if (!empty($vars['site_slogan'])) {
109 $site_fields[] = $vars['site_slogan'];
110 }
111 $vars['site_title'] = implode(' ', $site_fields);
112 if (!empty($site_fields)) {
113 $site_fields[0] = '<span>' . $site_fields[0] . '</span>';
114 }
115 $vars['site_html'] = implode(' ', $site_fields);
116
117 // Set a variable for the site name title and logo alt attributes text.
118 $slogan_text = $vars['site_slogan'];
119 $site_name_text = $vars['site_name'];
120 $vars['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
121 }
122
123 /**
124 * Override or insert variables into the node template.
125 */
126 function mpiwg_preprocess_node(&$vars) {
127 $vars['submitted'] = $vars['date'] . ' — ' . $vars['name'];
128 }
129
130 /**
131 * Override or insert variables into the comment template.
132 */
133 function mpiwg_preprocess_comment(&$vars) {
134 $vars['submitted'] = $vars['created'] . ' — ' . $vars['author'];
135 }
136
137 /**
138 * Override or insert variables into the block template.
139 */
140 function mpiwg_preprocess_block(&$vars) {
141 $vars['title_attributes_array']['class'][] = 'title';
142 //$vars['classes_array'][] = 'clearfix';
143 $vars['classes_array']= array('MPIWGDEV_block','sideblock');
144 }
145
146 /**
147 * Override or insert variables into the page template.
148 */
149 function mpiwg_process_page(&$vars) {
150 // Hook into color.module
151 if (module_exists('color')) {
152 _color_page_alter($vars);
153 }
154 }
155
156 /**
157 * Override or insert variables into the region template.
158 */
159 function mpiwg_preprocess_region(&$vars) {
160 if ($vars['region'] == 'header') {
161 $vars['classes_array'][] = 'clearfix';
162 }
163 }
164
165 function mpiwg_links__system__main_menu($variables) {
166 $html = " <ul>\n";
167
168 #$tree = menu_tree_all_data('main_menu',$variables['links']);
169
170 foreach ($variables as $link) {
171 $path=$link['href'];
172 if (($path == $_GET['q'] ||
173 ($path == '<front>' && drupal_is_front_page())) && (empty($options['language']) )) {
174 $html .= '<li class="sec on">'.l($link['title'], $link['href'], $link)."</li>";
175 }else{
176
177 $html .= '<li class="sec" >'.l($link['title'], $link['href'], $link)."</li>";
178 }
179 }
180
181 global $user;
182
183 // soll login im hauptmenu angezeigt werden?
184 if (theme_get_setting('mpiwg_login_in_main_menu')){
185 if (!$user->uid) {
186
187 $html .='<li class="sec" >'.l(t("Login"), 'user')."</li>";
188 } elseif ($user->name=='ip_login'){
189 $html .='<li class="sec" >'.l(t("Login"), 'user/logout')."</li>";
190 } else
191 {
192 $html .='<li class="sec" >'.l(t("Logout").'('.$user->name . ')', 'user/logout')."</li>";
193 }
194 }
195 $html .= " </ul>\n";
196
197
198 return $html;
199 }
200
201
202
203 function mpiwg_menu_tree($variables) {
204 return '<div class="subnav"> <ul class="menu">' . $variables['tree'] . '</ul></div>';
205 }
206 function mpiwg_menu_link ($variables){
207
208
209 $element = $variables['element'];
210 $sub_menu = '';
211
212 if ($element['#below']) {
213 $sub_menu = drupal_render($element['#below']);
214
215 }
216
217 $attrs="";
218
219 if (isset( $element['#localized_options']['attributes']['class'][0])){
220 $attrs = $element['#localized_options']['attributes']['class'][0];
221 }
222
223 $output ='<div class="level ' . $attrs .'">' . l($element['#title'], $element['#href'], $element['#localized_options']) . '</div>';
224
225 $active=false;
226 foreach ($element['#attributes']['class'] as $attr){
227 if ($attr == "active"){
228 $active=true;
229 }
230 }
231
232 if ($active) {
233 array_push($element['#attributes']['class'],'sn_on');
234 } else {
235 array_push($element['#attributes']['class'],'sn_off');
236 }
237
238 return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
239 }
240
241 function mpiwg_block_view_locale_language_alter(&$vars,$block){
242
243 $vars['content']='<div class="subnav">'.$vars['content'].'</div>';
244 }
245
246
247
248