Hi,
First of all thanx for sharing this amazing schedular…you guyz are rock
i am using this scheduler for my project …using recurring feature too.All is working fine some questions are
1.) i want to implement events sharing feature …for this i refered your example of shared events but i am unable to implement it .i am using events_rec file in which i have my all processing code expect sharing events can you guys plz help me where and how i can implement this functionality…
2.) i want that events colors are based on event’s calendar color;
-
how to pass current logged in user id in to database when creating events (with some hidden field or another way?)
-
How to implement readonly events…
Plz help me here is my code:—
function init() {
//alert(document.getElementById(‘StartTime1’).value);
var startime=document.getElementById(‘StartTime1’).value;
var endime=document.getElementById(‘EndTime1’).value;
var startweek=document.getElementById(‘StartWeek1’).value;
var format=document.getElementById(‘timeformat1’).value;
//alert(startime);
scheduler.config.show_loading=true;
scheduler.config.multi_day = true;
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.config.details_on_dblclick = true;
scheduler.config.details_on_create = true;
if(startime!="")
{
scheduler.config.first_hour=startime;
} else {
scheduler.config.first_hour=0;
}
scheduler.config.last_hour=23;
if(startweek!="Sunday")
{
scheduler.config.start_on_monday=true;
}
else {
scheduler.config.start_on_monday=false;
}
scheduler.config.full_day = true; // enable parameter to get full day event option on the lightbox form
if(format!='')
{
scheduler.config.hour_date=format;
}else {
scheduler.config.hour_date="%h:%A";
}
scheduler.config.agenda_end = scheduler.date.add(new Date(),3,“month”);
//scheduler.load(“common/events.xml”);
scheduler.locale.labels.workweek_tab = “W-Week”
scheduler.locale.labels.decade_tab = "Next 4 Days"
scheduler.attachEvent("onTemplatesReady",function(){
//alert("week");
//work week
scheduler.date.workweek_start = scheduler.date.week_start;
scheduler.templates.workweek_date = scheduler.templates.week_date;
scheduler.templates.workweek_scale_date = scheduler.templates.week_scale_date;
scheduler.date.add_workweek=function(date,inc){ return scheduler.date.add(date,inc*7,"day"); }
scheduler.date.get_workweek_end=function(date){ return scheduler.date.add(date,5,"day"); }
//alert("weekend");//Next 4 days
scheduler.date.decade_start = function(date)
{
//alert("date");
var ndate = new Date();
//ndate.setDate(Math.floor(date.getDate()/10)*10+1);
return this.date_part(ndate);
}
scheduler.templates.decade_date = scheduler.templates.week_date;
scheduler.templates.decade_scale_date = scheduler.templates.week_scale_date;
scheduler.date.add_decade=function(date,inc){ return scheduler.date.add(date,inc*4,"day"); }
});
scheduler.attachEvent(“onEventSave”,function(id,data){
if (!data.text) {
alert(“Text must not be empty”);
return false;
}
if (data.text.length<20) {
alert(“Text too small”);
return false;
}
return true;
})
scheduler.init('scheduler_here',new Date(),"week");
//alert(document.cookie.match(/PHPSESSID=[^;]+/)); //current session ID
scheduler.load(“php/events_rec.php”);
var dp = new dataProcessor("php/events_rec.php");
dp.init(scheduler);
//coloring for different users
scheduler.templates.event_class=function(start,end,event){
return "c"+event.color;
}
//allow edit operations only for own events
function allow_own(id){
var ev = this.getEvent(id);
return ev.userId == 6;
}
scheduler.attachEvent("onClick",allow_own);
scheduler.attachEvent("onDblClick",allow_own);
scheduler.locale.labels.section_snack = "For :";
var snacks = [
];
var department = [
];
scheduler.locale.labels.section_department = "Select Group";
scheduler.locale.labels.section_status = "Status";
scheduler.locale.labels.section_checkme = "Publish";
scheduler.locale.labels.section_checkme2 = "Lock";
scheduler.locale.labels.section_users = "Assigned Users";
scheduler.locale.labels.section_location = "Description";
scheduler.config.lightbox.sections=[
{ name:"description", height:20, map_to:"text", type:"textarea", focus:true },
{ name:"time", height:72, type:"time", map_to:"auto"},
{name:"department", height:21, map_to:"department", type:"select", options: department,script_path: "php/data.php"},
{ name:"snack", options: snacks, map_to:"calendar_id", type:"combo", filtering: true, script_path: "php/complete.php", cache: false },
{name:"status", height:21, map_to:"status", type:"select", options:[
{key:"Not-Started", label:"Not-Started"},
{key:"In-Progress", label:"In-Progress"},
{key:"Completed", label:"Completed"}
]},
{ name:"users", height:20,type:"textarea",map_to:"assigned_user"},
{ name:"location", height:43, type:"textarea", map_to:"description" },
{ name:"checkme", map_to:"is_publish", type:"checkbox", checked_value: 1, unchecked_value: 0 },
{ name:"checkme2", map_to:"is_lock", type:"checkbox", checked_value: 1, unchecked_value: 0 },
{name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"},
//{name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"},
];
}
function show_minical(){
if (scheduler.isCalendarVisible())
scheduler.destroyCalendar();
else
scheduler.renderCalendar({
position:“dhx_minical_icon”,
date:scheduler._date,
navigation:true,
handler:function(date,calendar)
{
scheduler.setCurrentView(date);
scheduler.destroyCalendar()
}
});
}
function openNewEvent() {
var id = scheduler.uid();
scheduler.addEvent({
id:id,
text:“new event”,
start_date: new Date(),
end_date:new Date()
});
scheduler.showLightbox(id);
}