root/trunk/install/php/listreserve.php

リビジョン 52, 10.5 kB (コミッタ: sorshi, コミット時期: 17 年 前)

録画ユニット数判定ミス修正

Line 
1 <?php
2 /*
3  Anime recording system foltia
4  http://www.dcc-jpl.com/soft/foltia/
5
6 listreserve.php
7
8 目的
9 録画予約番組放映予定と予約番組名を表示します。
10
11 引数
12 r:録画デバイス数
13
14  DCC-JPL Japan/foltia project
15
16 */
17 ?>
18 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
19 <html lang="ja">
20 <head>
21 <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
22 <meta http-equiv="Content-Style-Type" content="text/css">
23 <link rel="stylesheet" type="text/css" href="graytable.css">
24 <title>foltia:record plan</title>
25 </head>
26
27 <?php
28
29   include("./foltialib.php");
30
31 $con = m_connect();
32
33 $now = date("YmdHi");   
34
35     $query = "
36 SELECT
37 foltia_program .tid,
38 stationname,
39 foltia_program .title,
40 foltia_subtitle.countno,
41 foltia_subtitle.subtitle,
42 foltia_subtitle.startdatetime ,
43 foltia_subtitle.lengthmin ,
44 foltia_tvrecord.bitrate  ,
45 foltia_subtitle.startoffset ,
46 foltia_subtitle.pid 
47 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord
48 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
49 AND foltia_subtitle.enddatetime >= '$now'
50 UNION
51 SELECT
52 foltia_program .tid,
53 stationname,
54 foltia_program .title,
55 foltia_subtitle.countno,
56 foltia_subtitle.subtitle,
57 foltia_subtitle.startdatetime ,
58 foltia_subtitle.lengthmin ,
59 foltia_tvrecord.bitrate ,
60 foltia_subtitle.startoffset ,
61 foltia_subtitle.pid 
62 FROM foltia_tvrecord
63 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid )
64 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid )
65 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid )
66 WHERE foltia_tvrecord.stationid = 0 AND
67 foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC
68     ";
69
70     $rs = m_query($con, $query, "DBクエリに失敗しました");
71     $maxrows = pg_num_rows($rs);
72             
73
74 //チューナー数
75 if (getgetnumform(r) != ""){
76     $recunits = getgetnumform(r);
77 }elseif($recunits == ""){
78     $recunits = 2;
79 }
80
81 ?>
82
83 <body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" >
84 <div align="center">
85 <?php
86 printhtmlpageheader();
87 ?>
88   <p align="left"><font color="#494949" size="6">予約一覧</font></p>
89   <hr size="4">
90 <p align="left">録画予約番組放映予定と予約番組名を表示します。</p>
91
92 <?
93     if ($maxrows == 0) {
94         print "番組データがありません<BR>\n";           
95         }else{
96
97
98         /* フィールド数 */
99         $maxcols = pg_num_fields($rs);
100         ?>
101   <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%">
102     <thead>
103         <tr>
104             <th align="left">TID</th>
105             <th align="left">放映局</th>
106             <th align="left">タイトル</th>
107             <th align="left">話数</th>
108             <th align="left">サブタイトル</th>
109             <th align="left">開始時刻</th>
110             <th align="left">総尺</th>
111             <th align="left">画質</th>
112
113         </tr>
114     </thead>
115
116     <tbody>
117         <?php
118             /* テーブルのデータを出力 */
119             for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */
120                 echo("<tr>\n");
121                 /* pg_fetch_row で一行取り出す */
122                 $rowdata = pg_fetch_row($rs, $row);
123 $pid = htmlspecialchars($rowdata[9]);
124
125 $tid = htmlspecialchars($rowdata[0]);
126 $title = htmlspecialchars($rowdata[2]);
127 $subtitle htmlspecialchars($rowdata[4]);
128 //重複検出
129 //開始時刻 $rowdata[5]
130 //終了時刻
131 $endtime = calcendtime($rowdata[5],$rowdata[6]);
132 //番組の開始時刻より遅い時刻に終了し、終了時刻より前にはじまる番組があるかどうか
133 //オンボードチューナー録画
134 $query = "
135 SELECT
136 foltia_program .tid,
137 stationname,
138 foltia_program .title,
139 foltia_subtitle.countno,
140 foltia_subtitle.subtitle,
141 foltia_subtitle.startdatetime ,
142 foltia_subtitle.lengthmin ,
143 foltia_tvrecord.bitrate  ,
144 foltia_subtitle.startoffset ,
145 foltia_subtitle.pid 
146 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord
147 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
148 AND foltia_subtitle.enddatetime >= '$rowdata[5]'
149 AND foltia_subtitle.startdatetime <= '$endtime' 
150 UNION
151 SELECT
152 foltia_program .tid,
153 stationname,
154 foltia_program .title,
155 foltia_subtitle.countno,
156 foltia_subtitle.subtitle,
157 foltia_subtitle.startdatetime ,
158 foltia_subtitle.lengthmin ,
159 foltia_tvrecord.bitrate  ,
160 foltia_subtitle.startoffset ,
161 foltia_subtitle.pid 
162 FROM foltia_tvrecord
163 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid )
164 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid )
165 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid )
166 WHERE foltia_tvrecord.stationid = 0 AND
167 foltia_subtitle.enddatetime >= '$rowdata[5]' 
168 AND foltia_subtitle.startdatetime <= '$endtime' 
169     ";
170     $rclass = "";
171     $overlap = m_query($con, $query, "DBクエリに失敗しました");
172     $overlapmaxrows = pg_num_rows($overlap);
173     if ($overlapmaxrows > ($recunits) ){
174         for ($rrow = 0; $rrow < $overlapmaxrows ; $rrow++) {
175             $owrowdata = pg_fetch_row($overlap, $rrow);
176             $overlappid[] = $owrowdata[9];
177         }
178     if (in_array($rowdata[9], $overlappid)) {
179         $rclass = "overwraped";
180     }
181     }else{
182     $overlappid = "";
183     }//end if
184
185 //外部チューナー録画
186 $externalinputs = 1; //現状一系統のみ
187 $query = "
188 SELECT
189 foltia_program .tid,
190 stationname,
191 foltia_program .title,
192 foltia_subtitle.countno,
193 foltia_subtitle.subtitle,
194 foltia_subtitle.startdatetime ,
195 foltia_subtitle.lengthmin ,
196 foltia_tvrecord.bitrate  ,
197 foltia_subtitle.startoffset ,
198 foltia_subtitle.pid 
199 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord
200 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
201 AND foltia_subtitle.enddatetime > '$rowdata[5]'
202 AND foltia_subtitle.startdatetime < '$endtime' 
203 AND  (foltia_station.stationrecch = '0' OR  foltia_station.stationrecch = '-1' )
204 UNION
205 SELECT
206 foltia_program .tid,
207 stationname,
208 foltia_program .title,
209 foltia_subtitle.countno,
210 foltia_subtitle.subtitle,
211 foltia_subtitle.startdatetime ,
212 foltia_subtitle.lengthmin ,
213 foltia_tvrecord.bitrate  ,
214 foltia_subtitle.startoffset ,
215 foltia_subtitle.pid 
216 FROM foltia_tvrecord
217 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid )
218 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid )
219 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid )
220 WHERE foltia_tvrecord.stationid = 0 AND
221 foltia_subtitle.enddatetime > '$rowdata[5]' 
222 AND foltia_subtitle.startdatetime < '$endtime' 
223 AND  (foltia_station.stationrecch = '0' OR  foltia_station.stationrecch = '-1' )
224
225     ";
226     $eoverlap = m_query($con, $query, "DBクエリに失敗しました");
227     $eoverlapmaxrows = pg_num_rows($eoverlap);
228     if ($eoverlapmaxrows > ($externalinputs) ){
229         for ($erow = 0; $erow < $eoverlapmaxrows ; $erow++) {
230             $eowrowdata = pg_fetch_row($eoverlap, $erow);
231             $eoverlappid[] = $eowrowdata[9];
232         }
233
234         if (in_array($rowdata[9], $eoverlappid)) {
235             $rclass = "exoverwraped";
236         }
237     }else{
238     $eoverlappid = "";
239     }
240                 echo("<tr class=\"$rclass\">\n");
241                     // TID
242                     print "<td>";
243                     if ($tid == 0 ){
244                     print "$tid";
245                     }else{
246                     print "<a href=\"reserveprogram.php?tid=$tid\">$tid</a>";
247                     }
248                     print "</td>\n";
249                      // 放映局
250                      echo("<td>".htmlspecialchars($rowdata[1])."<br></td>\n");
251                      // タイトル
252                     print "<td>";
253                     if ($tid == 0 ){
254                     print "$title";
255                     }else{
256                     print "<a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a>";
257                     }
258                     print "</td>\n";
259                      // 話数
260                     echo("<td>".htmlspecialchars($rowdata[3])."<br></td>\n");
261                     // サブタイ
262                     if ($pid > 0 ){
263                     print "<td><a href=\"http://cal.syoboi.jp/tid/$tid/time#$pid\" target=\"_blank\">$subtitle<br></td>\n";
264                     }else{
265                     if ($protectmode) {
266                     print "<td>$subtitle<br></td>\n";
267                     }else{
268                     print "<td>$subtitle [<a href=\"delepgp.php?pid=$pid\">予約解除</a>]<br></td>\n";
269                     }
270                     }
271                     // 開始時刻(ズレ)
272                     echo("<td>".htmlspecialchars(foldate2print($rowdata[5]))."<br>(".htmlspecialchars($rowdata[8]).")</td>\n");
273                     // 総尺
274                     echo("<td>".htmlspecialchars($rowdata[6])."<br></td>\n");
275                     
276                     //録画レート
277                     echo("<td>".htmlspecialchars($rowdata[7])."<br></td>\n");
278                 echo("</tr>\n");
279             }
280         ?>
281     </tbody>
282 </table>
283
284
285 <table>
286     <tr><td>エンコーダ数</td><td><?=$recunits ?></td></tr>
287     <tr class="overwraped"><td>チューナー重複</td><td><br /></td></tr>
288     <tr class="exoverwraped"><td>外部入力重複</td><td><br /></td></tr>
289 </table>
290
291
292 <?php
293 } //if ($maxrows == 0) {
294
295
296     $query = "
297 SELECT
298 foltia_program.tid,
299 stationname,
300 foltia_program .title ,
301 foltia_tvrecord.bitrate ,
302 foltia_tvrecord.stationid 
303 FROM  foltia_tvrecord , foltia_program , foltia_station
304 WHERE foltia_tvrecord.tid = foltia_program.tid  AND foltia_tvrecord.stationid = foltia_station .stationid   
305 ORDER BY foltia_program.tid  DESC
306 ";
307     $rs = m_query($con, $query, "DBクエリに失敗しました");
308     $maxrows = pg_num_rows($rs);
309             
310         if ($maxrows == 0) {
311 //なければなにもしない
312             
313         }else{
314         $maxcols = pg_num_fields($rs);
315
316 ?>
317 <p align="left">録画予約番組タイトルを表示します。</p>
318   <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%">
319     <thead>
320         <tr>
321             <th align="left">予約解除</th>
322             <th align="left">TID</th>
323             <th align="left">放映局</th>
324             <th align="left">タイトル</th>
325             <th align="left">録画リスト</th>
326             <th align="left">画質</th>
327         </tr>
328     </thead>
329
330     <tbody>
331         <?php
332             /* テーブルのデータを出力 */
333             for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */
334                 /* pg_fetch_row で一行取り出す */
335                 $rowdata = pg_fetch_row($rs, $row);
336
337                 $tid = htmlspecialchars($rowdata[0]);
338                 
339                 if ($tid > 0){
340                 echo("<tr>\n");
341                 //予約解除
342                 if ($protectmode) {
343                     echo("<td>−</td>");               
344                 }else{
345                     echo("<td><a href=\"delreserve.php?tid=$tid&sid=" .
346                      htmlspecialchars($rowdata[4])  . "\">解除</a></td>\n");
347                 }
348                 //TID
349                     echo("<td><a href=\"reserveprogram.php?tid=$tid\">$tid</a></td>\n");
350                      //放映局
351                      echo("<td>".htmlspecialchars($rowdata[1])."<br></td>\n");
352                      //タイトル
353                      echo("<td><a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">" .
354                      htmlspecialchars($rowdata[2]) . "</a></td>\n");
355
356                     //MP4
357                     echo("<td><a href=\"showlibc.php?tid=$tid\">mp4</a></td>\n");
358
359                     echo("<td>".htmlspecialchars($rowdata[3])."<br></td>\n");
360     
361                 echo("</tr>\n");
362                 }else{
363                 print "<tr>
364                 <td>−</td><td>0</td>
365                 <td>[全局]<br></td>
366                 <td>EPG録画</td>
367                 <td><a href=\"showlibc.php?tid=0\">mp4</a></td>";
368                 echo("<td>".htmlspecialchars($rowdata[3])."<br></td>\n</tr>");
369                 }//if tid 0
370             }//for
371         }//else
372         ?>
373     </tbody>
374 </table>
375
376
377 </body>
378 </html>
379
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed