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,19 @@
<?php
// $Id: calendar-datebox.tpl.php,v 1.2.2.3 2010/11/21 14:15:32 karens Exp $
/**
* @file
* Template to display the date box in a calendar.
*
* - $view: The view.
* - $granularity: The type of calendar this box is in -- year, month, day, or week.
* - $mini: Whether or not this is a mini calendar.
* - $class: The class for this box -- mini-on, mini-off, or day.
* - $day: The day of the month.
* - $date: The current date, in the form YYYY-MM-DD.
* - $link: A formatted link to the calendar day view for this day.
* - $url: The url to the calendar day view for this day.
* - $selected: Whether or not this day has any items.
* - $items: An array of items for this day.
*/
?>
<div class="<?php print $granularity ?> <?php print $class; ?>"> <?php print $selected ? $link : $day; ?> </div>

View file

@ -0,0 +1,53 @@
<?php
// $Id: calendar-day-node.tpl.php,v 1.2.2.4 2010/11/21 13:19:37 karens Exp $
/**
* @file
* Template to display a view item as a calendar day 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
* one day, it has been broken apart into separate nodes for each calendar
* 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.
* $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.
*/
?>
<div class="view-item view-item-<?php print $view->name ?>">
<div class="<?php print $node->date_id; ?> calendar dayview">
<?php print theme('calendar_stripe_stripe', $node); ?>
<?php foreach ($fields as $field): ?>
<div class="view-field view-data-<?php print $field['id']; ?> <?php print $field['id']; ?>">
<?php if ($field['label']): ?>
<div class="view-label-<?php print $field['id'] ?>"><?php print $field['label'] ?></div>
<?php endif; ?>
<?php print $field['data']; ?>
</div>
<?php endforeach; ?>
</div>
</div>

View file

@ -0,0 +1,81 @@
<?php
// $Id: calendar-day.tpl.php,v 1.7.2.10 2010/11/21 13:19:37 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.
* $rows['date'] - the date for this day, formatted as YYYY-MM-DD.
* $rows['datebox'] - the formatted datebox for this day.
* $rows['empty'] - empty text for this day, if no items were found.
* $rows['all_day'] - an array of formatted all day items.
* $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
* 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>
* 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
* evenly over the remaining 90% of the table.
*/
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
?>
<div class="calendar-calendar"><div class="day-view">
<table>
<col width="<?php print $first_column_width?>"></col>
<?php foreach ($columns as $column): ?>
<col width="<?php print $column_width; ?>%"></col>
<?php endforeach; ?>
<thead>
<tr>
<th class="calendar-dayview-hour"><?php print $by_hour_count > 0 ? t('Time') : ''; ?></th>
<?php foreach ($columns as $column): ?>
<th class="calendar-agenda-items"><?php print $column; ?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<tr>
<td class="<?php print $agenda_hour_class ?>">
<span class="calendar-hour"><?php print $by_hour_count > 0 ? date_t('All day', 'datetime') : ''; ?></span>
</td>
<?php foreach ($columns as $column): ?>
<td class="calendar-agenda-items">
<div class="calendar">
<div class="inner">
<?php print isset($rows['all_day'][$column]) ? implode($rows['all_day'][$column]) : '&nbsp;';?>
</div>
</div>
</td>
<?php endforeach; ?>
</tr>
<?php foreach ($rows['items'] as $hour): ?>
<tr>
<td class="calendar-agenda-hour">
<span class="calendar-hour"><?php print $hour['hour']; ?></span>
<span class="calendar-ampm"><?php print $hour['ampm']; ?></span>
</td>
<?php foreach ($columns as $column): ?>
<td class="calendar-agenda-items">
<div class="calendar">
<div class="inner">
<?php print isset($hour['values'][$column]) ? implode($hour['values'][$column]) : '&nbsp;'; ?>
</div>
</div>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div></div>

View file

