Index: trunk/install/php/viewepg.php =================================================================== --- trunk/install/php/viewepg.php (リビジョン 120) +++ trunk/install/php/viewepg.php (リビジョン 1) @@ -4,5 +4,5 @@ http://www.dcc-jpl.com/soft/foltia/ -viewepg.php +reserveprogram.php 目的 @@ -16,18 +16,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); -$epgviewstyle = 1;// 0だと終了時刻も表示 -if ($useenvironmentpolicy == 1){ - if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; - } else { - login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); - } -}//end if login ?> @@ -37,8 +23,13 @@ -foltia:EPG番組表 +foltia:EPG + -?>
@@ -55,19 +46,8 @@ printhtmlpageheader(); ?> -

EPG番組表

-

番組手動予約

-
-

EPG番組表を表示します。 +

番組表

+
+

番組表を表示します。 \n"; - +print "($startyear/$startmonth/$startday $starthour:$startmin-)
\n"; $yesterday = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday -1 , $startyear)); -$dayyesterday = date ("m/d(D)",mktime($starthour , 0 , 0, $startmonth , $startday -1 , $startyear)); +$today0400 = date ("YmdHi",mktime(4 , 0 , 0, $startmonth , $startday , $startyear)); +$today1200 = date ("YmdHi",mktime(12 , 0 , 0, $startmonth , $startday , $startyear)); +$today2000 = date ("YmdHi",mktime(20 , 0 , 0, $startmonth , $startday , $startyear)); +$day1after = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday +1 , $startyear)); +$day1 = date ("m/d",mktime($starthour , 0 , 0, $startmonth , $startday +1 , $startyear)); +$day2after = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday +2 , $startyear)); +$day2 = date ("m/d",mktime($starthour , 0 , 0, $startmonth , $startday +2 , $startyear)); +$day3after = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday +3 , $startyear)); +$day3 = date ("m/d",mktime($starthour , 0 , 0, $startmonth , $startday +3 , $startyear)); +$day4after = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday +4 , $startyear)); +$day4 = date ("m/d",mktime($starthour , 0 , 0, $startmonth , $startday +4 , $startyear)); +$day5after = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday +5 , $startyear)); +$day5 = date ("m/d",mktime($starthour , 0 , 0, $startmonth , $startday +5 , $startyear)); +$day6after = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday +6 , $startyear)); +$day6 = date ("m/d",mktime($starthour , 0 , 0, $startmonth , $startday +6 , $startyear)); +$day7after = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday +7 , $startyear)); +$day7 = date ("m/d",mktime($starthour , 0 , 0, $startmonth , $startday +7 , $startyear)); -/////////////////////////////////////////////////////////// -//時刻の隣の【翌日】の変数 -$tomorrow = date ("YmdHi",mktime($starthour , 0 , 0, $startmonth , $startday +1 , $startyear)); -/////////////////////////////////////////////////////////// -//EPG番組表を取得しますのとなりの日付の【曜日】の変数 -$daytomorrow = date ("m/d(D)",mktime($starthour , 0 , 0, $startmonth , $startday +1 , $startyear)); -/////////////////////////////////////////////////////////// - - -$today0400 = date ("YmdHi",mktime(4 , 0 , 0, $startmonth , $startday , $startyear)); -$today0800 = date ("YmdHi",mktime(8 , 0 , 0, $startmonth , $startday , $startyear)); -$today1200 = date ("YmdHi",mktime(12 , 0 , 0, $startmonth , $startday , $startyear)); -$today1600 = date ("YmdHi",mktime(16 , 0 , 0, $startmonth , $startday , $startyear)); -$today2000 = date ("YmdHi",mktime(20 , 0 , 0, $startmonth , $startday , $startyear)); -$today2359 = date ("YmdHi",mktime(23 , 59 , 0, $startmonth , $startday , $startyear)); - - -/////////////////////////////////////////////////////////////////// -//1週間分のページのリンクの変数 -$day0after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday , $beginyear)); -$day0 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday , $beginyear)); -$day1after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +1 , $beginyear)); -$day1 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +1 , $beginyear)); -$day2after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +2 , $beginyear)); -$day2 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +2 , $beginyear)); -$day3after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +3 , $beginyear)); -$day3 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +3 , $beginyear)); -$day4after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +4 , $beginyear)); -$day4 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +4 , $beginyear)); -$day5after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +5 , $beginyear)); -$day5 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +5 , $beginyear)); -$day6after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +6 , $beginyear)); -$day6 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +6 , $beginyear)); -$day7after = date ("YmdHi",mktime($beginhour , 0 , 0, $beginmonth , $beginday +7 , $beginyear)); -$day7 = date ("m/d(D)",mktime($beginhour , 0 , 0, $beginmonth , $beginday +7 , $beginyear)); -/////////////////////////////////////////////////////////////////// @@ -126,13 +83,14 @@ $maxdisplay = 8; -$query = "SELECT count(*) FROM foltia_station WHERE \"ontvcode\" LIKE '%ontvjapan%'"; -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました"); -$maxrows = $rs->fetchColumn(0); + $query = "SELECT stationid, stationname, stationrecch, ontvcode FROM foltia_station WHERE \"ontvcode\" ~~ '%ontvjapan%' + "; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + if ($maxrows > $maxdisplay){ $pages = ceil($maxrows / $maxdisplay) ; } -$page = getgetnumform("p"); +$page = getgetnumform(p); if (($page == "")|| ($page <= 0) ){ @@ -150,30 +108,7 @@ -///////////////////////////////////////////////////////////////// -//表示部分 -$navigationbar = " +print "←前の日 現在 当日(4:00 12:00 20:00) 次の日 $day2 $day3 $day4 $day5 $day6 $day7
\n"; -[現在] | -$dayyesterday [前日] | -当日( -4:00  -8:00  -12:00  -16:00  -20:00  -24:00) | -$daytomorrow [翌日] -
- | -$day0 | -$day1 | -$day2 | -$day3 | -$day4 | -$day5 | -$day6 | -$day7 |
\n"; -print "$navigationbar"; -/////////////////////////////////////////////////////////////////// + if ($maxrows > $maxdisplay){ @@ -186,212 +121,50 @@ print " $page / $pages (放送局) "; -for ($i=1;$i<=$pages;$i++){ - print "$i・"; + +if ($page < $pages){ + $nextpage = $page + 1; + print ""; +} } -if ($page < $pages){ - $nextpage = $page + 1; - print ""; + $query = "SELECT stationid, stationname, stationrecch, ontvcode FROM foltia_station WHERE \"ontvcode\" ~~ '%ontvjapan%' ORDER BY stationid ASC , stationrecch OFFSET $offset LIMIT $maxdisplay + "; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + +//print ""; +$viewstations = pg_num_rows($rs); +print "

+ + + +"; +for ($i=0 ; $i < $viewstations ; $i++){ + $rowdata = pg_fetch_row($rs, $i); + if ($rowdata[1] != ""){ + print " \n"; + } } + +print " + + +"; +for ($i=0 ; $i < $viewstations ; $i++){ + $rowdata = pg_fetch_row($rs, $i); + if ($rowdata[3] != ""){ + print "\n"; + } } -//ココから新コード -//・局リスト -$query = "SELECT stationid, stationname, stationrecch, ontvcode -FROM foltia_station -WHERE \"ontvcode\" LIKE '%ontvjapan%' -ORDER BY stationid ASC , stationrecch -LIMIT ? OFFSET ? + +print " + +
$rowdata[1]
"; + renderepgstation($con,$rowdata[3],$start); + print "
"; -//$slistrs = m_query($con, $query, "DBクエリに失敗しました"); -$slistrs = sql_query($con, $query, "DBクエリに失敗しました",array($maxdisplay,$offset)); -while ($rowdata = $slistrs->fetch()) { - $stationhash[] = $rowdata[3]; - $snames[] = $rowdata[1]; // headder -} + ?> -//・時間と全順番のハッシュ作る -$epgstart = $start ; -$epgend = calcendtime($start , (8*60)); - -$query = "SELECT DISTINCT startdatetime -FROM foltia_epg -WHERE foltia_epg.ontvchannel in ( - SELECT ontvcode - FROM foltia_station - WHERE \"ontvcode\" LIKE '%ontvjapan%' - ORDER BY stationid ASC , stationrecch - LIMIT ? OFFSET ? - ) -AND startdatetime >= ? -AND startdatetime < ? -ORDER BY foltia_epg.startdatetime ASC "; - -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($maxdisplay,$offset,$start,$epgend)); - -//print "$query
\n"; - -$rowdata = $rs->fetch(); -if (! $rowdata) { -//番組データがない -$colmnums = 2; -}else{ - $colmnums = 0; - do { - $colmnums++; - $timetablehash[$rowdata[0]] = $colmnums; -// print "$rowdata[0]:$i+1
\n"; - } while ($rowdata = $rs->fetch()); -} -//print "colmnums $colmnums
\n"; - -//・局ごとに縦に配列入れていく -foreach ($stationhash as $stationname) { -$epgstart = $start ; -$epgend = calcendtime($start , (8*60)); -$query = " -SELECT startdatetime , enddatetime , lengthmin , epgtitle , epgdesc , epgcategory ,ontvchannel ,epgid , epgcategory -FROM foltia_epg -WHERE foltia_epg.ontvchannel = ? AND -enddatetime > ? AND -startdatetime < ? -ORDER BY foltia_epg.startdatetime ASC - "; - -// $statiodh = m_query($con, $query, "DBクエリに失敗しました"); - $statiodh = sql_query($con, $query, "DBクエリに失敗しました",array($stationname,$epgstart,$epgend)); - $stationrowdata = $statiodh->fetch(); - if (! $stationrowdata) { - //print("番組データがありません
"); - $item[0]["$stationname"] = ">番組データがありません"; -}else{ - do { -$printstarttime = substr($stationrowdata[0],8,2) . ":" . substr($stationrowdata[0],10,2); -$tdclass = "t".substr($stationrowdata[0],8,2) . substr($stationrowdata[0],10,2); -$title = $stationrowdata[3]; -$title = htmlspecialchars(z2h($title)); -$desc = $stationrowdata[4]; -$desc = htmlspecialchars(z2h($desc)); - -if ($epgviewstyle){ -$desc=$desc ."

"; -}else{ -$desc=$desc ."

". htmlspecialchars(foldate2print($stationrowdata[1])) ; -} - - -$height = htmlspecialchars($stationrowdata[2]) * 3; -$epgid = htmlspecialchars($stationrowdata[7]); -$epgcategory = htmlspecialchars($stationrowdata[8]); - -if (isset($timetablehash["$stationrowdata[0]"])){ - $number = $timetablehash["$stationrowdata[0]"]; -//print "$stationname $stationrowdata[0] [$number] $printstarttime $title $desc
\n"; -}else{ - $number = 0; -//print "$stationname $stationrowdata[0] 現在番組 $printstarttime $title $desc
\n"; -} -if ($epgcategory == ""){ -$item["$number"]["$stationname"] = " onClick=\"location = './reserveepg.php?epgid=$epgid'\">$printstarttime $title $desc"; -}else{ -$item["$number"]["$stationname"] = " id=\"$epgcategory\" onClick=\"location = './reserveepg.php?epgid=$epgid'\">$printstarttime $title $desc"; -}//if - - } while ($stationrowdata = $statiodh->fetch()); -}//if - -//・局ごとに間隔決定 -//$item[$i][NHK] はヌルかどうか判定 -$dataplace = 0 ; //初期化 -$rowspan = 0; - -for ($i=1; $i <= $colmnums ; $i++){ - if ($i === ($colmnums )){//最終行 - $rowspan = $i - $dataplace ; - //そして自分自身にタグを - //if ((!isset($item[$i][$stationname])) && ($item[$i][$stationname] == "")){ - if (!isset($item[$i][$stationname])){ - $item[$i][$stationname] = null ; - }else{ - $item[$i][$stationname] = ""; - $rowspan--; - } - //ROWSPAN - if ($rowspan === 1 ){ - $item[$dataplace][$stationname] = ""; - }else{ - $item[$dataplace][$stationname] = ""; -// $item[$dataplace][$stationname] = ""; - } - -// }elseif ((!isset($item[$i][$stationname]))&&($item[$i][$stationname] == "")){ - }elseif (!isset($item[$i][$stationname])){ - //ヌルなら - //$item[$i][$stationname] = $item[$i][$stationname] ; - $item[$i][$stationname] = null ; -// $item[$i][$stationname] = "
" ; - }else{ - //なんか入ってるなら - $rowspan = $i - $dataplace; - $itemDataplaceStationname = null; - if (isset($item[$dataplace][$stationname])){ - $itemDataplaceStationname = $item[$dataplace][$stationname]; - } - if ($rowspan === 1 ){ - $item[$dataplace][$stationname] = ""; - }else{ - $item[$dataplace][$stationname] = ""; -// $item[$dataplace][$stationname] = ""; - } - $dataplace = $i; - - } -}//for -}// end of for://・局ごとに縦に配列入れていく - -//・テーブルレンダリング -print "\n"; - -//ヘッダ -foreach ($snames as $s) { - print "" ; -} -//本体 -for ($l = 0 ;$l < $colmnums; $l++){ - print ""; - foreach ($stationhash as $stationname) { - print_r($item[$l]["$stationname"]); - } - print "\n"; -} -print "
".htmlspecialchars($s)."
\n"; - -print "

$navigationbar

"; -?> -
-凡例 - - - - - - - - - - - - - - - - - - -
情報アニメ・特撮ニュース・報道ドラマバラエティドキュメンタリー・教養教育音楽映画趣味・実用キッズスポーツその他演劇
- -