This repository has been archived by the owner on Feb 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate.php
220 lines (173 loc) · 5.63 KB
/
template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php
/**
* @file
* Theme functions
*/
// Include all files from the includes directory.
$includes_path = dirname(__FILE__) . '/includes/*.inc';
foreach (glob($includes_path) as $filename) {
require_once dirname(__FILE__) . '/includes/' . basename($filename);
}
/* SCA: All following copied and pasted from madlib/template.php with theme name replaced! */
// Provide < 5.3 for the __DIR__ constant.
if (!defined('__DIR__')) {
define('__DIR__', dirname(__FILE__));
}
// uncomment as needed
# require_once __DIR__ . '/includes/theme.inc';
require_once __DIR__ . '/includes/form.inc';
// MICHAEL -- I copied this hook function from the theme (dukelib)
// I created way back when we were exploring Drupal but prior
// to creating the DATAGIS Pilot
/**
* Implements hook_aggregator_block_item
*/
function dulcet_aggregator_block_item($variables) {
$item = $variables['item'];
//dpm($item);
$hrefUrl = $variables['item']->link;
$imgSrc = '';
$linkTitle = $variables['item']->title;
$theDate = $variables['item']->timestamp;
$useImages = "false";
//get pubDate
//if (isset($variables['item']->pubDate)) {
//$theDate = $variables['item']->pubDate;
//$useDate = "true";
//}
// get the image src
$match = array();
if (preg_match('/src="([^"]*)"/i', $item->description, $match) == 1) {
$imgSrc = $match[1];
$useImages = "true";
}
$div_img_shadow = sprintf('<a onClick="ga(\'send\', \'event\', { eventCategory: \'dulHome\', eventAction: \'Feature Blog Posts\', eventLabel: \'Item\'});" href="%s">'
. '<div class="blog-content">'
. '<img alt="" class="img-thumbnail" src="%s" />', $hrefUrl, $imgSrc);
$div_news_caption = sprintf('<p>'
. $linkTitle
. '</p>'
. '</div>'
. '</a>', $hrefUrl, $linkTitle);
$div_news_item = sprintf('<div class="event">'
. '<a href="%s">'
. $linkTitle
. '</a>'
. '<br />'
. '<span class="date">'
. date("D, M j", $theDate)
. '</span>'
. '<span class="hour">'
. date(", g:ia", $theDate)
. '</span>'
. '</div>', $hrefUrl);
if ($useImages == "true") {
return $div_img_shadow . $div_news_caption;
}
if ($useImages == "false") {
return $div_news_item;
}
}
/**
* Implements theme_item_list()
*/
function dulcet_item_list($vars) {
$vars['attributes']['id'] = 'rotate1';
return theme_item_list($vars);
}
/**
* Implements theme_menu_link()
*
* Removes 'east/' from the string generated by the l() function
*/
function dulcet_menu_link(array $variables) {
$base_path = base_path();
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
if (preg_match('/^\/east/', $base_path) == 1) {
# remove 'east/' from the $output after the l() call
$output = str_replace('east/', '', $output);
}
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
/**
* Implements hook_theme().
*/
function dulcet_theme(&$existing, $type, $theme, $path) {
return array(
'dul_search_form_wrapper' => array(
'render element' => 'element',
),
);
}
/**
* Adds the search form's submit button right after the input element.
*
* @ingroup themable
*/
function dulcet_dul_search_form_wrapper(&$vars) {
$output = '<div class="input-group">';
$output .= $vars['element']['#children'];
$output .= '<button type="submit" class="btn btn-success bannerSearch">';
$output .= '<i class="icon-search icon-white"></i>';
$output .= '<span class="element-invisible">' . t('Search') . '</span>';
$output .= '</button>';
$output .= '</div>';
return $output;
}
/**
* Appending class names to menu UL.
*
* @ingroup themable
*/
function dulcet_menu_tree($variables) {
return '<ul class="menu nav nav-list">' . $variables['tree'] . '</ul>';
}
/**
* Implements hook_js_alter
*
* uses tips from:
* http://oldwildissue.wordpress.com/2012/11/19/drupal-7-manually-update-jquery-version/
*/
function dulcet_js_alter(&$javascript) {
// $jquery_path = drupal_get_path('theme', 'dulcet') . '/js/jquery-1.8.3.min.js';
// based on the current path (is admin or not)
//dpm(current_path());
//kpr($javascript);
//$weight = (float) $javascript['https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js']['weight'];
//$javascript['https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js']['preprocess'] = FALSE;
//$javascript['/sites/all/themes/dulcet/js/simile/exhibit-api-v2.js']['weight'] = $weight - 0.001;
//kpr($javascript);
#$javascript['/sites/all/themes/dulcet/js/simile/exhibit-api-v2.js']['group'] = 'pick a group';
}
/**
* Implements hook_preprocess_block
*
*/
function dulcet_preprocess_block(&$variables) {
}
/**
* Adds CSS for IE
*/
function dulcet_preprocess__html(&$variables) {
//drupal_add_css(path_to_theme() . '/css/ie-lte-8.css', array('group' => CSS_THEME, 'weight' => 115, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
//$alias = drupal_get_path_alias();
// places to study
//if ($alias == "using/places-to-study") {
// drupal_add_js('/sites/all/themes/dulcet/js/simile/exhibit-api-v2.js', array('group' => JS_LIBRARY, 'weight' => -10000, 'preprocess' => TRUE));
// drupal_add_html_head_link(array('ex:converter' => 'googleSpreadsheets', 'type' => 'application/jsonp', 'rel' => 'exhibit/data', 'href' => 'http://spreadsheets.google.com/feeds/list/0Ai1EAVMshswCdGx3OE1ySXMtZThseVRFR1JXaF9JeXc/od6/public/basic?alt=json-in-script'));
//}
}
function dulcet_preprocess_maintenance_page(&$variables) {
drupal_add_css(
drupal_get_path('theme', 'dulcet') . '/css/maintenance-page.css',
array(
'type' => 'file',
'weight' => 1000,
)
);
}