@ -0,0 +1,26 @@
<?php
// $Id: calendar-main.tpl.php,v 1.2.2.4 2009/01/10 20:04:18 karens Exp $
/**
* @file
* Template to display calendar navigation and links.
*
* @see template_preprocess_calendar_main.
*
* $view: The view.
* $calendar_links: Array of formatted links to other calendar displays - year, month, week, day.
* $calendar_popup: The popup calendar date selector.
* $display_type: year, month, day, or week.
* $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);
?>
<div class="calendar-calendar">
<?php if (!empty($calendar_popup)) print $calendar_popup;?>
<?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>

View file

@ -0,0 +1,47 @@
<?php
// $Id: calendar-mini.tpl.php,v 1.1.2.7 2010/11/21 13:19:37 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.
* $rows: An array of data for each day of the week.
* $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; ?>
<table class="mini">
<thead>
<tr>
<?php foreach ($day_names as $cell): ?>
<th class="<?php print $cell['class']; ?>">
<?php print $cell['data']; ?>
</th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach ((array) $rows as $row): ?>
<tr>
<?php foreach ($row as $cell): ?>
<td class="<?php print $cell['class']; ?> <?php print $cell['id']; ?>">
<?php print $cell['data']; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div></div>

View file

@ -0,0 +1,28 @@
<?php
// $Id: calendar-month-multiple-node.tpl.php,v 1.1.2.6 2010/11/21 13:19:37 karens Exp $
/**
* @file
* Template to display a summary of the days items as a calendar month node.
*
*
* @see template_preprocess_calendar_month_multiple_node.
*/
?>
<div class="view-item view-item-<?php print $view->name ?>">
<div class="<?php print $curday; ?> calendar monthview">
<?php foreach ($types as $type): ?>
<?php if ($view->date_info->style_max_items_behavior != 'more'): ?>
<?php print theme('calendar_stripe_stripe', $type); ?>
<?php endif; ?>
<?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">
<?php print l(t('Click to see all @count events', array('@count' => $count)), $link) ?>
</div>
</div>
<?php else: ?>
<div class="calendar-more"><?php print l(t('more'), $link) ?>»</div>
<?php endif; ?>
</div>
</div>

View file

@ -0,0 +1,53 @@
<?php
// $Id: calendar-month-node.tpl.php,v 1.2.2.6 2010/11/21 13:19:37 karens Exp $
/**
* @file
* Template to display a view item as a calendar month 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
* one day, it has been broken apart into separate nodes for each calendar
* 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.
* $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.
*/
?>
<div class="view-item view-item-<?php print $view->name ?>">
<div class="<?php print $node->date_id; ?> calendar monthview">
<?php print theme('calendar_stripe_stripe', $node); ?>
<?php foreach ($fields as $field): ?>
<div class="view-field view-data-<?php print $field['id']; ?> <?php print $field['id']; ?>">
<?php if ($field['label']): ?>
<div class="view-label-<?php print $field['id'] ?>"><?php print $field['label'] ?></div>
<?php endif; ?>
<?php print $field['data']; ?>
</div>
<?php endforeach; ?>
</div>
</div>

View file

@ -0,0 +1,46 @@
<?php
// $Id: calendar-month.tpl.php,v 1.6.2.3 2008/06/19 22:55:56 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.
* $rows: An array of data for each day of the week.
* $view: The view.
* $calendar_links: Array of formatted links to other calendar displays - year, month, week, day.
* $display_type: year, month, day, or week.
* $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,
* it is in the form: calendar-nid-field_name-delta
*
*/
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
?>
<div class="calendar-calendar"><div class="month-view">
<table>
<thead>
<tr>
<?php foreach ($day_names as $cell): ?>
<th class="<?php print $cell['class']; ?>">
<?php print $cell['data']; ?>
</th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach ((array) $rows as $row): ?>
<tr>
<?php foreach ($row as $cell): ?>
<td id="<?php print $cell['id']; ?>" class="<?php print $cell['class']; ?>">
<?php print $cell['data']; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div></div>

