Removed obsolete $ in source files

This commit is contained in:
Manuel Cillero 2017-08-29 14:13:02 +02:00
parent a39c010e06
commit e5f2b64d98
146 changed files with 836 additions and 1081 deletions

View file

@ -1,4 +1,3 @@
; $Id: calendar_multiday.info,v 1.1.2.2 2011/01/03 12:28:47 karens Exp $
name = Calendar Multiday
description = "Use the calendar multiday display as an alternative to the standard display. (BETA version)"
dependencies[] = calendar
@ -12,4 +11,3 @@ version = "6.x-2.4"
core = "6.x"
project = "calendar"
datestamp = "1294072550"

View file

@ -1,6 +1,4 @@
<?php
// $Id: calendar_multiday.module,v 1.1.2.2 2010/12/31 16:25:43 karens Exp $
/**
* Implementation of hook_views_api().
*
@ -81,10 +79,10 @@ function calendar_multiday_theme() {
'calendar_month_col' => $base + array(
'template' => 'calendar-month-col',
'arguments' => array('item' => NULL),
),
),
'calendar_month_row' => $base + array(
'template' => 'calendar-month-row',
'arguments' => array('inner' => NULL, 'class' => NULL, 'iehint' => NULL),
),
),
);
}
}

View file

@ -1,4 +1,3 @@
// $Id: calendar_overlap.js,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/*
* Create the splitter, set the viewport size, and set the position of the scrollbar to the first item.
*/
@ -8,16 +7,16 @@ Drupal.behaviors.calendarSetScroll = function (context) {
$('.header-body-divider:not(.header-body-divider-processed)').each(function() {
var divider = $(this).addClass('header-body-divider-processed');
var start_y = divider.offset().top;
// Add the grippie icon
// Add the grippie icon
$(this).prepend('<div class="grippie"></div>').mousedown(startDrag);
function startDrag(e) {
start_y = divider.offset().top;
$(document).mousemove(performDrag).mouseup(endDrag);
return false;
}
function performDrag(e) {
var offset = e.pageY - start_y;
var mwc = $('#multi-day-container');
@ -25,25 +24,25 @@ Drupal.behaviors.calendarSetScroll = function (context) {
start_y = divider.offset().top;
return false;
}
function endDrag(e) {
$(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag);
}
});
$('.single-day-footer:not(.single-day-footer-processed)').each(function() {
var divider = $(this).addClass('single-day-footer-processed');
var start_y = divider.offset().top;
// Add the grippie icon
// Add the grippie icon
$(this).prepend('<div class="grippie"></div>').mousedown(startDrag);
function startDrag(e) {
start_y = divider.offset().top;
$(document).mousemove(performDrag).mouseup(endDrag);
return false;
}
function performDrag(e) {
var offset = e.pageY - start_y;
var sdc = $('#single-day-container');
@ -51,12 +50,12 @@ Drupal.behaviors.calendarSetScroll = function (context) {
start_y = divider.offset().top;
return false;
}
function endDrag(e) {
$(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag);
}
});
// Size the window
calendar_resizeViewport();
}
@ -69,14 +68,13 @@ function calendar_scrollToFirst() {
}
}
// Size the single day view
// Size the single day view
function calendar_resizeViewport() {
// Size of the browser window
var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height();
var top = $('#single-day-container').offset().top;
$('#multi-day-container').height(75);
// Give it a 20 pixel margin at the bottom
$('#single-day-container').height(Math.max(400,viewportHeight - top - 20));
}

View file

@ -1,5 +1,4 @@
<?php
//$Id: calendar.inc,v 1.1.2.4 2011/01/02 00:00:56 karens Exp $
/**
* Build calendar
*
@ -23,10 +22,10 @@ function calendar_build_calendar($view, $items) {
}
$items = $values;
ksort($items);
$rows = array();
$curday = drupal_clone($view->date_info->min_date);
switch ($view->date_info->granularity) {
case 'year':
$rows = array();
@ -49,7 +48,7 @@ function calendar_build_calendar($view, $items) {
break;
}
return $rows;
}
/**
* Build one month.
@ -85,20 +84,20 @@ function calendar_build_month(&$curday, $view, $items) {
$week_rows = calendar_build_week($curday, $view, $items, TRUE);
$multiday_buckets = $week_rows['multiday_buckets'];
$singleday_buckets = $week_rows['singleday_buckets'];
$total_rows = $week_rows['total_rows'];
// Theme each row
$output = "";
$final_day = clone($curday);
$iehint = 0;
$max_multirow_cnt = 0;
$max_singlerow_cnt = 0;
for ($i = 0; $i < $total_rows + 1; $i++) {
$inner = "";
// If we're displaying the week number, add it as the
// first cell in the week.
if ($i == 0 && !empty($view->date_info->style_with_weekno) && !in_array($view->date_info->granularity, array('day', 'week'))) {
@ -114,25 +113,25 @@ function calendar_build_month(&$curday, $view, $items) {
'entry' => $weekno,
'colspan' => 1,
'rowspan' => $total_rows + 1,
'id' => $view->name . '-weekno-' . $curday_date,
'id' => $view->name . '-weekno-' . $curday_date,
'class' => 'week'
);
$inner .= theme('calendar_month_col', $item);
}
$curday = clone($init_day);
// move backwards to the first day of the week
$day_wday = date_format($curday, 'w');
date_modify($curday, '-' . strval((7 + $day_wday - $first_day) % 7) . ' days');
for ( $wday = 0; $wday < 7; $wday++) {
$curday_date = date_format($curday, DATE_FORMAT_DATE);
$class = strtolower($weekdays[$wday]);
$item = NULL;
$in_month = !($curday_date < $view->date_info->min_date_date || $curday_date > $view->date_info->max_date_date || date_format($curday, 'n') != $month);
// Add the datebox
if ($i == 0) {
$count = $in_month ? intval(count($multiday_buckets[$wday]) + count($singleday_buckets[$wday])) : FALSE;
@ -151,40 +150,40 @@ function calendar_build_month(&$curday, $view, $items) {
else {
$index = $i - 1;
$multi_count = count($multiday_buckets[$wday]);
// Process multiday buckets first. If there is a multiday-bucket item in this row...
if ($index < $multi_count) {
// If this item is filled with either a blank or an entry...
if ($multiday_buckets[$wday][$index]['filled']) {
// Add item and add class
$item = $multiday_buckets[$wday][$index];
$item['class'] = 'multi-day';
$item['date'] = $curday_date;
// Is this an entry?
if (!$multiday_buckets[$wday][$index]['avail']) {
// If the item either starts or ends on today,
// then add tags so we can style the borders
if ($curday_date == $today && $in_month) {
$item['class'] .= ' starts-today';
}
// Calculate on which day of this week this item ends on..
$end_day = clone($curday);
$span = $item['colspan'] - 1;
date_modify($end_day, '+' . $span .' day');
$endday_date = date_format($end_day, DATE_FORMAT_DATE);
// If it ends today, add class
if ($endday_date == $today && $in_month) {
$item['class'] .= ' ends-today';
}
}
}
// If this is an acutal entry, add classes regarding the state of the
// item
if ($multiday_buckets[$wday][$index]['avail']) {
@ -192,11 +191,11 @@ function calendar_build_month(&$curday, $view, $items) {
($curday_date < $today ? ' past' : '') .
($curday_date > $today ? ' future' : '');
}
// Else, process the single day bucket - we only do this once per day
}
elseif ($index == $multi_count) {
$single_day_cnt = 0;
// If it's empty, add class
if (count($singleday_buckets[$wday]) == 0) {
@ -218,9 +217,9 @@ function calendar_build_month(&$curday, $view, $items) {
}
$class = 'single-day';
}
$rowspan = $total_rows - $index;
// Add item...
$item = array(
'entry' => $single_days,
@ -230,7 +229,7 @@ function calendar_build_month(&$curday, $view, $items) {
'date' => $curday_date,
'id' => $view->name . '-' . $curday_date . '-' . $index
);
// Hack for ie to help it properly space single day rows
if ($rowspan > 1 && $in_month && $single_day_cnt > 0) {
$max_multirow_cnt = max($max_multirow_cnt, $single_day_cnt);
@ -238,7 +237,7 @@ function calendar_build_month(&$curday, $view, $items) {
else {
$max_singlerow_cnt = max($max_singlerow_cnt, $single_day_cnt);
}
// If the singlerow is bigger than the multi-row, then null out
// ieheight - I'm estimating that a single row is twice the size of
// multi-row. This is really the best that can be done with ie
@ -248,14 +247,14 @@ function calendar_build_month(&$curday, $view, $items) {
elseif ($rowspan > 1 && $in_month && $single_day_cnt > 0) {
$iehint = max($iehint, $rowspan - 1); // How many rows to adjust for?
}
// Set the class
$item['class'] .= ($curday_date == $today && $in_month ? ' today' : '') .
($curday_date < $today ? ' past' : '') .
($curday_date > $today ? ' future' : '');
}
}
// If there isn't an item, then add empty class
if ($item != NULL) {
if (!$in_month) {
@ -264,10 +263,10 @@ function calendar_build_month(&$curday, $view, $items) {
// Style this entry - it will be a <td>.
$inner .= theme('calendar_month_col', $item);
}
date_modify($curday, '+1 day');
}
if ($i == 0) {
$output .= theme('calendar_month_row', $inner, 'date-box', $iehint);
}
@ -283,14 +282,14 @@ function calendar_build_month(&$curday, $view, $items) {
}
}
$curday = $final_day;
// Add the row into the row array....
$rows[] = array('data' => $output);
$curday_date = date_format($curday, DATE_FORMAT_DATE);
$curday_month = date_format($curday, 'n');
} while ($curday_month == $month && $curday_date <= $view->date_info->max_date_date);
// Merge the day names in as the first row.
$rows = array_merge(array(calendar_week_header($view)), $rows);
return $rows;
@ -309,7 +308,7 @@ function calendar_build_mini_week(&$curday, $view, $items, $check_month = FALSE)
$day_wday = date_format($curday, 'w');
date_modify($curday, '-' . strval((7 + $day_wday - $first_day) % 7) . ' days');
$curday_date = date_format($curday, DATE_FORMAT_DATE);
// If we're displaying the week number, add it as the
// first cell in the week.
if (!empty($view->date_info->style_with_weekno) && !in_array($view->date_info->granularity, array('day', 'week'))) {
@ -323,7 +322,7 @@ function calendar_build_mini_week(&$curday, $view, $items, $check_month = FALSE)
}
$rows[$week][] = array(
'data' => $weekno,
'id' => $view->name . '-weekno-' . $curday_date,
'id' => $view->name . '-weekno-' . $curday_date,
'class' => 'week');
}
for ($i = 0; $i < 7; $i++) {
@ -347,7 +346,7 @@ function calendar_build_mini_week(&$curday, $view, $items, $check_month = FALSE)
($curday_date > $today ? ' future' : '') .
(empty($items[$curday_date]) ? ' has-no-events' : ' has-events');
}
$rows[$week][] = array(
'data' => $content,
'class' => $class, 'id' => $view->name . '-' . $curday_date);
@ -363,17 +362,17 @@ function calendar_build_week(&$curday, $view, $items, $check_month = FALSE) {
$weekdays = calendar_untranslated_days($items, $view);
$month = date_format($curday, 'n');
$first_day = variable_get('date_first_day', 0);
// Set up buckets
$total_rows = 0;
$multiday_buckets = array( array(), array(), array(), array(), array(), array(), array());
$singleday_buckets = array( array(), array(), array(), array(), array(), array(), array());
// move backwards to the first day of the week
$day_wday = date_format($curday, 'w');
date_modify($curday, '-' . strval((7 + $day_wday - $first_day) % 7) . ' days');
$curday_date = date_format($curday, DATE_FORMAT_DATE);
for ($i = 0; $i < 7; $i++) {
if ($check_month && ($curday_date < $view->date_info->min_date_date || $curday_date > $view->date_info->max_date_date || date_format($curday, 'n') != $month)) {
$class = strtolower($weekdays[$i]) .' empty';
@ -389,7 +388,7 @@ function calendar_build_week(&$curday, $view, $items, $check_month = FALSE) {
date_modify($curday, '+1 day');
$curday_date = date_format($curday, DATE_FORMAT_DATE);
}
$rows = array(
'multiday_buckets' => $multiday_buckets,
'singleday_buckets' => $singleday_buckets,
@ -407,7 +406,7 @@ function calendar_build_week_day($curday, $view, $items, $wday, &$multiday_bucke
$cur_cnt = 0;
$total_cnt = 0;
$types = array();
// If we are hiding, count before processing further
if ($max_events != CALENDAR_SHOW_ALL) {
foreach ($items as $date => $day) {
@ -421,7 +420,7 @@ function calendar_build_week_day($curday, $view, $items, $wday, &$multiday_bucke
}
}
}
// If we haven't already exceeded the max or we'll showing all, then process the items
if ($max_events == CALENDAR_SHOW_ALL || !$hide || $total_cnt <= $max_events) {
// Count currently filled items
@ -430,7 +429,7 @@ function calendar_build_week_day($curday, $view, $items, $wday, &$multiday_bucke
$cur_cnt++;
}
}
foreach ($items as $date => $day) {
if ($date == $curday_date) {
$count = 0;
@ -438,38 +437,38 @@ function calendar_build_week_day($curday, $view, $items, $wday, &$multiday_bucke
foreach ($day as $time => $hour) {
foreach ($hour as $key => $item) {
$count++;
// Can we add an item?
if ($max_events == CALENDAR_SHOW_ALL || $cur_cnt <= $max_events) {
$all_day = $item->calendar_start_date == $item->calendar_end_date;
$theme = isset($item->calendar_node_theme) ? $item->calendar_node_theme : 'calendar_'. $view->date_info->granularity .'_node';
// Parse out date part
$start_ydate = date_format($item->date_start, DATE_FORMAT_DATE);
$end_ydate = date_format($item->date_end, DATE_FORMAT_DATE);
$cur_ydate = date_format($curday, DATE_FORMAT_DATE);
$is_multi_day = ($start_ydate < $cur_ydate || $end_ydate > $cur_ydate);
// Does this event span multi-days?
if ($multiday_theme && ($is_multi_day || $all_day)) {
// If this the first day of the week, or is the start date of the multi-day event,
// then record this item, otherwise skip over
$day_no = date_format($curday, 'd');
if ($wday == 0 || $start_ydate == $cur_ydate || ($view->date_info->granularity == 'month' && $day_no == 1) || ($all_day && !$is_multi_day)) {
$cur_cnt++;
// Calculate the colspan for this event
// If the last day of this event exceeds the end of the current month or week,
// truncate the remaining days
$diff = date_difference($view->date_info->max_date, $curday, 'days');
$remaining_days = ($view->date_info->granularity == 'month') ? min(6 - $wday, $diff) : $diff - 1;
$remaining_days = ($view->date_info->granularity == 'month') ? min(6 - $wday, $diff) : $diff - 1;
// The bucket_cnt defines the colspan. colspan = bucket_cnt + 1
$days = date_difference($curday, $item->date_end, 'days');
$bucket_cnt = max(0, min($days, $remaining_days));
// See if there is an avaiable slot to add an event. This will allow
// an event to precede a row filled up by a previous day event
$avail = FALSE;
@ -480,11 +479,11 @@ function calendar_build_week_day($curday, $view, $items, $wday, &$multiday_bucke
break;
}
}
// Add continuation attributes
$item->continuation = ($item->date_start < $curday);
$item->continues = ( $days > $bucket_cnt );
// Assign the item to the available bucket
$multiday_buckets[$wday][$bucket_index] = array(
'colspan' => $bucket_cnt + 1,
@ -496,13 +495,13 @@ function calendar_build_week_day($curday, $view, $items, $wday, &$multiday_bucke
'wday' => $wday,
'entry' => theme($theme, $item, $view)
);
// Block out empty buckets for the next days in this event for this week
for ($i = 0; $i < $bucket_cnt; $i++) {
$bucket = &$multiday_buckets[$i + $wday + 1];
$bucket_row_count = count($bucket);
$row_diff = $bucket_index - $bucket_row_count;
// Fill up the preceding buckets - these are available for future
// events
for ( $j = 0; $j < $row_diff; $j++) {
@ -545,7 +544,7 @@ function calendar_build_week_day($curday, $view, $items, $wday, &$multiday_bucke
}
}
}
// Add a more link if necessary
if ($max_events != CALENDAR_SHOW_ALL && $total_cnt > 0 && $cur_cnt < $total_cnt) {
$singleday_buckets[$wday][][] = array(
@ -606,7 +605,7 @@ function calendar_build_day($curday, $view, $items) {
}
$link = theme('calendar_'. $view->date_info->calendar_type .'_multiple_node', $curday_date, $count, $view, $types);
}
$content = array(
'date' => $curday_date,
'datebox' => theme('calendar_datebox', $curday_date, $view, $items, $selected),

View file

@ -1,7 +1,6 @@
<?php
// $Id: calendar-datebox.tpl.php,v 1.1.2.2 2010/12/31 14:16:12 karens Exp $
/**
* @file
* @file
* Template to display the date box in a calendar.
*
* - $view: The view.
@ -16,4 +15,4 @@
* - $items: An array of items for this day.
*/
?>
<div class="<?php print $granularity ?> <?php print $class; ?>"> <?php print !empty($selected) ? $link : $day; ?> </div>
<div class="<?php print $granularity ?> <?php print $class; ?>"> <?php print !empty($selected) ? $link : $day; ?> </div>

View file

@ -1,19 +1,18 @@
<?php
// $Id: calendar-day-node.tpl.php,v 1.1.2.2 2010/12/31 23:31:28 karens Exp $
/**
* @file
* Template to display a view item as a calendar day node.
*
* $node
*
* $node
* A node object for this calendar item. Note this is
* not a complete node object, but it will have $node->nid
* that you can use to load the full object, and
* $node->type to tell the content type of the node.
*
*
* $fields
* An array of information for every field selected in the 'Fields'
* section of this view, formatted as requested in the View setup.
*
*
* Calendar info for this individual calendar item is in local time --
* the user timezone where configurable timezones are allowed and set,
* otherwise the site timezone. If this item has extends over more than
@ -21,20 +20,20 @@
* date and calendar_start will be no earlier than the start of
* the current day and calendar_end will be no later than the end
* of the current day.
*
*
* $calendar_start - A formatted datetime start date for this item.
* i.e. '2008-05-12 05:26:15'.
* $calendar_end - A formatted datetime end date for this item,
* the same as the start date except for fields that have from/to
* fields defined, like Date module dates.
* fields defined, like Date module dates.
* $calendar_start_date - a PHP date object for the start time.
* $calendar_end_date - a PHP date object for the end time.
*
*
* You can use PHP date functions on the date object to display date
* information in other ways, like:
*
*
* print date_format($calendar_start_date, 'l, j F Y - g:ia');
*
*
* @see template_preprocess_calendar_day_node.
*/
$node_class = (isset($node->class)) ? ' ' . $node->class : '';
@ -48,11 +47,11 @@ $node_class = (isset($node->class)) ? ' ' . $node->class : '';
<div id="<?php print $field['id']; ?>" class="view-field view-data-<?php print $field['id'] ?>">
<?php if ($field['label']): ?>
<div class="view-label-<?php print $field['id'] ?>"><?php print $field['label'] ?></div>
<?php endif; ?>
<?php endif; ?>
<?php print $field['data']; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
</div>

View file

@ -1,9 +1,8 @@
<?php
// $Id: calendar-day-overlap.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a view as a calendar day, grouped by time with overlapping items
*
*
* @see template_preprocess_calendar_day.
*
* $rows: The rendered data for this day.
@ -14,17 +13,17 @@
* $rows['items'] - an array of timed items for the day.
* $rows['items'][$time_period]['hour'] - the formatted hour for a time period.
* $rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period.
* $rows['items'][$time_period][$column]['values'] - An array of formatted
* $rows['items'][$time_period][$column]['values'] - An array of formatted
* items for a time period and field column.
*
*
* $view: The view.
* $columns: an array of column names.
* $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
*
* The width of the columns is dynamically set using <col></col>
*
* The width of the columns is dynamically set using <col></col>
* based on the number of columns presented. The values passed in will
* work to set the 'hour' column to 10% and split the remaining columns
* work to set the 'hour' column to 10% and split the remaining columns
* evenly over the remaining 90% of the table.
*/
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
@ -48,7 +47,7 @@
<?php print isset($rows['all_day'][$column]) ? implode($rows['all_day'][$column]) : '&nbsp;';?>
</div>
</div>
<?php endforeach; ?>
<?php endforeach; ?>
</td>
</tr>
</tbody>
@ -60,8 +59,8 @@
try {
// Hide container while it renders... Degrade w/o javascript support
$('#single-day-container').css('visibility','hidden');
}catch(e){
// swallow
}catch(e){
// swallow
}
</script>
<table class="full">
@ -74,7 +73,7 @@
<td class="first">
<?php $is_first = TRUE; ?>
<?php foreach ($rows['items'] as $time_cnt => $hour): ?>
<?php
<?php
if ($time_cnt == 0) {
$class = 'first ';
}
@ -88,11 +87,11 @@
<span class="calendar-hour"><?php print $hour['hour']; ?></span>
<span class="calendar-ampm"><?php print $hour['ampm']; ?></span>
</div>
<?php endforeach; ?>
<?php endforeach; ?>
</td>
<td class="last">
<?php foreach ($rows['items'] as $time_cnt => $hour): ?>
<?php
<?php
if ($time_cnt == 0) {
$class = 'first ';
}
@ -115,7 +114,7 @@
</div>
</div>
</div>
<?php endforeach; ?>
<?php endforeach; ?>
</td>
</tr>
</tbody>
@ -129,7 +128,7 @@ try {
calendar_resizeViewport();
calendar_scrollToFirst();
$('#single-day-container').css('visibility','visible');
}catch(e){
// swallow
}catch(e){
// swallow
}
</script>
</script>

View file

@ -1,10 +1,9 @@
<?php
// $Id: calendar-day.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a view as a calendar day, grouped by time
* and optionally organized into columns by a field value.
*
*
* @see template_preprocess_calendar_day.
*
* $rows: The rendered data for this day.
@ -15,17 +14,17 @@
* $rows['items'] - an array of timed items for the day.
* $rows['items'][$time_period]['hour'] - the formatted hour for a time period.
* $rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period.
* $rows['items'][$time_period][$column]['values'] - An array of formatted
* $rows['items'][$time_period][$column]['values'] - An array of formatted
* items for a time period and field column.
*
*
* $view: The view.
* $columns: an array of column names.
* $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
*
* The width of the columns is dynamically set using <col></col>
*
* The width of the columns is dynamically set using <col></col>
* based on the number of columns presented. The values passed in will
* work to set the 'hour' column to 10% and split the remaining columns
* work to set the 'hour' column to 10% and split the remaining columns
* evenly over the remaining 90% of the table.
*/
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
@ -57,7 +56,7 @@
</div>
</div>
</td>
<?php endforeach; ?>
<?php endforeach; ?>
</tr>
<?php foreach ($rows['items'] as $hour): ?>
<tr>
@ -73,9 +72,9 @@
</div>
</div>
</td>
<?php endforeach; ?>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</tbody>
</table>
</div></div>
</div></div>

View file

@ -1,9 +1,8 @@
<?php
// $Id: calendar-main.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display calendar navigation and links.
*
*
* @see template_preprocess_calendar_main.
*
* $view: The view.
@ -13,7 +12,7 @@
* $mini: Whether this is a mini view.
* $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
*
*
*/
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
?>
@ -23,4 +22,4 @@
<?php if (!empty($calendar_add_date)) print $calendar_add_date; ?>
<?php if (empty($block)) print theme('links', $calendar_links);?>
<?php print theme('date_navigation', $view) ?>
</div>
</div>

View file

@ -1,9 +1,8 @@
<?php
// $Id: calendar-mini.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a view as a mini calendar month.
*
*
* @see template_preprocess_calendar_mini.
*
* $day_names: An array of the day of week names for the table header.
@ -11,17 +10,17 @@
* $view: The view.
* $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
*
*
* $show_title: If the title should be displayed. Normally false since the title is incorporated
* into the navigation, but sometimes needed, like in the year view of mini calendars.
*
*
*/
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
?>
<div class="calendar-calendar"><div class="month-view">
<?php if ($view->date_info->show_title): ?>
<?php print theme('date_navigation', $view); ?>
<?php endif; ?>
<?php endif; ?>
<table class="mini">
<thead>
<tr>
@ -44,4 +43,4 @@
<?php endforeach; ?>
</tbody>
</table>
</div></div>
</div></div>

View file

@ -1,9 +1,8 @@
<?php
// $Id: calendar-month-col.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a column
*
*
* - $item: The item to render within a td element.
*/
$id = (isset($item['id'])) ? 'id="' . $item['id'] . '" ' : '';

View file

@ -1,10 +1,9 @@
<?php
// $Id: calendar-month-multiple-node.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a summary of the days items as a calendar month node.
*
*
*
*
* @see template_preprocess_calendar_month_multiple_node.
*/
?>
@ -17,12 +16,12 @@
<?php endforeach; ?>
<div class="view-item <?php print views_css_safe('view-item-'. $view->name) ?>">
<?php if ($view->date_info->style_max_items_behavior != 'more'): ?>
<div class="multiple-events">
<div class="multiple-events">
<?php print l(t('Click to see all @count events', array('@count' => $count)), $link) ?>
</div>
</div>
</div>
<?php else: ?>
<div class="calendar-more"><?php print l(t('more'), $link) ?>»</div>
<?php endif; ?>
</div>
</div>
</div>

View file

@ -1,19 +1,18 @@
<?php
// $Id: calendar-month-node.tpl.php,v 1.1.2.2 2010/12/31 23:31:28 karens Exp $
/**
* @file
* Template to display a view item as a calendar month node.
*
* $node
*
* $node
* A node object for this calendar item. Note this is
* not a complete node object, but it will have $node->nid
* that you can use to load the full object, and
* $node->type to tell the content type of the node.
*
*
* $fields
* An array of information for every field selected in the 'Fields'
* section of this view, formatted as requested in the View setup.
*
*
* Calendar info for this individual calendar item is in local time --
* the user timezone where configurable timezones are allowed and set,
* otherwise the site timezone. If this item has extends over more than
@ -21,20 +20,20 @@
* date and calendar_start will be no earlier than the start of
* the current day and calendar_end will be no later than the end
* of the current day.
*
*
* $calendar_start - A formatted datetime start date for this item.
* i.e. '2008-05-12 05:26:15'.
* $calendar_end - A formatted datetime end date for this item,
* the same as the start date except for fields that have from/to
* fields defined, like Date module dates.
* fields defined, like Date module dates.
* $calendar_start_date - a PHP date object for the start time.
* $calendar_end_date - a PHP date object for the end time.
*
*
* You can use PHP date functions on the date object to display date
* information in other ways, like:
*
*
* print date_format($calendar_start_date, 'l, j F Y - g:ia');
*
*
* @see template_preprocess_calendar_month_node.
*/
$index = 0;
@ -50,15 +49,15 @@ $index = 0;
<div id="<?php print $field['id']; ?>" class="view-field view-data-<?php print $field['id'] ?>">
<?php if ($field['label']): ?>
<div class="view-label-<?php print $field['id'] ?>"><?php print $field['label'] ?></div>
<?php endif; ?>
<?php endif; ?>
<?php print $field['data']; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php if (isset($node->continues) && $node->continues) : ?>
<div class="continues">&raquo;</div>
<?php else : ?>
<div class="cutoff">&nbsp;</div>
<?php endif;?>
</div>
</div>
</div>

View file

@ -1,9 +1,8 @@
<?php
// $Id: calendar-month-row.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a row
*
*
* - $inner: The rendered string of the row's contents.
*/
$attrs = ($class) ? 'class="' . $class . '"': '';

View file

@ -1,9 +1,8 @@
<?php
// $Id: calendar-month.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a view as a calendar month.
*
*
* @see template_preprocess_calendar_month.
*
* $day_names: An array of the day of week names for the table header.
@ -14,9 +13,9 @@
* $block: Whether or not this calendar is in a block.
* $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $date_id: a css id that is unique for this date,
* $date_id: a css id that is unique for this date,
* it is in the form: calendar-nid-field_name-delta
*
*
*/
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
?>
@ -32,7 +31,7 @@
</tr>
</thead>
<tbody>
<?php
<?php
foreach ((array) $rows as $row) {
print $row['data'];
} ?>
@ -47,11 +46,11 @@ try {
$('tr[iehint]').each(function(index) {
var iehint = this.getAttribute('iehint');
// Add height of the multi day rows to the single day row - seems that 80% height works best
var height = this.clientHeight + (multiday_height * .8 * iehint);
var height = this.clientHeight + (multiday_height * .8 * iehint);
this.style.height = height + 'px';
});
}
}catch(e){
// swallow
// swallow
}
</script>
</script>

