t('left sidebar'), 'right' => t('right sidebar'), 'content_top' => t('content top'), 'content_bottom' => t('content bottom'), 'header' => t('header'), 'footer' => t('footer'), 'ge_sidebar' => t('greene sidebar'), 'navigation_bar' => t('navigation_bar') ); } /** * Override or insert PHPTemplate variables into the templates. */ function _zen_basic_variables($hook, $vars = array()) { switch ($hook) { case 'page': // GE Add view to body classes $vars['views_body_classes'] = "vtype-" . detect_views(); // This first part was already in the PHPTemplate engine code and gives page.tpl.php variances based on the args. $i = 0; $suggestion = 'page'; $suggestions = array($suggestion); while ($arg = arg($i++)) { $suggestions[] = $suggestion . '-' . $arg; if (!is_numeric($arg)) { $suggestion .= '-' . $arg; } } // This if block was added to give a page-node-node_type.tpl.php that has precedence over the args. if (arg(0) == 'node' && is_numeric(arg(1)) && isset($vars['node'])) { if (isset($vars['node']->type)) { $suggestions[] = $suggestion . '-' . $vars['node']->type; } } // This also from PHPTemplate to make sure the front page gets its own template. if (drupal_is_front_page()) { $suggestions[] = 'page-front'; } $vars['template_files'] = $suggestions; return $vars; } return $vars; } /* * Blocks */ function zen_basic_block($block) { if (module_exists('blocktheme')) { if ( $custom_theme = blocktheme_get_theme($block) ) { return _phptemplate_callback('block',array('block' => $block),array($custom_theme) ); } } return phptemplate_block($block); } /* * VIEW: Gallerie */ /** * views template to output a view. * This code was generated by the views theming wizard * Date: 15. Dezember 2007 - 12:41 * View: Gallerie * * This function goes in your template.php file */ function zen_basic_views_view_list_Gallerie($view, $nodes, $type) { drupal_add_css(drupal_get_path('module', 'views_bonus_grid') .'/views_bonus.css'); $fields = _views_get_fields(); // create basic page structure // get arguments and load referenced node content - if there's an argument $item_nid = $view->args[0]; if ($item_nid) { $item_node = node_load($item_nid); $item_node = node_build_content($item_node); $item_logo = $item_node->field_location_stueck_logo[0]['view'] ; $header_content = ''; $block = module_invoke('block', 'block', 'view', check_plain($item_node->field_stueck_navigationblock[0]['value']) ); $header_content .= '
' . $block['content'] . '
'; $header_content .= '
'; $header_content .= '

'. views_get_title($view, $type) . '

'; // in between goes the "normal" view content as produced below $footer_content = '
'; } $taken = array(); // Group our nodes $set = array(); foreach ($nodes as $node) { $set[$node->node_type][] = $node; } // Set up the fields in nicely named chunks. foreach ($view->field as $id => $field) { $field_name = $field['field']; if (isset($taken[$field_name])) { $field_name = $field['queryname']; } $taken[$field_name] = true; $field_names[$id] = $field_name; } // Set up some variables that won't change. $base_vars = array( 'view' => $view, 'view_type' => $type, ); $output = ''; foreach ($set as $label => $nodes) { $items = array(); foreach ($nodes as $i => $node) { $vars = $base_vars; $vars['node'] = $node; $vars['count'] = $i; $vars['stripe'] = $i % 2 ? 'even' : 'odd'; foreach ($view->field as $id => $field) { $name = $field_names[$id]; $vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view); if (isset($field['label'])) { $vars[$name . '_label'] = $field['label']; } } $items[] = _phptemplate_callback('views-list-Gallerie', $vars); } if ($items) { // $output .= theme('item_list', $items, $label); $content = ''; // set default count. $cols = $view->gridcount ? $view->gridcount : 3; $count = 0; $total = count($items); foreach ($items as $item) { if ($count % $cols == 0) { $content .= ''; } $content .= "\n"; $count++; if ($count % $cols == 0 || $count == $total) { $content .= ''; } } /* * Add empty row to cater for tables with less than minimum number of items */ $content .= ''; for ($i = 1; $i <= $cols; $i++) { $content .= "\n"; } $content .= ""; $content .= "
$item
 
"; if ($content) { $output .= '

' . t($view->name . "-" . $label) . '

'; $output .= $content; } } } $output = $header_content . $output . $footer_content; return $output; } /* * VIEW: Tatorte */ function zen_basic_views_bonus_view_grid($view, $nodes, $type) { drupal_add_css(drupal_get_path('module', 'views_bonus_grid') .'/views_bonus.css'); $fields = _views_get_fields(); $content = ''; // set default count. $cols = $view->gridcount ? $view->gridcount : 5; $count = 0; $total = count($nodes); foreach ($nodes as $node) { $item = ''; if ($count % $cols == 0) { $content .= ''; } foreach ($view->field as $field) { if ($fields[$field['id']]['visible'] !== FALSE) { if ($field['label']) { $item .= "
" . $field['label'] . "
"; } $item .= "
" . views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view) . "
"; } } $content .= "\n"; $count++; if ($count % $cols == 0 || $count == $total) { $content .= ''; } } $content .= '
$item
'; if ($content) { return $content; } } function detect_views() { $allviews = array_flip(views_get_all_urls()); if ($current = $allviews[arg(0)]) { return $current; } else { return FALSE; } }