Mercurial > epgrec.yaz
annotate programTable.php @ 76:69e0dabc765a
fixed: Reservation.class.php
modified: config.php.sample
modified: index.php
modified: install/step1.php
modified: install/step3.php
install/grscan.php
author | Sushi-k <epgrec@park.mda.or.jp> |
---|---|
date | Tue, 23 Feb 2010 19:58:30 +0900 |
parents | a2c4665b310c |
children | cb7da56c4198 |
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' ); | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
5 include_once( INSTALL_PATH . '/Settings.class.php' ); |
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
6 |
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
7 $settings = Settings::factory(); |
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
8 |
1 | 9 |
10 $options = " WHERE starttime > '".date("Y-m-d H:i:s", time() + 300 )."'"; | |
11 | |
12 $search = ""; | |
13 $use_regexp = 0; | |
14 $type = "*"; | |
15 $category_id = 0; | |
16 $station = 0; | |
17 | |
10
152b146bd276
fixed: mysql_connect before mysql_real_escape_string
Sushi-k <epgrec@park.mda.or.jp>
parents:
1
diff
changeset
|
18 // mysql_real_escape_stringより先に接続しておく必要がある |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
19 $dbh = @mysql_connect($settings->db_host, $settings->db_user, $settings->db_pass ); |
1 | 20 |
10
152b146bd276
fixed: mysql_connect before mysql_real_escape_string
Sushi-k <epgrec@park.mda.or.jp>
parents:
1
diff
changeset
|
21 // パラメータの処理 |
1 | 22 if(isset( $_POST['do_search'] )) { |
23 if( isset($_POST['search'])){ | |
24 if( $_POST['search'] != "" ) { | |
25 $search = $_POST['search']; | |
26 if( isset($_POST['use_regexp']) && ($_POST['use_regexp']) ) { | |
27 $use_regexp = $_POST['use_regexp']; | |
28 $options .= " AND CONCAT(title,description) REGEXP '".mysql_real_escape_string($search)."'"; | |
29 } | |
30 else { | |
31 $options .= " AND CONCAT(title,description) like '%".mysql_real_escape_string($search)."%'"; | |
32 } | |
33 } | |
34 } | |
35 if( isset($_POST['type'])){ | |
36 if( $_POST['type'] != "*" ) { | |
37 $type = $_POST['type']; | |
38 $options .= " AND type = '".$_POST['type']."'"; | |
39 } | |
40 } | |
41 if( isset($_POST['category_id'])) { | |
42 if( $_POST['category_id'] != 0 ) { | |
43 $category_id = $_POST['category_id']; | |
44 $options .= " AND category_id = '".$_POST['category_id']."'"; | |
45 } | |
46 } | |
47 if( isset($_POST['station'])) { | |
48 if( $_POST['station'] != 0 ) { | |
49 $station = $_POST['station']; | |
50 $options .= " AND channel_id = '".$_POST['station']."'"; | |
51 } | |
52 } | |
53 } | |
54 $options .= " ORDER BY starttime ASC LIMIT 300"; | |
55 $do_keyword = 0; | |
56 if( ($search != "") || ($type != "*") || ($category_id != 0) || ($station != 0) ) | |
57 $do_keyword = 1; | |
10
152b146bd276
fixed: mysql_connect before mysql_real_escape_string
Sushi-k <epgrec@park.mda.or.jp>
parents:
1
diff
changeset
|
58 |
1 | 59 try{ |
10
152b146bd276
fixed: mysql_connect before mysql_real_escape_string
Sushi-k <epgrec@park.mda.or.jp>
parents:
1
diff
changeset
|
60 |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
61 $precs = DBRecord::createRecords(PROGRAM_TBL, $options ); |
1 | 62 |
63 $programs = array(); | |
64 foreach( $precs as $p ) { | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
65 $ch = new DBRecord(CHANNEL_TBL, "id", $p->channel_id ); |
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
66 $cat = new DBRecord(CATEGORY_TBL, "id", $p->category_id ); |
1 | 67 $arr = array(); |
68 $arr['type'] = $p->type; | |
69 $arr['station_name'] = $ch->name; | |
70 $arr['starttime'] = $p->starttime; | |
71 $arr['endtime'] = $p->endtime; | |
72 $arr['title'] = $p->title; | |
73 $arr['description'] = $p->description; | |
74 $arr['id'] = $p->id; | |
75 $arr['cat'] = $cat->name_en; | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
76 $arr['rec'] = DBRecord::countRecords(RESERVE_TBL, "WHERE program_id='".$p->id."'"); |
1 | 77 |
78 array_push( $programs, $arr ); | |
79 } | |
80 | |
81 $k_category_name = ""; | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
82 $crecs = DBRecord::createRecords(CATEGORY_TBL ); |
1 | 83 $cats = array(); |
84 $cats[0]['id'] = 0; | |
85 $cats[0]['name'] = "すべて"; | |
86 $cats[0]['selected'] = $category_id == 0 ? "selected" : ""; | |
87 foreach( $crecs as $c ) { | |
88 $arr = array(); | |
89 $arr['id'] = $c->id; | |
90 $arr['name'] = $c->name_jp; | |
91 $arr['selected'] = $c->id == $category_id ? "selected" : ""; | |
92 if( $c->id == $category_id ) $k_category_name = $c->name_jp; | |
93 array_push( $cats, $arr ); | |
94 } | |
95 | |
96 $types = array(); | |
97 $types[0]['name'] = "すべて"; | |
98 $types[0]['value'] = "*"; | |
99 $types[0]['selected'] = $type == "*" ? "selected" : ""; | |
57 | 100 if( $settings->gr_tuners != 0 ) { |
1 | 101 $arr = array(); |
102 $arr['name'] = "GR"; | |
103 $arr['value'] = "GR"; | |
104 $arr['selected'] = $type == "GR" ? "selected" : ""; | |
105 array_push( $types, $arr ); | |
106 } | |
57 | 107 if( $settings->bs_tuners != 0 ) { |
1 | 108 $arr = array(); |
109 $arr['name'] = "BS"; | |
110 $arr['value'] = "BS"; | |
111 $arr['selected'] = $type == "BS" ? "selected" : ""; | |
112 array_push( $types, $arr ); | |
67
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
113 |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
114 // CS |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
115 if ($settings->cs_rec_flg != 0) { |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
116 $arr = array(); |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
117 $arr['name'] = "CS"; |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
118 $arr['value'] = "CS"; |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
119 $arr['selected'] = $type == "CS" ? "selected" : ""; |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
120 array_push( $types, $arr ); |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
121 } |
1 | 122 } |
123 | |
124 $k_station_name = ""; | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
125 $crecs = DBRecord::createRecords(CHANNEL_TBL); |
1 | 126 $stations = array(); |
127 $stations[0]['id'] = 0; | |
128 $stations[0]['name'] = "すべて"; | |
129 $stations[0]['selected'] = (! $station) ? "selected" : ""; | |
130 foreach( $crecs as $c ) { | |
131 $arr = array(); | |
132 $arr['id'] = $c->id; | |
133 $arr['name'] = $c->name; | |
134 $arr['selected'] = $station == $c->id ? "selected" : ""; | |
135 if( $station == $c->id ) $k_station_name = $c->name; | |
136 array_push( $stations, $arr ); | |
137 } | |
138 | |
139 $smarty = new Smarty(); | |
140 $smarty->assign("sitetitle","番組検索"); | |
141 $smarty->assign("do_keyword", $do_keyword ); | |
142 $smarty->assign( "programs", $programs ); | |
143 $smarty->assign( "cats", $cats ); | |
144 $smarty->assign( "k_category", $category_id ); | |
145 $smarty->assign( "k_category_name", $k_category_name ); | |
146 $smarty->assign( "types", $types ); | |
147 $smarty->assign( "k_type", $type ); | |
148 $smarty->assign( "search" , $search ); | |
149 $smarty->assign( "use_regexp", $use_regexp ); | |
150 $smarty->assign( "stations", $stations ); | |
151 $smarty->assign( "k_station", $station ); | |
152 $smarty->assign( "k_station_name", $k_station_name ); | |
153 $smarty->display("programTable.html"); | |
154 } | |
155 catch( exception $e ) { | |
156 exit( $e->getMessage() ); | |
157 } | |
57 | 158 ?> |