function block_readonly(id){
if (id) return true;
if (this.getEvent(id).user_id!=<?php echo $user_id;?>)
return false;
}
scheduler.attachEvent("onBeforeDrag",block_readonly)
scheduler.attachEvent("onClick",block_readonly)
Error is this.getEvent(id).user_id havent define yet! Please help me!
p/s: Anyway that set some event readonly form the server side, not viewer side?
What exactly doesn’t work? Do you want to display readonly form for occurrences of recurring event? If so you can make necessary check in the ‘onBeforeLightbox’ event and set readonly property.
Acctually it’s not the answer that I need. Here is my situation: Everybody can see all the event from the others people. But user only modify the event that was created by them self. So that i put the varaiable user_id in event table. So when user load the scheduler. The event will be set readonly or not depend on their user_id and event.user_id.
Here is my new code! I fixed by your guide. And the new problem is: User cant create new event
scheduler.load("<?= base_url();?>booking/getlich/<?= $_POST['product'];?>");
var dp = new dataProcessor("<?= base_url();?>booking/getlich/<?= $_POST['product'];?>");
dp.init(scheduler);
function block_readonly(id){
var ev = this.getEvent(id);
if (ev && ev.user_id!=<?php echo $user_id;?>)
return false;
if (id) return true;
}
scheduler.attachEvent("onBeforeDrag",block_readonly)
scheduler.attachEvent("onClick",block_readonly)