View file

@ -1,11 +1,10 @@
<?php
// $Id: calendar-week-multiple-node.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a summary of the days items as a calendar week node.
*
*
* @see template_preprocess_calendar_week_multiple_node.
*/
*/
?>
<div class="view-item view-item-<?php print $view->name ?>">
<div class="calendar weekview" id="<?php print $curday ?>">
@ -16,12 +15,12 @@
<?php endforeach; ?>
<div class="view-item <?php print views_css_safe('view-item-'. $view->name) ?>">
<?php if ($view->date_info->style_max_items_behavior != 'more'): ?>
<div class="multiple-events">
<div class="multiple-events">
<?php print l(t('Click to see all @count events', array('@count' => $count)), $link) ?>
</div>
</div>
</div>
<?php else: ?>
<div class="calendar-more"><?php print l(t('more'), $link) ?>»</div>
<?php endif; ?>
</div>
</div>
</div>

View file

@ -1,19 +1,18 @@
<?php
// $Id: calendar-week-node.tpl.php,v 1.1.2.2 2010/12/31 23:31:28 karens Exp $
/**
* @file
* Template to display a view item as a calendar week node.
*
* $node
*
* $node
* A node object for this calendar item. Note this is
* not a complete node object, but it will have $node->nid
* that you can use to load the full object, and
* $node->type to tell the content type of the node.
*
*
* $fields
* An array of information for every field selected in the 'Fields'
* section of this view, formatted as requested in the View setup.
*
*
* Calendar info for this individual calendar item is in local time --
* the user timezone where configurable timezones are allowed and set,
* otherwise the site timezone. If this item has extends over more than
@ -21,22 +20,22 @@
* date and calendar_start will be no earlier than the start of
* the current day and calendar_end will be no later than the end
* of the current day.
*
*
* $calendar_start - A formatted datetime start date for this item.
* i.e. '2008-05-12 05:26:15'.
* $calendar_end - A formatted datetime end date for this item,
* the same as the start date except for fields that have from/to
* fields defined, like Date module dates.
* fields defined, like Date module dates.
* $calendar_start_date - a PHP date object for the start time.
* $calendar_end_date - a PHP date object for the end time.
*
*
* You can use PHP date functions on the date object to display date
* information in other ways, like:
*
*
* print date_format($calendar_start_date, 'l, j F Y - g:ia');
*
*
* @see template_preprocess_calendar_week_node.
*/
*/
$index = 0;
?>
<div class="view-item view-item-<?php print $view->name ?>">
@ -50,9 +49,9 @@ $index = 0;
<div id="<?php print $field['id']; ?>" class="view-field view-data-<?php print $field['id'] ?>">
<?php if ($field['label']): ?>
<div class="view-label-<?php print $field['id'] ?>"><?php print $field['label'] ?></div>
<?php endif; ?>
<?php endif; ?>
<?php print $field['data']; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php if (isset($node->continues) && $node->continues) : ?>
@ -60,5 +59,5 @@ $index = 0;
<?php else : ?>
<div class="cutoff">&nbsp;</div>
<?php endif;?>
</div>
</div>
</div>

