1 |
<?php |
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 |
|
---|
14 |
|
---|
15 |
|
---|
16 |
|
---|
17 |
|
---|
18 |
|
---|
19 |
?> |
---|
20 |
|
---|
21 |
<?php |
---|
22 |
include("./foltialib.php"); |
---|
23 |
|
---|
24 |
$con = m_connect(); |
---|
25 |
$now = date("YmdHi"); |
---|
26 |
|
---|
27 |
|
---|
28 |
function printtitle(){ |
---|
29 |
|
---|
30 |
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"> |
---|
31 |
<html lang=\"ja\"> |
---|
32 |
<head> |
---|
33 |
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=EUC-JP\"> |
---|
34 |
<meta http-equiv=\"Content-Style-Type\" content=\"text/css\"> |
---|
35 |
<link rel=\"stylesheet\" type=\"text/css\" href=\"graytable.css\"> "; |
---|
36 |
|
---|
37 |
warndiskfreearea(); |
---|
38 |
print "<title>foltia:放映予定</title> |
---|
39 |
</head>"; |
---|
40 |
|
---|
41 |
|
---|
42 |
} |
---|
43 |
|
---|
44 |
//同一番組他局検索 |
---|
45 |
$query = " |
---|
46 |
SELECT |
---|
47 |
foltia_program .tid, |
---|
48 |
foltia_program .title, |
---|
49 |
foltia_subtitle.countno, |
---|
50 |
foltia_subtitle.subtitle, |
---|
51 |
foltia_subtitle.startdatetime , |
---|
52 |
foltia_subtitle.lengthmin , |
---|
53 |
foltia_tvrecord.bitrate , |
---|
54 |
foltia_subtitle.pid |
---|
55 |
FROM foltia_subtitle , foltia_program ,foltia_tvrecord |
---|
56 |
WHERE foltia_tvrecord.tid = foltia_program.tid |
---|
57 |
AND foltia_program.tid = foltia_subtitle.tid |
---|
58 |
AND foltia_subtitle.enddatetime >= '$now' |
---|
59 |
ORDER BY \"startdatetime\" ASC |
---|
60 |
"; |
---|
61 |
$reservedrssametid = m_query($con, $query, "DBクエリに失敗しました"); |
---|
62 |
$reservedmaxrowssameid = pg_num_rows($reservedrssametid); |
---|
63 |
|
---|
64 |
if ($reservedmaxrowssameid > 0 ){ |
---|
65 |
for ($rrow = 0; $rrow < $reservedmaxrowssameid ; $rrow++) { |
---|
66 |
$rowdata = pg_fetch_row($reservedrssametid, $rrow); |
---|
67 |
$reservedpidsametid[] = $rowdata[7]; |
---|
68 |
} |
---|
69 |
$rowdata = ""; |
---|
70 |
$rrow = ""; |
---|
71 |
}else{ |
---|
72 |
$reservedpidsametid = "" ; |
---|
73 |
} |
---|
74 |
|
---|
75 |
//録画番組検索 |
---|
76 |
$query = " |
---|
77 |
SELECT |
---|
78 |
foltia_program .tid, |
---|
79 |
stationname, |
---|
80 |
foltia_program .title, |
---|
81 |
foltia_subtitle.countno, |
---|
82 |
foltia_subtitle.subtitle, |
---|
83 |
foltia_subtitle.startdatetime , |
---|
84 |
foltia_subtitle.lengthmin , |
---|
85 |
foltia_tvrecord.bitrate , |
---|
86 |
foltia_subtitle.pid |
---|
87 |
FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord |
---|
88 |
WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid |
---|
89 |
AND foltia_subtitle.enddatetime >= '$now' |
---|
90 |
UNION |
---|
91 |
SELECT |
---|
92 |
foltia_program .tid, |
---|
93 |
stationname, |
---|
94 |
foltia_program .title, |
---|
95 |
foltia_subtitle.countno, |
---|
96 |
foltia_subtitle.subtitle, |
---|
97 |
foltia_subtitle.startdatetime , |
---|
98 |
foltia_subtitle.lengthmin , |
---|
99 |
foltia_tvrecord.bitrate , |
---|
100 |
foltia_subtitle.pid |
---|
101 |
FROM foltia_tvrecord |
---|
102 |
LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) |
---|
103 |
LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) |
---|
104 |
LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) |
---|
105 |
WHERE foltia_tvrecord.stationid = 0 AND |
---|
106 |
foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC |
---|
107 |
"; |
---|
108 |
|
---|
109 |
$reservedrs = m_query($con, $query, "DBクエリに失敗しました"); |
---|
110 |
$reservedmaxrows = pg_num_rows($reservedrs); |
---|
111 |
|
---|
112 |
if ($reservedmaxrows > 0 ){ |
---|
113 |
for ($rrow = 0; $rrow < $reservedmaxrows ; $rrow++) { |
---|
114 |
$rowdata = pg_fetch_row($reservedrs, $rrow); |
---|
115 |
$reservedpid[] = $rowdata[8]; |
---|
116 |
} |
---|
117 |
}else{ |
---|
118 |
$reservedpid = ""; |
---|
119 |
} |
---|
120 |
|
---|
121 |
$mode = getgetform(mode); |
---|
122 |
|
---|
123 |
if ($mode == "new"){ |
---|
124 |
|
---|
125 |
$query = " |
---|
126 |
|
---|
127 |
|
---|
128 |
|
---|
129 |
|
---|
130 |
|
---|
131 |
|
---|
132 |
|
---|
133 |
|
---|
134 |
|
---|
135 |
|
---|
136 |
|
---|
137 |
|
---|
138 |
|
---|
139 |
|
---|
140 |
; |
---|
141 |
$rs = m_query($con, $query, "DBクエリに失敗しました"); |
---|
142 |
$maxrows = pg_num_rows($rs); |
---|
143 |
|
---|
144 |
|
---|
145 |
|
---|
146 |
$query = " |
---|
147 |
|
---|
148 |
|
---|
149 |
|
---|
150 |
|
---|
151 |
|
---|
152 |
|
---|
153 |
|
---|
154 |
|
---|
155 |
|
---|
156 |
|
---|
157 |
|
---|
158 |
|
---|
159 |
|
---|
160 |
|
---|
161 |
; |
---|
162 |
$rs = m_query($con, $query, "DBクエリに失敗しました"); |
---|
163 |
$maxrows = pg_num_rows($rs); |
---|
164 |
|
---|
165 |
|
---|
166 |
|
---|
167 |
if ($maxrows == 0) { |
---|
168 |
header("Status: 404 Not Found",TRUE,404); |
---|
169 |
printtitle(); |
---|
170 |
print "<body BGCOLOR=\"#ffffff\" TEXT=\"#494949\" LINK=\"#0047ff\" VLINK=\"#000000\" ALINK=\"#c6edff\" > |
---|
171 |
<div align=\"center\">\n"; |
---|
172 |
printhtmlpageheader(); |
---|
173 |
print "<hr size=\"4\">\n"; |
---|
174 |
die_exit("番組データがありません<BR>"); |
---|
175 |
} |
---|
176 |
|
---|
177 |
printtitle(); |
---|
178 |
?> |
---|
179 |
<body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" > |
---|
180 |
<div align="center"> |
---|
181 |
<?php |
---|
182 |
printhtmlpageheader(); |
---|
183 |
?> |
---|
184 |
<p align="left"><font color="#494949" size="6"> |
---|
185 |
<?php |
---|
186 |
if ($mode == "new"){ |
---|
187 |
print "新番組放映予定"; |
---|
188 |
}else{ |
---|
189 |
print "放映予定"; |
---|
190 |
} |
---|
191 |
?> |
---|
192 |
</font></p> |
---|
193 |
<hr size="4"> |
---|
194 |
<p align="left">放映番組リストを表示します。</p> |
---|
195 |
|
---|
196 |
<? |
---|
197 |
|
---|
198 |
$maxcols = pg_num_fields($rs); |
---|
199 |
?> |
---|
200 |
<table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%"> |
---|
201 |
<thead> |
---|
202 |
<tr> |
---|
203 |
<th align="left">TID</th> |
---|
204 |
<th align="left">放映局</th> |
---|
205 |
<th align="left">タイトル</th> |
---|
206 |
<th align="left">話数</th> |
---|
207 |
<th align="left">サブタイトル</th> |
---|
208 |
<th align="left">開始時刻(ズレ)</th> |
---|
209 |
<th align="left">総尺</th> |
---|
210 |
|
---|
211 |
</tr> |
---|
212 |
</thead> |
---|
213 |
|
---|
214 |
<tbody> |
---|
215 |
<?php |
---|
216 |
|
---|
217 |
for ($row = 0; $row < $maxrows; $row++) { |
---|
218 |
/* pg_fetch_row で一行取り出す */ |
---|
219 |
$rowdata = pg_fetch_row($rs, $row); |
---|
220 |
|
---|
221 |
|
---|
222 |
if (in_array($rowdata[7], $reservedpidsametid)) { |
---|
223 |
$rclass = "reservedtitle"; |
---|
224 |
}else{ |
---|
225 |
$rclass = ""; |
---|
226 |
} |
---|
227 |
|
---|
228 |
if (in_array($rowdata[7], $reservedpid)) { |
---|
229 |
$rclass = "reserved"; |
---|
230 |
} |
---|
231 |
$pid = htmlspecialchars($rowdata[7]); |
---|
232 |
|
---|
233 |
$tid = htmlspecialchars($rowdata[0]); |
---|
234 |
$title = htmlspecialchars($rowdata[2]); |
---|
235 |
$subtitle = htmlspecialchars($rowdata[4]); |
---|
236 |
|
---|
237 |
echo("<tr class=\"$rclass\">\n"); |
---|
238 |
|
---|
239 |
print "<td>"; |
---|
240 |
if ($tid == 0 ){ |
---|
241 |
print "$tid"; |
---|
242 |
}else{ |
---|
243 |
print "<a href=\"reserveprogram.php?tid=$tid\">$tid</a>"; |
---|
244 |
} |
---|
245 |
print "</td>\n"; |
---|
246 |
|
---|
247 |
echo("<td>".htmlspecialchars($rowdata[1])."<br></td>\n"); |
---|
248 |
|
---|
249 |
print "<td>"; |
---|
250 |
if ($tid == 0 ){ |
---|
251 |
print "$title"; |
---|
252 |
}else{ |
---|
253 |
print "<a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a>"; |
---|
254 |
} |
---|
255 |
print "</td>\n"; |
---|
256 |
|
---|
257 |
echo("<td>".htmlspecialchars($rowdata[3])."<br></td>\n"); |
---|
258 |
|
---|
259 |
if ($pid > 0 ){ |
---|
260 |
print "<td><a href=\"http://cal.syoboi.jp/tid/$tid/time#$pid\" target=\"_blank\">$subtitle<br></td>\n"; |
---|
261 |
}else{ |
---|
262 |
print "<td>$subtitle<br></td>\n"; |
---|
263 |
} |
---|
264 |
|
---|
265 |
echo("<td>".htmlspecialchars(foldate2print($rowdata[5]))."<br>(".htmlspecialchars($rowdata[8]).")</td>\n"); |
---|
266 |
|
---|
267 |
echo("<td>".htmlspecialchars($rowdata[6])."<br></td>\n"); |
---|
268 |
|
---|
269 |
echo("</tr>\n"); |
---|
270 |
} |
---|
271 |
?> |
---|
272 |
</tbody> |
---|
273 |
</table> |
---|
274 |
|
---|
275 |
|
---|
276 |
</body> |
---|
277 |
</html> |
---|
278 |
|
---|