Hi,
Firstly, I’d like to say thank you for a great calendar/scheduler.
I’ve got the scheduler loading and saving events from mySql database. I’d like to populate a select in the lightbox with some names from my db. This is my client code:
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.locale.labels.section_coach = "Coach:";
scheduler.locale.labels.section_student = "Student:";
var sections = [
{key:'coach1', label:'Coach 1'},
{key:'coach2', label:'Coach 2'}
];
var students = [
{key:'student1', label:'Student 1'},
{key:'student2', label:'Student 2'}
];
scheduler.config.lightbox.sections = [
{ name:"description", height:130, map_to:"text", type:"textarea" , focus:true },
{ name:"student", height:72, type:"select", options:students, map_to:"student", filtering: true },
{ name:"coach", height:43, type:"select", options:sections, map_to:"coach", filtering: true },
{ 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);
}
This is my connector:
<?php
require_once("../codebase/connector/scheduler_connector.php");
$res=mysql_connect("localhost","admin","admin");
mysql_select_db("vital_perch");
$conn = new SchedulerConnector($res);
$conn->enable_log("temp.log");
$conn->render_table("perch2_golf_bookings","booking_id","start_date,end_date,text,coach");
?>
I’m not great at javascript - can someone please tell me how to get my students options from the database instead of an array?
I’d like the first name and last name concatenated together in my select.
I really appreciate the help.
Jon