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 »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • iCalendar.php: Could it save the ics file?
Pages: [1]

Author Topic: iCalendar.php: Could it save the ics file?  (Read 6325 times)

WebTeam

  • Guest
iCalendar.php: Could it save the ics file?
May 02, 2007, 11:42:37 pm
I've been searching and reading about getting the events entered via CiviEvent to display in Drupal's Calendar module. My event organizers, while very experienced in Texas nature topics, are not experienced computer users. It's got to be as simple as possible.

If my understanding is correct, every time there is a change in CiviEvents, our Event Organizers will need to download  'civicrm_ical.ics' to their computer and then upload the file to our server.

I am used to operating in Perl, new to php and CiviCRM, so I am offering this solution as an amateur. Wouldn't it be easy to add a function to save 'civicrm_ical.ics'?

You would need to start with a blank file as /drupal/files/civicrm/crm_docs/civicrm_ical.ics.

Add the function to /modules/civicrm/utils/iCalendar.php.

Code: [Select]
function overwrite_ics($filename, $format)
{
  $myFile = "/files/CRM/crm_docs/$filename";
  $fh = fopen($myFile, 'w') or die("can't open file");
  fwrite($fh, $format);
  fwrite($fh, $format);
  fclose($fh);
}

You could activate it in /modules/civicrm/Event/Page/iCalendar.php.

Code: [Select]
...other stuff
 require_once "CRM/Utils/ICalendar.php";
 $format = CRM_Utils_ICalendar::iCalendar( $info );

 if( $iCalPage == 1) {
      echo $format;
       exit();
 }

 CRM_Utils_ICalendar::send( 'civicrm_ical.ics', 'attachment', 'utf-8', $format );
 CRM_Utils_ICalendar::overwrite_ics( 'civicrm_ical.ics', $format );
 exit( );





Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: iCalendar.php: Could it save the ics file?
May 03, 2007, 12:50:22 am

WebTeam:

We will be documenting in the next week or so how to connect Drupal Calendar and CiviCRM events. We have tested this out on demo and are quite pleased with the results. We'll update the forum when the documentation is ready

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Michał Mach

  • Ask me questions
  • ****
  • Posts: 748
  • Karma: 59
    • CiviCRM site
  • CiviCRM version: latest
  • CMS version: Drupal and Joomla latest
  • MySQL version: numerous
  • PHP version: 5.3 and 5.2
Re: iCalendar.php: Could it save the ics file?
May 03, 2007, 02:38:27 am
Quickly describing what has been done on our demo instance (http://demo.civicrm.org/):

1. Install calendar module (and two others required by it: views and date)
2. Allow anonymous users to register for events in CiviCRM (this will make the iCal file accessible to everyone)
3. Go to Administer CiviCRM -> Manage Events and copy the link under "Browse iCalendar Listing"
3. Go to calendar and add new iCal feed source using the link you copied above.

There is probably also the matter of making calendar refresh the feed periodically with cron job - I didn't check this.

michau
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

My absolute favourite: Wordpress Integration!.

Donate Now!

j.q

  • Guest
Re: iCalendar.php: Could it save the ics file?
May 06, 2007, 08:13:56 am
Where could I find the iCal file for the events created through CiviEvents? I do get the iCal file generated from Drupal calendar. The only link I get from CiviEvents is the live URL but that is not an iCal link. On point 2 you state that anon users have access to iCal, where exactly do they?

Thanks in advance.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: iCalendar.php: Could it save the ics file?
May 06, 2007, 08:43:53 am
The links to both the iCalendar "feed" and to "download" an .ics file are both displayed on the Administer CiviCRM >> Manage Events page. In the demo site, go to:
http://demo.civicrm.org/drupal/civicrm/admin/event?reset=1

You'll see the links above the listing of events. Copy and paste them to wherever you want to expose them (or enter them in a iCal capable calendar).

For our demo, the iCal feed is:
http://demo.civicrm.org/drupal/civicrm/event/ical?reset=1&page=1
Protect your investment in CiviCRM by  becoming a Member!

j.q

  • Guest
Re: iCalendar.php: Could it save the ics file?
May 07, 2007, 08:17:05 am
Got it. Thanks!

keitha

  • Guest
Re: iCalendar.php: Could it save the ics file?
September 03, 2007, 03:41:44 am
Hi
Did the documentation referred to get published yet?
I am struggling with an "Invalid input file" error when I enter my iCal feed into Calendar

(my feed is http://192.168.61.132/drupal/index.php?q=civicrm/event/ical&reset=1&page=1)

I'm sure I can find the solution eventually but it is feeling like hard work to get this working...

Thanks
Keith

keitha

  • Guest
Re: iCalendar.php: Could it save the ics file?
September 03, 2007, 03:56:20 am
OK, fixed the last error by actually following the instructions (hadn't actually enabled anonymous users to register for events).
But no events displaying in my calendar...

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • iCalendar.php: Could it save the ics file?

This forum was archived on 2017-11-26.