<%pre> #include #include #include #include #include "exception.h" #include "livefeatures.h" #include "setup.h" #include "tools.h" #include "epg_events.h" using namespace std; using namespace vdrlive; <%args> int channel = -1; <%session scope="global"> bool logged_in(false); <%request scope="page"> cChannel* Channel; <%include>page_init.eh <{ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); }> <%cpp> pageTitle = tr("Schedule"); cSchedulesLock schedulesLock; cSchedules const* schedules = cSchedules::Schedules( schedulesLock ); ReadLock channelsLock( Channels ); if ( !channelsLock ) throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") ); // cChannel* Channel; (see %request above) if ( channel > 0 ) Channel = Channels.GetByNumber( channel ); else Channel = Channels.Get( Channels.GetNextNormal( -1 ) ); if ( Channel == 0 ) throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") ); cSchedule const* Schedule = schedules->GetSchedule( Channel ); if ( Schedule == 0 ) throw HtmlError( tr("No schedules available for this channel.") ); <& pageelems.doc_type &> VDR Live - <$ pageTitle $> <& pageelems.stylesheets &> <& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &> <& pageelems.ajax_js &> <& pageelems.logo &> <& menu active=("schedule") component=("schedule.channel_selection")>
<{ EpgEvents epgEvents; string current_day = ""; const cEvent* PresentEvent = Schedule->GetPresentEvent(); time_t now = time(NULL) - ::Setup.EPGLinger * 60; tChannelID channel_id(Channel->GetChannelID()); int evntNr = 0; for (const cEvent *Event = Schedule->Events()->First(); Event; Event = Schedule->Events()->Next(Event)) { if (Event->EndTime() <= now && Event != PresentEvent) continue; string evntId("eventId_"); evntId += lexical_cast(++evntNr); EpgEventPtr epgEvent(new EpgEvent(evntId, Event, Channel->Name())); epgEvents.push_back(epgEvent); string title(Event->Title() ? Event->Title() : ""); string short_description(Event->ShortText() ? Event->ShortText() : ""); string description(Event->Description() ? Event->Description() : ""); string start(Event->StartTime() ? FormatDateTime(tr("%I:%M %p"), Event->StartTime()) : ""); string end(Event->EndTime() ? FormatDateTime(tr("%I:%M %p"), Event->EndTime()) : ""); string day(Event->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), Event->StartTime()) : ""); tEventID event = Event->EventID(); ostringstream os; os << Event->EventID(); string strEventID = os.str(); bool truncated = false; bool lastEventCurrentDay = false; { cEvent* NextEvent = Schedule->Events()->Next(Event); if (!NextEvent) { lastEventCurrentDay = true; } else { string nday(NextEvent->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), NextEvent->StartTime()) : ""); lastEventCurrentDay = (day != nday); } } if (current_day != day) { if (current_day != "") { }> <{ } }> % current_day = day; % } % }
<$ day $>
"><& pageelems.event_timer channelid=(channel_id) eventid=(event) &> "><%cpp>if (LiveFeatures().Recent() ) { " alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>><%cpp> } else { <%cpp> } ">" border="0" alt="" <& tooltip.hint text=(tr("Find more at the Internet Movie Database.")) &>> ">
<$ start $> - <$ end $>
topaligned rightcol ">
" + tr("Click to view details.")) &><& tooltip.display domId=(epgEvent->Id()) &>><$ title $>
<%cpp>if (short_description.empty()) {  <%cpp> } <$ short_description $>
<%include>page_exit.eh <%def channel_selection>
<$ tr("Show schedule of channel") $>: <& channels_widget name=("channel") selected=(Channel ? *Channel->GetChannelID().ToString() : "") onchange=("document.forms.channels.submit()") &>