Now all modules are in core modules folder

This commit is contained in:
Manuel Cillero 2017-08-08 12:14:45 +02:00
parent 5ba1cdfa0b
commit 05b6a91b0c
1907 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,48 @@
<?php
/**
* @file
* Template to display date navigation links.
*
* $nav_title
* The formatted title for this view. In the case of block
* views, it will be a link to the full view, otherwise it will
* be the formatted name of the year, month, day, or week.
*
* $prev_url
* $next_url
* Urls for the previous and next calendar pages. The links are
* composed in the template to make it easier to change the text,
* add images, etc.
*
* $prev_options
* $next_options
* Query strings and other options for the links that need to
* be used in the l() function, including rel=nofollow.
*
* $block:
* Whether or not this view is in a block.
*
* $view
* The view object for this navigation.
*
* The &nbsp; in the prev and next divs is to be sure they are never
* completely empty, needed in some browsers to prop the header open
* so the title stays centered.
*
*/
?>
<div class="date-nav clear-block">
<div class="date-prev">
<?php if (!empty($prev_url)) : ?>
<span class="next views-summary"> <?php print l('« ' . ($block ? '' : date_t('Prev', 'date_nav')), $prev_url, $prev_options); ?></span>
<?php endif; ?>
&nbsp;</div>
<div class="date-heading">
<h3><?php print $nav_title ?></h3>
</div>
<div class="date-next">&nbsp;
<?php if (!empty($next_url)) : ?>
<span class="next views-summary"> <?php print l(($block ? '' : date_t('Next', 'date_nav')) . ' »', $next_url, $next_options); ?></span>
<?php endif; ?>
</div>
</div>

View file

@ -0,0 +1,40 @@
<?php
/**
* @file
* Template for a VALARM file.
*/
/**
* $alarm
* An array with the following information about each alarm:
*
* $alarm['action'] - the action to take, either 'DISPLAY' or 'EMAIL'
* $alarm['trigger'] - the time period for the trigger, like -P2D.
* $alarm['repeat'] - the number of times to repeat the alarm.
* $alarm['duration'] - the time period between repeated alarms, like P1D.
* $alarm['description'] - the description of the alarm.
*
* An email alarm should have two additional parts:
* $alarm['email'] - a comma-separated list of email recipients.
* $alarm['summary'] - the subject of the alarm email.
*
* If you are editing this file, remember that all output lines generated by it
* must end with DOS-style \r\n line endings, and not Unix-style \n, in order to
* comply with the iCal spec: http://tools.ietf.org/html/rfc5545#section-3.1.
*/
print "BEGIN:VALARM\r\n";
print "ACTION:" . $alarm['action'] . "\r\n";
if (!empty($alarm['trigger'])):
print "TRIGGER:" . $alarm['trigger'] . "\r\n";
endif;
if (!empty($alarm['repeat'])):
print "REPEAT:" . $alarm['repeat'] . "\r\n";
endif;
if (!empty($alarm['duration'])):
print "DURATION:" . $alarm['duration'] . "\r\n";
endif;
if ($alarm['action'] == 'EMAIL'):
print "ATTENDEE:MAILTO:" . $alarm['email'] . "\r\n";
print "SUMMARY:" . $alarm['summary'] . "\r\n";
endif;
print "DESCRIPTION:" . $alarm['description'] . "\r\n";
print "END:VALARM\r\n";

View file

@ -0,0 +1,31 @@
<?php
/**
* @file
* Template for a VCALENDAR file.
*/
/**
* $calname
* The name of the calendar.
* $events
* @see date-vevent.tpl.php.
* @see date-valarm.tpl.php.
*
* If you are editing this file, remember that all output lines generated by it
* must end with DOS-style \r\n line endings, and not Unix-style \n, in order to
* comply with the iCal spec: http://tools.ietf.org/html/rfc5545#section-3.1.
*/
if (empty($method)):
$method = 'PUBLISH';
endif;
print "BEGIN:VCALENDAR\r\n";
print "VERSION:2.0\r\n";
print "METHOD:$method\r\n";
if (!empty($calname)):
print "X-WR-CALNAME;VALUE=TEXT:$calname\r\n";
endif;
print "PRODID:-//Drupal iCal API//EN\r\n";
foreach ($events as $event):
print theme('date_vevent', $event);
endforeach;
print "END:VCALENDAR\r\n";

View file

