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,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),