root/trunk/install/php/listreserve.php

リビジョン 83, 12.3 kB (コミッタ: sorshi, コミット時期: 15 年 前)

foltiaHD最初のリリース。
デジタル録画はFriio/Friio BS/CSのみに対応。
ivtvは1.0系使用になりました。

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