2019-07-31 16:11:49 +02:00
|
|
|
/**
|
|
|
|
* get the data from schedule
|
|
|
|
*/
|
|
|
|
var Schedule = class {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* the schedule xml object parsed as jQuery object
|
|
|
|
*/
|
|
|
|
schedule = false;
|
|
|
|
|
|
|
|
/**
|
2019-07-31 23:49:24 +02:00
|
|
|
* Array of Events
|
2019-07-31 16:11:49 +02:00
|
|
|
*
|
|
|
|
* [{
|
|
|
|
* id: 2132,
|
|
|
|
* title: "foobar"
|
|
|
|
* date:2018-09-22T10:30:00+02:00
|
|
|
|
* }]
|
|
|
|
*/
|
2019-07-31 23:49:24 +02:00
|
|
|
events = [];
|
2019-07-31 16:11:49 +02:00
|
|
|
|
2019-07-31 23:49:24 +02:00
|
|
|
/**
|
|
|
|
* object with Information of the conference
|
|
|
|
* {'title', 'start', 'end', ..}
|
|
|
|
*/
|
|
|
|
conf = {
|
|
|
|
title: 'defaultConf',
|
|
|
|
start: '1984-09-23',
|
|
|
|
end: '1984-09-24'
|
2019-07-31 16:11:49 +02:00
|
|
|
}
|
|
|
|
|
2019-07-31 23:49:24 +02:00
|
|
|
/**
|
|
|
|
* indepent time
|
|
|
|
*/
|
|
|
|
now = new Date();
|
2019-07-31 16:11:49 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
talkPrototype = {
|
|
|
|
'date' : '1970-01-01T00:00:00+02:00',
|
|
|
|
'start' : '1970-01-01T00:00:00+02:00',
|
|
|
|
'duration' : '00:15',
|
|
|
|
'room' : 'Großer Saal',
|
|
|
|
'slug' : 'DS2018-9336-eroffnung',
|
|
|
|
'url' : '/2018/fahrplan/events/9336.html',
|
|
|
|
'title' : 'Eröffnung',
|
|
|
|
'subtitle' : 'Datenspuren 2018',
|
|
|
|
'track' : '',
|
|
|
|
'type' : '',
|
|
|
|
'language' : 'de',
|
|
|
|
'abstract' : 'Eröffnung der Datenspuren 2018',
|
|
|
|
'description' : 'Opening Datenspuren 2018',
|
|
|
|
'logo' : false,
|
|
|
|
'persons' : { 'id' : '7339', 'name' : 'Nerd Norbert' }
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* class constructor
|
|
|
|
*/
|
|
|
|
constructor(scheduleXml){
|
2019-07-31 23:49:24 +02:00
|
|
|
this.schedule = scheduleXml.children("schedule");
|
|
|
|
|
|
|
|
this.conf.title = this.schedule.children("conference").children("title").text();
|
|
|
|
this.conf.start = this.schedule.children("conference").children("start").text();
|
|
|
|
this.conf.end = this.schedule.children("conference").children("end").text();
|
|
|
|
this.events = this.getEvents();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set orientation time
|
|
|
|
*/
|
|
|
|
setTimeTo(time){
|
|
|
|
this.now = time;
|
2019-07-31 16:11:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return String the schedule title
|
|
|
|
*/
|
|
|
|
getScheduleTitle(){
|
2019-07-31 23:49:24 +02:00
|
|
|
return this.conf.title;
|
2019-07-31 16:11:49 +02:00
|
|
|
}
|
|
|
|
/**
|
2019-07-31 23:49:24 +02:00
|
|
|
* @return day of conf start
|
2019-07-31 16:11:49 +02:00
|
|
|
*/
|
2019-07-31 23:49:24 +02:00
|
|
|
getScheduleStart(){
|
|
|
|
return this.conf.start;
|
|
|
|
}
|
|
|
|
/**this.events
|
|
|
|
* @return day of conf end
|
|
|
|
*/
|
|
|
|
getScheduleEnd(){
|
|
|
|
return this.conf.end;
|
|
|
|
}
|
2019-07-31 16:11:49 +02:00
|
|
|
|
2019-07-31 23:49:24 +02:00
|
|
|
/**
|
|
|
|
* return array of all Events
|
|
|
|
*/
|
|
|
|
getEvents(){
|
|
|
|
let allEvents = [];
|
|
|
|
if (this.events.length == 0 ){
|
|
|
|
//this.schedule.find('event').toArray();
|
|
|
|
this.schedule.find('event').each( function(){
|
|
|
|
allEvents.push({
|
|
|
|
title: $(this).children('title').text(),
|
|
|
|
date: $(this).children('date').text(),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// console.log( 888, allEvents );
|
|
|
|
return allEvents;
|
2019-07-31 16:11:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-07-31 23:49:24 +02:00
|
|
|
* get next Events by time and room
|
2019-07-31 16:11:49 +02:00
|
|
|
*
|
|
|
|
* @param {Timestamp} minimum time to start
|
|
|
|
* @param {*} room
|
|
|
|
*/
|
|
|
|
getTalk(time, room){
|
|
|
|
return talk;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-07-31 23:49:24 +02:00
|
|
|
* get the next Events, based on time
|
|
|
|
*
|
2019-07-31 16:11:49 +02:00
|
|
|
*/
|
2019-07-31 23:49:24 +02:00
|
|
|
getNextEvents(){
|
|
|
|
if (this.events.length == 0){
|
|
|
|
return this.events;
|
|
|
|
}
|
|
|
|
|
|
|
|
let talks = [];
|
|
|
|
|
|
|
|
let now = this.now;
|
|
|
|
//let now = new Date('September 22, 2018 19:30:00').getTime();
|
|
|
|
|
|
|
|
this.events.forEach( talk => {
|
|
|
|
let talkStart = new Date(talk.date).getTime();
|
|
|
|
if ( talkStart >= now ){
|
|
|
|
talks.push(talk);
|
|
|
|
}
|
|
|
|
});
|
2019-07-31 16:11:49 +02:00
|
|
|
|
2019-07-31 23:49:24 +02:00
|
|
|
return talks;
|
2019-07-31 16:11:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|