OSDN Git Service

change: draw main program table too fast.
authorSushi-k <epgrec@park.mda.or.jp>
Thu, 16 Jul 2009 02:54:24 +0000 (11:54 +0900)
committerSushi-k <epgrec@park.mda.or.jp>
Thu, 16 Jul 2009 02:54:24 +0000 (11:54 +0900)
index.php
templates/index.html

index 0329f7f..921b793 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -36,22 +36,23 @@ $last_time = $top_time + 3600 * $program_length;
  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
  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
                $programs[$st]["station_name"]  = $crec->name;\r
-               $prec = DBRecord::createRecords( TBL_PREFIX . PROGRAM_TBL, "".\r
-                                                 "WHERE channel_disc = '".$channel_disc."' ".\r
-                                                 "AND endtime > '".toDatetime($top_time)."' ".\r
+               \r
+               $reca = $prec->fetch_array( "channel_disc", $channel_disc,\r
+                                                 "endtime > '".toDatetime($top_time)."' ".\r
                                                  "AND starttime < '". toDatetime($last_time)."' ".\r
                                                  "ORDER BY starttime ASC "\r
                                               );\r
                $programs[$st]['list'] = array();\r
                $num = 0;\r
-               foreach( $prec as $prg ) {\r
+               foreach( $reca as $prg ) {\r
                        // 前プログラムとの空きを調べる\r
-                       $start = toTimestamp( $prg->starttime );\r
+                       $start = toTimestamp( $prg['starttime'] );\r
                        if( $start - $prev_end ) {\r
                                $height = ($start-$prev_end) / 60;\r
                                if( $height > 0.5 ) {\r
@@ -64,30 +65,30 @@ $last_time = $top_time + 3600 * $program_length;
                                        $num++;\r
                                }\r
                        }\r
-                       $prev_end = toTimestamp( $prg->endtime );\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'])) / 30);\r
                        // $top_time より早く始まっている番組\r
-                       if( toTimestamp($prg->starttime) <$top_time ) {\r
-                               $height = (int)((toTimestamp($prg->endtime) - $top_time ) / 30);\r
+                       if( toTimestamp($prg['starttime']) <$top_time ) {\r
+                               $height = (int)((toTimestamp($prg['endtime']) - $top_time ) / 30);\r
                        }\r
                        // $last_time より遅く終わる番組\r
-                       if( toTimestamp($prg->endtime) > $last_time ) {\r
-                               $height = (int)(($last_time - toTimestamp($prg->starttime)) / 30);\r
+                       if( toTimestamp($prg['endtime']) > $last_time ) {\r
+                               $height = (int)(($last_time - toTimestamp($prg['starttime'])) / 30);\r
                        }\r
                        \r
                        // プログラムを埋める\r
-                       $cat = new DBRecord( TBL_PREFIX . CATEGORY_TBL, "id", $prg->category_id );\r
+                       $cat = new DBRecord( 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]['title'] = $prg['title'];\r
                        $programs[$st]['list'][$num]['starttime'] = date("H:i", $start )."" ;\r
-                       $programs[$st]['list'][$num]['description'] = $prg->description;\r
-                       $programs[$st]['list'][$num]['prg_start'] = str_replace( "-", "/", $prg->starttime);\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]['description'] = $prg['description'];\r
+                       $programs[$st]['list'][$num]['prg_start'] = str_replace( "-", "/", $prg['starttime']);\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
                        $num++;\r
                }\r
        }\r
@@ -109,6 +110,7 @@ $last_time = $top_time + 3600 * $program_length;
        }\r
        $st++;\r
  }\r
+ $prec = null;\r
  \r
  // 局の幅\r
  $ch_set_width = 150;\r
index f20c179..4fc5517 100755 (executable)
@@ -83,6 +83,7 @@
                        $.get(INISet.prgRecordURL, { program_id: id } ,function(data){
                                if(data.match(/^error/i)){
                                        alert(data);
+                                       $('#floatBox4Dialog').dialog('close');
                                }else{
                                        $('#prgID_' + id).addClass('prg_rec');
                                        $('#floatBox4Dialog').dialog('close');
@@ -93,6 +94,7 @@
                        $.get(INISet.prgCancelURL, { program_id: id } ,function(data){
                                if(data.match(/^error/i)){
                                        alert(data);
+                                       $('#floatBox4Dialog').dialog('close');
                                }else{
                                        $('#prgID_' + id).removeClass('prg_rec');
                                        $('#floatBox4Dialog').dialog('close');