View file

@ -0,0 +1,27 @@
<?php
// $Id: calendar-week-multiple-node.tpl.php,v 1.1.2.5 2010/11/21 13:19:37 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="<?php print $curday; ?> calendar weekview">
<?php foreach ($types as $type): ?>
<?php if ($view->date_info->style_max_items_behavior != 'more'): ?>
<?php print theme('calendar_stripe_stripe', $type); ?>
<?php endif; ?>
<?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">
<?php print l(t('Click to see all @count events', array('@count' => $count)), $link) ?>
</div>
</div>
<?php else: ?>
<div class="calendar-more"><?php print l(t('more'), $link) ?>»</div>
<?php endif; ?>
</div>
</div>

View file

@ -0,0 +1,53 @@
<?php
// $Id: calendar-week-node.tpl.php,v 1.2.2.3 2010/11/21 13:19:37 karens Exp $
/**
* @file
* Template to display a view item as a calendar week 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
* one day, it has been broken apart into separate nodes for each calendar
* 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.
* $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.
*/
?>
<div class="view-item view-item-<?php print $view->name ?>">
<div class="<?php print $node->date_id; ?> calendar weekview">
<?php print theme('calendar_stripe_stripe', $node); ?>
<?php foreach ($fields as $field): ?>
<div class="view-field view-data-<?php print $field['id']; ?> <?php print $field['id']; ?>">
<?php if ($field['label']): ?>
<div class="view-label-<?php print $field['id'] ?>"><?php print $field['label'] ?></div>
<?php endif; ?>
<?php print $field['data']; ?>
</div>
<?php endforeach; ?>
</div>
</div>

View file