@ -0,0 +1,47 @@
<?php
/**
* @file
* Template for a VEVENT file.
*/
/**
* $event
* An array with the following information about each event:
*
* $event['uid'] - a unique id for the event (usually the url).
* $event['summary'] - the name of the event.
* $event['start'] - the formatted start date of the event.
* $event['end'] - the formatted end date of the event.
* $event['rrule'] - the RRULE of the event, if any.
* $event['timezone'] - the formatted timezone name of the event, if any.
* $event['url'] - the url for the event.
* $event['location'] - the name of the event location, or a vvenue location id.
* $event['description'] - a description of the event.
* $event['alarm'] - an optional array of alarm values.
* @see date-valarm.tpl.php.
*
* If you are editing this file, remember that all output lines generated by it
* must end with DOS-style \r\n line endings, and not Unix-style \n, in order to
* comply with the iCal spec: http://tools.ietf.org/html/rfc5545#section-3.1.
*/
print "BEGIN:VEVENT\r\n";
print "UID:" . $event['uid'] . "\r\n";
print "SUMMARY:" . $event['summary'] . "\r\n";
print "DTSTAMP:" . $site_timezone_utc . "Z\r\n";
print "DTSTART;" . $event['timezone'] . $event['start'] . "\r\n";
if (!empty($event['end'])):
print "DTEND;" . $event['timezone'] . $event['end'] . "\r\n";
endif;
if (!empty($event['rrule'])):
print $event['rrule'] . "\r\n";
endif;
if (!empty($event['url'])):
print "URL;VALUE=URI:" . $event['url'] . "\r\n";
endif;
if (!empty($event['location'])):
print "LOCATION:" . $event['location'] . "\r\n";
endif;
if (!empty($event['description'])):
print "DESCRIPTION:" . $event['description'] . "\r\n";
endif;
print "END:VEVENT\r\n";

View file

@ -0,0 +1,54 @@
<?php
/**
* @file
* Template to display the Views date filter form.
*
* Values available vary depending on the operator. The availability
* of date vs adjustment depending on the filter settings. It can
* be date-only, date and adjustment, or adjustment only.
*
* If the operator is anything but 'Is between' or 'Is not between',
* a single date and adjustment field is available.
*
* $date
* $adjustment
*
* If the operator is 'Is between' or 'Is not between',
* two date and adjustment fields are available.
*
* $mindate
* $minadjustment
* $maxdate
* $maxadjustment
*
* A description field is also available.
*
* $description
*/
?>
<div class="date-views-filter-wrapper">
<div class="container-inline-date date-clear">
<?php if (!empty($date) || !empty($adjustment)) : ?>
<div class="date-clear">
<div class="date-views-filter"><?php print $date; ?></div>
<div class="date-views-filter"><?php print $adjustment ?></div>
</div>
<?php endif; ?>
<?php if (!empty($mindate) || !empty($minadjustment)) : ?>
<div class="date-clear">
<div class="date-views-filter"><?php print $mindate; ?></div>
<div class="date-views-filter"><?php print $minadjustment; ?></div>
</div>
<?php endif; ?>
<?php if (!empty($maxdate) || !empty($maxadjustment)) : ?>
<div class="date-clear">
<div class="date-views-filter"><?php print $maxdate; ?></div>
<div class="date-views-filter"><?php print $maxadjustment; ?></div>
</div>
<?php endif; ?>
</div>
<div class="date-clear form-item"><div class="description">
<?php print $description; ?>
</div>
</div>
</div>

View file

