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.inc,v 1.1.2.46 2010/11/28 23:31:28 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();
|
||||
|
@ -53,7 +52,7 @@ function calendar_build_calendar($view, $items) {
|
|||
break;
|
||||
}
|
||||
return $rows;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,7 +89,7 @@ function calendar_build_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'))) {
|
||||
|
@ -98,27 +97,27 @@ function calendar_build_week(&$curday, $view, $items, $check_month = FALSE) {
|
|||
if (!empty($view->date_info->display_types['week'])) {
|
||||
$weekno = l($week, $url, array('query' => !empty($view->date_info->append) ? $view->date_info->append : ''));
|
||||
}
|
||||
else {
|
||||
else {
|
||||
// Do not link week numbers, if Week views are disabled.
|
||||
$weekno = $week;
|
||||
}
|
||||
$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++) {
|
||||
$curday_date = date_format($curday, DATE_FORMAT_DATE);
|
||||
$curday_date = date_format($curday, DATE_FORMAT_DATE);
|
||||
$class = strtolower($weekdays[$i] .
|
||||
($view->date_info->mini ? ' mini' : ''));
|
||||
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 .= ' empty';
|
||||
$content = array(
|
||||
'date' => '',
|
||||
'datebox' => '',
|
||||
'empty' => theme('calendar_empty_day', $curday_date, $view),
|
||||
'date' => '',
|
||||
'datebox' => '',
|
||||
'empty' => theme('calendar_empty_day', $curday_date, $view),
|
||||
'link' => '',
|
||||
'all_day' => array(),
|
||||
'all_day' => array(),
|
||||
'items' => array(),
|
||||
);
|
||||
}
|
||||
|
@ -129,7 +128,7 @@ function calendar_build_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);
|
||||
|
@ -189,10 +188,10 @@ 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),
|
||||
'date' => $curday_date,
|
||||
'datebox' => theme('calendar_datebox', $curday_date, $view, $items, $selected),
|
||||
'empty' => $empty,
|
||||
'link' => $link,
|
||||
'all_day' => $all_day,
|
||||
|
@ -200,4 +199,3 @@ function calendar_build_day($curday, $view, $items) {
|
|||
);
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
//$Id: calendar.views.inc,v 1.1.2.11 2010/11/29 11:41:58 karens Exp $
|
||||
/**
|
||||
* Implementation of hook_views_query()
|
||||
*
|
||||
*
|
||||
* Handle the date_popup calendar goto date.
|
||||
*/
|
||||
function calendar_views_query_alter(&$view, &$query) {
|
||||
|
@ -10,24 +9,24 @@ function calendar_views_query_alter(&$view, &$query) {
|
|||
if (isset($_POST['calendar_goto']) && $_POST['view_name'] == $view->name) {
|
||||
require_once('./'. drupal_get_path('module', 'date_api') .'/date_api_elements.inc');
|
||||
$format = date_limit_format(variable_get('date_format_short', 'm/d/Y - H:i'), array('year', 'month', 'day'));
|
||||
$date = date_convert_from_custom($_POST['calendar_goto']['date'], $format);
|
||||
$date = date_convert_from_custom($_POST['calendar_goto']['date'], $format);
|
||||
switch ($_POST['calendar_type']) {
|
||||
case 'year':
|
||||
$arg = date_pad(date_part_extract($date, 'year'), 4);
|
||||
break;
|
||||
break;
|
||||
case 'month':
|
||||
$arg = date_pad(date_part_extract($date, 'year'), 4) .'-'. date_pad(date_part_extract($date, 'month'));
|
||||
break;
|
||||
break;
|
||||
case 'week':
|
||||
$ww = date_day_of_week($date, DATE_ISO);
|
||||
$ww = variable_get('date_first_day', 1) ? ($ww == 0 ? 6 : $ww - 1) : $ww;
|
||||
$date = date('Y-m-d', strtotime("-$ww days", strtotime($date)));
|
||||
$arg = date_pad(date_part_extract($date, 'year'), 4) .'-W'. date_pad(date_week($date));
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$arg = date_pad(date_part_extract($date, 'year'), 4) .'-'. date_pad(date_part_extract($date, 'month')) .'-'. date_pad(date_part_extract($date, 'day'));
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
drupal_goto(str_replace($_POST['calendar_previous_arg'], $arg, $_POST['view_url']));
|
||||
exit();
|
||||
|
@ -40,34 +39,34 @@ function calendar_views_pre_view(&$view, &$display_id, &$args) {
|
|||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
*
|
||||
* Creates calendar displays of Views results.
|
||||
*
|
||||
*
|
||||
* Create a new calendar by enabling or cloning the default calendar,
|
||||
* changing the date argument to use the correct date field(s), and setting
|
||||
* up the year, month, day, week, and block views with the desired styles
|
||||
* up the year, month, day, week, and block views with the desired styles
|
||||
* and fields.
|
||||
*
|
||||
*
|
||||
* Unlike previous versions of the Calendar module, there is just a single
|
||||
* Date argument instead of year, month, and day arguments. The argument
|
||||
* value will be YYYY-MM-DD for a day, YYYY-MM for a month, YYYY for a
|
||||
* year, and YYYY-W99 for a week. There is a default option to set the
|
||||
* year, and YYYY-W99 for a week. There is a default option to set the
|
||||
* argument to the current date when the argument is empty.
|
||||
*
|
||||
* A calendar display creates calendar navigation and links to
|
||||
*
|
||||
* A calendar display creates calendar navigation and links to
|
||||
* multiple displays for the year, month, day, or week views. The actual
|
||||
* displays are created by attaching calendar views that use whatever
|
||||
* styles are desired for those pages.
|
||||
*
|
||||
* styles are desired for those pages.
|
||||
*
|
||||
* Calendar views are attachments to create the year, month, day,
|
||||
* and week displays. They can be set to use any style, either a
|
||||
* calendar style or any other Views style, like teasers or lists.
|
||||
* If you don't want to use one of them, don't attach it to
|
||||
* anything. Only the attached views will show up in the calendar.
|
||||
*
|
||||
*
|
||||
* A calendar block will create a calendar block for the
|
||||
* view results. Attach a block view to the block and set up the
|
||||
* desired style in the block view.
|
||||
* desired style in the block view.
|
||||
*/
|
||||
/**
|
||||
* Implementation of hook_views_plugins
|
||||
|
@ -78,7 +77,7 @@ function calendar_views_plugins() {
|
|||
if (module_exists('calendar_multiday')) {
|
||||
$theme_path = drupal_get_path('module', 'calendar_multiday');
|
||||
}
|
||||
|
||||
|
||||
$views_path = drupal_get_path('module', 'views');
|
||||
require_once "./$theme_path/theme/theme.inc";
|
||||
|
||||
|
@ -135,7 +134,7 @@ function calendar_views_plugins() {
|
|||
'admin' => t('Calendar page'),
|
||||
'help topic' => 'getting-started',
|
||||
'js' => array(
|
||||
'misc/farbtastic/farbtastic.js',
|
||||
'misc/farbtastic/farbtastic.js',
|
||||
drupal_get_path('module', 'calendar') .'/js/calendar_colorpicker.js',
|
||||
),
|
||||
),
|
||||
|
@ -222,13 +221,13 @@ function calendar_views_plugins() {
|
|||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
if (module_exists('calendar_multiday')) {
|
||||
$data['style']['calendar_style']['additional themes'] += array(
|
||||
'calendar_day_overlap' => 'style',
|
||||
'calendar_week_overlap' => 'style',
|
||||
'calendar_week_overlap' => 'style',
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
<?php
|
||||
//$Id: calendar.views_default.inc,v 1.1.2.23 2010/11/28 23:31:28 karens Exp $
|
||||
/**
|
||||
* Set up so it can be used as an API to create default calendars for
|
||||
* specific date fields.
|
||||
*
|
||||
*
|
||||
* Use variable_set() to establish criteria for default calendars.
|
||||
* Set the variable in custom modules or in settings.
|
||||
*
|
||||
* Set the variable in custom modules or in settings.
|
||||
*
|
||||
* Example: Add a new default calendar to custom
|
||||
* calendars that are already configured:
|
||||
*
|
||||
*
|
||||
* $options = variable_get('calendar_default_view_options', array());
|
||||
* $option = array(
|
||||
* 'name' => 'example_event',
|
||||
|
@ -20,19 +19,19 @@
|
|||
* );
|
||||
* $options[] = $option;
|
||||
* variable_set('calendar_default_view_options', $options);
|
||||
*
|
||||
*
|
||||
*/
|
||||
function calendar_views_default_views() {
|
||||
$views = array();
|
||||
|
||||
|
||||
// Construct the default view with default options.
|
||||
$view = calendar_views_construct();
|
||||
$views[$view->name] = $view;
|
||||
|
||||
// Then see if there are any custom calendars to be created
|
||||
|
||||
// Then see if there are any custom calendars to be created
|
||||
// using variable_get().
|
||||
$calendar_options = variable_get('calendar_default_view_options', array());
|
||||
|
||||
|
||||
foreach ((array) $calendar_options as $calendar_option) {
|
||||
$view = calendar_views_construct($calendar_option);
|
||||
$views[$view->name] = $view;
|
||||
|
@ -41,31 +40,31 @@ function calendar_views_default_views() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Construct a default calendar to match specified options.
|
||||
* Views calls it without options, so the basic
|
||||
* Views calls it without options, so the basic
|
||||
* default view will use the default values.
|
||||
*
|
||||
* @param $options: an optional array of options to
|
||||
*
|
||||
* @param $options: an optional array of options to
|
||||
* create default calendars.
|
||||
*
|
||||
*
|
||||
* Possible options include:
|
||||
* @param string $name:
|
||||
* @param string $name:
|
||||
* The view name, if empty, defaults to 'calendar'.
|
||||
* @param string $description:
|
||||
* @param string $description:
|
||||
* The view description, if empty, defaults to generic description.
|
||||
* @param string $path:
|
||||
* @param string $path:
|
||||
* The view url, if empty, defaults to 'calendar'.
|
||||
* @param array $types:
|
||||
* Array of content types to limit the calendar to those types.
|
||||
* @param array $types:
|
||||
* Array of content types to limit the calendar to those types.
|
||||
* If empty, defaults to no type filter.
|
||||
* @param array $date_fields:
|
||||
* @param array $date_fields:
|
||||
* Date fields used to filter the calendar.
|
||||
* If empty, defaults to array('changed') for node.changed.
|
||||
* @param array $display_fields:
|
||||
* @param array $display_fields:
|
||||
* Fields to display in the calendar.
|
||||
* If empty, defaults to title and date fields.
|
||||
*
|
||||
*
|
||||
* @return the default calendar array.
|
||||
*/
|
||||
function calendar_views_construct($options = NULL) {
|
||||
|
@ -76,7 +75,7 @@ $path = NULL;
|
|||
$types = NULL;
|
||||
$date_fields = NULL;
|
||||
$display_fields = NULL;
|
||||
|
||||
|
||||
if (empty($options)) {
|
||||
$disabled = TRUE;
|
||||
}
|
||||
|
@ -126,7 +125,7 @@ foreach ($date_fields as $key => $field_name) {
|
|||
$cck_field = FALSE;
|
||||
}
|
||||
$fields[$alias] = $alias;
|
||||
|
||||
|
||||
// Add a sort for each date field:
|
||||
$sort_fields[$field_name] = array(
|
||||
'order' => 'ASC',
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
<?php
|
||||
// $Id: calendar_plugin_display_attachment.inc,v 1.1.2.22 2011/01/03 02:39:05 karens Exp $
|
||||
/**
|
||||
* The plugin that handles calendar attachment displays.
|
||||
*
|
||||
*
|
||||
* Adding year/month/day/week pages as attachments makes it
|
||||
* possible to use any style type, so they could be tables,
|
||||
* lists, teasers, or nodes as well as traditional calendar
|
||||
* pages.
|
||||
*
|
||||
* Force 'inherit_arguments' and 'inherit_filters' to TRUE,
|
||||
* and 'attachment_position' to 'after', and don't display
|
||||
*
|
||||
* Force 'inherit_arguments' and 'inherit_filters' to TRUE,
|
||||
* and 'attachment_position' to 'after', and don't display
|
||||
* those options in the UI.
|
||||
*
|
||||
* Allows paging (regular attachments do not), and adds an option
|
||||
*
|
||||
* Allows paging (regular attachments do not), and adds an option
|
||||
* to choose what calendar period this display represents.
|
||||
*/
|
||||
class calendar_plugin_display_attachment extends views_plugin_display_attachment {
|
||||
|
@ -27,7 +26,7 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
}
|
||||
return $this->view->style_plugin->render($this->view->result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create an array of possible display periods.
|
||||
*/
|
||||
|
@ -43,9 +42,9 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
$types = calendar_display_types();
|
||||
$default = $this->get_option('calendar_type');
|
||||
if (!array_key_exists($default, $types)) $default = 'month';
|
||||
return $default;
|
||||
return $default;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Inspect argument and view information to see which calendar
|
||||
|
@ -54,7 +53,7 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
* if there are values.
|
||||
*/
|
||||
function display_granularity($display_id) {
|
||||
|
||||
|
||||
$arguments = $this->view->get_items('argument', $display_id);
|
||||
$wildcard = '';
|
||||
$argument = '';
|
||||
|
@ -84,19 +83,19 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
}
|
||||
return $view_granularity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display validation.
|
||||
*/
|
||||
function validate() {
|
||||
$errors = parent::validate();
|
||||
|
||||
|
||||
$arguments = $this->display->handler->get_option('arguments');
|
||||
if (!in_array('date_argument', array_keys($arguments))) {
|
||||
if (empty($this->view->date_info->arg_missing)) {
|
||||
$errors[] = t("A Calendar period display will not work without a Date argument.");
|
||||
$errors[] = t("A Calendar period display will not work without a Date argument.");
|
||||
}
|
||||
$this->view->date_info->arg_missing = TRUE;
|
||||
$this->view->date_info->arg_missing = TRUE;
|
||||
}
|
||||
elseif ($arguments['date_argument']['default_action'] != 'default' || $arguments['date_argument']['default_argument_type'] != 'date') {
|
||||
if (empty($this->view->date_info->arg_missing_default)) {
|
||||
|
@ -107,21 +106,21 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attach only the appropriate displays for the current argument.
|
||||
*/
|
||||
function attach_to($display_id) {
|
||||
$display_granularity = $this->calendar_type();
|
||||
$view_granularity = $this->display_granularity($display_id);
|
||||
|
||||
// If this is not the right display to show,
|
||||
|
||||
// If this is not the right display to show,
|
||||
// don't attach it, just exit.
|
||||
if ($view_granularity != $display_granularity) {
|
||||
unset($this->display);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->view->date_info->parent_id = $display_id;
|
||||
|
||||
// See if we're attaching to a block rather than a page.
|
||||
|
@ -139,7 +138,7 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
$this->view->date_info->calendar_colors_group = $this->view->display[$display_id]->handler->options['calendar_colors_group'];
|
||||
$this->view->date_info->calendar_popup = $this->view->display[$display_id]->handler->options['calendar_popup'];
|
||||
$this->view->date_info->calendar_date_link = $this->view->display[$display_id]->handler->options['calendar_date_link'];
|
||||
}
|
||||
}
|
||||
parent::attach_to($display_id);
|
||||
}
|
||||
|
||||
|
@ -149,17 +148,17 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
$this->view->date_info->display_granularity = $this->calendar_type();
|
||||
$this->view->date_info->calendar_type = $this->calendar_type();
|
||||
}
|
||||
|
||||
|
||||
function query() {
|
||||
// If we are using legend colors based on taxonomy, make sure the
|
||||
// If we are using legend colors based on taxonomy, make sure the
|
||||
// node vid field is added to the query so the theme can use it.
|
||||
if (!empty($this->view->date_info->calendar_colors_taxonomy)) {
|
||||
if (empty($this->additional_fields)) $this->additional_fields = array();
|
||||
if (empty($this->additional_fields)) $this->additional_fields = array();
|
||||
$this->view->query->add_field('node', 'vid');
|
||||
}
|
||||
parent::query();
|
||||
parent::query();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Override some of the parent options.
|
||||
*/
|
||||
|
@ -168,7 +167,7 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
$display['inherit_argments'] = TRUE;
|
||||
$display['inherit_filters'] = TRUE;
|
||||
$display['attachment_position'] = 'after';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom option definitions.
|
||||
|
@ -178,11 +177,11 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
$options['calendar_type'] = array('default' => $this->calendar_type());
|
||||
return $options;
|
||||
}
|
||||
|
||||
|
||||
function options_form(&$form, &$form_state) {
|
||||
// It is very important to call the parent function here:
|
||||
parent::options_form($form, $form_state);
|
||||
|
||||
|
||||
switch ($form_state['section']) {
|
||||
case 'calendar_type':
|
||||
$form['#title'] .= t('Calendar period');
|
||||
|
@ -210,7 +209,7 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provide the summary for attachment options in the views UI.
|
||||
*
|
||||
|
@ -222,7 +221,7 @@ class calendar_plugin_display_attachment extends views_plugin_display_attachment
|
|||
$categories['calendar_settings'] = array(
|
||||
'title' => t('Calendar settings'),
|
||||
);
|
||||
|
||||
|
||||
$options['calendar_type'] = array(
|
||||
'category' => 'calendar_settings',
|
||||
'title' => t('Calendar period'),
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
// $Id: calendar_plugin_display_block.inc,v 1.1.2.12 2010/12/28 15:35:50 karens Exp $
|
||||
/**
|
||||
* The plugin that handles a calendar block.
|
||||
*
|
||||
*
|
||||
* The only style option that will be available is the calendar
|
||||
* style, which creates the navigation and links to other calendar
|
||||
* displays. All options for paging, row plugins, etc. are
|
||||
|
@ -13,31 +12,31 @@ class calendar_plugin_display_block extends views_plugin_display_block {
|
|||
function init(&$view, &$display, $options = NULL) {
|
||||
parent::init($view, $display, $options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display validation.
|
||||
*/
|
||||
function validate() {
|
||||
$errors = parent::validate();
|
||||
|
||||
|
||||
$arguments = $this->display->handler->get_option('arguments');
|
||||
if (!in_array('date_argument', array_keys($arguments))) {
|
||||
if (empty($this->view->date_info->arg_missing)) {
|
||||
$errors[] = t("The Calendar period display '@display_title' will not work without a Date argument.", array('@display_title' => $this->definition['title']));
|
||||
$errors[] = t("The Calendar period display '@display_title' will not work without a Date argument.", array('@display_title' => $this->definition['title']));
|
||||
}
|
||||
$this->view->date_info->arg_missing = TRUE;
|
||||
}
|
||||
elseif ($arguments['date_argument']['default_action'] != 'default' || $arguments['date_argument']['default_argument_type'] != 'date') {
|
||||
if (empty($this->view->date_info->arg_missing_default)) {
|
||||
$errors[] = calendar_errors('missing_argument_default');
|
||||
$errors[] = calendar_errors('missing_argument_default');
|
||||
}
|
||||
$this->view->date_info->arg_missing_default = TRUE;
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
function get_style_type() { return 'calendar'; }
|
||||
|
||||
|
||||
function defaultable_sections($section = NULL) {
|
||||
if (in_array($section, array('style_plugin', 'row_options', 'row_plugin', 'items_per_page'))) {
|
||||
return FALSE;
|
||||
|
@ -58,11 +57,11 @@ class calendar_plugin_display_block extends views_plugin_display_block {
|
|||
$display['defaults']['items_per_page'] = FALSE;
|
||||
$display['defaults']['row_plugin'] = FALSE;
|
||||
$display['defaults']['row_options'] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The display block handler returns the structure necessary for a block.
|
||||
*
|
||||
*
|
||||
* TODO This can be removed when the patch at http://drupal.org/node/290328
|
||||
* gets into an official release.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
<?php
|
||||
// $Id: calendar_plugin_display_page.inc,v 1.1.2.25 2011/01/03 02:39:05 karens Exp $
|
||||
/**
|
||||
* The plugin that handles a full calendar page.
|
||||
*
|
||||
*
|
||||
* The only style option that will be available is the calendar
|
||||
* style, which creates the navigation and links to other calendar
|
||||
* displays. All options for paging, row plugins, etc. are
|
||||
* deferred to the attachments.
|
||||
*/
|
||||
class calendar_plugin_display_page extends views_plugin_display_page {
|
||||
|
||||
|
||||
function render() {
|
||||
if (!empty($this->view->date_info->forbid)) {
|
||||
drupal_not_found();
|
||||
|
@ -23,11 +22,11 @@ class calendar_plugin_display_page extends views_plugin_display_page {
|
|||
*/
|
||||
function validate() {
|
||||
$errors = parent::validate();
|
||||
|
||||
|
||||
$arguments = $this->display->handler->get_option('arguments');
|
||||
if (!in_array('date_argument', array_keys($arguments))) {
|
||||
if (empty($this->view->date_info->arg_missing)) {
|
||||
$errors[] = t("The Calendar display '@display_title' will not work without a Date argument.", array('@display_title' => $this->definition['title']));
|
||||
$errors[] = t("The Calendar display '@display_title' will not work without a Date argument.", array('@display_title' => $this->definition['title']));
|
||||
}
|
||||
$this->view->date_info->arg_missing = TRUE;
|
||||
}
|
||||
|
@ -37,12 +36,12 @@ class calendar_plugin_display_page extends views_plugin_display_page {
|
|||
}
|
||||
$this->view->date_info->arg_missing_default = TRUE;
|
||||
}
|
||||
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
function get_style_type() { return 'calendar'; }
|
||||
|
||||
|
||||
function defaultable_sections($section = NULL) {
|
||||
if (in_array($section, array('style_plugin', 'row_options', 'row_plugin', 'items_per_page'))) {
|
||||
return FALSE;
|
||||
|
@ -63,11 +62,11 @@ class calendar_plugin_display_page extends views_plugin_display_page {
|
|||
$display['defaults']['row_plugin'] = FALSE;
|
||||
$display['defaults']['row_options'] = FALSE;
|
||||
$display['defaults']['items_per_page'] = FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom option definitions.
|
||||
*/
|
||||
*/
|
||||
function option_definition () {
|
||||
$options = parent::option_definition();
|
||||
$options['calendar_colors'] = array('default' => array());
|
||||
|
@ -91,7 +90,7 @@ class calendar_plugin_display_page extends views_plugin_display_page {
|
|||
$categories['calendar_settings'] = array(
|
||||
'title' => theme('advanced_help_topic', 'calendar', 'settings') . t('Calendar settings'),
|
||||
);
|
||||
|
||||
|
||||
$colors = $this->get_option('calendar_colors');
|
||||
$colors_taxonomy = $this->get_option('calendar_colors_taxonomy');
|
||||
$options['calendar_colors'] = array(
|
||||
|
@ -132,15 +131,15 @@ class calendar_plugin_display_page extends views_plugin_display_page {
|
|||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function popup_options() {
|
||||
return array(0 => t('No'), 1 => t('Yes'));
|
||||
}
|
||||
|
||||
|
||||
function options_form(&$form, &$form_state) {
|
||||
// It is very important to call the parent function here:
|
||||
parent::options_form($form, $form_state);
|
||||
|
||||
|
||||
switch ($form_state['section']) {
|
||||
case 'calendar_popup':
|
||||
$form['#title'] .= t('Date changer');
|
||||
|
@ -149,9 +148,9 @@ class calendar_plugin_display_page extends views_plugin_display_page {
|
|||
'#default_value' => $this->get_option('calendar_popup'),
|
||||
'#options' => $this->popup_options(),
|
||||
'#description' => t('Display a popup calendar date selector?'),
|
||||
);
|
||||
);
|
||||
break;
|
||||
|
||||
|
||||
case 'calendar_date_link':
|
||||
$form['#title'] .= t('Add new date link');
|
||||
$form['calendar_date_link'] = array(
|
||||
|
@ -159,7 +158,7 @@ class calendar_plugin_display_page extends views_plugin_display_page {
|
|||
'#default_value' => $this->get_option('calendar_date_link'),
|
||||
'#options' => array('' => t('No link')) + node_get_types('names'),
|
||||
'#description' => t('Display a link to add a new date of the specified content type. Displayed only to users with appropriate permissions.'),
|
||||
);
|
||||
);
|
||||
break;
|
||||
|
||||
case 'calendar_colors':
|
||||
|
@ -173,7 +172,7 @@ class calendar_plugin_display_page extends views_plugin_display_page {
|
|||
'#prefix' => '<div class="clear-block"><div style="float:left">',
|
||||
'#suffix' => '</div>',
|
||||
);
|
||||
$colors = $this->get_option('calendar_colors');
|
||||
$colors = $this->get_option('calendar_colors');
|
||||
|
||||
switch ($method) {
|
||||
case 'types':
|
||||
|
@ -293,6 +292,6 @@ class calendar_plugin_display_page extends views_plugin_display_page {
|
|||
variable_set('calendar_date_link_'. $form_state['values']['calendar_date_link'], $this->display->handler->get_option('path'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
<?php
|
||||
// $Id: calendar_plugin_style.inc,v 1.1.2.18 2011/01/03 02:39:05 karens Exp $
|
||||
/**
|
||||
* Style plugin to create the calendar navigation and links.
|
||||
*
|
||||
*
|
||||
* Used by the main calendar page and calendar block displays.
|
||||
*/
|
||||
class calendar_plugin_style extends views_plugin_style {
|
||||
/**
|
||||
* Init will be called after construct, when the plugin is attached to a
|
||||
* view and a display.
|
||||
* view and a display.
|
||||
*/
|
||||
function init(&$view, &$display, $options = NULL) {
|
||||
parent::init($view, $display, $options);
|
||||
|
@ -17,7 +16,7 @@ class calendar_plugin_style extends views_plugin_style {
|
|||
}
|
||||
$view->date_info->display_types = $this->display_types();
|
||||
}
|
||||
|
||||
|
||||
function display_types($granularity = NULL, $option_type = 'names') {
|
||||
$ids = array();
|
||||
$names = array();
|
||||
|
@ -39,7 +38,7 @@ class calendar_plugin_style extends views_plugin_style {
|
|||
}
|
||||
return $$option_type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calendar argument date fields used in this view.
|
||||
*/
|
||||
|
@ -61,7 +60,7 @@ class calendar_plugin_style extends views_plugin_style {
|
|||
}
|
||||
return ($date_fields);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Style validation.
|
||||
*/
|
||||
|
@ -71,11 +70,11 @@ class calendar_plugin_style extends views_plugin_style {
|
|||
return $errors;
|
||||
}
|
||||
$style = $this->display->display_options['style_plugin'];
|
||||
|
||||
|
||||
$arguments = $this->display->handler->get_option('arguments');
|
||||
if (!in_array('date_argument', array_keys($arguments))) {
|
||||
if (empty($this->view->date_info->arg_missing)) {
|
||||
$errors[$style] = t("The @style style requires a Date argument.", array('@style' => $style));
|
||||
$errors[$style] = t("The @style style requires a Date argument.", array('@style' => $style));
|
||||
}
|
||||
$this->view->date_info->arg_missing = TRUE;
|
||||
$this->date_info->arg_fields = array();
|
||||
|
@ -86,13 +85,13 @@ class calendar_plugin_style extends views_plugin_style {
|
|||
$this->date_info->arg_fields = $arguments['date_argument']['date_fields'];
|
||||
if ($arguments['date_argument']['default_action'] != 'default' || $arguments['date_argument']['default_argument_type'] != 'date') {
|
||||
if (empty($this->view->date_info->arg_missing_default)) {
|
||||
$errors[] = calendar_errors('missing_argument_default');
|
||||
$errors[] = calendar_errors('missing_argument_default');
|
||||
}
|
||||
$this->view->date_info->arg_missing_default = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure date fields are not set up to 'Group multiple values'
|
||||
|
||||
// Make sure date fields are not set up to 'Group multiple values'
|
||||
// in the calendar style.
|
||||
if ($style == 'calendar_style') {
|
||||
$view_fields = date_api_fields($this->view->base_table);
|
||||
|
@ -123,14 +122,14 @@ class calendar_plugin_style extends views_plugin_style {
|
|||
}
|
||||
|
||||
function query() {
|
||||
|
||||
|
||||
require_once('./'. drupal_get_path('module', 'date_api') .'/date_api_sql.inc');
|
||||
|
||||
|
||||
$style_options = $this->view->style_plugin->options;
|
||||
|
||||
// Evaluate our argument values and figure out which
|
||||
|
||||
// Evaluate our argument values and figure out which
|
||||
// calendar display we need to create.
|
||||
$i = 0;
|
||||
$i = 0;
|
||||
foreach ($this->view->argument as $id => $argument) {
|
||||
if ($argument->field == 'date_argument') {
|
||||
// TODO Decide if we want to provide a date here or not.
|
||||
|
@ -154,7 +153,7 @@ class calendar_plugin_style extends views_plugin_style {
|
|||
$this->view->date_info->min_date_date = date_format($this->view->date_info->min_date, DATE_FORMAT_DATE);
|
||||
$this->view->date_info->max_date_date = date_format($this->view->date_info->max_date, DATE_FORMAT_DATE);
|
||||
$this->view->date_info->forbid = isset($argument->forbid) ? $argument->forbid : FALSE;
|
||||
|
||||
|
||||
// Stop after the first date argument, if there is more than one.
|
||||
break;
|
||||
}
|
||||
|
@ -163,15 +162,15 @@ class calendar_plugin_style extends views_plugin_style {
|
|||
$this->view->date_info->display_types = $this->display_types();
|
||||
$keys = drupal_map_assoc(array_keys(calendar_display_types()));
|
||||
$this->view->date_info->calendar_type = $keys[$this->view->date_info->granularity];
|
||||
|
||||
|
||||
// bring the node type into the query so we can use it in the theme
|
||||
if ($this->view->base_table == 'node') {
|
||||
$this->view->query->add_field('node', 'type');
|
||||
}
|
||||
|
||||
|
||||
parent::query();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render the calendar navigation style.
|
||||
*/
|
||||
|
@ -179,4 +178,3 @@ class calendar_plugin_style extends views_plugin_style {
|
|||
return theme($this->theme_functions(), $this->view, $this->options, array());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
// $Id: calendar_view_plugin_style.inc,v 1.1.2.21 2010/12/28 15:35:50 karens Exp $
|
||||
|
||||
/**
|
||||
* Style plugin to render the year, month, week, or day calendar view.
|
||||
*/
|
||||
|
@ -8,7 +6,7 @@ class calendar_view_plugin_style extends calendar_plugin_style {
|
|||
|
||||
/**
|
||||
* Init will be called after construct, when the plugin is attached to a
|
||||
* view and a display.
|
||||
* view and a display.
|
||||
*/
|
||||
function init(&$view, &$display, $options = NULL) {
|
||||
parent::init($view, $display, $options);
|
||||
|
@ -26,15 +24,15 @@ class calendar_view_plugin_style extends calendar_plugin_style {
|
|||
$view->date_info->style_groupby_times = calendar_groupby_times($this->options['groupby_times']);
|
||||
}
|
||||
$view->date_info->style_groupby_field = $this->options['groupby_field'];
|
||||
|
||||
|
||||
// TODO make this an option setting.
|
||||
$view->date_info->style_show_empty_times = !empty($this->options['groupby_times_custom']) ? TRUE : FALSE;
|
||||
|
||||
|
||||
// Make sure views does't try to limit the number of items in this view.
|
||||
$this->view->pager['items_per_page'] = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set default options
|
||||
*/
|
||||
|
@ -62,7 +60,7 @@ class calendar_view_plugin_style extends calendar_plugin_style {
|
|||
'#options' => array(1 => t('First letter of name'), 2 => t('First two letters of name'), 3 => t('Abbreviated name'), 99 => t('Full name')),
|
||||
'#description' => t('The way day of week names should be displayed in a calendar.'),
|
||||
);
|
||||
|
||||
|
||||
$form['with_weekno'] = array(
|
||||
'#title' => t('Show week numbers'),
|
||||
'#default_value' => $this->options['with_weekno'],
|
||||
|
@ -98,7 +96,7 @@ class calendar_view_plugin_style extends calendar_plugin_style {
|
|||
'#description' => t("When choosing the 'custom' Time grouping option above, create custom time period groupings as a comma-separated list of 24-hour times in the format HH:MM:SS, like '00:00:00,08:00:00,18:00:00'. Be sure to start with '00:00:00'. All items after the last time will go in the final group."),
|
||||
);
|
||||
// Create a list of fields that are available for grouping and truncation,
|
||||
// excluding the date fields in the view from the grouping options.
|
||||
// excluding the date fields in the view from the grouping options.
|
||||
$field_options = array();
|
||||
$date_field_options = array();
|
||||
$fields = $this->display->handler->get_option('fields');
|
||||
|
@ -119,8 +117,8 @@ class calendar_view_plugin_style extends calendar_plugin_style {
|
|||
'#description' => t("Optionally group items into columns by a field value, for instance select the content type to show items for each content type in their own column, or use a location field to organize items into columns by location."),
|
||||
'#options' => array('' => '') + $field_options,
|
||||
);
|
||||
|
||||
if (module_exists('calendar_multiday')) {
|
||||
|
||||
if (module_exists('calendar_multiday')) {
|
||||
$form['multiday_theme'] = array(
|
||||
'#title' => t('Multi-day style'),
|
||||
'#default_value' => $this->options['multiday_theme'],
|
||||
|
@ -135,8 +133,8 @@ class calendar_view_plugin_style extends calendar_plugin_style {
|
|||
'#options' => array(0 => t('Do not display overlapping items'), 1 => t('Display overlapping items')),
|
||||
'#description' => t('Select whether calendar items are displayed as overlapping items.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach ($form as $key => $value) {
|
||||
if ($value['#type'] == 'value') {
|
||||
$form[$key]['#value'] = $value['#default_value'];
|
||||
|
@ -170,4 +168,4 @@ class calendar_view_plugin_style extends calendar_plugin_style {
|
|||
$this->view->date_info->hide_admin_links = TRUE;
|
||||
return theme($this->theme_functions(), $this->view, $this->options, array());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue