チェンジセット 94: trunk/install/php/listreserve.php
- コミット日時:
- 2010/02/28 22:28:26 (15 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
trunk/install/php/listreserve.php
r90 r94 62 62 $query = " 63 63 SELECT 64 foltia_program .tid, 65 stationname, 66 foltia_program .title, 67 foltia_subtitle.countno, 68 foltia_subtitle.subtitle, 69 foltia_subtitle.startdatetime , 70 foltia_subtitle.lengthmin , 71 foltia_tvrecord.bitrate , 72 foltia_subtitle.startoffset , 73 foltia_subtitle.pid , 74 foltia_subtitle.epgaddedby , 64 foltia_program.tid, stationname, foltia_program.title, 65 foltia_subtitle.countno, foltia_subtitle.subtitle, 66 foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, 67 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 68 foltia_subtitle.pid, foltia_subtitle.epgaddedby, 75 69 foltia_tvrecord.digital 76 70 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 77 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 78 AND foltia_subtitle.enddatetime >= '$now'72 AND foltia_subtitle.enddatetime >= ? 79 73 UNION 80 74 SELECT 81 foltia_program .tid, 82 stationname, 83 foltia_program .title, 84 foltia_subtitle.countno, 85 foltia_subtitle.subtitle, 86 foltia_subtitle.startdatetime , 87 foltia_subtitle.lengthmin , 88 foltia_tvrecord.bitrate , 89 foltia_subtitle.startoffset , 90 foltia_subtitle.pid , 91 foltia_subtitle.epgaddedby , 75 foltia_program.tid, stationname, foltia_program.title, 76 foltia_subtitle.countno, foltia_subtitle.subtitle, 77 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 78 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 79 foltia_subtitle.pid, foltia_subtitle.epgaddedby, 92 80 foltia_tvrecord.digital 93 81 FROM foltia_tvrecord … … 96 84 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 97 85 WHERE foltia_tvrecord.stationid = 0 AND 98 foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\"ASC86 foltia_subtitle.enddatetime >= ? ORDER BY x ASC 99 87 "; 100 88 101 $rs = m_query($con, $query, "DBクエリに失敗しました"); 102 $maxrows = pg_num_rows($rs); 103 89 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 90 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$now)); 104 91 105 92 //チューナー数 … … 122 109 123 110 <? 124 if ($maxrows == 0) { 111 $rowdata = $rs->fetch(); 112 if (! $rowdata) { 125 113 print "番組データがありません<BR>\n"; 126 114 }else{ 127 128 129 115 /* フィールド数 */ 130 $maxcols = pg_num_fields($rs);116 $maxcols = $rs->columnCount(); 131 117 ?> 132 118 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%"> … … 149 135 <?php 150 136 /* テーブルのデータを出力 */ 151 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */137 do { 152 138 echo("<tr>\n"); 153 /* pg_fetch_row で一行取り出す */ 154 $rowdata = pg_fetch_row($rs, $row); 139 155 140 $pid = htmlspecialchars($rowdata[9]); 156 141 … … 168 153 $query = " 169 154 SELECT 170 foltia_program .tid, 171 stationname, 172 foltia_program .title, 173 foltia_subtitle.countno, 174 foltia_subtitle.subtitle, 175 foltia_subtitle.startdatetime , 176 foltia_subtitle.lengthmin , 177 foltia_tvrecord.bitrate , 178 foltia_subtitle.startoffset , 179 foltia_subtitle.pid , 180 foltia_tvrecord.digital 155 foltia_program.tid, stationname, foltia_program.title, 156 foltia_subtitle.countno, foltia_subtitle.subtitle, 157 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 158 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 159 foltia_subtitle.pid, foltia_tvrecord.digital 181 160 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 182 161 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 183 AND foltia_subtitle.enddatetime > '$rowdata[5]'184 AND foltia_subtitle.startdatetime < '$endtime'162 AND foltia_subtitle.enddatetime > ? 163 AND foltia_subtitle.startdatetime < ? 185 164 UNION 186 165 SELECT 187 foltia_program .tid, 188 stationname, 189 foltia_program .title, 190 foltia_subtitle.countno, 191 foltia_subtitle.subtitle, 192 foltia_subtitle.startdatetime , 193 foltia_subtitle.lengthmin , 194 foltia_tvrecord.bitrate , 195 foltia_subtitle.startoffset , 196 foltia_subtitle.pid , 197 foltia_tvrecord.digital 166 foltia_program.tid, stationname, foltia_program.title, 167 foltia_subtitle.countno, foltia_subtitle.subtitle, 168 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 169 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 170 foltia_subtitle.pid, foltia_tvrecord.digital 198 171 FROM foltia_tvrecord 199 172 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) … … 201 174 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 202 175 WHERE foltia_tvrecord.stationid = 0 AND 203 foltia_subtitle.enddatetime > '$rowdata[5]'204 AND foltia_subtitle.startdatetime < '$endtime'205 176 foltia_subtitle.enddatetime > ? 177 AND foltia_subtitle.startdatetime < ? 178 "; 206 179 $rclass = ""; 207 $overlap = m_query($con, $query, "DBクエリに失敗しました"); 208 $overlapmaxrows = pg_num_rows($overlap); 180 // $overlap = m_query($con, $query, "DBクエリに失敗しました"); 181 $overlap = sql_query($con, $query, "DBクエリに失敗しました",array($rowdata[5],$endtime,$rowdata[5],$endtime)); 182 $owrowall = $overlap->fetchAll(); 183 $overlapmaxrows = count($owrowall); 209 184 if ($overlapmaxrows > ($recunits) ){ 210 185 … … 212 187 213 188 for ($rrow = 0; $rrow < $overlapmaxrows ; $rrow++) { 214 $owrowdata = pg_fetch_array($overlap, $rrow);189 $owrowdata = $owrowall[$rrow]; 215 190 $owtimeline[ $owrowdata['startdatetime'] ] = $owtimeline[ $owrowdata['startdatetime'] ] +1; 216 191 … … 237 212 $query = " 238 213 SELECT 239 foltia_program .tid, 240 stationname, 241 foltia_program .title, 242 foltia_subtitle.countno, 243 foltia_subtitle.subtitle, 244 foltia_subtitle.startdatetime , 245 foltia_subtitle.lengthmin , 246 foltia_tvrecord.bitrate , 247 foltia_subtitle.startoffset , 248 foltia_subtitle.pid , 249 foltia_tvrecord.digital 214 foltia_program.tid, stationname, foltia_program.title, 215 foltia_subtitle.countno, foltia_subtitle.subtitle, 216 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 217 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 218 foltia_subtitle.pid, foltia_tvrecord.digital 250 219 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 251 220 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 252 AND foltia_subtitle.enddatetime > '$rowdata[5]'253 AND foltia_subtitle.startdatetime < '$endtime'221 AND foltia_subtitle.enddatetime > ? 222 AND foltia_subtitle.startdatetime < ? 254 223 AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) 255 224 UNION 256 225 SELECT 257 foltia_program .tid, 258 stationname, 259 foltia_program .title, 260 foltia_subtitle.countno, 261 foltia_subtitle.subtitle, 262 foltia_subtitle.startdatetime , 263 foltia_subtitle.lengthmin , 264 foltia_tvrecord.bitrate , 265 foltia_subtitle.startoffset , 266 foltia_subtitle.pid , 267 foltia_tvrecord.digital 226 foltia_program.tid, stationname, foltia_program.title, 227 foltia_subtitle.countno, foltia_subtitle.subtitle, 228 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 229 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 230 foltia_subtitle.pid, foltia_tvrecord.digital 268 231 FROM foltia_tvrecord 269 232 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) … … 271 234 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 272 235 WHERE foltia_tvrecord.stationid = 0 AND 273 foltia_subtitle.enddatetime > '$rowdata[5]'274 AND foltia_subtitle.startdatetime < '$endtime'236 foltia_subtitle.enddatetime > ? 237 AND foltia_subtitle.startdatetime < ? 275 238 AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) 276 277 239 "; 278 $eoverlap = m_query($con, $query, "DBクエリに失敗しました"); 279 $eoverlapmaxrows = pg_num_rows($eoverlap); 240 // $eoverlap = m_query($con, $query, "DBクエリに失敗しました"); 241 $eoverlap = sql_query($con, $query, "DBクエリに失敗しました",array($rowdata[5], $endtime,$rowdata[5], $endtime)); 242 $eowrowall = $eoverlap->fetchAll(); 243 $eoverlapmaxrows = count($eowrowall); 280 244 if ($eoverlapmaxrows > ($externalinputs) ){ 281 245 … … 283 247 284 248 for ($erow = 0; $erow < $eoverlapmaxrows ; $erow++) { 285 $eowrowdata = pg_fetch_array($eoverlap, $erow);249 $eowrowdata = $eowrowall[$erow]; 286 250 $eowtimeline[ $eowrowdata['startdatetime'] ] = $eowtimeline[ $eowrowdata['startdatetime'] ] +1; 287 251 … … 359 323 echo("<br></td>\n"); 360 324 echo("</tr>\n"); 361 }325 } while ($rowdata = $rs->fetch()); 362 326 ?> 363 327 </tbody> … … 374 338 375 339 <?php 376 } //if ($maxrows == 0) { 377 378 340 } //if ($maxrows == 0) 379 341 $query = " 380 342 SELECT 381 foltia_program.tid, 382 stationname, 383 foltia_program .title , 384 foltia_tvrecord.bitrate , 385 foltia_tvrecord.stationid , 343 foltia_program.tid, stationname, foltia_program.title, 344 foltia_tvrecord.bitrate, foltia_tvrecord.stationid, 386 345 foltia_tvrecord.digital 387 346 FROM foltia_tvrecord , foltia_program , foltia_station … … 389 348 ORDER BY foltia_program.tid DESC 390 349 "; 391 $rs = m_query($con, $query, "DBクエリに失敗しました");392 $ maxrows = pg_num_rows($rs);393 394 if ($maxrows == 0) {350 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 351 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 352 $rowdata = $rs->fetch(); 353 if (! $rowdata) { 395 354 //なければなにもしない 396 355 397 356 }else{ 398 $maxcols = pg_num_fields($rs);357 $maxcols = $rs->columnCount(); 399 358 400 359 ?> … … 417 376 <?php 418 377 /* テーブルのデータを出力 */ 419 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 420 /* pg_fetch_row で一行取り出す */ 421 $rowdata = pg_fetch_row($rs, $row); 422 378 do { 423 379 $tid = htmlspecialchars($rowdata[0]); 424 380 … … 468 424 echo("\n</tr>"); 469 425 }//if tid 0 470 }//for426 } while ($rowdata = $rs->fetch()); 471 427 }//else 472 428 ?>