<%pre> #include #include #include #include "epgsearch.h" #include "tools.h" #include "setup.h" #include "epg_events.h" using namespace vdrlive; using namespace std; <%args> // input parameters string searchtimerid; string searchtimerquery; string searchplain; <%session scope="global"> bool logged_in(false); <%include>page_init.eh <%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); pageTitle = tr("Search results"); SearchResults results; if (!searchtimerid.empty()) results.GetByID(lexical_cast< int >(searchtimerid)); if (!searchtimerquery.empty()) results.GetByQuery(SearchResults::PopQuery(searchtimerquery)); if (!searchplain.empty()) { SearchTimer s; s.SetId(0); s.SetSearch(searchplain); s.SetSearchMode(0); s.SetUseTitle(true); s.SetUseSubtitle(false); s.SetUseDescription(false); results.GetByQuery(s.ToText()); } <& pageelems.doc_type &> VDR-Live - <$ pageTitle $> <& pageelems.stylesheets &> <& pageelems.ajax_js &> <& pageelems.logo &> <& menu active=("searchepg") &>
% if (results.size() == 0) { <$ tr("No search results") $> % } <%cpp> string current_day = ""; for (SearchResults::iterator result = results.begin(); result != results.end(); ++result) { cChannel* channel = Channels.GetByChannelID(result->Channel()); if (!channel) continue; string channelname = channel->Name(); int channelnr = channel->Number(); string start(result->StartTime() ? FormatDateTime(tr("%I:%M %p"), result->StartTime()) : ""); string end(result->StopTime() ? FormatDateTime(tr("%I:%M %p"), result->StopTime()) : ""); string day(result->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), result->StartTime()) : ""); string description = result->Description(); string epgid = EpgEvents::EncodeDomId(result->Channel(), result->EventId()); bool truncated = false; bool bottom = false; SearchResults::iterator nextResult = result; ++nextResult; if (nextResult == results.end()) bottom = true; else { string nextDay(nextResult->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), nextResult->StartTime()) : ""); bottom = (day != nextDay); } if (current_day != day) { if (current_day != "") { % } % current_day = day; % } % }
<$ day $>
"><& pageelems.event_timer epgid=(epgid) &> "> ">
<$ start $> - <$ end $>
">
<%include>page_exit.eh