root/trunk/install/php/index.php

リビジョン 1, 7.0 kB (コミッタ: jplcom, コミット時期: 17 年 前)

initial import

Line 
1 <?php
2 /*
3  Anime recording system foltia
4  http://www.dcc-jpl.com/soft/foltia/
5
6 index.php
7
8 目的
9 全番組放映予定を表示します。
10 録画予約されている番組は別色でわかりやすく表現されています。
11
12
13 オプション
14 mode:"new"を指定すると、新番組(第1話)のみの表示となる。
15
16  DCC-JPL Japan/foltia project
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 }//end function printtitle()
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     }//end if
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     }//end if
118
119 $mode = getgetform(mode);
120
121 if ($mode == "new"){
122 //新番組表示モード
123     $query = "
124     SELECT
125 foltia_program .tid,
126 stationname,
127 foltia_program .title,
128 foltia_subtitle.countno,
129 foltia_subtitle.subtitle,
130 foltia_subtitle.startdatetime ,
131 foltia_subtitle.lengthmin  ,
132 foltia_subtitle.pid ,
133 foltia_subtitle.startoffset   
134 FROM foltia_subtitle , foltia_program ,foltia_station 
135 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
136  AND foltia_subtitle.enddatetime >= '$now'  AND foltia_subtitle.countno = '1'
137 ORDER BY foltia_subtitle.startdatetime  ASC
138     ";
139     $rs = m_query($con, $query, "DBクエリに失敗しました");
140     $maxrows = pg_num_rows($rs);
141
142
143 }else{
144     $query = "
145     SELECT
146 foltia_program .tid,
147 stationname,
148 foltia_program .title,
149 foltia_subtitle.countno,
150 foltia_subtitle.subtitle,
151 foltia_subtitle.startdatetime ,
152 foltia_subtitle.lengthmin ,
153 foltia_subtitle.pid  ,
154 foltia_subtitle.startoffset   
155 FROM foltia_subtitle , foltia_program ,foltia_station 
156 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
157  AND foltia_subtitle.enddatetime >= '$now' 
158 ORDER BY foltia_subtitle.startdatetime  ASC
159     ";
160     $rs = m_query($con, $query, "DBクエリに失敗しました");
161     $maxrows = pg_num_rows($rs);
162
163 }//end if
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 }//endif
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                     // TID
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
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed