From 875bd49161ab8a25bd34e9c0a4d707dfbf145b5f Mon Sep 17 00:00:00 2001 From: Sushi-k Date: Mon, 8 Mar 2010 18:07:19 +0900 Subject: [PATCH] =?utf8?q?add:=20=E6=99=82=E9=96=93=E5=B8=AF=E3=81=A7?= =?utf8?q?=E7=B5=9E=E3=82=8A=E8=BE=BC=E3=81=BF=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Keyword.class.php | 5 +- keywordTable.php | 8 ++- programTable.php | 26 ++++++++- templates/keywordTable.html | 2 + templates/programTable.html | 12 +++- upgrade_to_201002.php | 138 -------------------------------------------- 6 files changed, 48 insertions(+), 143 deletions(-) delete mode 100755 upgrade_to_201002.php diff --git a/Keyword.class.php b/Keyword.class.php index 5afa80d..b262f80 100755 --- a/Keyword.class.php +++ b/Keyword.class.php @@ -47,6 +47,10 @@ class Keyword extends DBRecord { $options .= " AND WEEKDAY(starttime) = '".$this->weekofday."'"; } + if( $this->prgtime != 24 ) { + $options .= " AND time(starttime) BETWEEN cast('".sprintf( "%02d:00:00", $this->prgtime)."' as time) AND cast('".sprintf("%02d:59:59", $this->prgtime)."' as time)"; + } + $options .= " ORDER BY starttime ASC"; $recs = array(); @@ -56,7 +60,6 @@ class Keyword extends DBRecord { catch( Exception $e ) { throw $e; } - return $recs; } diff --git a/keywordTable.php b/keywordTable.php index f1f2c70..0b53109 100755 --- a/keywordTable.php +++ b/keywordTable.php @@ -9,10 +9,13 @@ include_once( INSTALL_PATH . "/Keyword.class.php" ); $weekofdays = array( "月", "火", "水", "木", "金", "土", "日", "なし" ); +$prgtimes = array(); +for( $i=0 ; $i < 25; $i++ ) { + $prgtimes[$i] = $i == 24 ? "なし" : $i."時~"; +} // 新規キーワードがポストされた - if( isset($_POST["add_keyword"]) ) { if( $_POST["add_keyword"] == 1 ) { try { @@ -23,6 +26,7 @@ if( isset($_POST["add_keyword"]) ) { $rec->channel_id = $_POST['k_station']; $rec->use_regexp = $_POST['k_use_regexp']; $rec->weekofday = $_POST['k_weekofday']; + $rec->prgtime = $_POST['k_prgtime']; $rec->autorec_mode = $_POST['autorec_mode']; // 録画予約実行 @@ -60,6 +64,8 @@ try { $arr['weekofday'] = $weekofdays["$rec->weekofday"]; + $arr['prgtime'] = $prgtimes["$rec->prgtime"]; + $arr['autorec_mode'] = $RECORD_MODE[(int)$rec->autorec_mode]['name']; array_push( $keywords, $arr ); diff --git a/programTable.php b/programTable.php index 28d5158..d6f900a 100755 --- a/programTable.php +++ b/programTable.php @@ -20,6 +20,7 @@ $weekofdays = array( array( "name" => "なし", "id" => 7, "selected" => "" ), ); + $autorec_modes = $RECORD_MODE; $autorec_modes[(int)($settings->autorec_mode)]['selected'] = "selected"; @@ -29,6 +30,8 @@ $use_regexp = 0; $type = "*"; $category_id = 0; $station = 0; +$prgtime = 24; + // mysql_real_escape_stringより先に接続しておく必要がある $dbh = @mysql_connect($settings->db_host, $settings->db_user, $settings->db_pass ); @@ -71,14 +74,21 @@ if(isset( $_POST['do_search'] )) { $options .= " AND WEEKDAY(starttime) = '".$weekofday."'"; } } + if( isset($_POST['prgtime']) ) { + $prgtime = (int)($_POST['prgtime']); + if( $prgtime != 24 ) { + $options .= " AND time(starttime) BETWEEN cast('".sprintf( "%02d:00:00", $prgtime)."' as time) AND cast('".sprintf("%02d:59:59", $prgtime)."' as time)"; + } + } } $options .= " ORDER BY starttime ASC LIMIT 300"; + + $do_keyword = 0; if( ($search != "") || ($type != "*") || ($category_id != 0) || ($station != 0) ) $do_keyword = 1; try{ - $precs = DBRecord::createRecords(PROGRAM_TBL, $options ); $programs = array(); @@ -157,6 +167,18 @@ try{ array_push( $stations, $arr ); } $weekofdays["$weekofday"]["selected"] = "selected" ; + + // 時間帯 + $prgtimes = array(); + for( $i=0; $i < 25; $i++ ) { + array_push( $prgtimes, + array( "name" => ( $i == 24 ? "なし" : sprintf("%0d時~",$i) ), + "value" => $i, + "selected" => ( $i == $prgtime ? "selected" : "" ) ) + ); + } + + $smarty = new Smarty(); $smarty->assign("sitetitle","番組検索"); @@ -177,6 +199,8 @@ try{ $smarty->assign( "weekofday", $weekofday ); $smarty->assign( "weekofdays", $weekofdays ); $smarty->assign( "autorec_modes", $autorec_modes ); + $smarty->assign( "prgtimes", $prgtimes ); + $smarty->assign( "prgtime", $prgtime ); $smarty->display("programTable.html"); } catch( exception $e ) { diff --git a/templates/keywordTable.html b/templates/keywordTable.html index 05c26eb..4cc9275 100755 --- a/templates/keywordTable.html +++ b/templates/keywordTable.html @@ -87,6 +87,7 @@ table#reservation_table tr.prg_rec {background-color: #F55;color:#FEE} 局 カテゴリ 曜日 + 開始時 録画モード 削除 @@ -100,6 +101,7 @@ table#reservation_table tr.prg_rec {background-color: #F55;color:#FEE} {$keyword.channel} {$keyword.category} {$keyword.weekofday} + {$keyword.prgtime} {$keyword.autorec_mode} diff --git a/templates/programTable.html b/templates/programTable.html index 8b2671b..42ab261 100755 --- a/templates/programTable.html +++ b/templates/programTable.html @@ -160,7 +160,7 @@ table#reservation_table tr.prg_rec {background-color: #F55;color:#FEE} 絞り込み:
-検索語句 +検索語句
正規表現使用 種別 +開始時 + 曜日 @@ -237,6 +244,7 @@ table#reservation_table tr.prg_rec {background-color: #F55;color:#FEE} + 録画モード: