# HG changeset patch # User Sushi-k # Date 1248691425 -32400 # Node ID 18df043055017080eb1ce308368058a6ca0cb044 # Parent 1fc71046946cf2038feb4a76cafd648123dc5f5a modified: index.php diff -r 1fc71046946c -r 18df04305501 index.php --- a/index.php Mon Jul 27 18:55:14 2009 +0900 +++ b/index.php Mon Jul 27 19:43:45 2009 +0900 @@ -4,12 +4,24 @@ include_once( INSTALL_PATH . "/DBRecord.class.php" ); include_once( INSTALL_PATH . "/Smarty/Smarty.class.php" ); include_once( INSTALL_PATH . "/reclib.php" ); +include_once( INSTALL_PATH . "/Settings.class.php" ); + +// 設定ファイルの有無を検査する +if( ! file_exists( INSTALL_PATH."/settings/config.xml") ) { + header( "Content-Type: text/html;charset=utf-8" ); + exit( "" ); +} + +$settings = Settings::factory(); $DAY_OF_WEEK = array( "(日)","(月)","(火)","(水)","(木)","(金)","(土)" ); // パラメータの処理 // 表示する長さ(時間) -$program_length = 8; +$program_length = $settings->program_length; if( isset( $_GET['length']) ) $program_length = (int) $_GET['length']; // 地上=GR/BS=BS $type = "GR"; @@ -36,11 +48,11 @@ if( $type == "BS" ) $channel_map = $BS_CHANNEL_MAP; else if( $type == "GR" ) $channel_map = $GR_CHANNEL_MAP; $st = 0; - $prec = new DBRecord(TBL_PREFIX.PROGRAM_TBL); + $prec = new DBRecord($settings->tbl_prefix.PROGRAM_TBL); foreach( $channel_map as $channel_disc => $channel ) { $prev_end = $top_time; try { - $crec = new DBRecord( TBL_PREFIX . CHANNEL_TBL, "channel_disc", $channel_disc ); + $crec = new DBRecord( $settings->tbl_prefix . CHANNEL_TBL, "channel_disc", $channel_disc ); $programs[$st]["station_name"] = $crec->name; $reca = $prec->fetch_array( "channel_disc", $channel_disc, @@ -54,9 +66,9 @@ // 前プログラムとの空きを調べる $start = toTimestamp( $prg['starttime'] ); if( $start - $prev_end ) { - $height = ($start-$prev_end) / 60; + $height = ($start-$prev_end) * $settings->height_per_hour / 3600; if( $height > 0.5 ) { - $height = (int)($height * 2); + $height = (int)$height; $programs[$st]['list'][$num]['category_none'] = "none"; $programs[$st]['list'][$num]['height'] = $height; $programs[$st]['list'][$num]['title'] = ""; @@ -67,18 +79,18 @@ } $prev_end = toTimestamp( $prg['endtime'] ); - $height = (int)((toTimestamp($prg['endtime']) - toTimestamp($prg['starttime'])) / 30); + $height = (int)((toTimestamp($prg['endtime']) - toTimestamp($prg['starttime'])) * $settings->height_per_hour / 3600); // $top_time より早く始まっている番組 if( toTimestamp($prg['starttime']) <$top_time ) { - $height = (int)((toTimestamp($prg['endtime']) - $top_time ) / 30); + $height = (int)((toTimestamp($prg['endtime']) - $top_time ) * $settings->height_per_hour / 3600); } // $last_time より遅く終わる番組 if( toTimestamp($prg['endtime']) > $last_time ) { - $height = (int)(($last_time - toTimestamp($prg['starttime'])) / 30); + $height = (int)(($last_time - toTimestamp($prg['starttime'])) * $settings->height_per_hour / 3600); } // プログラムを埋める - $cat = new DBRecord( TBL_PREFIX . CATEGORY_TBL, "id", $prg['category_id'] ); + $cat = new DBRecord( $settings->tbl_prefix . CATEGORY_TBL, "id", $prg['category_id'] ); $programs[$st]['list'][$num]['category_name'] = $cat->name_en; $programs[$st]['list'][$num]['height'] = $height; $programs[$st]['list'][$num]['title'] = $prg['title']; @@ -88,7 +100,7 @@ $programs[$st]['list'][$num]['duration'] = "" . (toTimestamp($prg['endtime']) - toTimestamp($prg['starttime'])); $programs[$st]['list'][$num]['channel'] = ($prg['type'] == "GR" ? "地上D" : "BS" ) . ":". $prg['channel'] . "ch"; $programs[$st]['list'][$num]['id'] = "" . ($prg['id']); - $programs[$st]['list'][$num]['rec'] = DBRecord::countRecords( TBL_PREFIX.RESERVE_TBL, "WHERE complete = '0' AND program_id = '".$prg['id']."'" ); + $programs[$st]['list'][$num]['rec'] = DBRecord::countRecords( $settings->tbl_prefix.RESERVE_TBL, "WHERE complete = '0' AND program_id = '".$prg['id']."'" ); $num++; } } @@ -97,9 +109,9 @@ } // 空きを埋める if( $last_time - $prev_end ) { - $height = ($last_time - $prev_end) / 60; + $height = ($last_time - $prev_end) * $settings->height_per_hour / 3600; if( $height > 0.5 ) { - $height = (int)($height * 2); + $height = (int)$height; $programs[$st]['list'][$num]['category_name'] = "none"; $programs[$st]['list'][$num]['height'] = $height; $programs[$st]['list'][$num]['title'] = ""; @@ -113,7 +125,7 @@ $prec = null; // 局の幅 - $ch_set_width = 150; + $ch_set_width = $settings->ch_set_width; // 全体の幅 $chs_width = $ch_set_width * count( $channel_map ); @@ -123,7 +135,7 @@ $smarty = new Smarty(); // カテゴリ一覧 - $crec = DBRecord::createRecords( TBL_PREFIX . CATEGORY_TBL ); + $crec = DBRecord::createRecords( $settings->tbl_prefix . CATEGORY_TBL ); $cats = array(); $num = 0; foreach( $crec as $val ) { @@ -138,13 +150,13 @@ // タイプ選択 $types = array(); $i = 0; - if( BS_TUNERS ) { + if( $settings->bs_tuners ) { $types[$i]['selected'] = $type == "BS" ? 'class="selected"' : ""; $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=BS&length=".$program_length."&time=".date( "YmdH", $top_time); $types[$i]['name'] = "BS"; $i++; } - if( GR_TUNERS ) { + if( $settings->gr_tuers ) { $types[$i]['selected'] = $type == "GR" ? 'class="selected"' : ""; $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=GR&length=".$program_length."&time=".date( "YmdH", $top_time); $types[$i]['name'] = "地上デジタル"; @@ -187,8 +199,9 @@ $smarty->assign( "tvtimes", $tvtimes ); $smarty->assign( "programs", $programs ); - $smarty->assign( "ch_set_width", $ch_set_width ); + $smarty->assign( "ch_set_width", $settings->ch_set_width ); $smarty->assign( "chs_width", $chs_width ); + $smarty->assign( "height_per_hour", $settings->height_per_hour ); // date("Y-m-d H:i:s", $timestamp); diff -r 1fc71046946c -r 18df04305501 templates/index.html --- a/templates/index.html Mon Jul 27 18:55:14 2009 +0900 +++ b/templates/index.html Mon Jul 27 19:43:45 2009 +0900 @@ -326,7 +326,7 @@ #tvtimes,#tvtimes2, .tvtimeDM {width:40px;} #tv_chs {padding-left:40px;padding-right:40px;} .tvtime { - height:120px; + height:{/literal}{$height_per_hour}{literal}px; color:#EEE; text-align:center; font-weight:bold; @@ -336,7 +336,10 @@ background-position: left bottom; } #tvtable div.tvtimetop {padding:8px 0px;} -#tvtable div.ch_set {width:150px;float:left;background-color:#BBB;} + +#tvtable div.ch_set {width:{/literal}{$ch_set_width}{literal}px;float:left;background-color:#BBB;} + + #tvtable div.ch_title, #tvtable div.prg {margin-right:2px;} #tvtable div.ch_title {padding:8px 0px;background-color:#333;color:#DDD;font-weight:bold;text-align:center} #tvtable div.prg { @@ -376,7 +379,7 @@ #tvtable div.prg_hover {background-color: #28D;color:#EFF} #float_titles { z-index:100} -#float_titles div.ch_title {width:150px;float:left;color:#FFF;font-weight:bold;text-align:center} +#float_titles div.ch_title {width:{/literal}{$ch_set_width}{literal}px;float:left;color:#FFF;font-weight:bold;text-align:center} #float_titles div.ch_title div{padding:8px 0px;margin:0 6px 0 4px;background-image: url(imgs/trancBG50.png);} #float_follows {position:absolute;}