@ -0,0 +1,417 @@
<?php
/**
* @file
* Theme functions for Date.
*/
/**
* Preprocessor to construct back and next navigation from the date argument.
*/
function template_preprocess_date_navigation(&$vars) {
$view = $vars['view'];
$next_args = $view->args;
$prev_args = $view->args;
$pos = $view->date_info->date_arg_pos;
$min_date = is_object($view->date_info->min_date) ? $view->date_info->min_date : date_now();
$max_date = is_object($view->date_info->max_date) ? $view->date_info->max_date : date_now();
if (empty($view->date_info->hide_nav)) {
$prev_date = drupal_clone($min_date);
date_modify($prev_date, '-1 '. $view->date_info->granularity);
$next_date = drupal_clone($min_date);
date_modify($next_date, '+1 '. $view->date_info->granularity);
$format = array('year' => 'Y', 'month' => 'Y-m', 'day' => 'Y-m-d');
switch ($view->date_info->granularity) {
case 'week':
$next_week = date_week(date_format($next_date, 'Y-m-d'));
$prev_week = date_week(date_format($prev_date, 'Y-m-d'));
$next_arg = date_format($next_date, 'Y-\W') . $next_week;
$prev_arg = date_format($prev_date, 'Y-\W') . $prev_week;
break;
default:
$next_arg = date_format($next_date, $format[$view->date_info->granularity]);
$prev_arg = date_format($prev_date, $format[$view->date_info->granularity]);
}
$next_path = str_replace($view->date_info->date_arg, $next_arg, $view->date_info->url);
$prev_path = str_replace($view->date_info->date_arg, $prev_arg, $view->date_info->url);
$next_args[$pos] = $next_arg;
$prev_args[$pos] = $prev_arg;
$vars['next_url'] = date_real_url($view, NULL, $next_arg);
$vars['prev_url'] = date_real_url($view, NULL, $prev_arg);
$vars['next_options'] = $vars['prev_options'] = array();
}
else {
$next_path = '';
$prev_path = '';
$vars['next_url'] = '';
$vars['prev_url'] = '';
$vars['next_options'] = $vars['prev_options'] = array();
}
// Check whether navigation links would point to
// a date outside the allowed range.
if (!empty($next_date) && !empty($vars['next_url']) && date_format($next_date, 'Y') > $view->date_info->max_allowed_year) {
$vars['next_url'] = '';
}
if (!empty($prev_date) && !empty($vars['prev_url']) && date_format($prev_date, 'Y') < $view->date_info->min_allowed_year) {
$vars['prev_url'] = '';
}
$vars['prev_options'] += array('attributes' => array());
$vars['next_options'] += array('attributes' => array());
$prev_title = '';
$next_title = '';
// Build next/prev link titles.
switch ($view->date_info->granularity) {
case 'year':
$prev_title = t('Navigate to previous year');
$next_title = t('Navigate to next year');
break;
case 'month':
$prev_title = t('Navigate to previous month');
$next_title = t('Navigate to next month');
break;
case 'week':
$prev_title = t('Navigate to previous week');
$next_title = t('Navigate to next week');
break;
case 'day':
$prev_title = t('Navigate to previous day');
$next_title = t('Navigate to next day');
break;
}
$vars['prev_options']['attributes'] += array('title' => $prev_title);
$vars['next_options']['attributes'] += array('title' => $next_title);
// Add nofollow for next/prev links.
$vars['prev_options']['attributes'] += array('rel' => 'nofollow');
$vars['next_options']['attributes'] += array('rel' => 'nofollow');
$link = FALSE;
// Month navigation titles are used as links in the block view.
if (!empty($view->date_info->block) && $view->date_info->granularity == 'month') {
$link = TRUE;
}
$nav_title = theme('date_nav_title', $view->date_info->granularity, $view, $link);
$vars['nav_title'] = $nav_title;
$vars['block'] = !empty($view->date_info->block);
}
/**
* Theme the calendar title
*/
function theme_date_nav_title($granularity, $view, $link = FALSE, $format = NULL) {
switch ($granularity) {
case 'year':
$title = $view->date_info->year;
$date_arg = $view->date_info->year;
break;
case 'month':
$format = !empty($format) ? $format : (empty($view->date_info->mini) ? 'F Y' : 'F');
$title = date_format_date($view->date_info->min_date, 'custom', $format);
$date_arg = $view->date_info->year .'-'. date_pad($view->date_info->month);
break;
case 'day':
$format = !empty($format) ? $format : (empty($view->date_info->mini) ? 'l, F j Y' : 'l, F j');
$title = date_format_date($view->date_info->min_date, 'custom', $format);
$date_arg = $view->date_info->year .'-'. date_pad($view->date_info->month) .'-'. date_pad($view->date_info->day);
break;
case 'week':
$format = !empty($format) ? $format : (empty($view->date_info->mini) ? 'F j Y' : 'F j');
$title = t('Week of @date', array('@date' => date_format_date($view->date_info->min_date, 'custom', $format)));
$date_arg = $view->date_info->year .'-W'. date_pad($view->date_info->week);
break;
}
if (!empty($view->date_info->mini) || $link) {
// Month navigation titles are used as links in the mini view.
$attributes = array('title' => t('View full page month'));
$url = date_real_url($view, $granularity, $date_arg, TRUE);
return l($title, $url, array('attributes' => $attributes));
}
else {
return $title;
}
}
/**
* Preprocessor to construct an ical vcalendar
*
* @param $events
* An array of events where each event is an array keyed on the uid:
* 'start'
* Start date object,
* 'end'
* End date object, optional, omit for all day event.
* 'summary'
* Title of event (Text)
* 'description'
* Description of event (Text)
* 'location'
* Location of event (Text or vvenue id)
* 'uid'
* ID of the event for use by calendaring program, usually the url of the node
* 'url'
* URL of event information
*
* 'alarm'
* sub-array of alarm information for the event, including:
* - 'action' - the action to take, either 'DISPLAY' or 'EMAIL'
* - 'trigger' - the time period for the trigger, like -P2D.
* - 'repeat' - the number of times to repeat the alarm.
* - 'duration' - the time period between repeated alarms, like P1D.
* - 'description' - the description of the alarm.
* An email alarm should have two additional parts:
* - 'email' - a comma-separated list of email recipients.
* - 'summary' - the subject of the alarm email.
*
* @param $calname
* Name of the calendar. Use site name if none is specified.
*
*/
function template_preprocess_date_vcalendar(&$vars) {
$vars['current_date'] = date_format(date_now(), DATE_FORMAT_ICAL);
$vars['current_date_utc'] = date_format(date_now('UTC'), DATE_FORMAT_ICAL);
$vars['site_timezone'] = date_default_timezone_name();
$vars['calname'] = date_ical_escape_text(!empty($vars['calname']) ? $vars['calname'] : variable_get('site_name', ''));
// Format the event results as iCal expects.
$events_in = $vars['events'];
$events = array();
$rows = $vars['rows'];
foreach ($events_in as $uid => $event) {
$row = array_shift($rows);
// Omit any items with empty dates.
if (!empty($event['start'])) {
$events[$uid] = $event;
$timezone = timezone_name_get(date_timezone_get($event['start']));
if (!empty($timezone)) {
$events[$uid]['timezone'] = "TZID=$timezone;";
}
else {
$events[$uid]['timezone'] = '';
}
$date_format = ($row->calendar_all_day == TRUE) ? DATE_FORMAT_ICAL_DATE : DATE_FORMAT_ICAL;
$events[$uid]['start'] = date_format($event['start'], $date_format);
// According to RFC 2445 (clarified in RFC 5545) the DTEND value is
// non-inclusive. When it is a DATE rather than a DATETIME, this means
// that we should add one day to its value.
if ($row->calendar_all_day) {
if (empty($event['end'])) {
$event['end'] = $event['start'];
}
date_modify($event['end'], "+1 day");
}
if ($event['start'] && $event['end']) {
$events[$uid]['end'] = date_format($event['end'], $date_format);
}
else {
$events[$uid]['end'] = $events[$uid]['start'];
}
foreach ($event as $key => $value) {
if (is_string($value)) {
$event[trim($key)] = trim($value);
}
}
// Escape text values.
foreach ($event as $key => $value) {
if ($key == 'alarm') {
foreach ($value as $alarm_key => $alarm_value) {
if (in_array($alarm_key, array('summary', 'description'))) {
$events[$uid]['alarm'][$alarm_key] = date_ical_escape_text($alarm_value);
}
}
}
elseif (in_array($key, array('summary', 'description', 'location'))) {
$events[$uid][$key] = date_ical_escape_text(html_entity_decode($value, ENT_QUOTES, 'UTF-8'));
}
}
}
}
$vars['events'] = $events;
}
/**
* Preprocessor for Date Views filter form.
*/
function template_preprocess_date_views_filter_form(&$vars) {
$form = $vars['form'];
$vars['date'] = drupal_render($form['valuedate']);
$vars['mindate'] = drupal_render($form['mindate']);
$vars['maxdate'] = drupal_render($form['maxdate']);
$vars['adjustment'] = drupal_render($form['valueadjustment']);
$vars['minadjustment'] = drupal_render($form['minadjustment']);
$vars['maxadjustment'] = drupal_render($form['maxadjustment']);
$vars['description'] = drupal_render($form['description']) . drupal_render($form);
}
/**
* Format a date timezone element.
*
* @param $element
* An associative array containing the properties of the element.
* Properties used: title, value, options, description, required and attributes.
* @return
* A themed HTML string representing the date selection boxes.
*/
function theme_date_timezone($element) {
return '<div class="date-clear">'. theme('form_element', $element, $element['#children']) .'</div>';
}
/**
* Format a date selection element.
*
* @param $element
* An associative array containing the properties of the element.
* Properties used: title, value, options, description, required and attributes.
* @return
* A themed HTML string representing the date selection boxes.
*/
function theme_date_select($element) {
$output = '';
$class = 'container-inline-date';
// Add #date_float to allow date parts to float together on the same line.
if (empty($element['#date_float'])) {
$class .= ' date-clear-block';
}
if (isset($element['#children'])) {
$output = $element['#children'];
}
return '<div class="'. $class .'">'. theme('form_element', $element, $output) .'</div>';
}
/**
* Format a date text element.
*
* @param $element
* An associative array containing the properties of the element.
* Properties used: title, value, options, description, required and attributes.
* @return
* A themed HTML string representing the date selection boxes.
*/
function theme_date_text($element) {
$output = '';
$class = 'container-inline-date';
// Add #date_float to allow date parts to float together on the same line.
if (empty($element['#date_float'])) {
$class .= ' date-clear-block';
}
if (isset($element['#children'])) {
$output = $element['#children'];
}
return '<div class="'. $class .'">'. theme('form_element', $element, $output) .'</div>';
}
/**
* Themes for date input form elements
*/
function theme_date_select_element($element) {
$part = array_pop($element['#parents']);
return '<div class="date-'. $part .'">'. theme('select', $element) .'</div>';
}
function theme_date_textfield_element($element) {
$part = array_pop($element['#parents']);
return '<div class="date-'. $part .'">'. theme('textfield', $element) .'</div>';
}
/**
* Functions to separate date parts in form.
*
* Separators float up to the title level for elements with titles,
* so won't work if this element has titles above the element date parts.
*/
function theme_date_part_hour_prefix($element) {
if ($element['#date_label_position'] != 'above') {
return '<span class="form-item date-spacer">&nbsp;-&nbsp;</span>';
}
}
function theme_date_part_minsec_prefix($element) {
if ($element['#date_label_position'] != 'above') {
return '<span class="form-item date-spacer">:</span>';
}
}
/**
* Format labels for each date part in a date_select.
*
* @param $part_type
* the type of field used for this part, 'textfield' or 'select'
* @param $element
* An associative array containing the properties of the element.
* Properties used: title, value, options, description, required and attributes.
*/
function theme_date_part_label_year($part_type, $element) {
return date_t('Year', 'datetime');
}
function theme_date_part_label_month($part_type, $element) {
return date_t('Month', 'datetime');
}
function theme_date_part_label_day($part_type, $element) {
return date_t('Day', 'datetime');
}
function theme_date_part_label_hour($part_type, $element) {
return date_t('Hour', 'datetime');
}
function theme_date_part_label_minute($part_type, $element) {
return date_t('Minute', 'datetime');
}
function theme_date_part_label_second($part_type, $element) {
return date_t('Second', 'datetime');
}
function theme_date_part_label_ampm($part_type, $element) {
return ' ';
}
function theme_date_part_label_timezone($part_type, $element) {
return t('Timezone');
}
/**
* Theme for a date block that looks like a mini calendar day.
* Pass in a date object already set to the right timezone,
* format as a calendar page date. The calendar styling is created in css.
*/
function theme_date_calendar_day($date) {
if (empty($date)) {
return NULL;
}
return '<div class="date-calendar-day">' .
'<span class="month">' . date_format_date($date, 'custom', 'M') . '</span>' .
'<span class="day">' . date_format_date($date, 'custom', 'j') . '</span>' .
'<span class="year">' . date_format_date($date, 'custom', 'Y') . '</span>' .
'</div>';
}
function theme_date_time_ago($start_date, $end_date, $interval = 2) {
// If no date is sent, then return nothing
if (empty($start_date) || empty($end_date)) {
return NULL;
}
// Time to compare dates to
$now = date_format(date_now(), DATE_FORMAT_DATETIME);
$start = date_format($start_date, DATE_FORMAT_DATETIME);
$end = date_format($end_date, DATE_FORMAT_DATETIME);
// 1) The date is entirely in the future
if ($now < $start) {
return t('!time from now', array('!time' => date_format_interval($start_date, $interval)));
}
// 2) Ongoing date
elseif ($now > $start && $now <= $end) {
//return t('Started !time ago', array('!time' => $dates['value']['interval']));
return t('ongoing');
}
// 3) Date is in the past (format_interval added 'ago' to the value).
else {
return date_format_interval($start_date, $interval);
}
}