Views + Calendar + Date : not displaying multiple content types/fields

tevih - October 27, 2009 - 17:08
Project:Calendar
Version:6.x-2.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I am trying to display multiple content types' dates in a calendar view (Yes, I have posted there, too - don't know who's issue [ besides mine :p]) and each content type has their own cck date field, for various reasons. (Event - can have "to and from"; Case tracker can have "due date" etc.)

I wanted all these dates to show up on the same calendar. I have the content types specified, and arguments and fields are all correct - I can set them up individually to display only one content type, and it displays. When I try and double-down to show more than 1 content type, they all disappear. The filters are the same (except Node: Type can include more or less options).

I've narrowed down the issue to when I try and add a fields for both content types. Since the Dates are different CCK fields, I have them all listed. If I only show the CCK field for 1 content type, then it shows up in the calendar. If I try listing both CCK date fields in the fields list, none of them show up. Shouldn't they all show up?

Here's the exported view:

$view = new view;
$view->name = 'atrium_calendar';
$view->description = 'Atrium > Calendar';
$view->tag = 'atrium';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'field_duedate_value' => array(
    'label' => 'Due date',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'long',
    'multiple' => array(
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_to' => '',
      'group' => TRUE,
    ),
    'repeat' => array(
      'show_repeat_rule' => '',
    ),
    'fromto' => array(
      'fromto' => 'both',
    ),
    'exclude' => 1,
    'id' => 'field_duedate_value',
    'table' => 'node_data_field_duedate',
    'field' => 'field_duedate_value',
    'relationship' => 'none',
  ),
  'field_date_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'default',
    'multiple' => array(
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_to' => '',
      'group' => TRUE,
    ),
    'repeat' => array(
      'show_repeat_rule' => '',
    ),
    'fromto' => array(
      'fromto' => 'value',
    ),
    'exclude' => 1,
    'id' => 'field_date_value',
    'table' => 'node_data_field_date',
    'field' => 'field_date_value',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'date_argument' => array(
    'default_action' => 'default',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'date',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'date_fields' => array(
      'node_data_field_date.field_date_value' => 'node_data_field_date.field_date_value',
      'node_data_field_date.field_date_value2' => 'node_data_field_date.field_date_value2',
      'node_data_field_duedate.field_duedate_value' => 'node_data_field_duedate.field_duedate_value',
    ),
    'year_range' => '-3:+3',
    'date_method' => 'OR',
    'granularity' => 'month',
    'id' => 'date_argument',
    'table' => 'node',
    'field' => 'date_argument',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '3' => 0,
      '5' => 0,
      '6' => 0,
      '4' => 0,
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'casetracker_basic_project' => 0,
      'casetracker_basic_case' => 0,
      'shoutbox' => 0,
      'blog' => 0,
      'book' => 0,
      'event' => 0,
      'feed_ical' => 0,
      'feed_ical_item' => 0,
      'group' => 0,
      'profile' => 0,
      'pingv_gallery' => 0,
      'pingv_image' => 0,
      'feed' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_is_member' => 0,
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'casetracker_basic_case' => 'casetracker_basic_case',
      'event' => 'event',
      'feed_ical_item' => 'feed_ical_item',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'current' => array(
    'operator' => 'active',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'current',
    'table' => 'spaces',
    'field' => 'current',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'spaces_feature',
  'spaces_feature' => 'atrium_calendar',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Calendar');
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'litecal');
$handler->override_option('style_options', array(
  'grouping' => '',
  'style' => 'full',
  'quickadd' => 'event:field_date',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'calendar/view');
$handler->override_option('menu', array(
  'type' => 'default tab',
  'title' => 'Calendar',
  'description' => '',
  'weight' => '-20',
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'normal',
  'title' => 'Calendar',
  'description' => '',
  'weight' => '0',
));
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('style_options', array(
  'grouping' => '',
  'style' => 'compact',
  'quickadd' => 'event:field_date',
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$translatables['atrium_calendar'] = array(
  t('Defaults'),
  t('Calendar'),
  t('Page'),
  t('Block'),
);

#1

merlinofchaos - October 27, 2009 - 17:18
Status:active» fixed

The issue is that they really need to be the same field. With SQL queries, it's very difficult to share different fields across something like a calendar. You can add the same field to multiple content types, though. Unfortunately, this is kind of a difficult change to make midstream, but it is what you have to do if you want this to work.

#2

dereine - October 27, 2009 - 17:20
Project:Views» Calendar
Version:6.x-2.6» 6.x-2.x-dev
Component:Views Data» Code
Status:fixed» active

I don't know how calendar works internal but i guess, it groups the result by the selected date field. Then views cannot do anything here.

Move to Calendar issue queue.

I think someone else should have asked the same question, i cannot imagine that you are the first person who wants to know this :)

#3

tevih - October 27, 2009 - 17:49

Thanks guys! I'll be following up more over there, then.

Theoretically, though, if it wasn't calendar it *would* display all values, right?

[edit]

that was confusing - Didn't realize you moved it here for me. :)

#4

tevih - October 27, 2009 - 17:58

After some searching in Calendar issues (since I wasn't sure what and where I should look for before) I came across this: http://drupal.org/node/426788

I think it may be the same issue as that, except the solution provided there does not work. The difference between what they were trying to do and what I was trying to do is that I have actual multiple CCK field types, rather than a single CCK filed with multiple values. And, nothing shows up (not even the first result, like in the above link)

#5

tevih - October 28, 2009 - 14:56

Bump. Help?

#6

tevih - November 2, 2009 - 17:57

The silence is not very reassuring.

To recap the question with extreme brevity:

I am unable to have a calendar display two different cck date fields. One cck date field type at a time displays fine. 2 types makes them all disappear.

help?

#7

tevih - November 3, 2009 - 17:43

why is nobody saying anything??

#8

awreneau - November 3, 2009 - 19:12

@tevih

I have multiple content types and I display them all on one calendar by color coding them(color coding isnt the key...this was poorly worded) . Have a look at
http://pack329.net/calendar

Is this what you want?

I have several content types:
Den1 Event
Den3 Event
Leadership
etc etc

I got started w/ Simpleviews module and had it build views for me for one content type. I then used that view to tweak the default calendar view to make it work for me.

Rather than export the view, which means nothing to me BTW, I'll list what I've got.

Relationships = NULL

Arguments = Date:Date (node) Content: Date (field name) - From Date OR Content:Date(field name) -From Date (i did this for each content type)
Node: Type

Fields Node: Type, Node: Title, Content: Date - From Date (Content:Date for each content type)

Filters = Node: Published Yes, Node: Type EACH EVENT

You'll have to tweak to your needs but maybe that will get you on the right track.

If exporting will help you I'll be glad to but I get lost in that code.

#9

tevih - November 6, 2009 - 15:36

Thanks! That might be what I'm looking for. I have one question, though - "Content: Date" in your fields, is that the same field for both content types? Or did you create two different date field types, one for each content type?

Exporting the view does not mean much for me, either, but it was one of the guidelines for submitting an issue...

#10

awreneau - November 6, 2009 - 16:34

I have a date field for each content type. However the date field is configured only on content types that have dates/events or are associated w/ the views/calendar modue(s).

Do you have your field setup as a DateTime type?

Also, this video helped me along as well as leveraging SimpleViews to help fill in the blanks some.

Something I repeatedly failed to do was override the defaults when configuring another block, just something to watch out for.

I hope that helps.

 
 

Drupal is a registered trademark of Dries Buytaert.