Removed obsolete $ in source files
This commit is contained in:
parent
a39c010e06
commit
e5f2b64d98
146 changed files with 836 additions and 1081 deletions
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
// $Id: calendar.module,v 1.121.2.43 2010/12/31 16:25:43 karens Exp $
|
||||
define('CALENDAR_SHOW_ALL', 0);
|
||||
define('CALENDAR_HIDE_ALL', -1);
|
||||
|
||||
|
@ -34,7 +33,7 @@ function calendar_init() {
|
|||
if (module_exists('calendar_multiday') || substr($_GET['q'], 0, 24) == 'admin/build/modules/list') {
|
||||
return;
|
||||
}
|
||||
// The css for Farbtastic color picker, painless to add it here
|
||||
// The css for Farbtastic color picker, painless to add it here
|
||||
// even though it isn't needed everywhere.
|
||||
drupal_add_css('misc/farbtastic/farbtastic.css');
|
||||
drupal_add_css(drupal_get_path('module', 'calendar') .'/calendar.css');
|
||||
|
@ -157,11 +156,11 @@ function calendar_block($op = 'list', $delta = 0) {
|
|||
* Calendar display types
|
||||
*/
|
||||
function calendar_display_types() {
|
||||
return array('year' => t('Year'), 'month' => t('Month'), 'day' => t('Day'), 'week' => t('Week'));
|
||||
return array('year' => t('Year'), 'month' => t('Month'), 'day' => t('Day'), 'week' => t('Week'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Figure out which type of display to use,
|
||||
* Figure out which type of display to use,
|
||||
* based on the current argument.
|
||||
*
|
||||
* @return year, month, day, or week.
|
||||
|
@ -193,7 +192,7 @@ function calendar_current_type($view) {
|
|||
* @param $delta - the delta for this field, used to distinguish fields that appear more than once in the calendar
|
||||
* @param $stripe - the hex code for this stripe.
|
||||
* @param $label - the label to give this stripe.
|
||||
*
|
||||
*
|
||||
* TODO Reconsider use of $GLOBALS as a method of triggering the legend, there
|
||||
* may be a better way.
|
||||
*/
|
||||
|
@ -208,7 +207,7 @@ function calendar_node_stripe($view, &$node, $query_name, $delta, $stripe = NULL
|
|||
if(!(isset($node->stripe))){
|
||||
$node->stripe = array();
|
||||
$node->stripe_label = array();
|
||||
}
|
||||
}
|
||||
if (!$label && array_key_exists($type, $type_names)) {
|
||||
$label = $type_names[$type];
|
||||
}
|
||||
|
@ -235,7 +234,7 @@ function calendar_node_stripe($view, &$node, $query_name, $delta, $stripe = NULL
|
|||
* @param $delta - the delta for this field, used to distinguish fields that appear more than once in the calendar
|
||||
* @param $stripe - the hex code for this stripe.
|
||||
* @param $label - the label to give this stripe.
|
||||
*
|
||||
*
|
||||
* TODO Reconsider use of $GLOBALS as a method of triggering the legend, there
|
||||
* may be a better way.
|
||||
*/
|
||||
|
@ -245,8 +244,8 @@ function calendar_node_taxonomy_stripe($view, &$node, $query_name, $delta, $stri
|
|||
if (empty($colors_taxonomy)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Rename the vid added by Views to the normal name that
|
||||
|
||||
// Rename the vid added by Views to the normal name that
|
||||
// taxonomy will expect, it's in the raw results.
|
||||
$node->vid = $node->raw->node_vid;
|
||||
$terms_for_node = taxonomy_node_get_terms($node);
|
||||
|
@ -269,7 +268,7 @@ function calendar_node_taxonomy_stripe($view, &$node, $query_name, $delta, $stri
|
|||
else {
|
||||
$node->stripe[] = '';
|
||||
$node->stripe_label[] = '';
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -282,7 +281,7 @@ function calendar_node_taxonomy_stripe($view, &$node, $query_name, $delta, $stri
|
|||
* @param $delta - the delta for this field, used to distinguish fields that appear more than once in the calendar
|
||||
* @param $stripe - the hex code for this stripe.
|
||||
* @param $label - the label to give this stripe.
|
||||
*
|
||||
*
|
||||
* TODO Reconsider use of $GLOBALS as a method of triggering the legend, there
|
||||
* may be a better way.
|
||||
*/
|
||||
|
@ -315,7 +314,7 @@ function calendar_node_group_stripe($view, &$node, $query_name, $delta, $stripe
|
|||
else {
|
||||
$node->stripe[] = '';
|
||||
$node->stripe_label[] = '';
|
||||
}
|
||||
}
|
||||
return $stripe;
|
||||
}
|
||||
|
||||
|
@ -376,7 +375,7 @@ function calendar_date_select_form(&$form_state, $view) {
|
|||
'#type' => 'hidden',
|
||||
'#value' => $view->get_url(),
|
||||
);
|
||||
$pos = calendar_arg_position($view);
|
||||
$pos = calendar_arg_position($view);
|
||||
$form['calendar_previous_arg'] = array(
|
||||
'#type' => 'hidden',
|
||||
'#value' => $view->args[$pos],
|
||||
|
@ -399,7 +398,7 @@ function calendar_arg_position($view) {
|
|||
}
|
||||
/**
|
||||
* Get the url for a calendar node.
|
||||
*
|
||||
*
|
||||
* @param $node - a calendar node object
|
||||
* @param $default - a default url to use when nothing specific is provided.
|
||||
*/
|
||||
|
@ -446,24 +445,24 @@ function calendar_errors($error) {
|
|||
}
|
||||
/**
|
||||
* Implementation of hook_elements.
|
||||
*
|
||||
*
|
||||
* Much of the colorpicker code was adapted from the Colorpicker module.
|
||||
* That module has no stable release yet nor any D6 branch.
|
||||
*
|
||||
*
|
||||
* TODO Consider dropping the duplicate code and adding a dependency
|
||||
* when that module is more stable, if calendar module customizations will
|
||||
* when that module is more stable, if calendar module customizations will
|
||||
* work in it.
|
||||
*/
|
||||
function calendar_elements() {
|
||||
// the Farbtastic colorpicker
|
||||
$type['calendar_colorpicker'] = array(
|
||||
'#attributes' => array('class' => 'calendar_colorpicker'),
|
||||
'#attributes' => array('class' => 'calendar_colorpicker'),
|
||||
'#input' => TRUE,
|
||||
);
|
||||
|
||||
|
||||
// a textfield to associate with the Farbtastic colorpicker
|
||||
$type['calendar_colorfield'] = array(
|
||||
'#attributes' => array('class' => 'calendar_colorfield'),
|
||||
'#attributes' => array('class' => 'calendar_colorfield'),
|
||||
'#input' => TRUE,
|
||||
'#validate' => array('calendar_validate_hex_color' => array())
|
||||
);
|
||||
|
@ -511,7 +510,7 @@ function theme_calendar_colorfield($element) {
|
|||
|
||||
/**
|
||||
* Add link to calendar to nodes.
|
||||
*
|
||||
*
|
||||
* Controlled by value of 'calendar_date_link' in the view.
|
||||
*/
|
||||
function calendar_link($type, $object, $teaser = FALSE) {
|
||||
|
@ -553,7 +552,7 @@ function calendar_remove($view_name) {
|
|||
function calendar_week_header($view) {
|
||||
$len = isset($view->date_info->style_name_size) ? $view->date_info->style_name_size : (!empty($view->date_info->mini) ? 1 : 3);
|
||||
$with_week = !empty($view->date_info->style_with_weekno);
|
||||
|
||||
|
||||
// create week header
|
||||
$untranslated_days = calendar_untranslated_days();
|
||||
if ($len == 99) {
|
||||
|
@ -608,7 +607,7 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
// Midnights are determined based on the same timezone as the View uses
|
||||
$display_timezone = date_timezone_get($view->date_info->min_date);
|
||||
$display_timezone_name = timezone_name_get($display_timezone);
|
||||
|
||||
|
||||
// Translate the view min and max dates to UTC values
|
||||
// so we can compare UTC dates to the view range.
|
||||
$min_utc = drupal_clone($view->date_info->min_date);
|
||||
|
@ -650,14 +649,14 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
$local_tz = date_get_timezone($field['tz_handling'], 'date');
|
||||
$field_name = $field['field_name'];
|
||||
$rrule_field = str_replace(array('_value2', '_value'), '_rrule', $alias);
|
||||
|
||||
|
||||
// Set a flag to tell us if individual multi-day dates need to be
|
||||
// split into separate nodes.
|
||||
$split_dates = TRUE;
|
||||
if (strstr($view->current_display, '_ical')) {
|
||||
$split_dates = FALSE;
|
||||
}
|
||||
|
||||
|
||||
// If there is no field for this item, just default to the site format.
|
||||
if (!isset($view->field[$field_name])) {
|
||||
$format = variable_get('date_format_short', 'm/d/Y - H:i');
|
||||
|
@ -692,7 +691,7 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
|
||||
// set the domain part of the id
|
||||
$domain = check_plain($_SERVER['SERVER_NAME']);
|
||||
|
||||
|
||||
// If there are multiple date fields in this calendar we may get
|
||||
// duplicate items from the other date fields, so add a way to
|
||||
// make sure each individual date field only gets added to the
|
||||
|
@ -705,9 +704,9 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
if (substr($field['type'], 0, 3) == 'cck') {
|
||||
$real_field = str_replace(array('_value2', '_value'), '', $field_name);
|
||||
}
|
||||
|
||||
|
||||
$id = 'calendar.'. $item->{$view->base_field} .'.'. $real_field .'.'. $delta;
|
||||
|
||||
|
||||
// When creating iCal feeds for repeating dates we don't want all
|
||||
// the multiple values, send only the first value.
|
||||
if (strstr($view->current_display, '_ical')) {
|
||||
|
@ -718,30 +717,30 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!in_array($id, $processed) && !empty($item->calendar_fields->$alias)) {
|
||||
|
||||
|
||||
// Create from and to date values for each item, adjusted to
|
||||
// the correct timezone.
|
||||
$values[0] = !empty($item->calendar_fields->$fromto[0]) ? $item->calendar_fields->$fromto[0] : $item->calendar_fields->$alias;
|
||||
$values[1] = !empty($item->calendar_fields->$fromto[1]) ? $item->calendar_fields->$fromto[1] : $item->calendar_fields->$alias;
|
||||
|
||||
|
||||
$db_tz = date_get_timezone_db($tz_handling, isset($item->$tz_alias) ? $item->$tz_alias : $display_timezone_name);
|
||||
$to_zone = date_get_timezone($tz_handling, isset($item->$tz_alias) ? $item->$tz_alias : $display_timezone_name);
|
||||
|
||||
|
||||
// Now $display_timezone determines how $item is split into
|
||||
// one entry per day, while $to_zone determines how date is displayed.
|
||||
// For now, use the date fields's timezone for the day splitting.
|
||||
$display_timezone_name = $to_zone;
|
||||
$values_display = array();
|
||||
|
||||
|
||||
// Start date
|
||||
$date = date_make_date($values[0], $db_tz, $field['sql_type']);
|
||||
if ($db_tz != $to_zone) {
|
||||
date_timezone_set($date, timezone_open($to_zone));
|
||||
}
|
||||
$values[0] = date_format($date, DATE_FORMAT_DATETIME);
|
||||
|
||||
|
||||
if ($display_timezone_name != $to_zone) {
|
||||
date_timezone_set($date, $display_timezone);
|
||||
$values_display[0] = date_format($date, DATE_FORMAT_DATETIME);
|
||||
|
@ -749,7 +748,7 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
else {
|
||||
$values_display[0] = $values[0];
|
||||
}
|
||||
|
||||
|
||||
// End date
|
||||
$date = date_make_date($values[1], $db_tz, $field['sql_type']);
|
||||
if ($db_tz != $to_zone) {
|
||||
|
@ -763,7 +762,7 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
else {
|
||||
$values_display[1] = $values[1];
|
||||
}
|
||||
|
||||
|
||||
// Now $values contain start and end date of a node,
|
||||
// expressed as strings in the display (local) timezone.
|
||||
// $values_utc does the same in UTC timezone.
|
||||
|
@ -778,13 +777,13 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
date_timezone_set($date, $display_timezone);
|
||||
$max_zone_string[$display_timezone_name] = date_format($date, DATE_FORMAT_DATE);
|
||||
}
|
||||
|
||||
|
||||
// Create a node for each date within the field's date range,
|
||||
// limited to the view's date range (regarding only day, not time).
|
||||
$now = max($min_zone_string[$display_timezone_name], substr($values_display[0], 0, 10));
|
||||
$to = min($max_zone_string[$display_timezone_name], substr($values_display[1], 0, 10));
|
||||
$next = date_make_date($now, $display_timezone);
|
||||
|
||||
|
||||
if ($display_timezone_name != $to_zone) {
|
||||
// Make $start and $end (derived from $node) use the timezone $to_zone, just as $values[..] do
|
||||
date_timezone_set($next, timezone_open($to_zone));
|
||||
|
@ -792,13 +791,13 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
if (empty($to)) {
|
||||
$to = $now;
|
||||
}
|
||||
|
||||
|
||||
// $now and $next are midnight (in display timezone) on the first day where node will occur.
|
||||
// $to is midnight on the last day where node will occur.
|
||||
// All three were limited by the min-max date range of the view.
|
||||
while ($now <= $to) {
|
||||
$node = drupal_clone($item);
|
||||
|
||||
|
||||
// Make sure the pseudo node has the same properties a
|
||||
// regular node would have.
|
||||
if (isset($node->node_title) && !isset($node->title)) {
|
||||
|
@ -820,10 +819,10 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
$node->format_time = '';
|
||||
}
|
||||
$node->url = calendar_get_node_link($node);
|
||||
|
||||
|
||||
//$node->$fromto[0] = $values[0];
|
||||
//$node->$fromto[1] = $values[1];
|
||||
|
||||
|
||||
// Flag which datefield this node is using, in case
|
||||
// there are multiple date fields in the view.
|
||||
$node->datefield = $alias;
|
||||
|
@ -863,16 +862,16 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
}
|
||||
$node->date_start = date_create($values[0], timezone_open($to_zone));
|
||||
$node->date_end = date_create(!empty($values[1]) ? $values[1] : $values[0], timezone_open($to_zone));;
|
||||
|
||||
|
||||
// Make date objects
|
||||
$node->calendar_start_date = date_create($node->calendar_start, timezone_open($to_zone));
|
||||
$node->calendar_end_date = date_create($node->calendar_end, timezone_open($to_zone));
|
||||
|
||||
|
||||
// Change string timezones into
|
||||
// calendar_start and calendar_end are UTC dates as formatted strings
|
||||
$node->calendar_start = date_format($node->calendar_start_date, DATE_FORMAT_DATETIME);
|
||||
$node->calendar_end = date_format($node->calendar_end_date, DATE_FORMAT_DATETIME);
|
||||
|
||||
|
||||
if (substr($real_field, 0, 6) == 'field_') {
|
||||
$cck_field = content_fields($cck_field_name);
|
||||
$granularity = is_array($cck_field['granularity']) ? end($cck_field['granularity']) : $cck_field['granularity'];
|
||||
|
@ -883,13 +882,13 @@ function calendar_build_nodes(&$view, &$items) {
|
|||
$increment = 1;
|
||||
}
|
||||
$node->calendar_all_day = $granularity == 'day' ? TRUE : date_is_all_day($node->calendar_start, $node->calendar_end, $granularity, $increment);
|
||||
|
||||
|
||||
// Flag all day values specifically set in date.
|
||||
$all_day_field = str_replace(array('_value2', '_value'), '_all_day', $node->datefield);
|
||||
if (!empty($all_day_field) && !empty($item->$all_day_field)) {
|
||||
$node->calendar_all_day = TRUE;
|
||||
}
|
||||
|
||||
|
||||
unset($node->calendar_fields);
|
||||
if (isset($node) && (empty($node->calendar_start))) {
|
||||
// if no date for the node and no date in the item
|
||||
|
|
Reference in a new issue