View file

@ -1,14 +1,13 @@
<?php
// $Id: calendar-week-overlap.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a view as a calendar week with overlapping items
*
*
* @see template_preprocess_calendar_week.
*
* $day_names: An array of the day of week names for the table header.
* $rows: The rendered data for this week.
*
*
* For each day of the week, you have:
* $rows['date'] - the date for this day, formatted as YYYY-MM-DD.
* $rows['datebox'] - the formatted datebox for this day.
@ -18,11 +17,11 @@
* $rows['items'][$time_period]['hour'] - the formatted hour for a time period.
* $rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period.
* $rows['items'][$time_period]['values'] - An array of formatted items for a time period.
*
*
* $view: The view.
* $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
*
*
*/
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
//dsm($rows);
@ -50,8 +49,8 @@
<tbody>
<tr class="holder"><td class="calendar-time-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td></tr>
<?php for ($i = 0; $i < $multiday_rows; $i++): ?>
<?php
$colpos = 0;
<?php
$colpos = 0;
$rowclass = "all-day";
if( $i == 0) {
$rowclass .= " first";
@ -79,7 +78,7 @@
</td>
<?php $colpos = $cell['wday'] + $cell['colspan']; ?>
<?php endif; ?>
<?php endfor; ?>
<?php endfor; ?>
<?php for($j = $colpos; $j < 7; $j++) : ?>
<td class="calendar-agenda-items multi-day no-entry"><div class="inner">&nbsp;</div></td>
<?php endfor;?>
@ -103,7 +102,7 @@
<td class="calendar-agenda-items multi-day no-entry"><div class="inner">&nbsp;</div></td>
<?php endfor; ?>
</tr>
</thead>
</thead>
</table>
</div>
<div class="header-body-divider">&nbsp;</div>
@ -112,8 +111,8 @@
try {
// Hide container while it renders... Degrade w/o javascript support
$('#single-day-container').css('visibility','hidden');
}catch(e){
// swallow
}catch(e){
// swallow
}
</script>
<table class="full">
@ -129,7 +128,7 @@
<td>
<?php endif; ?>
<?php foreach ($start_times as $time_cnt => $start_time): ?>
<?php
<?php
if ($time_cnt == 0) {
$class = 'first ';
}
@ -182,7 +181,7 @@ try {
// Show it now that it is complete and positioned
$('#single-day-container').css('visibility','visible');
}catch(e){
// swallow
}catch(e){
// swallow
}
</script>
</script>

View file

@ -1,14 +1,13 @@
<?php
// $Id: calendar-week.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a view as a calendar week.
*
*
* @see template_preprocess_calendar_week.
*
* $day_names: An array of the day of week names for the table header.
* $rows: The rendered data for this week.
*
*
* For each day of the week, you have:
* $rows['date'] - the date for this day, formatted as YYYY-MM-DD.
* $rows['datebox'] - the formatted datebox for this day.
@ -18,11 +17,11 @@
* $rows['items'][$time_period]['hour'] - the formatted hour for a time period.
* $rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period.
* $rows['items'][$time_period]['values'] - An array of formatted items for a time period.
*
*
* $view: The view.
* $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
*
*
*/
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
//dsm($rows);
@ -46,8 +45,8 @@ $index = 0;
</thead>
<tbody>
<?php for ($i = 0; $i < $multiday_rows; $i++): ?>
<?php
$colpos = 0;
<?php
$colpos = 0;
$rowclass = "all-day";
if( $i == 0) {
$rowclass .= " first";
@ -75,12 +74,12 @@ $index = 0;
</td>
<?php $colpos = $cell['wday'] + $cell['colspan']; ?>
<?php endif; ?>
<?php endfor; ?>
<?php endfor; ?>
<?php for($j = $colpos; $j < 7; $j++) : ?>
<td class="multi-day no-entry"><div class="inner">&nbsp;</div></td>
<?php endfor;?>
</tr>
<?php endfor; ?>
<?php endfor; ?>
<?php foreach ($items as $time): ?>
<tr class="not-all-day">
<td class="calendar-agenda-hour">
@ -96,7 +95,7 @@ $index = 0;
<div class="inner">&nbsp;</div>
</div>
</td>
<?php endfor; ?>
<?php endfor; ?>
<?php $curpos = $colpos + 1;?>
<td class="calendar-agenda-items single-day">
<div class="calendar">
@ -109,16 +108,16 @@ $index = 0;
</div>
</div>
</td>
<?php endforeach; ?>
<?php endforeach; ?>
<?php for ($i = $curpos; $i < 7; $i++): ?>
<td class="calendar-agenda-items single-day">
<div class="calendar">
<div class="inner">&nbsp;</div>
</div>
</td>
<?php endfor; ?>
<?php endfor; ?>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</tbody>
</table>
</div></div>

View file

@ -1,16 +1,15 @@
<?php
// $Id: calendar-year.tpl.php,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $
/**
* @file
* Template to display a view as a calendar year.
*
*
* @see template_preprocess_calendar_year.
*
* $view: The view.
* $months: An array with a formatted month calendar for each month of the year.
* $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
*
*
*/
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
?>
@ -18,10 +17,10 @@
<div class="calendar-calendar"><div class="year-view">
<table <?php if ($mini): ?> class="mini"<?php endif; ?>>
<tbody>
<tr><td><?php print $months[1] ?></td><td><?php print $months[2] ?></td><td><?php print $months[3] ?></td></tr>
<tr><td><?php print $months[4] ?></td><td><?php print $months[5] ?></td><td><?php print $months[6] ?></td></tr>
<tr><td><?php print $months[7] ?></td><td><?php print $months[8] ?></td><td><?php print $months[9] ?></td></tr>
<tr><td><?php print $months[10] ?></td><td><?php print $months[11] ?></td><td><?php print $months[12] ?></td></tr>
<tr><td><?php print $months[1] ?></td><td><?php print $months[2] ?></td><td><?php print $months[3] ?></td></tr>
<tr><td><?php print $months[4] ?></td><td><?php print $months[5] ?></td><td><?php print $months[6] ?></td></tr>
<tr><td><?php print $months[7] ?></td><td><?php print $months[8] ?></td><td><?php print $months[9] ?></td></tr>
<tr><td><?php print $months[10] ?></td><td><?php print $months[11] ?></td><td><?php print $months[12] ?></td></tr>
</tbody>
</table>
</div></div>
</div></div>

View file

@ -1,12 +1,11 @@
<?php
// $Id: theme.inc,v 1.1.2.4 2011/01/03 12:28:48 karens Exp $
/**
* Display a calendar navigation and links
*/
function template_preprocess_calendar_main(&$vars) {
require_once('./'. drupal_get_path('module', 'calendar_multiday') .'/includes/calendar.inc');
$view = $vars['view'];
$result = (array) $view->result;
$options = $view->style_plugin->options;
$handler = $view->style_plugin;
@ -15,12 +14,12 @@ function template_preprocess_calendar_main(&$vars) {
$vars['min_date_formatted'] = date_format($view->date_info->min_date, DATE_FORMAT_DATETIME);
$vars['max_date_formatted'] = date_format($view->date_info->max_date, DATE_FORMAT_DATETIME);
$view->date_info->mini = isset($view->date_info->mini) ? $view->date_info->mini : $view->date_info->granularity == 'year';
$url = $view->get_url();
$view->date_info->url = $url;
$arg = $view->date_info->date_arg;
$displays = $view->date_info->display_types;
// Set up the links to other calendar views.
$current_date = $view->date_info->min_date;
if (!empty($date->info->day)) {
@ -28,7 +27,7 @@ function template_preprocess_calendar_main(&$vars) {
}
elseif (!empty($view->date_info->week)) {
$week = date_week_range($view->date_info->week, $view->date_info->year);
$current_date = $week[0];
$current_date = $week[0];
}
elseif (!empty($view->date_info->month)) {
$current_date = date_make_date($view->date_info->year .'-'. date_pad($view->date_info->month) .'-01 00:00:00');
@ -68,60 +67,60 @@ function template_preprocess_calendar_main(&$vars) {
$calendar_links[] = $base + array('title' => date_t('Day', 'datetime'), 'href' => date_real_url($view, 'day'));
}
$vars['calendar_links'] = $calendar_links;
// If the Date Popup module is enabled, add a popup date selector.
if (!empty($view->date_info->calendar_popup)) {
$vars['calendar_popup'] = '<div class="clear-block">'. calendar_date_select($view) .'</div>';
}
// If an 'Add new ... link is provided, add it here.
// the query will bring the user back here after adding the node.
if (!empty($view->date_info->calendar_date_link) && user_access('create '. $view->date_info->calendar_date_link .' content')) {
$name = node_get_types('name', $view->date_info->calendar_date_link);
$href = 'node/add/'. str_replace('_', '-', $view->date_info->calendar_date_link);
$query = 'destination='. $view->date_info->url;
$query = 'destination='. $view->date_info->url;
$vars['calendar_links'][] = $base + array(
'title' => t('Add+'),
'href' => $href,
'title' => t('Add+'),
'href' => $href,
'query' => $query,
);
}
$vars['view'] = $view;
$vars['view'] = $view;
$vars['mini'] = !empty($view->date_info->mini);
$vars['block'] = !empty($view->date_info->block);
$vars['block_identifier'] = date_block_identifier($view);
}
/**
* Display a view as a calendar.
*
*
* This preprocessor does all the work needed for all types of calendar
* views and the template takes care of displaying links to related views.
*/
function template_preprocess_calendar(&$vars) {
require_once('./'. drupal_get_path('module', 'calendar_multiday') .'/includes/calendar.inc');
$view = $vars['view'];
// Make sure we only run through this function one time.
if (!empty($view->date_info->calendar_processed)) {
return;
}
$result = (array) $view->result;
$options = $view->style_plugin->options;
$handler = $view->style_plugin;
$fields = $view->field;
// Render each field into an output array. We have to do the rendering
// here because we don't apppear to have full access to the view
// here because we don't apppear to have full access to the view
// handlers in the theme functions.
$items = array();
$calendar_fields = date_api_fields($view->base_table);
$calendar_fields = array_keys($calendar_fields['alias']);
foreach ($result as $num => $row) {
$copy = drupal_clone($row);
$items[$num] = $row;
@ -135,7 +134,7 @@ function template_preprocess_calendar(&$vars) {
}
foreach ($fields as $name => $field) {
// Some fields, like the node edit and delete links, have no alias.
$field_alias = $field->field_alias != 'unknown' ? $field->field_alias : $name;
$field_alias = $field->field_alias != 'unknown' ? $field->field_alias : $name;
if (!empty($field) && is_object($field)) {
// Theme the copy instead of the original row so duplicate date
// fields each get a fresh copy of the original data to theme.
@ -144,20 +143,20 @@ function template_preprocess_calendar(&$vars) {
}
foreach ($fields as $name => $field) {
// Some fields, like the node edit and delete links, have no alias.
$field_alias = $field->field_alias != 'unknown' ? $field->field_alias : $name;
$field_alias = $field->field_alias != 'unknown' ? $field->field_alias : $name;
if (!empty($field->options['exclude'])) {
if (isset($items[$num]->{$field_alias})) unset($items[$num]->{$field_alias});
}
}
}
$vars['display_type'] = $view->date_info->granularity;
$vars['min_date_formatted'] = date_format($view->date_info->min_date, DATE_FORMAT_DATETIME);
$vars['max_date_formatted'] = date_format($view->date_info->max_date, DATE_FORMAT_DATETIME);
// Massage the resulting items into formatted calendar items.
$items = calendar_build_nodes($view, $items);
// Merge in items from other sources.
foreach (module_implements('calendar_add_items') as $module) {
$function = $module .'_calendar_add_items';
@ -171,14 +170,14 @@ function template_preprocess_calendar(&$vars) {
}
$view->date_info->mini = isset($view->date_info->mini) ? $view->date_info->mini : $view->date_info->granularity == 'year';
// Create the calendar day names and rows.
$rows = calendar_build_calendar($view, $items);
$vars['items'] = $items;
$vars['rows'] = $rows;
$view->date_info->calendar_processed = TRUE;
$vars['view'] = $view;
$vars['view'] = $view;
$vars['mini'] = !empty($view->date_info->mini);
$vars['block'] = !empty($view->date_info->block);
}
@ -190,9 +189,9 @@ function template_preprocess_calendar_month(&$vars) {
// Add in all the $vars added by the main calendar preprocessor.
template_preprocess_calendar($vars);
$view = $vars['view'];
$rows = $vars['rows'];
if (sizeof($rows) > 1) {
$day_names = array_shift($rows);
}
@ -200,7 +199,7 @@ function template_preprocess_calendar_month(&$vars) {
$day_names = $rows;
$rows = array();
}
$month_rows = $rows;
foreach ($rows as $weekno => $row) {
// If this row is already rendered, don't do anything.
@ -234,10 +233,10 @@ function template_preprocess_calendar_month(&$vars) {
}
}
}
$vars['rows'] = $month_rows;
$vars['day_names'] = $day_names;
$vars['display_type'] = $view->date_info->granularity;
$vars['min_date_formatted'] = date_format($view->date_info->min_date, DATE_FORMAT_DATETIME);
$vars['max_date_formatted'] = date_format($view->date_info->max_date, DATE_FORMAT_DATETIME);
@ -249,7 +248,7 @@ function template_preprocess_calendar_month(&$vars) {
function template_preprocess_calendar_mini(&$vars) {
// Add in all the $vars added by the main calendar preprocessor.
template_preprocess_calendar_month($vars);
$view = $vars['view'];
$view->date_info->show_title = !empty($view->date_info->show_title) ? $view->date_info->show_title : FALSE;
$vars['show_title'] = $view->date_info->show_title;
@ -263,15 +262,15 @@ function template_preprocess_calendar_year(&$vars) {
// Add in all the $vars added by the main calendar preprocessor.
$vars['view']->date_info->style_with_weekno = FALSE;
template_preprocess_calendar($vars);
// Get the url of the year view and remove the year argument from it.
// TODO clean this up in case there is another arg that looks like
// the year to make sure only the year gets removed.
$view = $vars['view'];
$year = date_format($view->date_info->min_date, 'Y');
// Construct a calendar for each month, adjusting the $view passed
// to the theme so it will produce the right results.
// Construct a calendar for each month, adjusting the $view passed
// to the theme so it will produce the right results.
$view = drupal_clone($vars['view']);
$rows = $vars['rows'];
$months = array();
@ -291,7 +290,7 @@ function template_preprocess_calendar_year(&$vars) {
$vars['months'] = $months;
$vars['view']->date_info->hide_nav = FALSE;
$vars['view']->date_info->granularity = 'year';
}
/**
@ -305,27 +304,27 @@ function template_preprocess_calendar_day_overlap(&$vars) {
* Display a day view.
*/
function template_preprocess_calendar_day(&$vars) {
// Add in all the $vars added by the main calendar preprocessor.
$vars['view']->style_with_weekno = FALSE;
template_preprocess_calendar($vars);
$view = $vars['view'];
$rows = $vars['rows'];
$item_count = 0;
$by_hour_count = 0;
$grouping_field = $view->date_info->style_groupby_field;
$display_overlap = $view->date_info->style_theme_style == '1';
// Add optional css
if ($display_overlap) {
drupal_add_css(drupal_get_path('module', 'calendar_multiday') .'/calendar-overlap.css');
drupal_add_js(drupal_get_path('module', 'calendar_multiday') . '/calendar_overlap.js');
$overlapped_items = array();
}
// If we're not grouping by time, move all items into the 'all day' array.
if (empty($view->date_info->style_groupby_times)) {
// Items are already grouped into times, so we need to process each time-group.
@ -336,14 +335,14 @@ function template_preprocess_calendar_day(&$vars) {
}
$rows['items'] = array();
}
$columns = array();
// Move all_day items into the right columns and render them.
$grouped_items = array();
foreach ($rows['all_day'] as $item) {
if (isset($item->{$grouping_field})) {
$column = $item->{$grouping_field};
$column = $item->{$grouping_field};
$item->{$grouping_field} = ''; // Remove the grouping field from the results.
if (!in_array($column, $columns)) {
$columns[] = $column;
@ -357,14 +356,14 @@ function template_preprocess_calendar_day(&$vars) {
$item_count++;
}
$vars['rows']['all_day'] = $grouped_items;
// Moved timed items into the right columns and render them.
$start_times = $view->date_info->style_groupby_times;
$show_empty_times = $view->date_info->style_show_empty_times;
$show_empty_times = $view->date_info->style_show_empty_times;
$end_start_time = '23:59:59';
$start_time = array_shift($start_times);
$next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time;
$grouped_items = array();
foreach ($rows['items'] as &$items) {
foreach ($items as &$item) {
@ -383,7 +382,7 @@ function template_preprocess_calendar_day(&$vars) {
// slots if the option to show empty times was chosen.
while ($time >= $next_start_time && $time < $end_start_time) {
if ((!empty($show_empty_times) || $display_overlap) && !array_key_exists($start_time, $grouped_items)) {
$grouped_items[$start_time]['values'] = array();
$grouped_items[$start_time]['values'] = array();
}
$start_time = $next_start_time;
$next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time;
@ -392,14 +391,14 @@ function template_preprocess_calendar_day(&$vars) {
if ($display_overlap) {
$time_end = date_format($item->date_end, 'H:i:s');
$item->time_start = $time;
$item->time_end = $time_end;
$item->time_end = $time_end;
_calc_indents($overlapped_items, $time, $time_end, $item);
}
$item_count++;
$by_hour_count++;
}
}
// Finish out the day's time values if we want to see empty times.
if (!empty($show_empty_times) || $display_overlap) {
while ($start_time < $end_start_time && ($start_time != NULL || $display_overlap)) {
@ -409,13 +408,13 @@ function template_preprocess_calendar_day(&$vars) {
$next_start_time = array_shift($start_times);
}
if (!array_key_exists($start_time, $grouped_items)) {
$grouped_items[$start_time]['values'] = array();
$grouped_items[$start_time]['values'] = array();
}
$start_time = $next_start_time;
$next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time;
}
}
// Do the headers last, once we know what the actual values are.
$i = 0;
$start_times = array_keys($grouped_items);
@ -423,38 +422,38 @@ function template_preprocess_calendar_day(&$vars) {
$next_start_time = array_key_exists($i + 1, $start_times) ? $start_times[$i + 1] : '23:59:59';
$heading = theme('calendar_time_row_heading', $start_time, $next_start_time, $rows['date']);
$grouped_items[$start_time]['hour'] = $heading['hour'];
$grouped_items[$start_time]['ampm'] = $heading['ampm'];
$grouped_items[$start_time]['ampm'] = $heading['ampm'];
foreach ($grouped_items[$start_time]['values'] as $column => &$items) {
foreach ($items as $index => &$item) {
if ($display_overlap) {
$offset = round(date_format($item->date_start, 'i') / 15);
$duration = date_convert('1970-01-01 ' . $item->time_end, DATE_DATETIME, DATE_UNIX) -
$duration = date_convert('1970-01-01 ' . $item->time_end, DATE_DATETIME, DATE_UNIX) -
date_convert('1970-01-01 ' . $item->time_start, DATE_DATETIME, DATE_UNIX);
$duration = round($duration / (15 * 60));
$item->class = 'd_'. $duration . ' o_'. $offset . ' i_' . $item->indent . ' md_' . min($item->max_depth, 5);
}
$theme = isset($item->calendar_node_theme) ? $item->calendar_node_theme : 'calendar_'. $view->date_info->granularity .'_node';
$grouped_items[$start_time]['values'][$column][$index] = theme($theme, $item, $view);
}
}
}
$i++;
$i++;
}
ksort($grouped_items);
$vars['rows']['items'] = $grouped_items;
if (empty($columns)) {
$columns = array(t('Items'));
}
$vars['columns'] = $columns;
$vars['agenda_hour_class'] = 'calendar-agenda-hour';
$first_column_width = 10;
if (empty($view->date_info->style_groupby_times)) {
$vars['agenda_hour_class'] .= ' calendar-agenda-no-hours';
$first_column_width = 1;
}
$vars['first_column_width'] = $first_column_width;
if (count($columns)) {
$vars['column_width'] = round((100 - $first_column_width)/count($columns));
@ -482,13 +481,13 @@ function template_preprocess_calendar_week(&$vars) {
// Add in all the $vars added by the main calendar preprocessor.
$vars['view']->style_with_weekno = FALSE;
template_preprocess_calendar($vars);
$view = $vars['view'];
$rows = $vars['rows'];
$item_count = 0;
$by_hour_count = 0;
$start_time = NULL;
if (sizeof($rows) > 1) {
$day_names = array_shift($rows);
}
@ -496,27 +495,27 @@ function template_preprocess_calendar_week(&$vars) {
$day_names = $rows;
$rows = array();
}
// Moved timed items into the right columns and render them.
$show_empty_times = $view->date_info->style_show_empty_times;
$show_empty_times = $view->date_info->style_show_empty_times;
$end_start_time = '23:59:59';
$grouped_items = array();
// pass the multiday buckets
$vars['all_day'] = $rows['multiday_buckets'];
// Remove the count for singleday
$vars['multiday_rows'] = max(0, $rows['total_rows'] - 1);
$vars['multiday_rows'] = max(0, $rows['total_rows'] - 1);
$display_overlap = ($view->date_info->style_multiday_theme == '1' && $view->date_info->style_theme_style == '1');
$vars['display_overlap'] = $display_overlap;
// Add optional css
if ($display_overlap) {
drupal_add_css(drupal_get_path('module', 'calendar_multiday') .'/calendar-overlap.css');
drupal_add_js(drupal_get_path('module', 'calendar_multiday') . '/calendar_overlap.js');
$overlapped_items = array( array(), array(), array(), array(), array(), array(), array());
// Locate the first item
$first_time = '23:59:59';
$first_time_index = -1;
@ -528,13 +527,13 @@ function template_preprocess_calendar_week(&$vars) {
$first_time = $time;
$first_time_index = $i;
}
}
}
}
if ($first_time_index > -1) {
$rows['singleday_buckets'][$first_time_index][$first_time][0]['is_first'] = TRUE;
}
}
// If we're not grouping by time, move all items into the 'all day' array.
if (empty($view->date_info->style_groupby_times)) {
$add_row = FALSE;
@ -547,9 +546,9 @@ function template_preprocess_calendar_week(&$vars) {
}
}
if ( $add_row ) {
$vars['multiday_rows']++;
$vars['multiday_rows']++;
}
}
}
else {
foreach ($rows['singleday_buckets'] as $wday => $singleday_row) {
$columns[] = $wday;
@ -564,23 +563,23 @@ function template_preprocess_calendar_week(&$vars) {
if ($vars['multiday_rows'] == 0) {
$vars['multiday_rows']++;
}
}
}
else {
// Find the next time slot and fill it. Populate the skipped
// slots if the option to show empty times was chosen.
while ($time >= $next_start_time && $time < $end_start_time) {
if (($show_empty_times || $display_overlap) && !array_key_exists($start_time, $grouped_items)) {
$grouped_items[$start_time]['values'][$wday] = array();
$grouped_items[$start_time]['values'][$wday] = array();
}
$start_time = $next_start_time;
$next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time;
}
$grouped_items[$start_time]['values'][$wday][] = &$item;
$grouped_items[$start_time]['values'][$wday][] = &$item;
if ($display_overlap) {
$date_end = date_format($item['item']->date_end, 'H:i:s');
_calc_indents($overlapped_items[$wday], $time, $date_end, $item);
}
$item_count++;
$item_count++;
$by_hour_count++;
}
}
@ -594,7 +593,7 @@ function template_preprocess_calendar_week(&$vars) {
$next_start_time = array_shift($start_times);
}
if (!array_key_exists($start_time, $grouped_items)) {
$grouped_items[$start_time]['values'][$wday] = array();
$grouped_items[$start_time]['values'][$wday] = array();
}
$start_time = $next_start_time;
$next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time;
@ -603,7 +602,7 @@ function template_preprocess_calendar_week(&$vars) {
ksort($grouped_items);
}
}
// Do the headers last, once we know what the actual values are.
$i = 0;
$start_times = array_keys($grouped_items);
@ -622,21 +621,21 @@ function template_preprocess_calendar_week(&$vars) {
$duration = round($duration / (15 * 60));
$item['class'] = 'd_'. $duration . ' o_'. $offset . ' i_' . $item['indent'] . ' md_' . min($item['max_depth'], 5);
}
}
}
}
}
}
$vars['items'] = $grouped_items;
$vars['items'] = $grouped_items;
$vars['day_names'] = $day_names;
$vars['columns'] = $columns;
$vars['start_times'] = $view->date_info->style_groupby_times;
$vars['first_time'] = $first_time;
$vars['agenda_hour_class'] = 'calendar-agenda-hour';
$first_column_width = 10;
if (empty($view->date_info->style_groupby_times)) {
$vars['agenda_hour_class'] .= ' calendar-agenda-no-hours';
$first_column_width = 1;
@ -652,14 +651,14 @@ function template_preprocess_calendar_week(&$vars) {
function template_preprocess_calendar_datebox(&$vars) {
$date = $vars['date'];
$view = $vars['view'];
$vars['day'] = intval(substr($date, 8, 2));
$force_view_url = !empty($view->date_info->block) ? TRUE : FALSE;
$vars['url'] = date_real_url($view, NULL, $date, $force_view_url);
$vars['link'] = l($vars['day'], $vars['url']);
$vars['granularity'] = $view->date_info->granularity;
$vars['mini'] = $view->date_info->mini;
if ($view->date_info->mini) {
if (!empty($vars['selected'])) {
$vars['class'] = 'mini-day-on';
@ -682,11 +681,11 @@ function template_preprocess_calendar_node(&$vars) {
$fields = array();
foreach ($view->field as $name => $field) {
// Some fields, like the node edit and delete links, have no alias.
$field_alias = $field->field_alias != 'unknown' ? $field->field_alias : $name;
$field_alias = $field->field_alias != 'unknown' ? $field->field_alias : $name;
if (!empty($node->$field_alias)) {
$data = $node->$field_alias;
$label = $field->options['label'];
// CCK has some special label options.
if (!empty($field->content_field)) {
switch ($field->options['label_type']) {
@ -710,10 +709,10 @@ function template_preprocess_calendar_node(&$vars) {
$vars['calendar_end'] = $node->calendar_end;
$vars['calendar_start_date'] = $node->calendar_start_date;
$vars['calendar_end_date'] = $node->calendar_end_date;
// We added the node type to the results in the query,
// but it will show up as $node->node_type instead of
// $node->type. Rename it to match the normal way it
// $node->type. Rename it to match the normal way it
// would show up on a node object.
$vars['node']->type = $vars['node']->node_type;
}
@ -737,7 +736,7 @@ function template_preprocess_calendar_month_multiple_node(&$vars) {
$year = $parts[0];
$month = intval($parts[1]);
$day = intval($parts[2]);
// create the link to the day
$vars['link'] = date_real_url($view, NULL, date_pad($year, 4) .'-'. date_pad($month) .'-'. date_pad($day));
}
@ -767,13 +766,13 @@ function template_preprocess_calendar_week_node(&$vars) {
function template_preprocess_calendar_week_multiple_node(&$vars) {
$view = $vars['view'];
$curday = $vars['curday'];
// get the year month and date
$parts = explode('-', substr($curday, 0, 10));
$year = $parts[0];
$month = intval($parts[1]);
$day = intval($parts[2]);
// create the link to the day
$vars['link'] = date_real_url($view, NULL, date_pad($year, 4) .'-'. date_pad($month) .'-'. date_pad($day));
}
@ -820,7 +819,7 @@ function theme_calendar_stripe_legend() {
array('class' => 'calendar-legend', 'data' => t('Key'))
);
$rows = array();
$output = '';
$output = '';
foreach ((array) $GLOBALS['calendar_stripes'] as $label => $stripe) {
if ($stripe) {
$rows[] = array($label, '<div style="background-color:'. $stripe .';color:'. $stripe .'" class="stripe" title="Key: '. $label .'">&nbsp;</div>');
@ -858,7 +857,7 @@ function theme_calendar_stripe_stripe($node) {
* The day to display.
*/
function theme_calendar_empty_day($curday, $view) {
if ($view->date_info->calendar_type != 'day') {
return '<div class="calendar-empty">&nbsp;</div>'."\n";
}
@ -885,18 +884,18 @@ function theme_calendar_empty_day($curday, $view) {
* Returns an array with the max depth of the branch and whether an overlap occurred
*/
function _calc_indents(&$overlapped_items, $start, $end, &$item, $depth = 0) {
// Are there any items at this depth?
if (!empty($overlapped_items)) {
// Iterate for each item as this depth and see if we overlap
foreach ($overlapped_items as $index => &$entry) {
foreach ($overlapped_items as $index => &$entry) {
// We search depth-first, so if there are children for this item, recurse into
// each child tree looking for an overlap
if (!empty($entry['children'])) {
$rc = _calc_indents($entry['children'], $start, $end, $item, $depth + 1);
// Was there an overlap in the child tree?
if ($rc['overlap']) {
if (is_object($entry['item'])) {
@ -907,16 +906,16 @@ function _calc_indents(&$overlapped_items, $start, $end, &$item, $depth = 0) {
$entry['item']['indent'] = _calc_indent($entry['depth'], $rc['max_depth']);
$entry['item']['max_depth'] = $rc['max_depth'];
}
// There was an overlap, pop out of this depth
return $rc;
}
}
// No, child overlap, so check if we overlap this item
# if ($start >= $entry['start'] && $start <= $entry['end']) {
if ($start >= $entry['start'] && $start < $entry['end']) {
// We overlap, create an overlapping entry
$entry['children'][] = array('item' => &$item, 'depth' => $depth + 1, 'start' => $start, 'end' => $end, 'children' => array());
if (is_object($entry['item'])) {
@ -937,19 +936,19 @@ function _calc_indents(&$overlapped_items, $start, $end, &$item, $depth = 0) {
$item['indent'] = _calc_indent($depth + 1, $max_depth);
$item['max_depth'] = $max_depth;
}
// We overlap, so pop out of this depth
return array('overlap' => TRUE, 'max_depth' => $max_depth);
}
}
// If there are items at this depth, but no overlap, then return no overlap and pop
// out of this depth
if ($depth > 0) {
return array('overlap' => FALSE, 'max_depth' => 0);
}
}
// No overlap at any depth, reset the array of overlaps
if ($depth == 0) {
reset($overlapped_items);
@ -958,7 +957,7 @@ function _calc_indents(&$overlapped_items, $start, $end, &$item, $depth = 0) {
else {
$overlapped_items[] = array('item' => &$item, 'depth' => $depth, 'start' => $start, 'end' => $end, 'children' => array());
}
if (is_object($item)) {
$item->indent = _calc_indent($depth, $depth);
$item->max_depth = $depth;