Mercurial > epgrec.yaz
comparison index.php @ 120:cb04c9ca1cb0
add: チャンネルスキップの追加途中(改造中)
author | yoneda <epgrec@park.mda.or.jp> |
---|---|
date | Sun, 14 Mar 2010 23:49:11 +0900 |
parents | cb7da56c4198 |
children | ea54c3128da3 |
comparison
equal
deleted
inserted
replaced
116:f268d7d10590 | 120:cb04c9ca1cb0 |
---|---|
35 $top_time = $tmp_time; | 35 $top_time = $tmp_time; |
36 } | 36 } |
37 } | 37 } |
38 $last_time = $top_time + 3600 * $program_length; | 38 $last_time = $top_time + 3600 * $program_length; |
39 | 39 |
40 // 紙 | 40 // 紙 |
41 for( $i = 0 ; $i < $program_length; $i++ ) { | 41 for( $i = 0 ; $i < $program_length; $i++ ) { |
42 $tvtimes[$i] = date("H", $top_time + 3600 * $i ); | 42 $tvtimes[$i] = date("H", $top_time + 3600 * $i ); |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 // 腟茵 | 46 // 腟茵 |
47 $programs = array(); | 47 $programs = array(); |
48 if( $type == "BS" ) $channel_map = $BS_CHANNEL_MAP; | 48 if( $type == "BS" ) $channel_map = $BS_CHANNEL_MAP; |
49 else if( $type == "GR" ) $channel_map = $GR_CHANNEL_MAP; | 49 else if( $type == "GR" ) $channel_map = $GR_CHANNEL_MAP; |
50 else if( $type == "CS" ) $channel_map = $CS_CHANNEL_MAP; | 50 else if( $type == "CS" ) $channel_map = $CS_CHANNEL_MAP; |
51 $st = 0; | 51 $st = 0; |
52 $prec = null; | 52 $prec = null; |
53 try { | 53 try { |
54 $prec = new DBRecord(PROGRAM_TBL); | 54 $prec = new DBRecord(PROGRAM_TBL); |
55 } | 55 } |
56 catch( Exception $e ) { | 56 catch( Exception $e ) { |
57 exit('違若絖сゃ潟鴻若眼.'); | 57 exit('違若絖сゃ潟鴻若眼.'); |
58 } | 58 } |
59 foreach( $channel_map as $channel_disc => $channel ) { | 59 $num_ch = 0; |
60 foreach( $channel_map as $channel_disc => $channel ) { | |
60 $prev_end = $top_time; | 61 $prev_end = $top_time; |
61 try { | 62 try { |
62 $crec = new DBRecord( CHANNEL_TBL, "channel_disc", $channel_disc ); | 63 $crec = new DBRecord( CHANNEL_TBL, "channel_disc", $channel_disc ); |
64 $programs[$st]["skip"] = $crec->skip; | |
65 if( $crec->skip == 0 ) $num_ch++; | |
66 | |
63 $programs[$st]["station_name"] = $crec->name; | 67 $programs[$st]["station_name"] = $crec->name; |
64 $programs[$st]["channel_disc"] = $crec->channel_disc; | 68 $programs[$st]["channel_disc"] = $crec->channel_disc; |
65 | 69 |
66 $reca = $prec->fetch_array( "channel_disc", $channel_disc, | 70 $reca = $prec->fetch_array( "channel_disc", $channel_disc, |
67 "endtime > '".toDatetime($top_time)."' ". | 71 "endtime > '".toDatetime($top_time)."' ". |
124 $programs[$st]['list'][$num]['starttime'] = ""; | 128 $programs[$st]['list'][$num]['starttime'] = ""; |
125 $programs[$st]['list'][$num]['description'] = ""; | 129 $programs[$st]['list'][$num]['description'] = ""; |
126 $num++; | 130 $num++; |
127 } | 131 } |
128 $st++; | 132 $st++; |
129 } | 133 } |
130 $prec = null; | 134 $prec = null; |
131 | 135 |
132 // 絮綛 | 136 // 絮綛 |
133 $ch_set_width = $settings->ch_set_width; | 137 $ch_set_width = (int)($settings->ch_set_width); |
134 // 篏綛 | 138 // 篏綛 |
135 $chs_width = $ch_set_width * count( $channel_map ); | 139 $chs_width = $ch_set_width * $num_ch; |
136 | 140 |
137 // GET< | 141 // GET< |
138 $get_param = $_SERVER['SCRIPT_NAME'] . "?type=".$type."&length=".$program_length.""; | 142 $get_param = $_SERVER['SCRIPT_NAME'] . "?type=".$type."&length=".$program_length.""; |
139 | 143 |
140 $smarty = new Smarty(); | 144 $smarty = new Smarty(); |
141 | 145 |
142 // 眼筝荀 | 146 // 眼筝荀 |
143 $crec = DBRecord::createRecords( CATEGORY_TBL ); | 147 $crec = DBRecord::createRecords( CATEGORY_TBL ); |
144 $cats = array(); | 148 $cats = array(); |
145 $num = 0; | 149 $num = 0; |
146 foreach( $crec as $val ) { | 150 foreach( $crec as $val ) { |
147 $cats[$num]['name_en'] = $val->name_en; | 151 $cats[$num]['name_en'] = $val->name_en; |
148 $cats[$num]['name_jp'] = $val->name_jp; | 152 $cats[$num]['name_jp'] = $val->name_jp; |
149 $num++; | 153 $num++; |
150 } | 154 } |
151 $smarty->assign( "cats", $cats ); | 155 $smarty->assign( "cats", $cats ); |
152 | 156 |
153 | 157 |
154 | 158 // 帥ゃ御 |
155 // 帥ゃ御 | 159 $types = array(); |
156 $types = array(); | 160 $i = 0; |
157 $i = 0; | 161 if( $settings->bs_tuners != 0 ) { |
158 if( $settings->bs_tuners != 0 ) { | |
159 $types[$i]['selected'] = $type == "BS" ? 'class="selected"' : ""; | 162 $types[$i]['selected'] = $type == "BS" ? 'class="selected"' : ""; |
160 $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=BS&length=".$program_length."&time=".date( "YmdH", $top_time); | 163 $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=BS&length=".$program_length."&time=".date( "YmdH", $top_time); |
161 $types[$i]['name'] = "BS"; | 164 $types[$i]['name'] = "BS"; |
162 $i++; | 165 $i++; |
163 | 166 |
166 $types[$i]['selected'] = $type == "CS" ? 'class="selected"' : ""; | 169 $types[$i]['selected'] = $type == "CS" ? 'class="selected"' : ""; |
167 $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=CS&length=".$program_length."&time=".date( "YmdH", $top_time); | 170 $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=CS&length=".$program_length."&time=".date( "YmdH", $top_time); |
168 $types[$i]['name'] = "CS"; | 171 $types[$i]['name'] = "CS"; |
169 $i++; | 172 $i++; |
170 } | 173 } |
171 } | 174 } |
172 if( $settings->gr_tuners != 0 ) { | 175 if( $settings->gr_tuners != 0 ) { |
173 $types[$i]['selected'] = $type == "GR" ? 'class="selected"' : ""; | 176 $types[$i]['selected'] = $type == "GR" ? 'class="selected"' : ""; |
174 $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=GR&length=".$program_length."&time=".date( "YmdH", $top_time); | 177 $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=GR&length=".$program_length."&time=".date( "YmdH", $top_time); |
175 $types[$i]['name'] = "遺吾帥"; | 178 $types[$i]['name'] = "遺吾帥"; |
176 $i++; | 179 $i++; |
177 } | 180 } |
178 $smarty->assign( "types", $types ); | 181 $smarty->assign( "types", $types ); |
179 | 182 |
180 // ヤ御 | 183 // ヤ御 |
181 $days = array(); | 184 $days = array(); |
182 $day = array(); | 185 $day = array(); |
183 $day['d'] = ""; | 186 $day['d'] = ""; |
184 $day['link'] = $get_param . "&time=". date( "YmdH", time() - 3600 *24 ); | 187 $day['link'] = $get_param . "&time=". date( "YmdH", time() - 3600 *24 ); |
185 $day['ofweek'] = ""; | 188 $day['ofweek'] = ""; |
186 $day['selected'] = $top_time < mktime( 0, 0 , 0) ? 'class="selected"' : ''; | 189 $day['selected'] = $top_time < mktime( 0, 0 , 0) ? 'class="selected"' : ''; |
187 | 190 |
188 array_push( $days , $day ); | 191 array_push( $days , $day ); |
189 $day['d'] = "憜"; | 192 $day['d'] = "憜"; |
190 $day['link'] = $get_param; | 193 $day['link'] = $get_param; |
191 $day['ofweek'] = ""; | 194 $day['ofweek'] = ""; |
192 $day['selected'] = ""; | 195 $day['selected'] = ""; |
193 array_push( $days, $day ); | 196 array_push( $days, $day ); |
194 for( $i = 0 ; $i < 8 ; $i++ ) { | 197 for( $i = 0 ; $i < 8 ; $i++ ) { |
195 $day['d'] = "".date("d", time() + 24 * 3600 * $i ) . ""; | 198 $day['d'] = "".date("d", time() + 24 * 3600 * $i ) . ""; |
196 $day['link'] = $get_param . "&time=".date( "Ymd", time() + 24 * 3600 * $i) . date("H" , $top_time ); | 199 $day['link'] = $get_param . "&time=".date( "Ymd", time() + 24 * 3600 * $i) . date("H" , $top_time ); |
197 $day['ofweek'] = $DAY_OF_WEEK[(int)date( "w", time() + 24 * 3600 * $i )]; | 200 $day['ofweek'] = $DAY_OF_WEEK[(int)date( "w", time() + 24 * 3600 * $i )]; |
198 $day['selected'] = date("d", $top_time) == date("d", time() + 24 * 3600 * $i ) ? 'class="selected"' : ''; | 201 $day['selected'] = date("d", $top_time) == date("d", time() + 24 * 3600 * $i ) ? 'class="selected"' : ''; |
199 array_push( $days, $day ); | 202 array_push( $days, $day ); |
200 } | 203 } |
201 $smarty->assign( "days" , $days ); | 204 $smarty->assign( "days" , $days ); |
202 | 205 |
203 // 御 | 206 // 御 |
204 $toptimes = array(); | 207 $toptimes = array(); |
205 for( $i = 0 ; $i < 24; $i+=4 ) { | 208 for( $i = 0 ; $i < 24; $i+=4 ) { |
206 $tmp = array(); | 209 $tmp = array(); |
207 $tmp['hour'] = sprintf( "%02d:00", $i ); | 210 $tmp['hour'] = sprintf( "%02d:00", $i ); |
208 $tmp['link'] = $get_param . "&time=".date("Ymd", $top_time ) . sprintf("%02d", $i ); | 211 $tmp['link'] = $get_param . "&time=".date("Ymd", $top_time ) . sprintf("%02d", $i ); |
209 array_push( $toptimes, $tmp ); | 212 array_push( $toptimes, $tmp ); |
210 } | 213 } |
211 $smarty->assign( "toptimes" , $toptimes ); | 214 $smarty->assign( "toptimes" , $toptimes ); |
212 | 215 |
213 $smarty->assign( "tvtimes", $tvtimes ); | 216 $smarty->assign( "tvtimes", $tvtimes ); |
214 $smarty->assign( "programs", $programs ); | 217 $smarty->assign( "programs", $programs ); |
215 $smarty->assign( "ch_set_width", $settings->ch_set_width ); | 218 $smarty->assign( "ch_set_width", (int)($settings->ch_set_width) ); |
216 $smarty->assign( "chs_width", $chs_width ); | 219 $smarty->assign( "chs_width", $chs_width ); |
217 $smarty->assign( "height_per_hour", $settings->height_per_hour ); | 220 $smarty->assign( "height_per_hour", $settings->height_per_hour ); |
218 $smarty->assign( "height_per_min", $settings->height_per_hour / 60 ); | 221 $smarty->assign( "height_per_min", $settings->height_per_hour / 60 ); |
222 $smarty->assign( "num_ch", $num_ch ); | |
223 $smarty->assign( "num_all_ch" , count( $channel_map ) ); | |
219 | 224 |
220 // date("Y-m-d H:i:s", $timestamp); | 225 // date("Y-m-d H:i:s", $timestamp); |
221 | 226 |
222 $sitetitle = date( "Y", $top_time ) . "綛" . date( "m", $top_time ) . "" . date( "d", $top_time ) . "". date( "H", $top_time ) . | 227 $sitetitle = date( "Y", $top_time ) . "綛" . date( "m", $top_time ) . "" . date( "d", $top_time ) . "". date( "H", $top_time ) . |
223 "鐔".( $type == "GR" ? "遺吾帥" : "BS吾帥" )."腟茵"; | 228 "鐔".( $type == "GR" ? "遺吾帥" : "BS吾帥" )."腟茵"; |
224 | 229 |
225 $smarty->assign("sitetitle", $sitetitle ); | 230 $smarty->assign("sitetitle", $sitetitle ); |
226 | 231 |
227 $smarty->assign("top_time", str_replace( "-", "/" ,toDatetime($top_time)) ); | 232 $smarty->assign("top_time", str_replace( "-", "/" ,toDatetime($top_time)) ); |
228 $smarty->assign("last_time", str_replace( "-", "/" ,toDatetime($last_time)) ); | 233 $smarty->assign("last_time", str_replace( "-", "/" ,toDatetime($last_time)) ); |
229 | 234 |
230 | 235 |
231 $smarty->display("index.html"); | 236 $smarty->display("index.html"); |
232 ?> | 237 ?> |