comparison recordedTable.php @ 39:8965ef108821

change: modify all scripts for web base setting.
author Sushi-k <epgrec@park.mda.or.jp>
date Tue, 28 Jul 2009 11:50:04 +0900
parents bbbc4f1ecf1d
children 87ded65fa485
comparison
equal deleted inserted replaced
38:2bc96d657ba1 39:8965ef108821
1 <?php 1 <?php
2 include_once('config.php'); 2 include_once('config.php');
3 include_once( INSTALL_PATH . '/DBRecord.class.php' ); 3 include_once( INSTALL_PATH . '/DBRecord.class.php' );
4 include_once( INSTALL_PATH . '/Smarty/Smarty.class.php' ); 4 include_once( INSTALL_PATH . '/Smarty/Smarty.class.php' );
5 include_once( INSTALL_PATH . '/Settings.class.php' );
6
7 $settings = Settings::factory();
8
5 9
6 $order = ""; 10 $order = "";
7 $search = ""; 11 $search = "";
8 $category_id = 0; 12 $category_id = 0;
9 $station = 0; 13 $station = 0;
10 14
11 // mysql_real_escape_stringより先に接続しておく必要がある 15 // mysql_real_escape_stringより先に接続しておく必要がある
12 $dbh = @mysql_connect( DB_HOST, DB_USER, DB_PASS ); 16 $dbh = @mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass );
13 17
14 #$options = "WHERE complete='1'"; 18 #$options = "WHERE complete='1'";
15 $options = "WHERE starttime < '". date("Y-m-d H:i:s")."'"; // ながら再生は無理っぽい? 19 $options = "WHERE starttime < '". date("Y-m-d H:i:s")."'"; // ながら再生は無理っぽい?
16 20
17 if(isset( $_POST['do_search'] )) { 21 if(isset( $_POST['do_search'] )) {
37 41
38 42
39 $options .= " ORDER BY starttime DESC"; 43 $options .= " ORDER BY starttime DESC";
40 44
41 try{ 45 try{
42 $rvs = DBRecord::createRecords(TBL_PREFIX.RESERVE_TBL, $options ); 46 $rvs = DBRecord::createRecords(RESERVE_TBL, $options );
43 $records = array(); 47 $records = array();
44 foreach( $rvs as $r ) { 48 foreach( $rvs as $r ) {
45 $cat = new DBRecord(TBL_PREFIX.CATEGORY_TBL, "id", $r->category_id ); 49 $cat = new DBRecord(CATEGORY_TBL, "id", $r->category_id );
46 $ch = new DBRecord(TBL_PREFIX.CHANNEL_TBL, "id", $r->channel_id ); 50 $ch = new DBRecord(CHANNEL_TBL, "id", $r->channel_id );
47 $arr = array(); 51 $arr = array();
48 $arr['id'] = $r->id; 52 $arr['id'] = $r->id;
49 $arr['station_name'] = $ch->name; 53 $arr['station_name'] = $ch->name;
50 $arr['starttime'] = $r->starttime; 54 $arr['starttime'] = $r->starttime;
51 $arr['endtime'] = $r->endtime; 55 $arr['endtime'] = $r->endtime;
52 $arr['asf'] = "".INSTALL_URL."/viewer.php?reserve_id=".$r->id; 56 $arr['asf'] = "".$settings->install_url."/viewer.php?reserve_id=".$r->id;
53 $arr['title'] = htmlspecialchars($r->title,ENT_QUOTES); 57 $arr['title'] = htmlspecialchars($r->title,ENT_QUOTES);
54 $arr['description'] = htmlspecialchars($r->description,ENT_QUOTES); 58 $arr['description'] = htmlspecialchars($r->description,ENT_QUOTES);
55 $arr['thumb'] = "<img src=\"".INSTALL_URL.THUMBS."/".$r->path.".jpg\" />"; 59 $arr['thumb'] = "<img src=\"".$settings->install_url.$settings->thumbs."/".$r->path.".jpg\" />";
56 $arr['cat'] = $cat->name_en; 60 $arr['cat'] = $cat->name_en;
57 $arr['mode'] = $RECORD_MODE[$r->mode]['name']; 61 $arr['mode'] = $RECORD_MODE[$r->mode]['name'];
58 62
59 array_push( $records, $arr ); 63 array_push( $records, $arr );
60 } 64 }
61 65
62 $crecs = DBRecord::createRecords(TBL_PREFIX.CATEGORY_TBL ); 66 $crecs = DBRecord::createRecords(CATEGORY_TBL );
63 $cats = array(); 67 $cats = array();
64 $cats[0]['id'] = 0; 68 $cats[0]['id'] = 0;
65 $cats[0]['name'] = "すべて"; 69 $cats[0]['name'] = "すべて";
66 $cats[0]['selected'] = $category_id == 0 ? "selected" : ""; 70 $cats[0]['selected'] = $category_id == 0 ? "selected" : "";
67 foreach( $crecs as $c ) { 71 foreach( $crecs as $c ) {
70 $arr['name'] = $c->name_jp; 74 $arr['name'] = $c->name_jp;
71 $arr['selected'] = $c->id == $category_id ? "selected" : ""; 75 $arr['selected'] = $c->id == $category_id ? "selected" : "";
72 array_push( $cats, $arr ); 76 array_push( $cats, $arr );
73 } 77 }
74 78
75 $crecs = DBRecord::createRecords(TBL_PREFIX.CHANNEL_TBL ); 79 $crecs = DBRecord::createRecords(CHANNEL_TBL );
76 $stations = array(); 80 $stations = array();
77 $stations[0]['id'] = 0; 81 $stations[0]['id'] = 0;
78 $stations[0]['name'] = "すべて"; 82 $stations[0]['name'] = "すべて";
79 $stations[0]['selected'] = (! $station) ? "selected" : ""; 83 $stations[0]['selected'] = (! $station) ? "selected" : "";
80 foreach( $crecs as $c ) { 84 foreach( $crecs as $c ) {
90 $smarty->assign("sitetitle","録画済一覧"); 94 $smarty->assign("sitetitle","録画済一覧");
91 $smarty->assign( "records", $records ); 95 $smarty->assign( "records", $records );
92 $smarty->assign( "search", $search ); 96 $smarty->assign( "search", $search );
93 $smarty->assign( "stations", $stations ); 97 $smarty->assign( "stations", $stations );
94 $smarty->assign( "cats", $cats ); 98 $smarty->assign( "cats", $cats );
95 $smarty->assign( "use_thumbs", USE_THUMBS ); 99 $smarty->assign( "use_thumbs", $settings->use_thumbs );
96 100
97 $smarty->display("recordedTable.html"); 101 $smarty->display("recordedTable.html");
98 102
99 103
100 } 104 }