Two schedulers inside one

Hello,
I am making a internal application for my company.
Each user has it’s own calendar with appointments.
There is a need one user ( user X) to be able to see “free” spots on other user (user Y) in order to match both free time and in the same time not to be able to see details about other user appointments.
At the beginning I was thinking to create new Scheduler and user Y’s events to be represented as blocked time over user X’s calendars with his/her’s events --> therefore user X will know only where he/she will not be able to add an appointment for the two users.

It appears that reoccurring events are very hard to be represented as block time parameters for (scheduler.blockTime(6, [0,860,1860,2460]):wink:
In other words converting [week_1___1,2,3,4,5] ----> scheduler.blockTime(6, [0,8
60,1860,2460]); seems to be a hell of a job.

Then I was thinking to get user Y’s data without cricitcal information (event’s details) and represent it in user X’s calendar - but this does not garantee me that user X will not try to enter event on already “taken” spot (because user Y’s events are not blocked period)

Another thing that raised in my mind was to ask here is there a way to say in XML that I’m using for passing the data form SQL to WEB application that those time periods are disabled.

<data> <event> <id><![CDATA[1415620066604]]></id> <text><![CDATA[My Private time]]></text> <details><![CDATA[My Private time]]></details> <start_date><![CDATA[2014-11-10 08:40:00]]></start_date> <end_date><![CDATA[2014-11-17 00:00:00]]></end_date> <rec_pattern><![CDATA[week_1___1,2,3,4,5]]></rec_pattern> <rec_type><![CDATA[week_1___1,2,3,4,5#]]></rec_type> <event_length><![CDATA[12000]]></event_length> <event_pid><![CDATA[]]></event_pid> <subject><![CDATA[74002]]></subject> </event> </data>
Adding some code like
<![CDATA[true]]
or else that I was not able to find …

More or less i use straight forward scheduler object <-----> XML <----> SQL procedure as fields.
So my question is:
Is there an easy way to accomplish my mission with what you’ve read above?
Any thoughts, suggestions, ideas will be highly appreciated.
Thanks

Hello,
one of the approaches to block not available time, without loading extra information to the client-side, is to load such info from the server as start/end date pair.

I.e. each time user opens some date in the scheduler, you send an ajax request to the server and load array of the times blocked by another users. Then you could mark that dates as blocked.
If you use PHP or .NET backend, you can parse recurring events for a certain time period on the server side and load it to the client side as a start_date/end_date pairs.
Then you could go with marking timespans by a start and end dates:

scheduler.addMarkedTimespan({ start_date: loaded_start_date, end_date: loaded_end_date, css: "blocked-time" })

There is a php helper for parsing recurrences on the server, check this topic for a link and example
viewtopic.php?f=6&t=36212&p=112089&hilit=recurring+server+side#p112089

Here is a fragment client-side code (using jQuery for sending ajax), server-side in this sample supposed to return a blocked times as a JSON array [{start_date:"…", end_date:"…"},…]

[code]scheduler.attachEvent(“onViewChange”, function (mode, date) {
var toStr = scheduler.date.date_to_str("%d-%m-%Y");
var start = scheduler.date[mode + “_start”](new Date(date));
var end = scheduler.date.add(start, 1, mode);

$.ajax({
	dataType: "json",
	url: 'blocked_time.php',
	data: {
		from: toStr(start),
		to: toStr(end)//stringify dates
	},
	complete: function (response) {


		var timespans = JSON.parse(response.responseText); //preprocess loaded data if neaded

		// Remove previously loaded timespans
		scheduler.deleteMarkedTimespan({ type: "ajax_timespan" });

		for (var i = 0; i < timespans.length; i++) {
			var span = timespans[i];
			span.start_date = scheduler.templates.xml_date(span.start_date);
			span.end_date = scheduler.templates.xml_date(span.end_date);

			span.type = "ajax_timespan"; //add custom type, so all loaded timespans could be deleted
			span.css = "schedule_blocled";
			span.html = "Blocked";
			scheduler.addMarkedTimespan(timespans[i]);
		}
		scheduler.updateView();

	}

});

});[/code]
docs.dhtmlx.com/scheduler/api__s … eview.html
docs.dhtmlx.com/scheduler/api__s … event.html
docs.dhtmlx.com/scheduler/api__s … espan.html