1 |
<?php |
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 |
|
---|
14 |
|
---|
15 |
|
---|
16 |
|
---|
17 |
|
---|
18 |
|
---|
19 |
include("./foltialib.php"); |
---|
20 |
$con = m_connect(); |
---|
21 |
$epgviewstyle = 1; |
---|
22 |
if ($useenvironmentpolicy == 1){ |
---|
23 |
if (!isset($_SERVER['PHP_AUTH_USER'])) { |
---|
24 |
header("WWW-Authenticate: Basic realm=\"foltia\""); |
---|
25 |
header("HTTP/1.0 401 Unauthorized"); |
---|
26 |
redirectlogin(); |
---|
27 |
exit; |
---|
28 |
} else { |
---|
29 |
login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); |
---|
30 |
} |
---|
31 |
} |
---|
32 |
?> |
---|
33 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
---|
34 |
<html lang="ja"> |
---|
35 |
<head> |
---|
36 |
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP"> |
---|
37 |
<meta http-equiv="Content-Style-Type" content="text/css"> |
---|
38 |
<link rel="stylesheet" type="text/css" href="graytable.css"> |
---|
39 |
<title>foltia:EPG番組表</title> |
---|
40 |
</head> |
---|
41 |
<?php |
---|
42 |
$start = getgetnumform("start"); |
---|
43 |
|
---|
44 |
if ($start == ""){ |
---|
45 |
$start = date("YmdHi"); |
---|
46 |
}else{ |
---|
47 |
$start = ereg_replace( "[^0-9]", "", $start); |
---|
48 |
} |
---|
49 |
|
---|
50 |
|
---|
51 |
?> |
---|
52 |
<body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" > |
---|
53 |
<div align="center"> |
---|
54 |
<?php |
---|
55 |
printhtmlpageheader(); |
---|
56 |
?> |
---|
57 |
<p align="left"><font color="#494949" size="6">EPG番組表</font></p> |
---|
58 |
<p align="left"><a href="./m.php">番組手動予約</a ></p> |
---|
59 |
<hr size="4"> |
---|
60 |
<p align="left">EPG番組表を表示します。 |
---|
61 |
<?php |
---|
62 |
|
---|
63 |
|
---|
64 |
|
---|
65 |
$begin = date("YmdHi"); |
---|
66 |
$beginyear = substr($begin,0,4); |
---|
67 |
$beginmonth = substr($begin,4,2); |
---|
68 |
$beginday = substr($begin,6,2); |
---|
69 |
$beginhour = substr($begin,8,2); |
---|
70 |
$beginmin = substr($begin,10,2); |
---|
71 |
|
---|
72 |
|
---|
73 |
$startyear = substr($start,0,4); |
---|
74 |
$startmonth = substr($start,4,2); |
---|
75 |
$startday = substr($start,6,2); |
---|
76 |
$starthour = substr($start,8,2); |
---|
77 |
$startmin = substr($start,10,2); |
---|
78 |
$day_of_the_week = date ("(D)",mktime($starthour , 0 , 0, $startmonth , $startday , $startyear)); |
---|
79 |
|
---|
80 |
print "($startyear/$startmonth/$startday $day_of_the_week $starthour:$startmin-)<BR>\n"; |
---|
81 |
|
---|
82 |
|
---|
83 |
$yesterday = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday -1 , $startyear)); |
---|
84 |
$dayyesterday = date ("m/d(D)",mktime($starthour , 0 , 0, $startmonth , $startday -1 , $startyear)); |
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 |
$tomorrow = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday +1 , $startyear)); |
---|
89 |
|
---|
90 |
|
---|
91 |
$daytomorrow = date ("m/d(D)",mktime($starthour , 0 , 0, $startmonth , $startday +1 , $startyear)); |
---|
92 |
|
---|
93 |
|
---|
94 |
|
---|
95 |
$today0400 = date ("YmdHi",mktime(4 , 0 , 0, $startmonth , $startday , $startyear)); |
---|
96 |
$today0800 = date ("YmdHi",mktime(8 , 0 , 0, $startmonth , $startday , $startyear)); |
---|
97 |
$today1200 = date ("YmdHi",mktime(12 , 0 , 0, $startmonth , $startday , $startyear)); |
---|
98 |
$today1600 = date ("YmdHi",mktime(16 , 0 , 0, $startmonth , $startday , $startyear)); |
---|
99 |
$today2000 = date ("YmdHi",mktime(20 , 0 , 0, $startmonth , $startday , $startyear)); |
---|
100 |
$today2359 = date ("YmdHi",mktime(23 , 59 , 0, $startmonth , $startday , $startyear)); |
---|
101 |
|
---|
102 |
|
---|
103 |
|
---|
104 |
|
---|
105 |
$day0after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday , $beginyear)); |
---|
106 |
$day0 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday , $beginyear)); |
---|
107 |
$day1after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +1 , $beginyear)); |
---|
108 |
$day1 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +1 , $beginyear)); |
---|
109 |
$day2after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +2 , $beginyear)); |
---|
110 |
$day2 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +2 , $beginyear)); |
---|
111 |
$day3after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +3 , $beginyear)); |
---|
112 |
$day3 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +3 , $beginyear)); |
---|
113 |
$day4after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +4 , $beginyear)); |
---|
114 |
$day4 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +4 , $beginyear)); |
---|
115 |
$day5after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +5 , $beginyear)); |
---|
116 |
$day5 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +5 , $beginyear)); |
---|
117 |
$day6after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +6 , $beginyear)); |
---|
118 |
$day6 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +6 , $beginyear)); |
---|
119 |
$day7after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +7 , $beginyear)); |
---|
120 |
$day7 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +7 , $beginyear)); |
---|
121 |
|
---|
122 |
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|
126 |
$maxdisplay = 8; |
---|
127 |
|
---|
128 |
$query = "SELECT count(*) FROM foltia_station WHERE \"ontvcode\" LIKE '%ontvjapan%'"; |
---|
129 |
|
---|
130 |
$rs = sql_query($con, $query, "DBクエリに失敗しました"); |
---|
131 |
$maxrows = $rs->fetchColumn(0); |
---|
132 |
if ($maxrows > $maxdisplay){ |
---|
133 |
$pages = ceil($maxrows / $maxdisplay) ; |
---|
134 |
} |
---|
135 |
|
---|
136 |
$page = getgetnumform("p"); |
---|
137 |
|
---|
138 |
if (($page == "")|| ($page <= 0) ){ |
---|
139 |
$page = 1 ; |
---|
140 |
$offset = 0 ; |
---|
141 |
}else{ |
---|
142 |
$page = ereg_replace( "[^0-9]", "", $page); |
---|
143 |
if ($page > $pages){ |
---|
144 |
$page = $pages ; |
---|
145 |
}elseif ($page <= 0) { |
---|
146 |
$page = 1 ; |
---|
147 |
} |
---|
148 |
$offset = ($page * $maxdisplay ) - $maxdisplay; |
---|
149 |
} |
---|
150 |
|
---|
151 |
|
---|
152 |
|
---|
153 |
|
---|
154 |
$navigationbar = " |
---|
155 |
|
---|
156 |
[<A HREF=\"./viewepg.php\">現在</A>] | |
---|
157 |
<A HREF=\"./viewepg.php?p=$page&start=$yesterday\">$dayyesterday [前日]</A> | |
---|
158 |
当日( |
---|
159 |
<A HREF=\"./viewepg.php?p=$page&start=$today0400\">4:00</A> |
---|
160 |
<A HREF=\"./viewepg.php?p=$page&start=$today0800\">8:00</A> |
---|
161 |
<A HREF=\"./viewepg.php?p=$page&start=$today1200\">12:00</A> |
---|
162 |
<A HREF=\"./viewepg.php?p=$page&start=$today1600\">16:00</A> |
---|
163 |
<A HREF=\"./viewepg.php?p=$page&start=$today2000\">20:00</A> |
---|
164 |
<A HREF=\"./viewepg.php?p=$page&start=$today2359\">24:00</A>) | |
---|
165 |
<A HREF=\"./viewepg.php?p=$page&start=$tomorrow\">$daytomorrow [翌日]</A> |
---|
166 |
<br> |
---|
167 |
| |
---|
168 |
<A HREF=\"./viewepg.php?p=$page&start=$day0after\">$day0</A> | |
---|
169 |
<A HREF=\"./viewepg.php?p=$page&start=$day1after\">$day1</A> | |
---|
170 |
<A HREF=\"./viewepg.php?p=$page&start=$day2after\">$day2</A> | |
---|
171 |
<A HREF=\"./viewepg.php?p=$page&start=$day3after\">$day3</A> | |
---|
172 |
<A HREF=\"./viewepg.php?p=$page&start=$day4after\">$day4</A> | |
---|
173 |
<A HREF=\"./viewepg.php?p=$page&start=$day5after\">$day5</A> | |
---|
174 |
<A HREF=\"./viewepg.php?p=$page&start=$day6after\">$day6</A> | |
---|
175 |
<A HREF=\"./viewepg.php?p=$page&start=$day7after\">$day7</A> | <BR>\n"; |
---|
176 |
print "$navigationbar"; |
---|
177 |
|
---|
178 |
|
---|
179 |
if ($maxrows > $maxdisplay){ |
---|
180 |
|
---|
181 |
|
---|
182 |
if ($page > 1){ |
---|
183 |
$beforepage = $page - 1; |
---|
184 |
print "<a href = \"./viewepg.php?p=$beforepage&start=$start\">←</A>"; |
---|
185 |
} |
---|
186 |
|
---|
187 |
print " $page / $pages (放送局) "; |
---|
188 |
for ($i=1;$i<=$pages;$i++){ |
---|
189 |
print "<a href = \"./viewepg.php?p=$i&start=$start\">$i</a>・"; |
---|
190 |
} |
---|
191 |
|
---|
192 |
|
---|
193 |
if ($page < $pages){ |
---|
194 |
$nextpage = $page + 1; |
---|
195 |
print "<a href = \"./viewepg.php?p=$nextpage&start=$start\">→</a>"; |
---|
196 |
} |
---|
197 |
} |
---|
198 |
|
---|
199 |
|
---|
200 |
$query = "SELECT stationid, stationname, stationrecch, ontvcode |
---|
201 |
FROM foltia_station |
---|
202 |
WHERE \"ontvcode\" LIKE '%ontvjapan%' |
---|
203 |
ORDER BY stationid ASC , stationrecch |
---|
204 |
LIMIT ? OFFSET ? |
---|
205 |
"; |
---|
206 |
|
---|
207 |
|
---|
208 |
$slistrs = sql_query($con, $query, "DBクエリに失敗しました",array($maxdisplay,$offset)); |
---|
209 |
while ($rowdata = $slistrs->fetch()) { |
---|
210 |
$stationhash[] = $rowdata[3]; |
---|
211 |
$snames[] = $rowdata[1]; |
---|
212 |
} |
---|
213 |
|
---|
214 |
|
---|
215 |
$epgstart = $start ; |
---|
216 |
$epgend = calcendtime($start , (8*60)); |
---|
217 |
|
---|
218 |
$query = "SELECT DISTINCT startdatetime |
---|
219 |
FROM foltia_epg |
---|
220 |
WHERE foltia_epg.ontvchannel in ( |
---|
221 |
SELECT ontvcode |
---|
222 |
FROM foltia_station |
---|
223 |
WHERE \"ontvcode\" LIKE '%ontvjapan%' |
---|
224 |
ORDER BY stationid ASC , stationrecch |
---|
225 |
LIMIT ? OFFSET ? |
---|
226 |
) |
---|
227 |
AND startdatetime >= ? |
---|
228 |
AND startdatetime < ? |
---|
229 |
ORDER BY foltia_epg.startdatetime ASC "; |
---|
230 |
|
---|
231 |
|
---|
232 |
$rs = sql_query($con, $query, "DBクエリに失敗しました",array($maxdisplay,$offset,$start,$epgend)); |
---|
233 |
|
---|
234 |
|
---|
235 |
|
---|
236 |
$rowdata = $rs->fetch(); |
---|
237 |
if (! $rowdata) { |
---|
238 |
|
---|
239 |
$colmnums = 2; |
---|
240 |
}else{ |
---|
241 |
$colmnums = 0; |
---|
242 |
do { |
---|
243 |
$colmnums++; |
---|
244 |
$timetablehash[$rowdata[0]] = $colmnums; |
---|
245 |
|
---|
246 |
} while ($rowdata = $rs->fetch()); |
---|
247 |
|
---|
248 |
|
---|
249 |
|
---|
250 |
|
---|
251 |
foreach ($stationhash as $stationname) { |
---|
252 |
$epgstart = $start ; |
---|
253 |
$epgend = calcendtime($start , (8*60)); |
---|
254 |
$query = " |
---|
255 |
SELECT startdatetime , enddatetime , lengthmin , epgtitle , epgdesc , epgcategory ,ontvchannel ,epgid , epgcategory |
---|
256 |
FROM foltia_epg |
---|
257 |
WHERE foltia_epg.ontvchannel = ? AND |
---|
258 |
enddatetime > ? AND |
---|
259 |
startdatetime < ? |
---|
260 |
ORDER BY foltia_epg.startdatetime ASC |
---|
261 |
"; |
---|
262 |
|
---|
263 |
|
---|
264 |
$statiodh = sql_query($con, $query, "DBクエリに失敗しました",array($stationname,$epgstart,$epgend)); |
---|
265 |
$stationrowdata = $statiodh->fetch(); |
---|
266 |
$stationrowdata) { |
---|
267 |
|
---|
268 |
$item[0]["$stationname"] = ">番組データがありません"; |
---|
269 |
|
---|
270 |
|
---|
271 |
$printstarttime = substr($stationrowdata[0],8,2) . ":" . substr($stationrowdata[0],10,2); |
---|
272 |
$tdclass = "t".substr($stationrowdata[0],8,2) . substr($stationrowdata[0],10,2); |
---|
273 |
$title = $stationrowdata[3]; |
---|
274 |
$title = htmlspecialchars(z2h($title)); |
---|
275 |
$desc = $stationrowdata[4]; |
---|
276 |
$desc = htmlspecialchars(z2h($desc)); |
---|
277 |
|
---|
278 |
if ($epgviewstyle){ |
---|
279 |
$desc=$desc ."<br><br><!-- ". htmlspecialchars(foldate2print($stationrowdata[1])) ."-->"; |
---|
280 |
}else{ |
---|
281 |
$desc=$desc ."<br><br>". htmlspecialchars(foldate2print($stationrowdata[1])) ; |
---|
282 |
} |
---|
283 |
|
---|
284 |
|
---|
285 |
$height = htmlspecialchars($stationrowdata[2]) * 3; |
---|
286 |
$epgid = htmlspecialchars($stationrowdata[7]); |
---|
287 |
$epgcategory = htmlspecialchars($stationrowdata[8]); |
---|
288 |
|
---|
289 |
if (isset($timetablehash["$stationrowdata[0]"])){ |
---|
290 |
$number = $timetablehash["$stationrowdata[0]"]; |
---|
291 |
|
---|
292 |
}else{ |
---|
293 |
$number = 0; |
---|
294 |
|
---|
295 |
} |
---|
296 |
if ($epgcategory == ""){ |
---|
297 |
$item["$number"]["$stationname"] = " onClick=\"location = './reserveepg.php?epgid=$epgid'\"><span id=\"epgstarttime\">$printstarttime</span> <A HREF=\"./reserveepg.php?epgid=$epgid\"><span id=\"epgtitle\">$title</span></A> <span id=\"epgdesc\">$desc</span>"; |
---|
298 |
}else{ |
---|
299 |
$item["$number"]["$stationname"] = " id=\"$epgcategory\" onClick=\"location = './reserveepg.php?epgid=$epgid'\"><span id=\"epgstarttime\">$printstarttime</span> <A HREF=\"./reserveepg.php?epgid=$epgid\"><span id=\"epgtitle\">$title</span></A> <span id=\"epgdesc\">$desc</span></span>"; |
---|
300 |
} |
---|
301 |
|
---|
302 |
} while ($stationrowdata = $statiodh->fetch()); |
---|
303 |
} |
---|
304 |
|
---|
305 |
//・局ごとに間隔決定 |
---|
306 |
//$item[$i][NHK] はヌルかどうか判定 |
---|
307 |
$dataplace = 0 ; |
---|
308 |
$rowspan = 0; |
---|
309 |
|
---|
310 |
for ($i=1; $i <= $colmnums ; $i++){ |
---|
311 |
if ($i === ($colmnums )){ |
---|
312 |
$rowspan = $i - $dataplace ; |
---|
313 |
|
---|
314 |
//if ((!isset($item[$i][$stationname])) && ($item[$i][$stationname] == "")){ |
---|
315 |
if (!isset($item[$i][$stationname])){ |
---|
316 |
$item[$i][$stationname] = null ; |
---|
317 |
}else{ |
---|
318 |
$item[$i][$stationname] = "<td ". $item[$i][$stationname] . "</td>"; |
---|
319 |
$rowspan--; |
---|
320 |
} |
---|
321 |
|
---|
322 |
if ($rowspan === 1 ){ |
---|
323 |
$item[$dataplace][$stationname] = "<td ". $item[$dataplace][$stationname] . "</td>"; |
---|
324 |
}else{ |
---|
325 |
$item[$dataplace][$stationname] = "<td rowspan = $rowspan ". $item[$dataplace][$stationname] . "</td>"; |
---|
326 |
|
---|
327 |
} |
---|
328 |
|
---|
329 |
|
---|
330 |
}elseif (!isset($item[$i][$stationname])){ |
---|
331 |
|
---|
332 |
|
---|
333 |
$item[$i][$stationname] = null ; |
---|
334 |
|
---|
335 |
}else{ |
---|
336 |
|
---|
337 |
$rowspan = $i - $dataplace; |
---|
338 |
$itemDataplaceStationname = null; |
---|
339 |
$item[$dataplace][$stationname])){ |
---|
340 |
$itemDataplaceStationname = $item[$dataplace][$stationname]; |
---|
341 |
|
---|
342 |
$rowspan === 1 ){ |
---|
343 |
$item[$dataplace][$stationname] = "<td ". $itemDataplaceStationname . "</td>"; |
---|
344 |
|
---|
345 |
$item[$dataplace][$stationname] = "<td rowspan = $rowspan ". $itemDataplaceStationname . "</td>"; |
---|
346 |
|
---|
347 |
} |
---|
348 |
$dataplace = $i; |
---|
349 |
|
---|
350 |
|
---|
351 |
|
---|
352 |
} |
---|
353 |
|
---|
354 |
//・テーブルレンダリング |
---|
355 |
print "<table>\n<tr>"; |
---|
356 |
|
---|
357 |
|
---|
358 |
foreach ($snames as $s) { |
---|
359 |
print "<th>".htmlspecialchars($s)."</th>" ; |
---|
360 |
} |
---|
361 |
|
---|
362 |
for ($l = 0 ;$l < $colmnums; $l++){ |
---|
363 |
print "<tr>"; |
---|
364 |
foreach ($stationhash as $stationname) { |
---|
365 |
print_r($item[$l]["$stationname"]); |
---|
366 |
} |
---|
367 |
print "</tr>\n"; |
---|
368 |
} |
---|
369 |
print "</table>\n"; |
---|
370 |
|
---|
371 |
print "<p align=\"left\"> $navigationbar </p>"; |
---|
372 |
?> |
---|
373 |
<hr> |
---|
374 |
凡例 |
---|
375 |
<table> |
---|
376 |
<tr> |
---|
377 |
<td id="information">情報</td> |
---|
378 |
<td id="anime">アニメ・特撮</td> |
---|
379 |
<td id="news">ニュース・報道</td> |
---|
380 |
<td id="drama">ドラマ</td> |
---|
381 |
<td id="variety">バラエティ</td> |
---|
382 |
<td id="documentary">ドキュメンタリー・教養</td> |
---|
383 |
<td id="education">教育</td> |
---|
384 |
<td id="music">音楽</td> |
---|
385 |
<td id="cinema">映画</td> |
---|
386 |
<td id="hobby">趣味・実用</td> |
---|
387 |
<td id="kids">キッズ</td> |
---|
388 |
<td id="sports">スポーツ</td> |
---|
389 |
<td id="etc">その他</td> |
---|
390 |
<td id="stage">演劇</td> |
---|
391 |
|
---|
392 |
</tr> |
---|
393 |
</table> |
---|
394 |
</body> |
---|
395 |
</html> |
---|
396 |
|
---|
397 |
|
---|
398 |
|
---|