Mercurial > epgrec.yaz
annotate recordedTable.php @ 35:7d1f7e4cac82
modified: index.php
author | Sushi-k <epgrec@park.mda.or.jp> |
---|---|
date | Mon, 27 Jul 2009 19:45:40 +0900 |
parents | bbbc4f1ecf1d |
children | 8965ef108821 |
rev | line source |
---|---|
1 | 1 <?php |
2 include_once('config.php'); | |
3 include_once( INSTALL_PATH . '/DBRecord.class.php' ); | |
4 include_once( INSTALL_PATH . '/Smarty/Smarty.class.php' ); | |
5 | |
6 $order = ""; | |
7 $search = ""; | |
8 $category_id = 0; | |
9 $station = 0; | |
10 | |
10
152b146bd276
fixed: mysql_connect before mysql_real_escape_string
Sushi-k <epgrec@park.mda.or.jp>
parents:
1
diff
changeset
|
11 // mysql_real_escape_stringより先に接続しておく必要がある |
152b146bd276
fixed: mysql_connect before mysql_real_escape_string
Sushi-k <epgrec@park.mda.or.jp>
parents:
1
diff
changeset
|
12 $dbh = @mysql_connect( DB_HOST, DB_USER, DB_PASS ); |
152b146bd276
fixed: mysql_connect before mysql_real_escape_string
Sushi-k <epgrec@park.mda.or.jp>
parents:
1
diff
changeset
|
13 |
1 | 14 #$options = "WHERE complete='1'"; |
15 $options = "WHERE starttime < '". date("Y-m-d H:i:s")."'"; // ながら再生は無理っぽい? | |
16 | |
17 if(isset( $_POST['do_search'] )) { | |
18 if( isset($_POST['search'])){ | |
19 if( $_POST['search'] != "" ) { | |
20 $search = $_POST['search']; | |
21 $options .= " AND CONCAT(title,description) like '%".mysql_real_escape_string($_POST['search'])."%'"; | |
22 } | |
23 } | |
24 if( isset($_POST['category_id'])) { | |
25 if( $_POST['category_id'] != 0 ) { | |
26 $category_id = $_POST['category_id']; | |
27 $options .= " AND category_id = '".$_POST['category_id']."'"; | |
28 } | |
29 } | |
30 if( isset($_POST['station'])) { | |
31 if( $_POST['station'] != 0 ) { | |
32 $station = $_POST['station']; | |
33 $options .= " AND channel_id = '".$_POST['station']."'"; | |
34 } | |
35 } | |
36 } | |
37 | |
38 | |
39 $options .= " ORDER BY starttime DESC"; | |
40 | |
41 try{ | |
42 $rvs = DBRecord::createRecords(TBL_PREFIX.RESERVE_TBL, $options ); | |
43 $records = array(); | |
44 foreach( $rvs as $r ) { | |
45 $cat = new DBRecord(TBL_PREFIX.CATEGORY_TBL, "id", $r->category_id ); | |
46 $ch = new DBRecord(TBL_PREFIX.CHANNEL_TBL, "id", $r->channel_id ); | |
47 $arr = array(); | |
48 $arr['id'] = $r->id; | |
49 $arr['station_name'] = $ch->name; | |
50 $arr['starttime'] = $r->starttime; | |
51 $arr['endtime'] = $r->endtime; | |
14
bbbc4f1ecf1d
added: remove video with real file.
Sushi-k <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
52 $arr['asf'] = "".INSTALL_URL."/viewer.php?reserve_id=".$r->id; |
bbbc4f1ecf1d
added: remove video with real file.
Sushi-k <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
53 $arr['title'] = htmlspecialchars($r->title,ENT_QUOTES); |
bbbc4f1ecf1d
added: remove video with real file.
Sushi-k <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
54 $arr['description'] = htmlspecialchars($r->description,ENT_QUOTES); |
bbbc4f1ecf1d
added: remove video with real file.
Sushi-k <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
55 $arr['thumb'] = "<img src=\"".INSTALL_URL.THUMBS."/".$r->path.".jpg\" />"; |
1 | 56 $arr['cat'] = $cat->name_en; |
57 $arr['mode'] = $RECORD_MODE[$r->mode]['name']; | |
58 | |
59 array_push( $records, $arr ); | |
60 } | |
61 | |
62 $crecs = DBRecord::createRecords(TBL_PREFIX.CATEGORY_TBL ); | |
63 $cats = array(); | |
64 $cats[0]['id'] = 0; | |
65 $cats[0]['name'] = "すべて"; | |
66 $cats[0]['selected'] = $category_id == 0 ? "selected" : ""; | |
67 foreach( $crecs as $c ) { | |
68 $arr = array(); | |
69 $arr['id'] = $c->id; | |
70 $arr['name'] = $c->name_jp; | |
71 $arr['selected'] = $c->id == $category_id ? "selected" : ""; | |
72 array_push( $cats, $arr ); | |
73 } | |
74 | |
75 $crecs = DBRecord::createRecords(TBL_PREFIX.CHANNEL_TBL ); | |
76 $stations = array(); | |
77 $stations[0]['id'] = 0; | |
78 $stations[0]['name'] = "すべて"; | |
79 $stations[0]['selected'] = (! $station) ? "selected" : ""; | |
80 foreach( $crecs as $c ) { | |
81 $arr = array(); | |
82 $arr['id'] = $c->id; | |
83 $arr['name'] = $c->name; | |
84 $arr['selected'] = $station == $c->id ? "selected" : ""; | |
85 array_push( $stations, $arr ); | |
86 } | |
87 | |
88 | |
89 $smarty = new Smarty(); | |
90 $smarty->assign("sitetitle","録画済一覧"); | |
91 $smarty->assign( "records", $records ); | |
92 $smarty->assign( "search", $search ); | |
93 $smarty->assign( "stations", $stations ); | |
94 $smarty->assign( "cats", $cats ); | |
95 $smarty->assign( "use_thumbs", USE_THUMBS ); | |
96 | |
97 $smarty->display("recordedTable.html"); | |
98 | |
99 | |
100 } | |
101 catch( exception $e ) { | |
102 exit( $e->getMessage() ); | |
103 } | |
104 ?> |