/[drupal]/contributions/sandbox/frjo/event46/event.theme
ViewVC logotype

Contents of /contributions/sandbox/frjo/event46/event.theme

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


Revision 1.1 - (show annotations) (download) (as text)
Thu Mar 30 08:54:25 2006 UTC (3 years, 8 months ago) by frjo
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
Hacked version of event for Drupal 4.6.x, adds back location and more.
1 <?php
2 // $Id: event.theme,v 1.5.2.16 2005/12/05 03:05:53 killes Exp $
3
4 /**
5 * @addtogroup themeable
6 * @{
7 */
8
9 /**
10 * Format a calendar view
11 *
12 * @param day
13 * The day to display.
14 */
15 function theme_event_calendar_month($op, $header, $rows) {
16 $output = theme("table", $header, $rows);
17 return '<div class="event-calendar"><div class="month-view">'. $output ."</div></div>\n";
18 }
19
20 /**
21 * Format a calendar view
22 *
23 * @param day
24 * The day to display.
25 */
26 function theme_event_calendar_week($op, $header, $rows) {
27 $output = theme("table", $header, $rows);
28 return '<div class="event-calendar"><div class="week-view">'. $output ."</div></div>\n";
29 }
30
31 /**
32 * Format a calendar view
33 *
34 * @param day
35 * The day to display.
36 */
37 function theme_event_calendar_day($op, $header, $rows) {
38 $output = theme("table", $header, $rows);
39 return '<div class="event-calendar"><div class="day-view">'. $output ."</div></div>\n";
40 }
41
42 /**
43 * Format a calendar view
44 *
45 * @param day
46 * The day to display.
47 */
48 function theme_event_calendar_table($op, $header, $rows) {
49 $output = theme("table", $header, $rows);
50 return '<div class="event-calendar"><div class="table-view">'. $output ."</div></div>\n";
51 }
52
53 /**
54 * Format a calendar view
55 *
56 * @param day
57 * The day to display.
58 */
59 function theme_event_calendar_list($op, $header, $rows) {
60 return '<div class="event-calendar"><div class="list-view">'. $rows ."</div></div>\n";
61 }
62
63 /**
64 * Format an event node for display in an expanded calendar, like a calendar page
65 *
66 * @param node
67 * The node being displayed
68 * @param module
69 * The name of the external module calling the function. Default: null;
70 */
71 function theme_event_node_day($node, $module = NULL) {
72 $output .= '<div class="event dayview">'."\n";
73
74 if ((event_get_types('all') + event_get_types('solo')) > 1) {
75 $output .= '<div class="type">'. l('('. $node->event_node_title .')', 'event/'.gmdate('Y/m/d', $node->event_start).'/day/'.$node->type, array('title' => t('limit view to events of this type'))).'</div>'."\n";
76 }
77
78 $output .= '<div class="title">'. l($node->title, "node/$node->nid", array('title' => t('view this event'))) .'</div>'."\n";
79
80 $output .= '<div class="start">'. t('Start') .': '. $node->start_time_format .'</div>'."\n";
81 if ($node->event_start != $node->event_end) {
82 $output .= '<div class="end">'. t('End') .': '. $node->end_time_format .'</div>'."\n";
83 }
84 $output .= '<div class="content">'. check_output($node->body, $node->format) ."</div>\n";
85 $output .= '<div class="links">'. theme('links', $node->event_links) ."\n</div>";
86 $output .= "</div>\n";
87 return $output;
88 }
89
90 /**
91 * Format an event node for display in an expanded calendar, like a calendar page
92 *
93 * @param node
94 * The node being displayed
95 * @param module
96 * The name of the external module calling the function. Default: null;
97 */
98 function theme_event_node_week($node, $module = NULL) {
99 static $stripe, $stripe_map;
100
101 if(!$stripe_map[$node->nid]) {
102 if($stripe >= 10) {
103 $stripe = 1;
104 }
105 else {
106 $stripe++;
107 }
108 $stripe_map[$node->nid] = $stripe;
109 }
110
111 $output .= '<div class="event weekview">'."\n";
112 $output .= '<div class="stripe-'. $stripe_map[$node->nid] .'"></div>'."\n";
113
114 switch ($node->event_state) {
115 case 'singleday':
116 $times = '<div class="start">'. t('Start') .': '. $node->start_time_format .'</div>'."\n";
117 if ($node->event_start != $node->event_end) {
118 $times .= '<div class="end">'. t('End') .': '. $node->end_time_format .'</div>'."\n";
119 }
120 break;
121 case 'start':
122 $times = '<div class="start">'. t('Start') .': '. $node->start_time_format .'</div>'."\n";
123 break;
124 case 'end':
125 $times = '<div class="end">'. t('End') .': '. $node->end_time_format .'</div>'."\n";
126 break;
127 case 'ongoing':
128 $times = '<div class="ongoing">'. t('all day') .'</div>'."\n";
129 break;
130 }
131
132 if ((event_get_types('all') + event_get_types('solo')) > 1) {
133 $output .= '<div class="type">'. l('('. $node->event_node_title .')', 'event/'. gmdate('Y/m/d', $node->event_current_date) .'/month/'.$node->type, array('title' => t('limit view to events of this type'))).'</div>'."\n";
134 }
135 $output .= '<div class="title">'. l($node->title, "node/$node->nid", array('title' => t('view this event'))) .'</div>'."\n";
136 $output .= $times;
137 $output .= '<div class="links">'. theme('links', $node->event_links) ."\n</div>";
138 $output .= '</div>' . "\n";
139 return $output;
140 }
141
142 /**
143 * Format an event node for display in an expanded calendar, like a calendar page
144 *
145 * @param node
146 * The node being displayed
147 * @param module
148 * The name of the external module calling the function. Default: null;
149 */
150 function theme_event_node_month($node, $module = NULL) {
151 static $stripe, $stripe_map;
152
153 if (!$stripe_map[$node->nid]) {
154 if ($stripe >= 10) {
155 $stripe = 1;
156 }
157 else {
158 $stripe++;
159 }
160 $stripe_map[$node->nid] = $stripe;
161 }
162
163 $output .= '<div class="event monthview">'."\n";
164 $output .= '<div class="stripe-'. $stripe_map[$node->nid] .'"></div>'."\n";
165
166 switch ($node->event_state) {
167 case 'singleday':
168 $times = '<div class="start">'. t('Start') .': '. $node->start_time_format .'</div>'."\n";
169 if ($node->event_start != $node->event_end) {
170 $times .= '<div class="end">'. t('End') .': '. $node->end_time_format .'</div>'."\n";
171 }
172 break;
173 case 'start':
174 $times = '<div class="start">'. t('Start') .': '. $node->start_time_format .'</div>'."\n";
175 break;
176 case 'end':
177 $times = '<div class="end">'. t('End') .': '. $node->end_time_format .'</div>'."\n";
178 break;
179 case 'ongoing':
180 $times = '<div class="ongoing">'. t('all day') .'</div>'."\n";
181 break;
182 }
183 if ((event_get_types('all') + event_get_types('solo')) > 1) {
184 $output .= '<div class="type">'. l('('. $node->event_node_title .')', 'event/'. gmdate('Y/m/d', $node->event_current_date) .'/month/'.$node->type, array('title' => t('limit view to events of this type'))).'</div>'."\n";
185 }
186 $output .= '<div class="title">'. l($node->title, "node/$node->nid", array('title' => t('view this event'))) .'</div>'."\n";
187 $output .= $times;
188 $output .= '<div class="links">'. theme('links', $node->event_links) ."\n</div>";
189 $output .= '</div>' . "\n";
190
191 return $output;
192 }
193
194 /**
195 * Format an event node for display in an expanded calendar, like a calendar page
196 *
197 * @param node
198 * The node being displayed
199 * @param module
200 * The name of the external module calling the function. Default: null;
201 */
202
203 function theme_event_node_table($node, $module = NULL) {
204 static $stripe, $stripe_map, $link_count;
205 $link_count++;
206
207 if (!$stripe_map[$node->nid]) {
208 if ($stripe >= 10) {
209 $stripe = 1;
210 }
211 else {
212 $stripe++;
213 }
214 $stripe_map[$node->nid] = $stripe;
215 }
216
217 $output .= '<div class="event tableview">'."\n";
218 $output .= '<div class="stripe-'. $stripe_map[$node->nid] .'"></div>'."\n";
219 if (!$module && (event_get_types('all') + event_get_types('solo')) > 1) {
220 $output .= '<div class="type">'. l('('. $node->event_node_title .')', 'event/'.gmdate('Y/m/d', $node->event_start).'/table/'.$node->type, array('title' => t('limit view to events of this type'))).'</div>'."\n";
221 }
222 $output .= '<div class="title">'. l($node->title, "node/$node->nid", array('title' => t('view this event'))) .'</div>'."\n";
223
224 switch ($node->event_state) {
225 case 'singleday':
226 $output .= '<div class="start">'. t('Start') .': '. $node->start_time_format ."</div>\n";
227 if ($node->event_start != $node->event_end) {
228 $output .= '<div class="end">'. t('End') .': '. $node->end_time_format ."</div>\n";
229 }
230 break;
231 case 'start':
232 $output .= '<div class="start">'. t('Start') .': '. $node->start_time_format ."</div>\n";
233 break;
234 case 'end':
235 $output .= '<div class="end">'. t('End') .': '. $node->end_time_format ."</div>\n";
236 break;
237 case 'ongoing':
238 $output .= '<div class="ongoing">('. t('all day') .')</div>'."\n";
239 break;
240 }
241
242 $output .= '<div id="info_'. $link_count .'" class="info">'."\n";
243 if ($node->event_state != 'singleday') {
244 $output .= '<div class="start">'. t('Start') .': '. $node->start_format .'</div>'."\n";
245 if ($node->event_start != $node->event_end) {
246 $output .= '<div class="end">'. t('End') .': '. $node->end_format .'</div>'."\n";
247 }
248 }
249 $output .= '<div class="content">'. check_output($node->body, $node->format) .'</div></div>'."\n";
250
251 $links = $node->event_links;
252 $links[] = l(t('more info'), 'node/'.$node->nid, array('onclick' => "popupnotes('info_". $link_count ."'); return false;", 'title' => t('Show detailed information for this event.')));
253 $output .= '<div class="links">'. theme('links', $links) ."\n</div>";
254 $output .= '</div>'."\n";
255 return $output;
256 }
257
258 function theme_event_node_list($node, $module = NULL) {
259 static $stripe, $stripe_map, $link_count;
260 $link_count++;
261
262 if (!$stripe_map[$node->nid]) {
263 if ($stripe >= 10) {
264 $stripe = 1;
265 }
266 else {
267 $stripe++;
268 }
269 $stripe_map[$node->nid] = $stripe;
270 }
271
272 $output .= '<div class="event tableview">'."\n";
273 $output .= '<div class="stripe-'. $stripe_map[$node->nid] .'"></div>'."\n";
274 if (!$module && (event_get_types('all') + event_get_types('solo')) > 1) {
275 $output .= '<div class="type">'. l('('. $node->event_node_title .')', 'event/'.gmdate('Y/m/d', $node->event_start).'/table/'.$node->type, array('title' => t('limit view to events of this type'))).'</div>'."\n";
276 }
277 $output .= '<div class="title">'. l($node->title, "node/$node->nid", array('title' => t('view this event'))) .'</div>'."\n";
278
279 switch ($node->event_state) {
280 case 'singleday':
281 $output .= '<div class="start">'. t('Start') .': '. $node->start_time_format ."</div>\n";
282 if ($node->event_start != $node->event_end) {
283 $output .= '<div class="end">'. t('End') .': '. $node->end_time_format ."</div>\n";
284 }
285 break;
286 case 'start':
287 $output .= '<div class="start">'. t('Start') .': '. $node->start_time_format ."</div>\n";
288 break;
289 case 'end':
290 $output .= '<div class="end">'. t('End') .': '. $node->end_time_format ."</div>\n";
291 break;
292 case 'ongoing':
293 $output .= '<div class="ongoing">('. t('all day') .')</div>'."\n";
294 break;
295 }
296
297 $output .= '<div id="info_'. $link_count .'" class="info">'."\n";
298 if ($node->event_state != 'singleday') {
299 $output .= '<div class="start">'. t('Start') .': '. $node->start_format .'</div>'."\n";
300 if ($node->event_start != $node->event_end) {
301 $output .= '<div class="end">'. t('End') .': '. $node->end_format .'</div>'."\n";
302 }
303 }
304 $output .= '<div class="content">'. check_output($node->body, $node->format) .'</div></div>'."\n";
305
306 $links = $node->event_links;
307 $links[] = l(t('more info'), 'node/'.$node->nid, array('onclick' => "popupnotes('info_". $link_count ."'); return false;", 'title' => t('Show detailed information for this event.')));
308 $output .= '<div class="links">'. theme('links', $links) ."\n</div>";
309 $output .= '</div>'."\n";
310 return $output;
311 }
312
313 /**
314 * Format an date's day box in a calendar
315 *
316 * @param day
317 * The day to display.
318 */
319 function theme_event_calendar_date_box($year, $month, $day, $view) {
320 switch ($view) {
321 case 'table':
322 $output = '<div class="day">'. t('%month / %day', array('%month' => $month, '%day' => $day)) .'</div>'."\n";
323 break;
324 case 'list':
325 $output = '<div class="day">'. format_date(_event_mktime(0, 0, 0, $month, $day, $year), 'custom', 'l, F j, Y') .'</div>'."\n";
326 break;
327 case 'day':
328 break;
329 default:
330 $output = '<div class="day">'. $day .'</div>'."\n";
331 break;
332 }
333 return $output;
334 }
335
336 /**
337 * Format an empty day on a calendar
338 *
339 * @param day
340 * The day to display.
341 */
342 function theme_event_empty_day($year, $month, $day, $view) {
343 switch ($view) {
344 case 'table':
345 $output = '<div class="day">'. t('%month / %day', array('%month' => $month, '%day' => $day)) .'</div>'."\n";
346 $output .= '<div class="event-empty"></div>'."\n";
347 break;
348 case 'day':
349 case 'list':
350 break;
351 default:
352 $output = '<div class="day">'. $day .'</div>'."\n";
353 $output .= '<div class="event-empty"></div>'."\n";
354 break;
355 }
356 return $output;
357 }
358
359 /**
360 * Format an date value for a nodeapi insert
361 *
362 * @param node
363 * The node which needs it's dates formatted
364 */
365 function theme_event_nodeapi($node) {
366 $output = '<div class="event-nodeapi"><div class="'. $node->type. '-start"><label>'. t('Start') .': </label>'. $node->start_format .'</div></div>'."\n";
367 if ($node->event_start != $node->event_end) {
368 $output .= '<div class="event-nodeapi"><div class="'. $node->type. '-end"><label>'. t('End') .': </label>'. $node->end_format .'</div></div>'."\n";
369 }
370 /* if (variable_get('configurable_timezones', 1)) {
371 $zones = event_zonelist();
372 $output .= '<div class="event-nodeapi"><div class="'. $node->type. '-tz"><label>'. t('Timezone') .': </label>'. $zones[$node->timezone] .'</div></div>'."\n";
373 } */
374 if ($node->event_location) {
375 $output .= '<div class="event-nodeapi"><div class="'. $node->type. '-location"><label>'. t('Location') .': </label>'. $node->event_location .'</div></div>'."\n";
376 }
377 return $output;
378 }
379
380 /**
381 * Format the event filter control dropdown
382 *
383 * @param form
384 * The form containing the taxonomy controls
385 */
386 function theme_event_filter_control($form) {
387 return '<div class="event-filter-control">'. $form .'</div>';
388 }
389
390 /**
391 * Format the 'next' navigation controls for event calendars
392 *
393 * @param link
394 * The url for the navigation
395 */
396 function theme_event_nav_next($url) {
397 return '<span class="next">'. l('»', $url) .'</span>';
398 }
399
400 /**
401 * Format the 'previous' navigation controls for event calendars
402 *
403 * @param link
404 * The url for the navigation
405 */
406 function theme_event_nav_prev($url) {
407 return '<span class="prev">'. l('«', $url) .'</span>';
408 }
409
410 /**
411 * Format the links for event calendars
412 *
413 * @param links
414 * An array of links to render
415 * @param view
416 * The current view being rendered
417 */
418 function theme_event_links($links, $view) {
419 return theme('links', $links);
420 }
421
422 /**
423 * Format the ical link
424 *
425 * @param path
426 * The url for the ical feed
427 */
428 function theme_event_ical_link($path) {
429 $ical_link = '<div class="ical-link">'. l('<img src="'. drupal_get_path('module', 'event') .'/images/ical14x18.png" alt="'.t('Add to iCalendar').'" />&nbsp;iCal', $path, array('title' => t('Add this calendar to your iCalendar')), NULL, NULL, TRUE, TRUE) .'</div>';
430 return preg_replace("|http://|","webcal://", $ical_link);
431 }
432
433 /**
434 * Format the 'read more' link for events
435 *
436 * @param path
437 * The url to use for the read more link
438 */
439 function theme_event_more_link($path) {
440 return '<div class="more-link">'. l(t('more'), $path, array('title' => t('More events.'))) .'</div>';
441 }
442
443 /**
444 * Format an individual upcoming event block item
445 *
446 * @param node
447 * The node to render as an upcoming event
448 */
449 function theme_event_upcoming_item($node) {
450 $output = l($node->title, "node/$node->nid");
451 if ((event_get_types('all') + event_get_types('solo')) > 1) {
452 $output .= '<span class="event-nodetype">'. t("($node->typename)") .'</span>';
453 }
454 $output .= '<span class="event-timeleft">('. $node->timeleft .')</span>';
455 return $output;
456 }
457
458 /**
459 * Format the upcoming event block for event calendars
460 *
461 * @param items
462 * An array of themed upcoming events
463 */
464 function theme_event_upcoming_block($items) {
465 $output = theme("item_list", $items);
466 return $output;
467 }
468
469 /** @} End of addtogroup themeable */
470 ?>

  ViewVC Help
Powered by ViewVC 1.1.2