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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • an approach to resources and resource calendars
Pages: [1]

Author Topic: an approach to resources and resource calendars  (Read 1515 times)

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
an approach to resources and resource calendars
September 16, 2011, 11:03:23 am
we are thinking of modelling a resource as an activity type with a calendar that shows availablity / bookings of that resource making a read only calendar to show its availability.

the idea for the workflow (in this early version) is that people can see when the resource is available and then do the booking side of things manualls.

i know that others have used merci for event booking but i do like the idea of keeping it cms agnostic and taking advantage of the jquery calendar (at least in a read only sense) and i think that i am not that in to tying up this development with the merci development.

@totten - i'm interested in how cool / not cool you found the way that the civicrm_activity model handled time when you were making your calendar.  specifically that it does that via a start time and duration rather than a start and end time.  was that a problem for you, or did it make it easier when you were doing your calendar, or did it make no difference?

interested to hear thoughts on all this.
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: an approach to resources and resource calendars
September 16, 2011, 11:57:01 am
Quote from: michaelmcandrew on September 16, 2011, 11:03:23 am
@totten - i'm interested in how cool / not cool you found the way that the civicrm_activity model handled time when you were making your calendar.  specifically that it does that via a start time and duration rather than a start and end time.  was that a problem for you, or did it make it easier when you were doing your calendar, or did it make no difference?

Well, we have had a couple minor issues that involved translating between "start-timestamp,end-timestamp", "start-timestamp,duration", and "start-date,start-time,end-time". That's not really the fault of CiviCRM's data model -- the three models are useful in different contexts, and a little impedence mismatch is inevitable.

Main suggestions:
1. Make sure everyone touching the code understands which model applies and when.
2. Be wary of activities which aren't fully specified (missing duration or missing end-time)
3. Have some good helpers/functions to handle conversions. In PHP, the "date" and "strtotime" functions can do this, e.g.

Code: [Select]
  $start_time = '2011-09-16 23:45:00';
  $duration = 30;
  $end_time = date('Y-m-d H:i:s',
     strtotime("+${duration} minutes",
       strtotime($start_time)
     )
  );

In Javascript, datajs.com looks pretty handy. (That's the tool bundled with jQuery week-calendar. Not sure what's used in jQuery full-calendar.)

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: an approach to resources and resource calendars
September 22, 2011, 11:09:39 am
Thanks for the reply Tim. I'm going to download the code you have at http://code.locker10.com/ that you reference here: http://civicrm.org/blogs/totten/experimenting-activity-calendars to get me started.

I am wondering if the calendar library you used will allow me to only add meetings where no meetings already exist, etc. etc.

Will find all this out soon enough I guess :)
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • an approach to resources and resource calendars

This forum was archived on 2017-11-26.