OSDN Git Service

modified: Keyword.class.php
authorSushi-k <epgrec@park.mda.or.jp>
Wed, 24 Feb 2010 11:22:19 +0000 (20:22 +0900)
committerSushi-k <epgrec@park.mda.or.jp>
Wed, 24 Feb 2010 11:22:19 +0000 (20:22 +0900)
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

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

index 16cd26a..5afa80d 100755 (executable)
@@ -43,6 +43,10 @@ class Keyword extends DBRecord {
                        $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 @@ class Keyword extends DBRecord {
                        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 );          // あんまり時間を空けないのもどう?
                                        }
                                }
index cb9c025..53b8751 100755 (executable)
@@ -225,7 +225,8 @@ define( "RESERVE_STRUCT",
        "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 @@ define( "PROGRAM_STRUCT",
        "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 @@ define( "KEYWORD_STRUCT",
        "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
index 83b806e..b3690fd 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -61,6 +61,7 @@ $last_time = $top_time + 3600 * $program_length;
        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)."' ".
index a93ff8c..8178f9a 100755 (executable)
@@ -79,8 +79,6 @@ echo "</div>";
 
 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>";
index 87096f5..f1f2c70 100755 (executable)
@@ -7,8 +7,12 @@ include_once( INSTALL_PATH . "/Reservation.class.php" );
 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 @@ if( isset($_POST["add_keyword"]) ) {
                        $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 @@ try {
                
                $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 );
        }
 }
index 286cb9f..28d5158 100755 (executable)
@@ -6,9 +6,24 @@ include_once( INSTALL_PATH . '/Settings.class.php' );
 
 $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 @@ if(isset( $_POST['do_search'] )) {
                        $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 @@ try{
        }
        
        $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 @@ try{
                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 @@ try{
        $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 ) {
index 9bb43a3..7ae6671 100755 (executable)
@@ -3,12 +3,15 @@ include_once('config.php');
 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() );
index 9dcb392..d6a1415 100755 (executable)
                );
        }
        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)){
                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 @@ h2 {padding: 4px}
 #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 @@ h2 {padding: 4px}
 <div style="position:absolute;bottom:0;">
   <div class="tvtimeDM" style="float:left;">&nbsp;</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 @@ h2 {padding: 4px}
 
 
 <div id="floatBox4Dialog">jQuery UI Dialog</div>
+<div id="channelDialog">jQuery UI Dialog</div>
 
 {literal}
 <script type="text/javascript">
index fbb9a7a..05c26eb 100755 (executable)
@@ -86,6 +86,8 @@ table#reservation_table tr.prg_rec  {background-color: #F55;color:#FEE}
   <th>種別</th>
   <th>局</th>
   <th>カテゴリ</th>
+  <th>曜日</th>
+  <th>録画モード</th>
   <th>削除</th>
  </tr>
 
@@ -97,6 +99,8 @@ table#reservation_table tr.prg_rec  {background-color: #F55;color:#FEE}
   <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}
index 3d0a64e..8b2671b 100755 (executable)
@@ -176,6 +176,11 @@ table#reservation_table tr.prg_rec  {background-color: #F55;color:#FEE}
   {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 @@ table#reservation_table tr.prg_rec  {background-color: #F55;color:#FEE}
   <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 @@ table#reservation_table tr.prg_rec  {background-color: #F55;color:#FEE}
   <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}