Timeline, events with multiple instructors

Hi, Sorry if this is too long. I am trying to be able to have multiple instructors on an event and have events show up in the Timeline view. Thanks for you help!

I have two scenarios that both are missing a part. :frowning:

FIRST Setup: I can save multiple Instructors per event but can’t display theme in the timeline view.

One questions is, Can you display an event in timeline view that has multiple instructors?
So the event would be on the timeline twice, once for each instructor or is there a different way?

SCHEDULER.php

<script src='codebase/ext/dhtmlxscheduler_timeline.js?v=20190111' type="text/javascript" charset="utf-8"></script>
	
scheduler.createTimelineView({
	name: "timeline",
	x_unit: "day",
	x_date: "%F %d",
	x_step: 1,
	x_size: 14,
	//y_unit: scheduler.serverList("location"),
	//y_property: "location",
	y_unit: scheduler.serverList("instructor_id"), 
	y_property: "instructor_id",
	render: "bar"
});

EVENTS.php

require_once('../common/connector/scheduler_connector.php');
include ('../common/connector/crosslink_connector.php');
include ('../common/config.php');
include ('../common/connector/db_mysqli.php');


$list_cross_instructor = new CrossOptionsConnector($res,$dbtype);
$list_cross_instructor->dynamic_loading(true);
$list_cross_instructor->options->render_table("instructor","instructor_id","instructor_id(value), instructor_name(label)"); 
$list_cross_instructor->link->render_table("event_instructor","event_id","instructor_id, event_id"); 

$list_event_instructor_link = new OptionsConnector($res,$dbtype);
$list_event_instructor_link->render_complex_sql("SELECT ei.event_id AS `key`, i.instructor_name AS `label`, i.instructor_initials AS `initials`, ei.event_instructor_id AS `event_instructor_id` FROM event_instructor ei INNER JOIN instructor i ON i.instructor_id = ei.instructor_id", "key", "key,label,initials,event_instructor_id");


$scheduler->set_options("instructor_id", $list_cross_instructor->options);
$scheduler->set_options("event_instructor_link", $list_event_instructor_link);

$scheduler->render_table("events","event_id","start_date,end_date,label, topic_id,country,baseline,course,location,class_type,classroom");

No1_Sched_MultipleInstr

================================================================

SECOND Setup: I can display events in the timeline but the event only shows 1 instructor tied to it. There should be multiple instructors.
And it does not save new instructors to the database when I select a second instructor. The scheduler.php file is the same for both.

SCHEDULER.php

<script src='codebase/ext/dhtmlxscheduler_timeline.js?v=20190111' type="text/javascript" charset="utf-8"></script>
	
scheduler.createTimelineView({
	name: "timeline",
	x_unit: "day",
	x_date: "%F %d",
	x_step: 1,
	x_size: 14,
	y_unit: scheduler.serverList("instructor_id"), 
	y_property: "instructor_id",
	render: "bar"
});

EVENTS.php

require_once('../common/connector/scheduler_connector.php');
include ('../common/connector/crosslink_connector.php');
include ('../common/config.php');
include ('../common/connector/db_mysqli.php');


$list_cross_instructor = new CrossOptionsConnector($res,$dbtype);
$list_cross_instructor->dynamic_loading(true);
$list_cross_instructor->options->render_table("instructor","instructor_id","instructor_id(value), instructor_name(label)"); 
$list_cross_instructor->link->render_table("event_instructor","event_id","instructor_id, event_id"); 

$list_event_instructor_link = new OptionsConnector($res,$dbtype);
$list_event_instructor_link->render_complex_sql("SELECT ei.event_id AS `key`, i.instructor_name AS `label`, i.instructor_initials AS `initials`, ei.event_instructor_id AS `event_instructor_id` FROM event_instructor ei INNER JOIN instructor i ON i.instructor_id = ei.instructor_id", "key", "key,label,initials,event_instructor_id");


$scheduler->set_options("instructor_id", $list_cross_instructor->options);
$scheduler->set_options("event_instructor_link", $list_event_instructor_link);

	
$scheduler->sql->attach("Update","Update EVENTS SET start_date='{start_date}',end_date='{end_date}',label= '{label}',topic_id={topic_id},country={country},baseline={baseline},
	course={course},location={location},class_type={class_type},classroom={classroom} WHERE event_id={key}");

$scheduler->render_complex_sql("SELECT e.start_date AS `start_date`, e.end_date AS `end_date`, e.label AS `label`, e.event_id AS `key`, e.topic_id,e.country,e.baseline,
		e.course,e.location,e.class_type,e.classroom, event_instructor_id, i.instructor_id AS `instructor_id`, i.instructor_name 
	FROM EVENTS e 
		LEFT JOIN (event_instructor ei 
			INNER JOIN instructor i ON i.instructor_id = ei.instructor_id ) 
		ON ei.event_id = e.event_id", "key", 
	"start_date,end_date, label, key,topic_id,country,baseline,course,location,class_type,classroom, event_instructor_id, instructor_id, instructor_name"); 

No2_Sched_MultipleInstr

Hi,

Yes, Scheduler provides the possibility to assign events to several sections. Read more details in the documentation here https://docs.dhtmlx.com/scheduler/timeline_view.html#assignmentofeventstoseveralsections

Thanks for your reply Polina,

I tried adding the multisection.js, but still have same issues.

Can this be done with linking the sections with a second table i.e. the users table with no column on the events table?

If I add the users column to the event table will the multi select combo box save to that table?

Thanks!
Ron

I have managed to get this working, Thanks again for the help!