Hi,
My goal over the next few months is to provide a scheduling system for Golf Pro’s as part of an app for a CMS. I’m experiencing one or two issues with initial setup, currently the recurring events seems to be having problems.
Recently, someone kindly helped me with options connector, which works well, but only until I introduced recurring events, now the options in my select are no longer being outputted.
Also, the recurring event saves and displays as expected, until you navigate away from the page and then back to the page, the recurring event has disappeared even though the entry has been saved to the database. The entry stored is for example: ‘week_4___2#4’ in the rec_type field.
Can someone please advise or provide a detailed example of recurring events in action both client and server side for PHP? I’ll need t know why this is affecting existing code for Options Selector too.
The code for my connector is:
require_once("../codebase/connector/scheduler_connector.php");
$res=mysql_connect("localhost","pass","pass");
mysql_select_db("db_name");
$list = new OptionsConnector($res);
$list->render_sql("SELECT clientId as value, CONCAT(firstName, ' ',lastName) as label from golf_clients","value","value,label");
$conn = new SchedulerConnector($res);
$conn->enable_log("temp.log");
$conn->set_options("student", $list);
$conn->render_table("golf_bookings","booking_id","start_date,end_date,text,coach,student,rec_type");
and my client-side code is as:
function init() {
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.config.first_hour = 8;
scheduler.config.last_hour = 20;
scheduler.config.details_on_create = true;
scheduler.config.details_on_dblclick = true;
scheduler.config.prevent_cache = true;
scheduler.config.full_day = true;
scheduler.locale.labels.section_coach = "Coach:";
scheduler.locale.labels.section_student = "Student:";
var sections = [
{key:'coach1', label:'Coach 1'},
{key:'coach2', label:'Coach 2'}
];
scheduler.attachEvent("onTemplatesReady", function(){
var lightbox_form = scheduler.getLightbox(); // this will generate lightbox form
var inputs = lightbox_form.getElementsByTagName('input');
var date_of_end = null;
for (var i=0; i<inputs.length; i++) {
if (inputs[i].name == "date_of_end") {
date_of_end = inputs[i];
break;
}
}
var repeat_end_date_format = scheduler.date.date_to_str("%d.%m.%Y");
var show_minical = function(){
if (scheduler.isCalendarVisible())
scheduler.destroyCalendar();
else {
scheduler.renderCalendar({
position:date_of_end,
date:scheduler._date,
navigation:true,
handler:function(date,calendar) {
date_of_end.value = repeat_end_date_format(date);
scheduler.destroyCalendar()
}
});
}
};
date_of_end.onclick = show_minical;
});
scheduler.config.lightbox.sections = [
{ name:"description", height:130, map_to:"text", type:"textarea" , focus:true },
{ name:"student", height: 21, map_to: "student", type: "select", options:scheduler.serverList("student") },
{ name:"coach", height:43, type:"select", options:sections, map_to:"coach", filtering: true },
{ name:"recurring", type:"recurring", map_to:"rec_type", button:"recurring" },
{ name:"time", height:72, type:"time", map_to:"auto" }
];
scheduler.templates.event_class=function(start, end, event){
if(event.coach) // if event has subject property then special class should be assigned
return "event_"+event.coach;
return ""; // default return
};
scheduler.init('scheduler_here',null,"week");
scheduler.load("data/connector.php");
var dp = new dataProcessor("data/connector.php");
dp.init(scheduler);
var calendar = scheduler.renderCalendar({
container:"cal_here",
navigation:true,
handler:function(date){
scheduler.setCurrentView(date, scheduler._mode);
}
});
scheduler.linkCalendar(calendar);
scheduler.setCurrentView(scheduler._date, scheduler._mode);
}
Jon.