Get Events in PHP

Hello,

I’m trying to develop an integration with the scheduler and I need to get all the events (including the recurring) for a certain period.

Analyzing the scheduler, I noticed that I could use the file “events.php”, passing as a parameter the desired period, but when I did that, I’ve noticed that some recurring events out of the period are being shoewd in and I cannot understand why.

Also, I have a daily recurring event that happens at 2pm, but on a certain date has been moved to 11am, which in the database creates a second instance of the same event. When trying to pick up the day’s events with “events.php”, I’m getting in the returned XML two instances of the event.

What can I be doing wrong? Is there a way to get the events that really happens in a certain period?

I also tested the JS function getEvents(), but the result was the same: Events recurring outside the period.

Can U guys help?

Hello,
retreiving recurring events on the server side is not trivial, since they are stored in a special format
docs.dhtmlx.com/scheduler/recurr … ntegration

And it goes more difficult when it comes to processing of deleted/edited occurences of the series.
docs.dhtmlx.com/scheduler/recurr … ntheseries

This may be a designed behavior. However i’m not sure what code do you run and what events do you see, maybe i’m getting it wrong.
Recurring series stored in the db as events with start/end dates meaning dates of the whole series(from the date of the first occurence to the date of the last one).
For example, if there is a serie from 1st January 2014 to 1st January 2015 and you load 1-30 June 2014 - recurring serie still has to be loaded since it occures within the loaded period

This is probably means the deleted/modified instances of the recurring series. They stored as a separate records and refers to the parent serie, see the doc article above

In order to retreive events on the server side, you may try using a helper class from scheduler wordpress plugin
github.com/DHTMLX/scheduler-wor … Helper.php

[code]$helper = new SchedulerHelper($mysqlconnection, $tablename);

$events = $helper->get_dates(“2014-01-01 00:00:00”, “2015-01-01 00:00:00”);[/code]

Hi,

I’ll try to use the helper class, thanks a lot!

Aliaksandr,

Does the SchedulerHelper gets the recurring events too?

Hello,
yes, the helper should handle recurring events. When you retreive events from the date range it returns array of occurences. e.g. if you have dayly recurrence(single record in the db) and you retreive events for a week, helper should return array of 7 elements, each of them is an occurence of the serie with a correct date

It worked!

Thanks a lot!

By the way, I’ve noticed that the end time in the not recurring events are exactly the same as the start time, which gives me events with duration of 0 minutes.

I’ve commented the line bellow and everything worked fine:
//$ev[‘end_date’] = date(“Y-m-d H:i:s”, $cur_date + $this->event_length);

Hi,
thanks for the info!
I think that way you may get an incorrect dates of recurring events. Try adding a condition, instead of commenting-out the line:

if($this->event_length > 0){ $ev['end_date'] = date("Y-m-d H:i:s", $cur_date + $this->event_length); }

We’ll investigate the issue with the helper from our side

I have a weekly recurring event every friday and saterday,and i deleted one week friday,but using ScheduleHelper its still displaing on getevents

Using ScheduleHelper not displaying events based on actual timings (starttime and endtime)
Suppose event is there in between 2014-07-17 00:00:00 and 2014-07-17 10:20:00,getevent returning empty array

Aliaksandr
Sorry to tell you that concept wrong behind Scedule Helper bcoz when ever a event from recurring event get modified its inserting new record but deleting that record its get deleted rather than updating rec_type as none,give me a favour regarding issue

Hi,

dhtmlxConnector seems to handle such cases correctly, since in our samples if you delete modified instance the database item receives rec_type=none.
According the sources, SchedulerHepler.php also handles the deleted instances correctly github.com/DHTMLX/scheduler-wor … er.php#L61

The problem might be related to the time zone settings. Please try the attached version of the helper. Does it works any different?
SchedulerHelper.zip (2.7 KB)

Hi Aliaksandr

I apologise That recurrring event after modifying not deleting ,
But my doubt is ablout ScheduleHelper how does it work?

Any help :exclamation: :question:

Hi

Actually there is no add_days method available inside that class

SchedulerHelper do the next

  • read from DB master event and all related exceptions ( deletion and modifications markers )
  • create an array of event occurences based on the master event data
  • update occurrences based on modifications markers
  • remove occurrences based on deletion markers
  • returns the result list

Hi Stanislav
I have a record like this in my DB
id start_date end_date text rec_type event_pid event_length
1 2014-06-24 12:50:00 2014-06-24 14:45:00 New event 0 0

But using ScheduleHelper it cant able to fetch between 2014-06-24 12:50:00 and 2014-06-24 14:45:00 (Exact time of a date)

one more question i.e wht exactly event_length? its look like storing in seconds,but when i tried to ptint date and time of that second its neither mathching with start_date or end_date of my event stored in DB. Can u please explain. :question:

Is there a SchedulerHelper for Java? That would be extremely helpful.

Unfortunately there is no such tool

Hello and thank you for this helper class. I’m having problems with it fetching all-day events. It only seems to fetch events with start & end dates that are different. Please let me know if there’s a way to debug this; thank you for any input.

Anyone?

Can you share a minimal dump of data for which issue occurs ?