CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Using Views to create iCal feed of Activities
Pages: [1]

Author Topic: Using Views to create iCal feed of Activities  (Read 626 times)

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
Using Views to create iCal feed of Activities
March 04, 2015, 07:20:31 pm
I use Activities to track certain events (I don't use civiEvents because it's overkill for these particular events). I need these activities to show up in my drupal fullcalendar view. Currently I'm importing the activities twice (once as drupal nodes and then as civi activities). I thought I could surely create a view of activities and filter the ones i need and create an iCal feed using views that I could then use Feeds in drupal to import regularly to create nodes. I can't get Views to do it because it doesn't recognize the date from civi.

Any ideas on a way I can do this without having to import the items twice? I guess I could switch to using civiEvent for this since it has iCal feed built in but I'd wind up having to completely change workflows.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Using Views to create iCal feed of Activities
March 05, 2015, 12:55:18 pm
hi - yes you 'should' be able to get civi activities data in to views.

can you make any views with civi data?

if not are you drupal and civi in different dbs - in which case find the CMS settings at civicrm/admin/setting/uf?reset=1 and follow instructions to add to settings.php

otherwise - not sure
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
Re: Using Views to create iCal feed of Activities
March 05, 2015, 06:42:02 pm
Yes I can create a view with civi data but it won't create an iCal feed because it won't recognize the date from civi.

I've done the settings thing.

This is the error I get in the feed view:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /admin/structure/views/view/activities_ical/preview/feed/ajax
StatusText: Service unavailable (with message)
ResponseText:

this is the view code:
Code: [Select]
$view = new view();
$view->name = 'activities_ical';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'civicrm_activity';
$view->human_name = 'Acitivies iCal';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Acitivies iCal';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'role';
$handler->display->display_options['access']['role'] = array(
  3 => '3',
);
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: CiviCRM Activities: Activity ID */
$handler->display->display_options['fields']['id']['id'] = 'id';
$handler->display->display_options['fields']['id']['table'] = 'civicrm_activity';
$handler->display->display_options['fields']['id']['field'] = 'id';
$handler->display->display_options['fields']['id']['label'] = '';
$handler->display->display_options['fields']['id']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['id']['separator'] = '';
/* Field: CiviCRM Activities: Subject */
$handler->display->display_options['fields']['subject']['id'] = 'subject';
$handler->display->display_options['fields']['subject']['table'] = 'civicrm_activity';
$handler->display->display_options['fields']['subject']['field'] = 'subject';
$handler->display->display_options['fields']['subject']['label'] = '';
$handler->display->display_options['fields']['subject']['element_label_colon'] = FALSE;
/* Field: CiviCRM Activities: Scheduled Activity Date */
$handler->display->display_options['fields']['activity_date_time']['id'] = 'activity_date_time';
$handler->display->display_options['fields']['activity_date_time']['table'] = 'civicrm_activity';
$handler->display->display_options['fields']['activity_date_time']['field'] = 'activity_date_time';
$handler->display->display_options['fields']['activity_date_time']['label'] = '';
$handler->display->display_options['fields']['activity_date_time']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['activity_date_time']['date_format'] = 'custom';
$handler->display->display_options['fields']['activity_date_time']['custom_date_format'] = 'Y-m-d h:i a';
$handler->display->display_options['fields']['activity_date_time']['second_date_format'] = 'privatemsg_current_day';
/* Field: CiviCRM Activities: Location */
$handler->display->display_options['fields']['location']['id'] = 'location';
$handler->display->display_options['fields']['location']['table'] = 'civicrm_activity';
$handler->display->display_options['fields']['location']['field'] = 'location';
$handler->display->display_options['fields']['location']['label'] = '';
$handler->display->display_options['fields']['location']['element_label_colon'] = FALSE;
/* Field: CiviCRM Activities: Details */
$handler->display->display_options['fields']['details']['id'] = 'details';
$handler->display->display_options['fields']['details']['table'] = 'civicrm_activity';
$handler->display->display_options['fields']['details']['field'] = 'details';
$handler->display->display_options['fields']['details']['label'] = '';
$handler->display->display_options['fields']['details']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['details']['text_format'] = 'full_html';
/* Field: CiviCRM Tags: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'civicrm_tag';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
/* Filter criterion: CiviCRM Activities: Activity Type */
$handler->display->display_options['filters']['activity_type']['id'] = 'activity_type';
$handler->display->display_options['filters']['activity_type']['table'] = 'civicrm_activity';
$handler->display->display_options['filters']['activity_type']['field'] = 'activity_type';
$handler->display->display_options['filters']['activity_type']['value'] = array(
  38 => '38',
  40 => '40',
  54 => '54',
  55 => '55',
);
/* Filter criterion: CiviCRM Activity Contacts: Activity Contact ID */
$handler->display->display_options['filters']['contact_id']['id'] = 'contact_id';
$handler->display->display_options['filters']['contact_id']['table'] = 'civicrm_activity_contact';
$handler->display->display_options['filters']['contact_id']['field'] = 'contact_id';
$handler->display->display_options['filters']['contact_id']['value']['value'] = '4610';
/* Filter criterion: CiviCRM Activities: Scheduled Activity Date */
$handler->display->display_options['filters']['activity_date_time']['id'] = 'activity_date_time';
$handler->display->display_options['filters']['activity_date_time']['table'] = 'civicrm_activity';
$handler->display->display_options['filters']['activity_date_time']['field'] = 'activity_date_time';
$handler->display->display_options['filters']['activity_date_time']['operator'] = '>=';
$handler->display->display_options['filters']['activity_date_time']['value']['value'] = 'today';
$handler->display->display_options['filters']['activity_date_time']['value']['type'] = 'offset';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'acitivies-ical';

/* Display: Feed */
$handler = $view->new_display('feed', 'Feed', 'feed');
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'date_ical';
$handler->display->display_options['style_options']['cal_name'] = '';
$handler->display->display_options['row_plugin'] = 'date_ical_fields';
$handler->display->display_options['row_options']['date_field'] = 'first_available';
$handler->display->display_options['row_options']['title_field'] = 'subject';
$handler->display->display_options['row_options']['description_field'] = 'details';
$handler->display->display_options['row_options']['location_field'] = 'location';
$handler->display->display_options['row_options']['additional_settings'] = array(
  'skip_blank_dates' => 0,
);
$handler->display->display_options['path'] = 'acitivies-ical.xml';
$handler->display->display_options['displays'] = array(
  'default' => 'default',
  'page' => 'page',
);

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Using Views to create iCal feed of Activities
March 05, 2015, 07:01:19 pm
hmm - does the data data not come in as a data type that views recognises as 'date' - that would surprise me as iirc when you try to filter on civi dates, it does treat them as date type data
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
Re: Using Views to create iCal feed of Activities
March 05, 2015, 07:44:31 pm
Yes, for the page view it shows the date fine. see the screen shot view_page.png

but for the feed view it doesn't interpret the date. see the screen shot view_feed.png

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Using Views to create iCal feed of Activities
March 05, 2015, 09:03:54 pm
have you done the equivalent with just drupal content - any obvious differences in the output of date field from a content type field v civi date field?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
Re: Using Views to create iCal feed of Activities
March 05, 2015, 09:16:29 pm
Yes, no issues with drupal content or with importing google calendar iCal feeds using Feeds.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Using Views to create iCal feed of Activities

This forum was archived on 2017-11-26.