summaryrefslogtreecommitdiff
path: root/pages/searchresults.ecpp
blob: 6711ec8b033549ebe566c2794e4c3c2fdc3e8139 (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
112
113
114
115
116
117
118
119
120
121
122
123
<%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;
</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<%include>page_init.eh</%include>
<{
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
}>
<%cpp>
	pageTitle = tr("Search results");
	SearchResults results;
	if (!searchtimerid.empty())
		results.GetByID(lexical_cast< int >(searchtimerid));
	if (!searchtimerquery.empty())
		results.GetByQuery(SearchResults::PopQuery(searchtimerquery));
</%cpp>
<& pageelems.doc_type &>
<html>
	<head>
		<title>VDR-Live - <$ pageTitle $></title>
		<link rel="stylesheet" type="text/css" href="/styles.css" />
		<& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &>
		<& pageelems.ajax_js &>
	</head>
	<body onload="<& pageelems.infobox_start_update &>">
		<& pageelems.logo &>
		<& menu active=("searchresults") &>
		<div class="inhalt">
%           if (results.size() == 0) {
                <$ tr("No search results") $>
%           }
			<table class="searchresults" cellspacing="0" callpadding="0">
<{
				string current_day = "";
				bool active_line = false;
				EpgEvents epgEvents;
				int evntNr = 0;

				for (SearchResults::iterator result = results.begin(); result != results.end(); ++result) {
//					active_line = !active_line;
					string channelname = Channels.GetByChannelID(result->Channel())->Name();
					int channelnr = Channels.GetByChannelID(result->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()) : "");
					tEventID event = result->EventId();
					tChannelID channel_id(result->Channel());
					string description = result->Description();

					
					string evntId("eventId_");
					evntId += lexical_cast<std::string, int>(++evntNr);
					EpgEventPtr epgEvent(new EpgEvent(evntId, channelname, result->Title(), result->ShortText(), description, result->StartTime(), result->StopTime()));
					epgEvents.push_back(epgEvent);
					bool truncated = false;

					if (current_day != day) {
						if (current_day != "") {
}>
						<tr>
							<td colspan="5" style="border-top: 1px solid black; border-bottom: none; background-image: none">&nbsp;</td></tr>
						</tr>
<{
						}
}>
						<tr>
							<td class="day" colspan="5"><div class="boxheader"><div><div><$ day $></div></div></div></td>
						</tr>
%					current_day = day;
%					}
                    <tr class="<? active_line ? "active" ?>">
						<td style="border-left: 1px solid black"><& pageelems.event_timer channelid=(channel_id) eventid=(event)&></td>
						<td><a href="schedule.html?channel=<$ channelnr $>"><$ channelname $></a></td>
						<td><$ start $> - <$ end $></td>

						<td>
							<div class="more"<& tooltip.hint text=(StringEscapeAndBreak(StringWordTruncate(description, 300, truncated)) + string("<br />") + string(tr("Click to view details."))) &><& tooltip.display domId=(epgEvent->Id()) &>><strong><$ result->Title() $></strong></div><$ result->ShortText() $><br />
						</td>
						
						<td style="border-right: 1px solid black">&nbsp;</td>
					</tr>
%				}
%				if (results.size() > 0) {
						<tr>
							<td colspan="5" style="border-top: 1px solid black; background: none; border-bottom: none">&nbsp;</td>
						</tr>
%				}
			</table>
		</div>
		<div class="epg_data" style="display: none;">
<{
		// create hidden div for the tooltip hints.
		for (vector<EpgEventPtr>::iterator i = epgEvents.begin(); i != epgEvents.end(); ++i) {
			EpgEventPtr epg = *i;
}>
			<& pageelems.epg_tt_box boxId=(epg->Id()) caption=(epg->Caption()) time=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) short_descr=(epg->ShortDescr()) long_descr=(epg->LongDescr()) elapsed=(epg->Elapsed()) &>
<{
		}
}>
		</div>
	</body>
</html>

<%include>page_exit.eh</%include>