Mercurial > epgrec.yaz
annotate programTable.php @ 129:1e93ea03ebd9
mod: typoをfix
author | Sushi-k <epgrec@park.mda.or.jp> |
---|---|
date | Wed, 17 Mar 2010 20:39:36 +0900 |
parents | 7a64d5e3baee |
children | f5d58cf2842f |
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' ); |
115 | 6 include_once( INSTALL_PATH . '/Keyword.class.php' ); |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
7 |
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
8 $settings = Settings::factory(); |
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
9 |
1 | 10 $options = " WHERE starttime > '".date("Y-m-d H:i:s", time() + 300 )."'"; |
11 | |
77 | 12 // |
13 $weekofdays = array( | |
14 array( "name" => "", "id" => 0, "selected" => "" ), | |
15 array( "name" => "", "id" => 1, "selected" => "" ), | |
16 array( "name" => "羂", "id" => 2, "selected" => "" ), | |
17 array( "name" => "", "id" => 3, "selected" => "" ), | |
18 array( "name" => "", "id" => 4, "selected" => "" ), | |
19 array( "name" => "", "id" => 5, "selected" => "" ), | |
20 array( "name" => "", "id" => 6, "selected" => "" ), | |
21 array( "name" => "", "id" => 7, "selected" => "" ), | |
22 ); | |
23 | |
106 | 24 |
77 | 25 $autorec_modes = $RECORD_MODE; |
26 $autorec_modes[(int)($settings->autorec_mode)]['selected'] = "selected"; | |
27 | |
1 | 28 $search = ""; |
29 $use_regexp = 0; | |
30 $type = "*"; | |
31 $category_id = 0; | |
115 | 32 $channel_id = 0; |
33 $weekofday = 7; | |
106 | 34 $prgtime = 24; |
35 | |
115 | 36 // <若帥 |
1 | 37 if(isset( $_POST['do_search'] )) { |
38 if( isset($_POST['search'])){ | |
115 | 39 $search = $_POST['search']; |
40 if( isset($_POST['use_regexp']) && ($_POST['use_regexp']) ) { | |
41 $use_regexp = (int)($_POST['use_regexp']); | |
1 | 42 } |
43 } | |
44 if( isset($_POST['type'])){ | |
115 | 45 $type = $_POST['type']; |
1 | 46 } |
47 if( isset($_POST['category_id'])) { | |
115 | 48 $category_id = (int)($_POST['category_id']); |
1 | 49 } |
50 if( isset($_POST['station'])) { | |
115 | 51 $channel_id = (int)($_POST['station']); |
1 | 52 } |
77 | 53 if( isset($_POST['weekofday']) ) { |
115 | 54 $weekofday = (int)($_POST['weekofday']); |
77 | 55 } |
106 | 56 if( isset($_POST['prgtime']) ) { |
57 $prgtime = (int)($_POST['prgtime']); | |
58 } | |
1 | 59 } |
106 | 60 |
1 | 61 $do_keyword = 0; |
115 | 62 if( ($search != "") || ($type != "*") || ($category_id != 0) || ($channel_id != 0) ) |
1 | 63 $do_keyword = 1; |
10
152b146bd276
fixed: mysql_connect before mysql_real_escape_string
Sushi-k <epgrec@park.mda.or.jp>
parents:
1
diff
changeset
|
64 |
1 | 65 try{ |
115 | 66 $precs = Keyword::search( $search, $use_regexp, $type, $category_id, $channel_id, $weekofday, $prgtime ); |
1 | 67 |
68 $programs = array(); | |
69 foreach( $precs as $p ) { | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
70 $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
|
71 $cat = new DBRecord(CATEGORY_TBL, "id", $p->category_id ); |
1 | 72 $arr = array(); |
73 $arr['type'] = $p->type; | |
74 $arr['station_name'] = $ch->name; | |
75 $arr['starttime'] = $p->starttime; | |
76 $arr['endtime'] = $p->endtime; | |
77 $arr['title'] = $p->title; | |
78 $arr['description'] = $p->description; | |
79 $arr['id'] = $p->id; | |
80 $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
|
81 $arr['rec'] = DBRecord::countRecords(RESERVE_TBL, "WHERE program_id='".$p->id."'"); |
1 | 82 |
83 array_push( $programs, $arr ); | |
84 } | |
85 | |
86 $k_category_name = ""; | |
77 | 87 $crecs = DBRecord::createRecords(CATEGORY_TBL); |
1 | 88 $cats = array(); |
89 $cats[0]['id'] = 0; | |
90 $cats[0]['name'] = "鴻"; | |
91 $cats[0]['selected'] = $category_id == 0 ? "selected" : ""; | |
92 foreach( $crecs as $c ) { | |
93 $arr = array(); | |
94 $arr['id'] = $c->id; | |
95 $arr['name'] = $c->name_jp; | |
96 $arr['selected'] = $c->id == $category_id ? "selected" : ""; | |
97 if( $c->id == $category_id ) $k_category_name = $c->name_jp; | |
98 array_push( $cats, $arr ); | |
99 } | |
100 | |
101 $types = array(); | |
102 $types[0]['name'] = "鴻"; | |
103 $types[0]['value'] = "*"; | |
104 $types[0]['selected'] = $type == "*" ? "selected" : ""; | |
57 | 105 if( $settings->gr_tuners != 0 ) { |
1 | 106 $arr = array(); |
107 $arr['name'] = "GR"; | |
108 $arr['value'] = "GR"; | |
109 $arr['selected'] = $type == "GR" ? "selected" : ""; | |
110 array_push( $types, $arr ); | |
111 } | |
57 | 112 if( $settings->bs_tuners != 0 ) { |
1 | 113 $arr = array(); |
114 $arr['name'] = "BS"; | |
115 $arr['value'] = "BS"; | |
116 $arr['selected'] = $type == "BS" ? "selected" : ""; | |
117 array_push( $types, $arr ); | |
67
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
118 |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
119 // CS |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
120 if ($settings->cs_rec_flg != 0) { |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
121 $arr = array(); |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
122 $arr['name'] = "CS"; |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
123 $arr['value'] = "CS"; |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
124 $arr['selected'] = $type == "CS" ? "selected" : ""; |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
125 array_push( $types, $arr ); |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
57
diff
changeset
|
126 } |
1 | 127 } |
128 | |
129 $k_station_name = ""; | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
10
diff
changeset
|
130 $crecs = DBRecord::createRecords(CHANNEL_TBL); |
1 | 131 $stations = array(); |
132 $stations[0]['id'] = 0; | |
133 $stations[0]['name'] = "鴻"; | |
115 | 134 $stations[0]['selected'] = (! $channel_id) ? "selected" : ""; |
1 | 135 foreach( $crecs as $c ) { |
136 $arr = array(); | |
137 $arr['id'] = $c->id; | |
138 $arr['name'] = $c->name; | |
115 | 139 $arr['selected'] = $channel_id == $c->id ? "selected" : ""; |
140 if( $channel_id == $c->id ) $k_station_name = $c->name; | |
1 | 141 array_push( $stations, $arr ); |
142 } | |
77 | 143 $weekofdays["$weekofday"]["selected"] = "selected" ; |
106 | 144 |
145 // 絽 | |
146 $prgtimes = array(); | |
147 for( $i=0; $i < 25; $i++ ) { | |
148 array_push( $prgtimes, | |
149 array( "name" => ( $i == 24 ? "" : sprintf("%0d鐔",$i) ), | |
150 "value" => $i, | |
151 "selected" => ( $i == $prgtime ? "selected" : "" ) ) | |
152 ); | |
153 } | |
154 | |
155 | |
1 | 156 |
157 $smarty = new Smarty(); | |
158 $smarty->assign("sitetitle","腟罎膣"); | |
159 $smarty->assign("do_keyword", $do_keyword ); | |
160 $smarty->assign( "programs", $programs ); | |
161 $smarty->assign( "cats", $cats ); | |
162 $smarty->assign( "k_category", $category_id ); | |
163 $smarty->assign( "k_category_name", $k_category_name ); | |
164 $smarty->assign( "types", $types ); | |
165 $smarty->assign( "k_type", $type ); | |
166 $smarty->assign( "search" , $search ); | |
167 $smarty->assign( "use_regexp", $use_regexp ); | |
168 $smarty->assign( "stations", $stations ); | |
115 | 169 $smarty->assign( "k_station", $channel_id ); |
1 | 170 $smarty->assign( "k_station_name", $k_station_name ); |
77 | 171 $smarty->assign( "weekofday", $weekofday ); |
172 $smarty->assign( "k_weekofday", $weekofdays["$weekofday"]["name"] ); | |
173 $smarty->assign( "weekofday", $weekofday ); | |
174 $smarty->assign( "weekofdays", $weekofdays ); | |
175 $smarty->assign( "autorec_modes", $autorec_modes ); | |
106 | 176 $smarty->assign( "prgtimes", $prgtimes ); |
177 $smarty->assign( "prgtime", $prgtime ); | |
1 | 178 $smarty->display("programTable.html"); |
179 } | |
180 catch( exception $e ) { | |
181 exit( $e->getMessage() ); | |
182 } | |
115 | 183 ?> |