include_once( INSTALL_PATH . "/DBRecord.class.php" );\r
include_once( INSTALL_PATH . "/Smarty/Smarty.class.php" );\r
include_once( INSTALL_PATH . "/reclib.php" );\r
+include_once( INSTALL_PATH . "/Settings.class.php" );\r
+\r
+// 設定ファイルの有無を検査する\r
+if( ! file_exists( INSTALL_PATH."/settings/config.xml") ) {\r
+ header( "Content-Type: text/html;charset=utf-8" );\r
+ exit( "<script type=\"text/javascript\">\n" .\r
+ "<!--\n".\r
+ "window.open(\"".$url."\",\"_self\");".\r
+ "// -->\n</script>" );\r
+}\r
+\r
+$settings = Settings::factory();\r
\r
$DAY_OF_WEEK = array( "(日)","(月)","(火)","(水)","(木)","(金)","(土)" );\r
\r
// パラメータの処理\r
// 表示する長さ(時間)\r
-$program_length = 8;\r
+$program_length = $settings->program_length;\r
if( isset( $_GET['length']) ) $program_length = (int) $_GET['length'];\r
// 地上=GR/BS=BS\r
$type = "GR";\r
if( $type == "BS" ) $channel_map = $BS_CHANNEL_MAP;\r
else if( $type == "GR" ) $channel_map = $GR_CHANNEL_MAP;\r
$st = 0;\r
- $prec = new DBRecord(TBL_PREFIX.PROGRAM_TBL);\r
+ $prec = new DBRecord($settings->tbl_prefix.PROGRAM_TBL);\r
foreach( $channel_map as $channel_disc => $channel ) {\r
$prev_end = $top_time;\r
try {\r
- $crec = new DBRecord( TBL_PREFIX . CHANNEL_TBL, "channel_disc", $channel_disc );\r
+ $crec = new DBRecord( $settings->tbl_prefix . CHANNEL_TBL, "channel_disc", $channel_disc );\r
$programs[$st]["station_name"] = $crec->name;\r
\r
$reca = $prec->fetch_array( "channel_disc", $channel_disc,\r
// 前プログラムとの空きを調べる\r
$start = toTimestamp( $prg['starttime'] );\r
if( $start - $prev_end ) {\r
- $height = ($start-$prev_end) / 60;\r
+ $height = ($start-$prev_end) * $settings->height_per_hour / 3600;\r
if( $height > 0.5 ) {\r
- $height = (int)($height * 2);\r
+ $height = (int)$height;\r
$programs[$st]['list'][$num]['category_none'] = "none";\r
$programs[$st]['list'][$num]['height'] = $height;\r
$programs[$st]['list'][$num]['title'] = "";\r
}\r
$prev_end = toTimestamp( $prg['endtime'] );\r
\r
- $height = (int)((toTimestamp($prg['endtime']) - toTimestamp($prg['starttime'])) / 30);\r
+ $height = (int)((toTimestamp($prg['endtime']) - toTimestamp($prg['starttime'])) * $settings->height_per_hour / 3600);\r
// $top_time より早く始まっている番組\r
if( toTimestamp($prg['starttime']) <$top_time ) {\r
- $height = (int)((toTimestamp($prg['endtime']) - $top_time ) / 30);\r
+ $height = (int)((toTimestamp($prg['endtime']) - $top_time ) * $settings->height_per_hour / 3600);\r
}\r
// $last_time より遅く終わる番組\r
if( toTimestamp($prg['endtime']) > $last_time ) {\r
- $height = (int)(($last_time - toTimestamp($prg['starttime'])) / 30);\r
+ $height = (int)(($last_time - toTimestamp($prg['starttime'])) * $settings->height_per_hour / 3600);\r
}\r
\r
// プログラムを埋める\r
- $cat = new DBRecord( TBL_PREFIX . CATEGORY_TBL, "id", $prg['category_id'] );\r
+ $cat = new DBRecord( $settings->tbl_prefix . CATEGORY_TBL, "id", $prg['category_id'] );\r
$programs[$st]['list'][$num]['category_name'] = $cat->name_en;\r
$programs[$st]['list'][$num]['height'] = $height;\r
$programs[$st]['list'][$num]['title'] = $prg['title'];\r
$programs[$st]['list'][$num]['duration'] = "" . (toTimestamp($prg['endtime']) - toTimestamp($prg['starttime']));\r
$programs[$st]['list'][$num]['channel'] = ($prg['type'] == "GR" ? "地上D" : "BS" ) . ":". $prg['channel'] . "ch";\r
$programs[$st]['list'][$num]['id'] = "" . ($prg['id']);\r
- $programs[$st]['list'][$num]['rec'] = DBRecord::countRecords( TBL_PREFIX.RESERVE_TBL, "WHERE complete = '0' AND program_id = '".$prg['id']."'" );\r
+ $programs[$st]['list'][$num]['rec'] = DBRecord::countRecords( $settings->tbl_prefix.RESERVE_TBL, "WHERE complete = '0' AND program_id = '".$prg['id']."'" );\r
$num++;\r
}\r
}\r
}\r
// 空きを埋める\r
if( $last_time - $prev_end ) {\r
- $height = ($last_time - $prev_end) / 60;\r
+ $height = ($last_time - $prev_end) * $settings->height_per_hour / 3600;\r
if( $height > 0.5 ) {\r
- $height = (int)($height * 2);\r
+ $height = (int)$height;\r
$programs[$st]['list'][$num]['category_name'] = "none";\r
$programs[$st]['list'][$num]['height'] = $height;\r
$programs[$st]['list'][$num]['title'] = "";\r
$prec = null;\r
\r
// 局の幅\r
- $ch_set_width = 150;\r
+ $ch_set_width = $settings->ch_set_width;\r
// 全体の幅\r
$chs_width = $ch_set_width * count( $channel_map );\r
\r
$smarty = new Smarty();\r
\r
// カテゴリ一覧\r
- $crec = DBRecord::createRecords( TBL_PREFIX . CATEGORY_TBL );\r
+ $crec = DBRecord::createRecords( $settings->tbl_prefix . CATEGORY_TBL );\r
$cats = array();\r
$num = 0;\r
foreach( $crec as $val ) {\r
// タイプ選択\r
$types = array();\r
$i = 0;\r
- if( BS_TUNERS ) {\r
+ if( $settings->bs_tuners ) {\r
$types[$i]['selected'] = $type == "BS" ? 'class="selected"' : "";\r
$types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=BS&length=".$program_length."&time=".date( "YmdH", $top_time);\r
$types[$i]['name'] = "BS";\r
$i++;\r
}\r
- if( GR_TUNERS ) {\r
+ if( $settings->gr_tuers ) {\r
$types[$i]['selected'] = $type == "GR" ? 'class="selected"' : "";\r
$types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=GR&length=".$program_length."&time=".date( "YmdH", $top_time);\r
$types[$i]['name'] = "地上デジタル";\r
\r
$smarty->assign( "tvtimes", $tvtimes );\r
$smarty->assign( "programs", $programs );\r
- $smarty->assign( "ch_set_width", $ch_set_width );\r
+ $smarty->assign( "ch_set_width", $settings->ch_set_width );\r
$smarty->assign( "chs_width", $chs_width );\r
+ $smarty->assign( "height_per_hour", $settings->height_per_hour );\r
\r
// date("Y-m-d H:i:s", $timestamp);\r
\r