blob: 64ae350ade344e3f44966e00fb62bbbf3803a3b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
<%pre>
#include <vdr/channels.h>
#include <vdr/i18n.h>
#include <vdr/epg.h>
#include "epgsearch.h"
#include "tools.h"
#include "setup.h"
#include "epg_events.h"
using namespace vdrlive;
using namespace std;
</%pre>
<%args>
// input parameters
string searchtimerid;
string searchtimerquery;
string searchplain;
</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<%include>page_init.eh</%include>
<%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());
}
</%cpp>
<& pageelems.doc_type &>
<html>
<head>
<title>VDR-Live - <$ pageTitle $></title>
<& pageelems.stylesheets &>
<& pageelems.ajax_js &>
</head>
<body>
<& pageelems.logo &>
<& menu active=("searchepg") &>
<div class="inhalt">
% if (results.size() == 0) {
<$ tr("No search results") $>
% }
<table class="listing" cellspacing="0" cellpadding="0">
<%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 != "") {
</%cpp>
<tr class="spacer">
<td colspan="4"/>
</tr>
% }
<tr class="head">
<td colspan="4"><div class="boxheader"><div><div><$ day $></div></div></div></td>
</tr>
% current_day = day;
% }
<tr>
<td class="action leftcol <? bottom ? "bottomrow"?>"><& pageelems.event_timer epgid=(epgid) &></td>
<td class="topaligned <? bottom ? "bottomrow"?>"><div class="withmargin"><a href="schedule.html?channel=<$ channelnr $>"><$ channelname $></a></div></td>
<td class="topaligned <? bottom ? "bottomrow"?>"><div class="withmargin nowrap"><$ start $> - <$ end $></div></td>
<td class="topaligned rightcol <? bottom ? "bottomrow"?>"><div class="more withmargin"><a <& tooltip.hint text=(StringEscapeAndBreak(StringWordTruncate(description, 300, truncated)) + "<br />" + tr("Click to view details.")) &><& tooltip.display domId=(epgid) &>><span class="title"><$ result->Title() $></span><br /><span class="short"><%cpp>if (result->ShortText().empty()) { </%cpp> <%cpp> } </%cpp><$ result->ShortText() $></span></a></div></td>
</tr>
% }
</table>
</div>
</body>
</html>
<%include>page_exit.eh</%include>
|