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

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

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


Revision 1.3 - (show annotations) (download) (as text)
Mon Sep 8 23:14:39 2008 UTC (14 months, 2 weeks ago) by roopletheme
Branch: MAIN
CVS Tags: DRUPAL-5--1-6, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.2: +106 -29 lines
File MIME type: text/x-php
Complete overhaul, fixed numerous bugs.
1 <?php
2 // $Id$
3
4 function phptemplate_body_class($sidebar_left, $sidebar_right) {
5 if ($sidebar_left != '' && $sidebar_right != '') {
6 $class = 'sidebars';
7 }
8 else {
9 if ($sidebar_left != '') {
10 $class = 'sidebar-left';
11 }
12 if ($sidebar_right != '') {
13 $class = 'sidebar-right';
14 }
15 }
16
17 if (isset($class)) {
18 print ' class="'. $class .'"';
19 }
20
21 }
22 if (is_null(theme_get_setting('newsflash_style'))) {
23 global $theme_key;
24 // Save default theme settings
25 $defaults = array(
26 'newsflash_style' => 'blue',
27 'newsflash_width' => 0,
28 'newsflash_fixedwidth' => '850',
29 'newsflash_breadcrumb' => 0,
30 'newsflash_iepngfix' => 0,
31 'newsflash_themelogo' => 0,
32 'newsflash_fontfamily' => 0,
33 'newsflash_customfont' => '',
34 'newsflash_uselocalcontent' => 0,
35 'newsflash_localcontentfile' => '',
36 'newsflash_leftsidebarwidth' => '210',
37 'newsflash_rightsidebarwidth' => '210',
38 'newsflash_suckerfish' => 0,
39 'newsflash_usecustomlogosize' => 0,
40 'newsflash_logowidth' => '100',
41 'newsflash_logoheight' => '100',
42 );
43
44 variable_set(
45 str_replace('/', '_', 'theme_'. $theme_key .'_settings'),
46 array_merge(theme_get_settings($theme_key), $defaults)
47 );
48 // Force refresh of Drupal internals
49 theme_get_setting('', TRUE);
50 }
51
52 function newsflash_regions() {
53 return array(
54 'sidebar_left' => t('Left Sidebar'),
55 'sidebar_right' => t('Right Sidebar'),
56 'header' => t('Header'),
57 'suckerfish' => t('Suckerfish Menu'),
58 'user1' => t('User1'),
59 'user2' => t('User2'),
60 'user3' => t('User3'),
61 'content_top' => t('Content Top'),
62 'content_bottom' => t('Content Bottom'),
63 'user4' => t('User4'),
64 'user5' => t('User5'),
65 'user6' => t('User6'),
66 'footer_region' => t('Footer'),
67 );
68 }
69
70 function get_newsflash_style() {
71 $style = theme_get_setting('newsflash_style');
72 if (!$style) {
73 $style = 'blue';
74 }
75 if (isset($_COOKIE["newsflashstyle"])) {
76 $style = $_COOKIE["newsflashstyle"];
77 }
78 return $style;
79 }
80
81 $style = get_newsflash_style();
82 drupal_add_css(drupal_get_path('theme', 'newsflash') .'/css/'. $style .'.css', 'theme');
83
84 if (theme_get_setting('newsflash_iepngfix')) {
85 drupal_add_js(drupal_get_path('theme', 'newsflash') .'/js/jquery.pngFix.js', 'theme');
86 }
87
88 if (theme_get_setting('newsflash_suckerfish')) {
89 drupal_add_css(drupal_get_path('theme', 'newsflash') .'/css/suckerfish_'. $style .'.css', 'theme');
90 }
91
92 if (theme_get_setting('newsflash_uselocalcontent')) {
93 $local_content = drupal_get_path('theme', 'newsflash') .'/'. theme_get_setting('newsflash_localcontentfile');
94 if (file_exists($local_content)) {
95 drupal_add_css($local_content, 'theme');
96 }
97 }
98
99 function phptemplate_menu_links($links, $attributes = array()) {
100
101 if (!count($links)) {
102 return '';
103 }
104 $level_tmp = explode('-', key($links));
105 $level = $level_tmp[0];
106 $output = "<ul class=\"links-$level ". $attributes['class'] ."\" id=\"". $attributes['id'] ."\">\n";
107
108 $num_links = count($links);
109 $i = 1;
110
111 foreach ($links as $index => $link) {
112 $output .= '<li';
113
114 $output .= ' class="';
115 if (stristr($index, 'active')) {
116 $output .= 'active';
117 }
118 elseif ((drupal_is_front_page()) && ($link['href']=='<front>')) {
119 $link['attributes']['class'] = 'active';
120 $output .= 'active';
121 }
122 if ($i == 1) {
123 $output .= ' first'; }
124 if ($i == $num_links) {
125 $output .= ' last'; }
126
127 $output .= '"';
128
129 $output .= ">". l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']) ."</li>\n";
130
131 $i++;
132 }
133 $output .= '</ul>';
134 return $output;
135 }

  ViewVC Help
Powered by ViewVC 1.1.2