summaryrefslogtreecommitdiff
path: root/pages/whats_on.ecpp
blob: 5015f6717fbf0ab1c45df281253eebe06fdcdd13 (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<%pre>
#include <vdr/plugin.h>
#include <vdr/channels.h>
#include <vdr/epg.h>
#include <vdr/config.h>
#include <vdr/i18n.h>
#include "setup.h"
#include "tools.h"
#include "epg_events.h"

using namespace std;
using namespace vdrlive;

</%pre>
<%args>
type = "now";
string attime;

</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<%include>page_init.eh</%include>
<{
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");


cSchedulesLock schedulesLock;
const cSchedules* Schedules = cSchedules::Schedules(schedulesLock);

string head;
time_t seektime = 0;

if (type == "now") {
	head = tr("What's running at")+string(" ")+FormatDateTime(tr("%I:%M %p"), time(0));
} else if (type == "next") {
	head = tr("What's on next?");
} else if (type == "at") {
	seektime = GetTimeT(attime);
	if (seektime - time(0) + 3600 < 0) // if wanted time is past more then 1h, then use tomorrow
		seektime += SECSINDAY;
	head = tr("What's running at") + string(" ") + FormatDateTime(tr("%I:%M %p"), seektime) +string(" (") +FormatDateTime(tr("%a, %b %d"), seektime) + string(")");
}

}>
<& pageelems.doc_type &>
<html>
	<head>
		<title>VDR-Live - <$ head $></title>
		<link rel="stylesheet" type="text/css" href="styles.css" />
		<& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &>
		<& pageelems.ajax_js &>
		<script type="text/javascript"><!--
		function showtime(selection)
		{
			if (selection.options[selection.selectedIndex].value != "")
				window.location.href = "whats_on.html?type=at&attime=" + selection.options[selection.selectedIndex].value;
		}
		function showspectime(selection)
		{
			if (selection.value != "")
				window.location.href = "whats_on.html?type=at&attime=" + selection.value;
		}
		//--></script>
	</head>
	<body onload="<& pageelems.infobox_start_update &>">
		<& pageelems.logo &>
		<& menu active=("whats_on") component=("whats_on.whats_on_actions")>
		<div class="inhalt">
<{
	EpgEvents epgEvents;

	ReadLock channelsLock( Channels );
	if (channelsLock) {
		int evntNr = 0;
		for (cChannel *Channel = Channels.First(); Channel && Channel->Number() <= LiveSetup().GetLastChannel(); Channel = Channels.Next(Channel)) {
			if (!Channel->GroupSep()) {
				const cSchedule *Schedule = Schedules->GetSchedule(Channel);
				if (Schedule) {				
					const cEvent *Event = NULL;
					if (type == "now")
						Event = Schedule->GetPresentEvent();
					else if (type == "next")
						Event = Schedule->GetFollowingEvent();
					else if (type == "at")
						Event = Schedule->GetEventAround(seektime);
					
						if (Event) {
							string evntId("eventId_");
							evntId += lexical_cast<std::string, int>(++evntNr);
							EpgEventPtr epgEvent(new EpgEvent(evntId, Event, Channel->Name()));
							epgEvents.push_back(epgEvent);
							tChannelID channel_id(Channel->GetChannelID());
							tEventID event = Event->EventID();

							bool truncated = false;
							string description();
}>
			<div class="event">
				<div class="station">
					<div><div><div><a href="schedule.html?channel=<$ Channel->Number() $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ (epgEvent->Caption()) $></a></div></div></div>
				</div>
				<div class="content">
					<div class="tools">
						<& pageelems.event_timer channelid=(channel_id) eventid=(event) &>
%							if (type == "now") {
						<& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(channel_id) image="zap.png" alt="" &>
%							}
%						if (LiveSetup().HaveEPGSearch()) {
						<a href="searchresults.html?searchplain=<$ StringEscapeAndBreak(epgEvent->Title()) $>"><img src="/search.png" border="0" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>></img></a>
%						}
					</div>
				 	<div>
						<div class="info"><$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $></div>
%							if (epgEvent->Elapsed() >= 0) {
						<div class="progress"><div><& pageelems.progressbar progress=(epgEvent->Elapsed()) &></div></div>
%							}
						<div class="title"><$ (epgEvent->Title()) $></div>
						<div class="short"><$ (epgEvent->ShortDescr()) $></div>
						<div class="description"><$ (StringWordTruncate(epgEvent->LongDescr(), 150, truncated)) $></div>
						<div class="more"<& tooltip.hint text=(StringEscapeAndBreak(StringWordTruncate(epgEvent->LongDescr(), 300, truncated)) + string("<br />") + string(tr("Click to view details."))) &><& tooltip.display domId=(epgEvent->Id()) &>><$ (string(tr("more")) + string(" ...")) $></div>
				 	</div>
				</div>
			</div>
<{
					}
				}
			}
		}
	}
}>
		</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>

<%def whats_on_actions>
<a href="whats_on.html?type=now"><$ tr("Now") $></a>
<span class="sep">|</span>
<a href="whats_on.html?type=next"><$ tr("Next") $></a>
<span class="sep">|</span>
<span><$ tr("What's on") $></span>
<select name="userdeftimes" size="1" id="userdeftimes" onchange="showtime(this)">
	<option value="0"/>
<{
	vector< string > parts = StringSplit( LiveSetup().GetTimes(), ';' );
	vector< string >::const_iterator part = parts.begin();
	for ( int i = 0; part != parts.end(); ++i, ++part ) {
}>
	<option value="<$ *part $>"> <$ tr("at") + string(" ") + *part $></option>
<{
	}
}>
</select>
<span class="sep">|</span>
<span><$ tr("at") $></span>
<input type="text" size="6" name="spectime" id="spectime" onchange="showspectime(this)"/></td>
</%def>