I am new to the using Ajax scheduler. I have a school project which shows the events based on school branch and instructor availability. I mean select the branch from a combo and then select the instructor and submit the same the scheduler will show the events for the same. I have done the same and working fine. Now I want to do that instructor will specify his availability time for a week. i.e. On Monday between 8.00 - 19.00, On Tuesday between 7.30 - 18.30 and so on for the week so available time to create event for that instructor is every Monday between 8.00 - 19.00 and every Tuesday between 7.30 - 18.30. See below image that will clear the idea. http://www.techmodi.com/demo/RND/FB_Deals/facebook-api/Scheduler%20Post_1.JPG
And what is the question?
If you want to block event creation then user tries to create event which doesn’t match available time you need to block it on different events: onDrag, onEventCreated and so on.
Yes but don’t know how to do that ? Do I need to create array ? or what ? below is my code so, you guys have more clear idea about my query.
<script type="text/javascript" charset="utf-8">
var startTime = <?php echo $startTimeArray[0]; ?>;
var endTime = <?php echo $endTimeArray[0]; ?>;
function init() {
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.config.prevent_cache = true;
scheduler.config.lightbox.sections=[
{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
{name:"location", height:43, type:"textarea", map_to:"details" },
{name:"time", height:72, type:"time", map_to:"auto"}
]
//Found by urvesh. 4 is started by four AM in left side of the scheduler
scheduler.config.first_hour = startTime;
scheduler.locale.labels.section_location = "Location";
scheduler.config.details_on_create = true;
scheduler.config.details_on_dblclick = true;
scheduler.config.last_hour = endTime;
//scheduler.init('scheduler_here',null,"month");
scheduler.init('scheduler_here', null, "week");
if(document.getElementById("branches").value == '0')
{
alert("Select Branch!");
//document.getElementById("branch_err").innerHTML="Select Branch properly";
return false;
}
if(document.getElementById("instrutors").value == '0' || document.getElementById("instrutors").value == '')
{
alert("Please select Instructor");
return false;
}
var ins = document.getElementById("instrutors").value;
scheduler.load("01_basic_init_connector.php?instructorId="+ins+"&uid="+scheduler.uid());
var dp = new dataProcessor("01_basic_init_connector.php");
dp.init(scheduler);
}
</script>
I called the above init() after the select the School name and Instructor. so, please tell me how can I restrict user to create event for that time period and also wants to change the color of that cell and user should not able to click on them.
For example you don’t want to let user save event with the start_date = 14:00
scheduler.attachEvent("onEventSave",function(id,data){
var sd = data.start_date;
if(sd.getHours() == 14 && sd.getMinutes() == 0) {
alert("Incorrect time was used");
return false; // event won't be saved
}
return true; // event will be saved
})
Same way you need to specify your logic and create appropriate handlers for other internal scheduler events.
What cell?
You can allow him to create event that way but inform that time is not correct and delete it.
I want to change the color of the part where the Event can not be created and also wants to disable the click on that part. e.g. On Monday between 8.00 - 19.00 event can be created. so, I want to change the color for Monday 00.00 to 8.00 and 19.00 to 24.00. and also on that click and dbl click needs to disable.