recurring events - checking availability in calendar

I’m wondering if there’s an easy way to programmatically check availability in a calendar using recurring events, assuming that only a single event can occur at one time.

As we don’t have individual records for each recurring event, i’m having to work through each type and work out if an instance occurs during the timeslot I am trying to book.

Please let me know if there’s an easy way to do this.



thanks,

Rose

On the client side you can call
scheduler.getEvents(start_date, end_date);
it will return all events which occurs in the same time, including the recurring ones.


thanks, I hope I can use that. I need to check the events from the server side (PHP) so am trying to work out how I can work in the call to the js function… if you have anything else available for use on the server side please let me know.



thanks a mil!



Rose

Attached php class can be used to get the same result on server-side
scheduler_rec_events.zip (2.44 KB)

You are a lifesaver! thank you thank you thank you!!


I’ve installed the scripts, but it gives an error when an independent recurring event does not exist within the time period passed. With independent recurring event, I mean one that has the event_length populated with a timestamp.



The first query (as below) picks up these events and then sets the values of $updates.



 



$query = “SELECT * FROM “.$this->table_name.” WHERE (rec_type=‘none’ OR rec_type=’’) AND (event_length>=’”.($this->date_start_ts)."’ AND event_length<=’".($this->date_end_ts)."’) ";
  $res = mysql_query($query, $this->connect);
  for ($i = 0; $i < mysql_num_rows($res); $i++)
   {
   $event = mysql_fetch_assoc($res);
   $updates[mysql_result($res, $i, ‘event_length’)] = $event;
   }




In my case, no events are returned but then I get the error in the following part:



while ($data = mysql_fetch_assoc($res))
   {



//below value $updates is not set
   $event_cur = new SchedulerDate($data, $updates);
   $event_cur->transpositor($this->date_start_ts);
   $final_temp = $event_cur->date_generator($this->date_start_ts, $this->date_end_ts);
   foreach ($final_temp as $v)
    {
    $final[] = $v;
    }
   }



I am not following the logic here so not sure how to fix this…



Apologies for all the questions!



thanks,



Rose



 

The second query must not fail if first one return an empty array.

Basically, the first query takes all exception-from-recurring-rules, while second one takes all events which may occur in defined set of time.

Updated version of the class is attached to the post, it has some notice-level messages fixed.

scheduler_helper.ZIP (10.3 KB)


Thank you for the update.  You’ve really saved me tons of time.



regards,



Rose