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