diff programTable.php @ 106:57676bb30f64

add: 時間帯で絞り込みを追加
author Sushi-k <epgrec@park.mda.or.jp>
date Mon, 08 Mar 2010 18:07:19 +0900
parents cb7da56c4198
children 9b9e22be8407 7a64d5e3baee
line wrap: on
line diff
--- a/programTable.php	Wed Mar 03 00:02:15 2010 +0900
+++ b/programTable.php	Mon Mar 08 18:07:19 2010 +0900
@@ -20,6 +20,7 @@
 					array( "name" => "", "id" => 7, "selected" => "" ),
 );
 
+
 $autorec_modes = $RECORD_MODE;
 $autorec_modes[(int)($settings->autorec_mode)]['selected'] = "selected";
 
@@ -29,6 +30,8 @@
 $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 @@
 			$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 @@
 		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 @@
 	$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 ) {