A calendar for each organic group

seth97 - June 23, 2009 - 21:50
Project:Calendar
Version:5.x-2.7
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:calendar, Organic Groups, views
Description

Hi!
I want to create a view with a calendar for each organic group, but somehow my arguments (and breadcrumbs) are not correct and I can't find a solution.

The view is almost working but if I press 'Year' at the top I get: url/group_calendar/2009/2009 and 'Month' I get: url//group_calendar/2009/2009/06
If i manually edit the link to url//group_calendar/2009 or url//group_calendar/2009/06 everything looks fine!

What am I doing wrong?
Thanks!

Here is my view:

$view = new stdClass();
$view->name = 'calendar_group';
$view->description = 'Calendar view - modified to work on each group.';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Group Calendar';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'calendar';
$view->url = 'node/$group/group_calendar';
$view->use_pager = FALSE;
$view->nodes_per_page = '0';
$view->block = TRUE;
$view->block_title = 'Group Calendar';
$view->block_header = '';
$view->block_header_format = '1';
$view->block_footer = '';
$view->block_footer_format = '1';
$view->block_empty = '';
$view->block_empty_format = '1';
$view->block_type = 'table';
$view->nodes_per_block = '999';
$view->block_more = TRUE;
$view->block_use_page_header = FALSE;
$view->block_use_page_footer = FALSE;
$view->block_use_page_empty = FALSE;
$view->sort = array (
);
$view->argument = array (
array (
'type' => 'gid',
'argdefault' => '1',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
array (
'type' => 'calendar_year',
'argdefault' => '2',
'title' => '%1',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
array (
'type' => 'calendar_month',
'argdefault' => '2',
'title' => '%2',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
array (
'type' => 'calendar_day',
'argdefault' => '2',
'title' => '%3',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => 'Title:',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
array (
'tablename' => 'node_data_field_time',
'field' => 'field_time_value',
'label' => 'Time:',
'handler' => 'date_views_field_handler_ungroup',
'options' => 'default',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'calendar_event',
),
),
array (
'tablename' => 'og_ancestry',
'field' => 'picg',
'operator' => '=',
'options' => '',
'value' => '***CURRENT_GID***',
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, node_data_field_time, og_ancestry);
$views[$view->name] = $view;

#1

seth97 - June 24, 2009 - 21:04
Category:support request» bug report

I noticed that everything worked fine when I changed back to the previous version of Calendar module 5.x-2.6.

Everything else is the same:
Same View (as I posted above), same Date module, same OG module

So this seems to be a problem with Calendar module 5.x-2.7

Thanks!

#2

seth97 - June 25, 2009 - 07:52
Component:User interface» Code

#3

Layne - July 2, 2009 - 20:07

subscribe (I'm using Drupal 6.x)

#4

Layne - July 3, 2009 - 18:01

Forgive me if I'm hijacking this thread but I'm trying to get a calendar view to work for each organic group too.

I cloned the standard calendar view and then altered the path, arguments, and filters for the Page view. I think I'm really close to getting what I need. However, my view produces the following SQL query which is close to being correct.

SELECT node.nid AS nid,
   node.title AS node_title,
   node_data_field_time.field_time_value AS node_data_field_time_field_time_value,
   node_data_field_time.field_time_value2 AS node_data_field_time_field_time_value2,
   node_data_field_time.field_time_rrule AS node_data_field_time_field_time_rrule,
   node_data_field_time.delta AS node_data_field_time_delta,
   node.type AS node_type,
   node.vid AS node_vid,
   og_ancestry.nid AS og_ancestry_nid
FROM node node
LEFT JOIN content_field_time node_data_field_time ON node.vid = node_data_field_time.vid
LEFT JOIN og_ancestry og_ancestry ON node.nid = og_ancestry.nid
WHERE ((node.status <> 0) AND (node.type in ('event')) AND (og_ancestry.is_public <> 0) AND (og_ancestry.group_nid  = ***CURRENT_GID***) AND (og_ancestry.group_nid = 0))
    AND ((DATE_FORMAT(ADDTIME(node_data_field_time.field_time_value, SEC_TO_TIME(-25200)), '%Y-%m') <= '2009-07' AND DATE_FORMAT(ADDTIME(node_data_field_time.field_time_value2, SEC_TO_TIME(-25200)), '%Y-%m') >= '2009-07'))
   ORDER BY node_data_field_time_field_time_value ASC

I think this would work perfectly if there wasn't "AND (og_ancesty.group_nid =0)" in the generated query.

Any ideas how I might remove that from my view (or even change the "AND" to an "OR")?

Thanks.

P.S. I guess this is probably more of a Views issue than a Calendar one.

#5

Layne - July 3, 2009 - 18:03
Version:5.x-2.7» 6.x-2.1
Category:bug report» support request

#6

seth97 - July 6, 2009 - 17:26
Version:6.x-2.1» 5.x-2.7
Category:support request» bug report

@Layne to avoid confusion you could maybe start your own issue.

I reported an error that showed up in 5.x-2.7, but not in 5.x-2.6. So, I guess a specific error in the 5.x-2.7 shouldn't be mixed up with your support request for 6.x-2.1.

Or are you getting the same error as I described above?

#7

Layne - July 6, 2009 - 17:35

Seth, My apologies, you are correct.

 
 

Drupal is a registered trademark of Dries Buytaert.