Mercurial > epgrec.yaz
changeset 77:cb7da56c4198
modified: Keyword.class.php
modified: config.php.sample
modified: index.php
modified: install/step1.php
modified: keywordTable.php
modified: programTable.php
modified: simpleReservation.php
modified: templates/index.html
modified: templates/keywordTable.html
modified: templates/programTable.html
author | Sushi-k <epgrec@park.mda.or.jp> |
---|---|
date | Wed, 24 Feb 2010 20:22:19 +0900 |
parents | 69e0dabc765a |
children | ded62b253bca |
files | Keyword.class.php config.php.sample index.php install/step1.php keywordTable.php programTable.php simpleReservation.php templates/index.html templates/keywordTable.html templates/programTable.html |
diffstat | 10 files changed, 111 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/Keyword.class.php Tue Feb 23 19:58:30 2010 +0900 +++ b/Keyword.class.php Wed Feb 24 20:22:19 2010 +0900 @@ -43,6 +43,10 @@ $options .= " AND channel_id = '".$this->channel_id."'"; } + if( $this->weekofday != 7 ) { + $options .= " AND WEEKDAY(starttime) = '".$this->weekofday."'"; + } + $options .= " ORDER BY starttime ASC"; $recs = array(); @@ -72,7 +76,7 @@ foreach( $precs as $rec ) { try { if( $rec->autorec ) { - Reservation::simple( $rec->id, $this->id, $this->settings->autorec_mode ); + Reservation::simple( $rec->id, $this->id, $this->autorec_mode ); usleep( 100 ); // あんまり時間を空けないのもどう? } }
--- a/config.php.sample Tue Feb 23 19:58:30 2010 +0900 +++ b/config.php.sample Wed Feb 24 20:22:19 2010 +0900 @@ -225,7 +225,8 @@ "complete boolean not null default '0',". // 完了フラグ "reserve_disc varchar(128) not null default 'none',". // 識別用hash "autorec integer not null default '0',". // キーワードID - "mode integer not null default '0'" //録画モード + "mode integer not null default '0',". //録画モード + "index reserve_idx (channel_disc, starttime)" // インデックス ); @@ -242,7 +243,9 @@ "starttime datetime not null default '1970-01-01 00:00:00',". // 開始時刻 "endtime datetime not null default '1970-01-01 00:00:00',". // 終了時刻 "program_disc varchar(128) not null default 'none',". // 識別用hash - "autorec boolean not null default '1'" // 自動録画有効無効 + "autorec boolean not null default '1',". // 自動録画有効無効 + "index program_idx (channel_disc, starttime)" // インデックス + ); @@ -270,6 +273,7 @@ "channel_id integer not null default '0',". // channel ID "category_id integer not null default '0',". // カテゴリID "use_regexp boolean not null default '0',". // 正規表現を使用するなら1 - "autorec_mode integer not null defult '0'" // 自動録画のモード02/23/2010追加 + "autorec_mode integer not null default '0',". // 自動録画のモード02/23/2010追加 + "weekofday enum ('0','1','2','3','4','5','6','7' ) default '7'" // 曜日 ); ?> \ No newline at end of file
--- a/index.php Tue Feb 23 19:58:30 2010 +0900 +++ b/index.php Wed Feb 24 20:22:19 2010 +0900 @@ -61,6 +61,7 @@ try { $crec = new DBRecord( CHANNEL_TBL, "channel_disc", $channel_disc ); $programs[$st]["station_name"] = $crec->name; + $programs[$st]["channel_disc"] = $crec->channel_disc; $reca = $prec->fetch_array( "channel_disc", $channel_disc, "endtime > '".toDatetime($top_time)."' ".
--- a/install/step1.php Tue Feb 23 19:58:30 2010 +0900 +++ b/install/step1.php Wed Feb 24 20:22:19 2010 +0900 @@ -79,8 +79,6 @@ if( !file_exists( "/usr/local/bin/grscan" ) ) { -include_once( INSTALL_PATH."/settings/gr_channel.php" ); - echo "<p><b>地上デジタルチャンネルの設定確認</b></p>"; echo "<div>現在、config.phpでは以下のチャンネルの受信が設定されています。受信不可能なチャンネルが混ざっていると番組表が表示できません。</div>";
--- a/keywordTable.php Tue Feb 23 19:58:30 2010 +0900 +++ b/keywordTable.php Wed Feb 24 20:22:19 2010 +0900 @@ -7,8 +7,12 @@ include_once( INSTALL_PATH . "/Keyword.class.php" ); // include_once( INSTALL_PATH . "/Settings.class.php" ); + +$weekofdays = array( "月", "火", "水", "木", "金", "土", "日", "なし" ); + // 新規キーワードがポストされた + if( isset($_POST["add_keyword"]) ) { if( $_POST["add_keyword"] == 1 ) { try { @@ -18,6 +22,8 @@ $rec->category_id = $_POST['k_category']; $rec->channel_id = $_POST['k_station']; $rec->use_regexp = $_POST['k_use_regexp']; + $rec->weekofday = $_POST['k_weekofday']; + $rec->autorec_mode = $_POST['autorec_mode']; // 録画予約実行 $rec->reservation(); @@ -52,6 +58,10 @@ $arr['use_regexp'] = $rec->use_regexp; + $arr['weekofday'] = $weekofdays["$rec->weekofday"]; + + $arr['autorec_mode'] = $RECORD_MODE[(int)$rec->autorec_mode]['name']; + array_push( $keywords, $arr ); } }
--- a/programTable.php Tue Feb 23 19:58:30 2010 +0900 +++ b/programTable.php Wed Feb 24 20:22:19 2010 +0900 @@ -6,9 +6,24 @@ $settings = Settings::factory(); - $options = " WHERE starttime > '".date("Y-m-d H:i:s", time() + 300 )."'"; +// 曜日 +$weekofdays = array( + array( "name" => "月", "id" => 0, "selected" => "" ), + array( "name" => "火", "id" => 1, "selected" => "" ), + array( "name" => "水", "id" => 2, "selected" => "" ), + array( "name" => "木", "id" => 3, "selected" => "" ), + array( "name" => "金", "id" => 4, "selected" => "" ), + array( "name" => "土", "id" => 5, "selected" => "" ), + array( "name" => "日", "id" => 6, "selected" => "" ), + array( "name" => "なし", "id" => 7, "selected" => "" ), +); + +$autorec_modes = $RECORD_MODE; +$autorec_modes[(int)($settings->autorec_mode)]['selected'] = "selected"; + +$weekofday = 7; $search = ""; $use_regexp = 0; $type = "*"; @@ -50,6 +65,12 @@ $options .= " AND channel_id = '".$_POST['station']."'"; } } + if( isset($_POST['weekofday']) ) { + $weekofday = $_POST['weekofday']; + if( $weekofday != 7 ) { + $options .= " AND WEEKDAY(starttime) = '".$weekofday."'"; + } + } } $options .= " ORDER BY starttime ASC LIMIT 300"; $do_keyword = 0; @@ -79,7 +100,7 @@ } $k_category_name = ""; - $crecs = DBRecord::createRecords(CATEGORY_TBL ); + $crecs = DBRecord::createRecords(CATEGORY_TBL); $cats = array(); $cats[0]['id'] = 0; $cats[0]['name'] = "すべて"; @@ -135,6 +156,7 @@ if( $station == $c->id ) $k_station_name = $c->name; array_push( $stations, $arr ); } + $weekofdays["$weekofday"]["selected"] = "selected" ; $smarty = new Smarty(); $smarty->assign("sitetitle","番組検索"); @@ -150,6 +172,11 @@ $smarty->assign( "stations", $stations ); $smarty->assign( "k_station", $station ); $smarty->assign( "k_station_name", $k_station_name ); + $smarty->assign( "weekofday", $weekofday ); + $smarty->assign( "k_weekofday", $weekofdays["$weekofday"]["name"] ); + $smarty->assign( "weekofday", $weekofday ); + $smarty->assign( "weekofdays", $weekofdays ); + $smarty->assign( "autorec_modes", $autorec_modes ); $smarty->display("programTable.html"); } catch( exception $e ) {
--- a/simpleReservation.php Tue Feb 23 19:58:30 2010 +0900 +++ b/simpleReservation.php Wed Feb 24 20:22:19 2010 +0900 @@ -3,12 +3,15 @@ include_once( INSTALL_PATH . "/DBRecord.class.php" ); include_once( INSTALL_PATH . "/Reservation.class.php" ); include_once( INSTALL_PATH . "/reclib.php" ); +include_once( INSTALL_PATH . "/Settings.class.php" ); if( ! isset( $_GET['program_id'] ) ) exit("Error: 番組が指定されていません" ); $program_id = $_GET['program_id']; +$settings = Settings::factory(); + try { - Reservation::simple( $program_id ); + Reservation::simple( $program_id , 0, $settings->autorec_mode); } catch( Exception $e ) { exit( "Error:". $e->getMessage() );
--- a/templates/index.html Tue Feb 23 19:58:30 2010 +0900 +++ b/templates/index.html Wed Feb 24 20:22:19 2010 +0900 @@ -79,6 +79,31 @@ ); } var PRG = { + chdialog:function(disc){ + $('#channelDialog').dialog('close'); + $.get('channelInfo.php', { channel_disc: disc },function(data) { + if(data.match(/^error/i)){ + alert(data); + } + else { + var str = data; + str += '<div style="margin:2em 0 1em 0;text-align:center;"><a href="javascript:PRG.chupdate()" class="ui-state-default ui-corner-all ui-dialog-buttonpane button">更新</a></div>'; + $('#channelDialog').html(str); + $('#channelDialog').dialog('open', 'center'); + + } + }); + + }, + chupdate:function() { + var v_sid = $('#id_sid').val(); + var v_channel_disc = $('#id_disc').val(); + $.post('channelSetSID.php', { channel_disc: v_channel_disc, + sid: v_sid }, function(data) { + + $('#channelDialog').dialog('close'); + }); + }, rec:function(id){ $.get(INISet.prgRecordURL, { program_id: id } ,function(data){ if(data.match(/^error/i)){ @@ -289,6 +314,11 @@ var DG = $('#floatBox4Dialog'); DG.dialog({title:'録画予約',width:600}); DG.dialog('close'); + + var DG2 = $('#channelDialog'); + DG2.dialog({title:'チャンネル情報',width:600}); + DG2.dialog('close'); + nowBar.INI(); CTG.INI(); MDA.SCR.INI(); // 番組表の位置保存 @@ -403,6 +433,12 @@ #floatBox4Dialog .prg_rec_cfg{background:#EEE;padding:1em 2em;margin:0.4em 0;} #floatBox4Dialog .labelLeft {width:8em;float:left;text-align:right;} #floatBox4Dialog .button {padding:0.4em 1em;} + +#channelDialog .prg_title{font-size:120%;font-weight:bold;padding:0.4em 0;text-align:center;} +#channelDialog .prg_rec_cfg{background:#EEE;padding:1em 2em;margin:0.4em 0;} +#channelDialog .labelLeft {width:8em;float:left;text-align:right;} +#channelDialog .button {padding:0.4em 1em;} + --> </style> @@ -482,7 +518,7 @@ <div style="position:absolute;bottom:0;"> <div class="tvtimeDM" style="float:left;"> </div> {foreach from=$programs item=program } - <div class="ch_title"><div>{$program.station_name}</div></div> + <div class="ch_title" ><div style="cursor: pointer" onClick="javascript:PRG.chdialog('{$program.channel_disc}')" >{$program.station_name}</div></div> {/foreach} </div> <br style="clear:left;" /> @@ -532,6 +568,7 @@ <div id="floatBox4Dialog">jQuery UI Dialog</div> +<div id="channelDialog">jQuery UI Dialog</div> {literal} <script type="text/javascript">
--- a/templates/keywordTable.html Tue Feb 23 19:58:30 2010 +0900 +++ b/templates/keywordTable.html Wed Feb 24 20:22:19 2010 +0900 @@ -86,6 +86,8 @@ <th>種別</th> <th>局</th> <th>カテゴリ</th> + <th>曜日</th> + <th>録画モード</th> <th>削除</th> </tr> @@ -97,6 +99,8 @@ <td>{$keyword.type}</td> <td>{$keyword.channel}</td> <td>{$keyword.category}</td> + <td>{$keyword.weekofday}</td> + <td>{$keyword.autorec_mode}</td> <td><input type="button" value="削除" onClick="javascript:PRG.delkey('{$keyword.id}')" /></td> </tr> {/foreach}
--- a/templates/programTable.html Tue Feb 23 19:58:30 2010 +0900 +++ b/templates/programTable.html Wed Feb 24 20:22:19 2010 +0900 @@ -176,6 +176,11 @@ {foreach from=$cats item=cat} <option value="{$cat.id}" {$cat.selected}>{$cat.name}</option> {/foreach} + </select> +曜日<select name='weekofday'> + {foreach from=$weekofdays item=day} + <option value="{$day.id}" {$day.selected}>{$day.name}</option> + {/foreach} </select> <input type="submit" value="絞り込む" /> </form> @@ -223,6 +228,7 @@ <b>種別:</b>{if $k_type == "*"}すべて{else}{$k_type}{/if} <b>局:</b>{if $k_station == 0}すべて{else}{$k_station_name}{/if} <b>カテゴリ:</b>{if $k_category == 0}すべて{else}{$k_category_name}{/if} + <b>曜日:</b>{if $weekofday == 7}なし{else}{$k_weekofday}{/if}曜 <b>件数:</b>{$programs|@count} <input type="hidden" name="add_keyword" value="{$do_keyword}" /> <input type="hidden" name="k_use_regexp" value="{$use_regexp}" /> @@ -230,7 +236,13 @@ <input type="hidden" name="k_type" value="{$k_type}" /> <input type="hidden" name="k_category" value="{$k_category}" /> <input type="hidden" name="k_station" value="{$k_station}" /> - <input type="submit" value="この絞り込みを自動録画キーワードに登録" /> + <input type="hidden" name="k_weekofday" value={$weekofday} /> + <b>録画モード:</b><select name="autorec_mode" > + {foreach from=$autorec_modes item=mode name=recmode } + <option value="{$smarty.foreach.recmode.index}" {$mode.selected} >{$mode.name}</option> + {/foreach} + </select> + <br><input type="submit" value="この絞り込みを自動録画キーワードに登録" /> </form> </div> {/if}