@ -0,0 +1,80 @@
<?php
// $Id: calendar-week.tpl.php,v 1.5.2.6 2009/02/16 23:46:22 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.
* $rows['empty'] - empty text for this day, if no items were found.
* $rows['all_day'] - an array of formatted all day items.
* $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]['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);
//dsm($items);
?>
<div class="calendar-calendar"><div class="week-view">
<table>
<thead>
<tr>
<th class="calendar-agenda-hour"><?php print $by_hour_count > 0 ? t('Time') : ''; ?></th>
<?php foreach ($day_names as $cell): ?>
<th class="<?php print $cell['class']; ?>">
<?php print $cell['data']; ?>
</th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<tr>
<td class="<?php print $agenda_hour_class ?>">
<span class="calendar-hour"><?php print $by_hour_count > 0 ? date_t('All day', 'datetime') : ''; ?></span>
</td>
<?php foreach ($rows as $day): ?>
<td class="calendar-agenda-items">
<?php print $day['datebox']; ?>
<div class="calendar">
<div class="inner">
<?php print array_key_exists('all_day', $day) && count($day['all_day']) ? implode($day['all_day']) : '&nbsp;';?>
</div>
</div>
</td>
<?php endforeach; ?>
</tr>
<?php foreach ($items as $time): ?>
<tr>
<td class="calendar-agenda-hour">
<span class="calendar-hour"><?php print $time['hour']; ?></span>
<span class="calendar-ampm"><?php print $time['ampm']; ?></span>
</td>
<?php foreach ($columns as $column): ?>
<td class="calendar-agenda-items">
<div class="calendar">
<div class="inner">
<?php print isset($time['values'][$column]) ? implode($time['values'][$column]) : '&nbsp;'; ?>
</div>
</div>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div></div>

View file

@ -0,0 +1,27 @@
<?php
// $Id: calendar-year.tpl.php,v 1.6.2.1 2008/06/14 11:38:34 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);
?>
<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>
</tbody>
</table>
</div></div>

View file

@ -0,0 +1,754 @@
<?php
// $Id: theme.inc,v 1.10.2.80 2011/01/03 12:45:27 karens Exp $
/**
* Display a calendar navigation and links
*/
function template_preprocess_calendar_main(&$vars) {
require_once('./'. drupal_get_path('module', 'calendar') .'/includes/calendar.inc');
$view = $vars['view'];
$result = (array) $view->result;
$options = $view->style_plugin->options;
$handler = $view->style_plugin;
$vars['display_type'] = $view->date_info->granularity;
$vars['min_date_formatted'] = !empty($view->date_info->min_date) ? date_format($view->date_info->min_date, DATE_FORMAT_DATETIME) : '';
$vars['max_date_formatted'] = !empty($view->date_info->end_date) ? 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)) {
$current_date = date_make_date($date_info->date_arg .' 00:00:00');
}
elseif (!empty($view->date_info->week)) {
$week = date_week_range($view->date_info->week, $view->date_info->year);
$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');
}
else {
$current_date = date_make_date($view->date_info->year .'-01-01 00:00:00');
}
$ww = date_day_of_week($vars['min_date_formatted'], DATE_ISO);
$ww = variable_get('date_first_day', 1) ? ($ww == 0 ? 6 : $ww - 1) : $ww;
$week_date = date('Y-m-d', strtotime("-$ww days", strtotime($vars['min_date_formatted'])));
if (empty($view->date_info->month) || $view->date_info->month == $view->argument['date_argument']->options['wildcard']) {
$view->date_info->month = date_format($current_date, 'm');
}
if (empty($view->date_info->day) || $view->date_info->day == $view->argument['date_argument']->options['wildcard']) {
$view->date_info->day = date_format($current_date, 'd');
}
if (empty($view->date_info->week) || $view->date_info->week == $view->argument['date_argument']->options['wildcard']) {
$view->date_info->week = date_week(date_pad(date_part_extract($week_date, 'year'), 4) .'-'. date_part_extract($week_date, 'month') .'-'. date_part_extract($week_date, 'day'));
# $view->date_info->week = date_week($view->date_info->year .'-'. date_pad($view->date_info->month) .'-'. date_pad($view->date_info->day));
}
$calendar_links = array();
$base = array('attributes' => array('rel' => 'nofollow'));
if (!empty($displays['year'])) {
$calendar_links['calendar calendar-year'] = $base + array('title' => date_t('Year', 'datetime'), 'href' => date_real_url($view, 'year'));
}
if (!empty($displays['month'])) {
$calendar_links['calendar calendar-month'] = $base + array('title' => date_t('Month', 'datetime'), 'href' => date_real_url($view, 'month'));
}
if (!empty($displays['week'])) {
$wy = $view->date_info->year;
$view->date_info->year = date_pad(date_part_extract($week_date, 'year'), 4);
$calendar_links['calendar calendar-week'] = $base + array('title' => date_t('Week', 'datetime'), 'href' => date_real_url($view, 'week'));
$view->date_info->year = $wy;
}
if (!empty($displays['day'])) {
$calendar_links['calendar calendar-day'] = $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("administer nodes") || 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;
$vars['calendar_links']['calendar calendar-add'] = $base + array(
'title' => t('Add+'),
'href' => $href,
'query' => $query,
);
}
$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') .'/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
// 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;
$items[$num]->raw = $copy;
$items[$num]->calendar_fields = new stdClass();
foreach ($row as $key => $value) {
if (in_array($key, $calendar_fields)) {
$items[$num]->calendar_fields->$key = $value;
}
}
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;
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.
$items[$num]->{$field_alias} = $field->theme($copy);
}
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';
if (function_exists($function)) {
if ($feeds = $function($view)) {
foreach ($feeds as $feed) {
$items = $feed;
}
}
}
}
$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['mini'] = !empty($view->date_info->mini);
$vars['block'] = !empty($view->date_info->block);
}
/**
* Display a month view.
*/
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);
}
else {
$day_names = $rows;
$rows = array();
}
$month_rows = $rows;
foreach ($rows as $weekno => $row) {
foreach ($row as $day => $data) {
$cell = $data['data'];
// If this cell is already rendered, like the weekno column,
// move to the next item.
if (!is_array($cell)) {
$month_rows[$weekno][$day]['data'] = $cell;
continue;
}
$data = $cell['datebox'];
if ($cell['empty']) {
$data .= $cell['empty'];
}
else {
$data .= implode($cell['all_day']);
foreach ($cell['items'] as $hour => $item) {
$data .= implode($item);
}
$data .= $cell['link'];
}
if ($view->date_info->mini) {
$month_rows[$weekno][$day]['data'] = $data;
}
else {
$month_rows[$weekno][$day]['data'] = '<div class="inner">'. $data .'</div>';
}
}
}
$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);
}
/**
* Display a mini month view.
*/
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;
$vars['view'] = $view;
}
/**
* Display a year view.
*/
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.
$view = drupal_clone($vars['view']);
$rows = $vars['rows'];
$months = array();
foreach ($rows as $month => $month_rows) {
$view->date_info->month = $month;
$view->date_info->granularity = 'month';
$view->date_info->mini = TRUE;
$view->date_info->hide_nav = TRUE;
$view->date_info->show_title = TRUE;
$view->date_info->url = date_real_url($view, NULL, date_pad($year, 4) .'-'. date_pad($month));
$view->date_info->min_date = date_make_date($view->date_info->year .'-'. date_pad($month) .'-01 00:00:00', date_default_timezone_name());
$view->date_info->max_date = drupal_clone($view->date_info->min_date);
date_modify($view->date_info->max_date, '+1 month');
date_modify($view->date_info->max_date, '-1 second');
$months[$month] = theme('calendar_mini', $view, $vars['options'], $month_rows);
}
$vars['months'] = $months;
$vars['view']->date_info->hide_nav = FALSE;
$vars['view']->date_info->granularity = 'year';
}
/**
* 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;
// 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.
foreach ($rows['items'] as $time => $items) {
foreach($items as $item) {
$rows['all_day'][] = $item;
}
}
$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};
$item->{$grouping_field} = ''; // Remove the grouping field from the results.
if (!in_array($column, $columns)) {
$columns[] = $column;
}
}
else {
$column = t('Items');
}
$theme = isset($item->calendar_node_theme) ? $item->calendar_node_theme : 'calendar_'. $view->date_info->granularity .'_node';
$grouped_items[$column][] = theme($theme, $item, $view);
$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;
$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 $time => $items) {
foreach ($items as $item) {
if (isset($item->{$grouping_field})) {
$column = $item->{$grouping_field};
$item->{$grouping_field} = ''; // Remove the grouping field from the results.
if (!in_array($column, $columns)) {
$columns[] = $column;
}
}
else {
$column = t('Items');
}
// 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 ((!empty($show_empty_times)) && !array_key_exists($start_time, $grouped_items)) {
$grouped_items[$start_time]['values'] = array();
}
$start_time = $next_start_time;
$next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time;
}
$theme = isset($item->calendar_node_theme) ? $item->calendar_node_theme : 'calendar_'. $view->date_info->granularity .'_node';
$grouped_items[$start_time]['values'][$column][] = theme($theme, $item, $view);
$item_count++;
$by_hour_count++;
}
}
// Finish out the day's time values if we want to see empty times.
if (!empty($show_empty_times)) {
while ($start_time < $end_start_time) {
if (!array_key_exists($start_time, $grouped_items)) {
$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);
foreach ($start_times as $start_time) {
$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'];
$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));
}
else {
$vars['column_width'] = (100 - $first_column_width);
}
$vars['item_count'] = $item_count;
$vars['by_hour_count'] = $by_hour_count;
return;
}
/**
* Display a week view.
*/
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;
if (sizeof($rows) > 1) {
$day_names = array_shift($rows);
}
else {
$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;
$end_start_time = '23:59:59';
$grouped_items = array();
$vars['rows'] = $rows[0];
foreach ($rows[0] as $weekno => $row) {
$vars['rows'][$weekno] = $row['data'];
// If we're not grouping by time, move all items into the 'all day' array.
if (empty($view->date_info->style_groupby_times)) {
foreach ($row['data']['items'] as $items) {
foreach($items as $item) {
$rows['all_day'][] = $item;
}
}
$row['data']['items'] = array();
}
$columns[] = $weekno;
$start_times = $view->date_info->style_groupby_times;
$start_time = array_shift($start_times);
$next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time;
foreach ($row['data']['all_day'] as $key => $item) {
$theme = isset($item->calendar_node_theme) ? $item->calendar_node_theme : 'calendar_'. $view->date_info->granularity .'_node';
$vars['rows'][$weekno]['all_day'][$key] = theme($theme, $item, $view);
$item_count++;
}
foreach ($row['data']['items'] as $time => $items) {
foreach ($items as $item) {
// 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) && !array_key_exists($start_time, $grouped_items)) {
$grouped_items[$start_time]['values'][$weekno] = array();
}
$start_time = $next_start_time;
$next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time;
}
$theme = isset($item->calendar_node_theme) ? $item->calendar_node_theme : 'calendar_'. $view->date_info->granularity .'_node';
$grouped_items[$start_time]['values'][$weekno][] = theme($theme, $item, $view);
$item_count++;
$by_hour_count++;
}
}
// Finish out the day's time values if we want to see empty times.
if ($show_empty_times) {
while ($start_time < $end_start_time) {
if (!array_key_exists($start_time, $grouped_items)) {
$grouped_items[$start_time]['values'][$weekno] = array();
}
$start_time = $next_start_time;
$next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time;
}
}
}
ksort($grouped_items);
// Do the headers last, once we know what the actual values are.
$i = 0;
$start_times = array_keys($grouped_items);
foreach ($start_times as $start_time) {
$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, $row['data']['date']);
$grouped_items[$start_time]['hour'] = $heading['hour'];
$grouped_items[$start_time]['ampm'] = $heading['ampm'];
}
$vars['items'] = $grouped_items;
$vars['day_names'] = $day_names;
$vars['columns'] = $columns;
$vars['start_times'] = $view->date_info->style_groupby_times;
$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['item_count'] = $item_count;
$vars['by_hour_count'] = $by_hour_count;
return;
}
/**
* Create the calendar date box.
*/
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'] = !empty($view->date_info->display_types['day']) ? l($vars['day'], $vars['url']) : $vars['day'];
$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';
}
else {
$vars['class'] = 'mini-day-off';
}
}
else {
$vars['class'] = 'day';
}
}
/**
* Format an calendar node for display.
*/
function template_preprocess_calendar_node(&$vars) {
$node = $vars['node'];
$view = $vars['view'];
$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;
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']) {
case 'none':
$label = '';
break;
case 'widget':
$label = $field->content_field['widget']['label'];
break;
}
}
$fields[$field_alias] = array(
'id' => views_css_safe($field_alias),
'label' => $label,
'data' => $data,
);
}
}
$vars['fields'] = $fields;
$vars['calendar_start'] = $node->calendar_start;
$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
// would show up on a node object.
$vars['node']->type = $vars['node']->node_type;
}
/**
* Format an calendar month node for display.
*/
function template_preprocess_calendar_month_node(&$vars) {
template_preprocess_calendar_node($vars);
}
/**
* Format an calendar month node for display.
*/
function template_preprocess_calendar_month_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));
}
/**
* Format an calendar day node for display.
*/
function template_preprocess_calendar_day_node(&$vars) {
template_preprocess_calendar_node($vars);
$node = $vars['node'];
// Remote items may have a teaser to show.
if (!empty($node->remote) && !empty($node->teaser)) {
$fields['teaser'] = '<div class="content">'. ($node->teaser) ."</div>\n";
}
}
/**
* Format an calendar week node for display.
*/
function template_preprocess_calendar_week_node(&$vars) {
template_preprocess_calendar_node($vars);
}
/**
* Format an calendar week node for display.
*/
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));
}
/**
* Format the time row headings in the week and day view.
*/
function theme_calendar_time_row_heading($start_time, $next_start_time, $curday_date) {
static $format_hour, $format_ampm;
if (empty($format_hour)) {
$format = variable_get('date_format_short', 'm/d/Y - H:i');
$format_hour = str_replace(array('a', 'A'), '', date_limit_format($format, array('hour', 'minute')));
$format_ampm = strstr($format, 'a') ? 'a' : (strstr($format, 'A') ? 'A' : '');
}
if ($start_time == '00:00:00' && $next_start_time == '23:59:59') {
$hour = t('All times');
}
elseif ($start_time == '00:00:00') {
$date = date_create($curday_date .' '. $next_start_time);
$hour = t('Before @time', array('@time' => date_format($date, $format_hour)));
}
else {
$date = date_create($curday_date .' '. $start_time);
$hour = date_format($date, $format_hour);
}
if (!empty($date)) {
$ampm = date_format($date, $format_ampm);
}
else {
$ampm = '';
}
return array('hour' => $hour, 'ampm' => $ampm);
}
/**
* Format a node stripe legend
*/
function theme_calendar_stripe_legend() {
if (empty($GLOBALS['calendar_stripes'])) {
return '';
}
$header = array(
array('class' => 'calendar-legend', 'data' => t('Item')),
array('class' => 'calendar-legend', 'data' => t('Key'))
);
$rows = array();
$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>');
}
}
if (!empty($rows)) {
$output .= theme('table', $header, $rows, array('class' => 'mini calendar-legend'));
}
return $output;
}
/**
* Format node stripes
*/
function theme_calendar_stripe_stripe($node) {
if (empty($node->stripe) || (!count($node->stripe))) {
return;
}
$output = '';
if(is_array($node->stripe_label)){
foreach($node->stripe_label as $k => $stripe_label){
if(!empty($node->stripe[$k]) && !empty($stripe_label)) {
$GLOBALS['calendar_stripes'][$stripe_label] = $node->stripe[$k];
$output.= '<div style="background-color:'. $node->stripe[$k] .';color:'. $node->stripe[$k] .'" class="stripe" title="Key: '. $node->stripe_label[$k] .'">&nbsp;</div>'."\n";
}
}
}
return $output;
}
/**
* Format an empty day on a calendar
*
* @param day
* 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";
}
else {
return '<div class="calendar-dayview-empty">'. t('Empty day') .'</div>';
}
}
/** @} End of addtogroup themeable */

View file

@ -0,0 +1,30 @@
# $Id: theme.cs.po,v 1.1.2.1 2010/10/22 20:06:37 wojtha Exp $
#
# Czech translation of Calendar (6.x-2.2)
# Copyright (c) 2010 by the Czech translation team
#
msgid ""
msgstr ""
"Project-Id-Version: Calendar (6.x-2.2)\n"
"POT-Creation-Date: 2010-10-22 20:03+0000\n"
"PO-Revision-Date: 2010-09-29 21:22+0000\n"
"Language-Team: Czech\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=((((n%10)==1)&&((n%100)!=11))?(0):(((((n%10)>=2)&&((n%10)<=4))&&(((n%100)<10)||((n%100)>=20)))?(1):2));\n"
msgid "Item"
msgstr "Položka"
msgid "Items"
msgstr "Položky"
msgid "Key"
msgstr "Klíč"
msgid "Add+"
msgstr "Přidat+"
msgid "All times"
msgstr "Všechny časy"
msgid "Before @time"
msgstr "Před @time"
msgid "Empty day"
msgstr "Den bez události"