Mercurial > epgrec.yaz
comparison programTable.php @ 37:e5f9aa34d06f
change: modify all script for web base setting
author | yoneda <epgrec@park.mda.or.jp> |
---|---|
date | Tue, 28 Jul 2009 00:00:04 +0900 |
parents | 152b146bd276 |
children | 8965ef108821 |
comparison
equal
deleted
inserted
replaced
36:c2522d1df005 | 37:e5f9aa34d06f |
---|---|
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 $options = " WHERE starttime > '".date("Y-m-d H:i:s", time() + 300 )."'"; | 10 $options = " WHERE starttime > '".date("Y-m-d H:i:s", time() + 300 )."'"; |
7 | 11 |
8 $search = ""; | 12 $search = ""; |
9 $use_regexp = 0; | 13 $use_regexp = 0; |
10 $type = "*"; | 14 $type = "*"; |
11 $category_id = 0; | 15 $category_id = 0; |
12 $station = 0; | 16 $station = 0; |
13 | 17 |
14 // mysql_real_escape_stringより先に接続しておく必要がある | 18 // mysql_real_escape_stringより先に接続しておく必要がある |
15 $dbh = @mysql_connect(DB_HOST, DB_USER, DB_PASS ); | 19 $dbh = @mysql_connect($settings->db_host, $settings->db_user, $settings->db_pass ); |
16 | 20 |
17 // パラメータの処理 | 21 // パラメータの処理 |
18 if(isset( $_POST['do_search'] )) { | 22 if(isset( $_POST['do_search'] )) { |
19 if( isset($_POST['search'])){ | 23 if( isset($_POST['search'])){ |
20 if( $_POST['search'] != "" ) { | 24 if( $_POST['search'] != "" ) { |
52 if( ($search != "") || ($type != "*") || ($category_id != 0) || ($station != 0) ) | 56 if( ($search != "") || ($type != "*") || ($category_id != 0) || ($station != 0) ) |
53 $do_keyword = 1; | 57 $do_keyword = 1; |
54 | 58 |
55 try{ | 59 try{ |
56 | 60 |
57 $precs = DBRecord::createRecords(TBL_PREFIX.PROGRAM_TBL, $options ); | 61 $precs = DBRecord::createRecords(PROGRAM_TBL, $options ); |
58 | 62 |
59 $programs = array(); | 63 $programs = array(); |
60 foreach( $precs as $p ) { | 64 foreach( $precs as $p ) { |
61 $ch = new DBRecord(TBL_PREFIX.CHANNEL_TBL, "id", $p->channel_id ); | 65 $ch = new DBRecord(CHANNEL_TBL, "id", $p->channel_id ); |
62 $cat = new DBRecord(TBL_PREFIX.CATEGORY_TBL, "id", $p->category_id ); | 66 $cat = new DBRecord(CATEGORY_TBL, "id", $p->category_id ); |
63 $arr = array(); | 67 $arr = array(); |
64 $arr['type'] = $p->type; | 68 $arr['type'] = $p->type; |
65 $arr['station_name'] = $ch->name; | 69 $arr['station_name'] = $ch->name; |
66 $arr['starttime'] = $p->starttime; | 70 $arr['starttime'] = $p->starttime; |
67 $arr['endtime'] = $p->endtime; | 71 $arr['endtime'] = $p->endtime; |
68 $arr['title'] = $p->title; | 72 $arr['title'] = $p->title; |
69 $arr['description'] = $p->description; | 73 $arr['description'] = $p->description; |
70 $arr['id'] = $p->id; | 74 $arr['id'] = $p->id; |
71 $arr['cat'] = $cat->name_en; | 75 $arr['cat'] = $cat->name_en; |
72 $arr['rec'] = DBRecord::countRecords(TBL_PREFIX.RESERVE_TBL, "WHERE program_id='".$p->id."'"); | 76 $arr['rec'] = DBRecord::countRecords(RESERVE_TBL, "WHERE program_id='".$p->id."'"); |
73 | 77 |
74 array_push( $programs, $arr ); | 78 array_push( $programs, $arr ); |
75 } | 79 } |
76 | 80 |
77 $k_category_name = ""; | 81 $k_category_name = ""; |
78 $crecs = DBRecord::createRecords(TBL_PREFIX.CATEGORY_TBL ); | 82 $crecs = DBRecord::createRecords(CATEGORY_TBL ); |
79 $cats = array(); | 83 $cats = array(); |
80 $cats[0]['id'] = 0; | 84 $cats[0]['id'] = 0; |
81 $cats[0]['name'] = "すべて"; | 85 $cats[0]['name'] = "すべて"; |
82 $cats[0]['selected'] = $category_id == 0 ? "selected" : ""; | 86 $cats[0]['selected'] = $category_id == 0 ? "selected" : ""; |
83 foreach( $crecs as $c ) { | 87 foreach( $crecs as $c ) { |
107 $arr['selected'] = $type == "BS" ? "selected" : ""; | 111 $arr['selected'] = $type == "BS" ? "selected" : ""; |
108 array_push( $types, $arr ); | 112 array_push( $types, $arr ); |
109 } | 113 } |
110 | 114 |
111 $k_station_name = ""; | 115 $k_station_name = ""; |
112 $crecs = DBRecord::createRecords(TBL_PREFIX.CHANNEL_TBL ); | 116 $crecs = DBRecord::createRecords(CHANNEL_TBL); |
113 $stations = array(); | 117 $stations = array(); |
114 $stations[0]['id'] = 0; | 118 $stations[0]['id'] = 0; |
115 $stations[0]['name'] = "すべて"; | 119 $stations[0]['name'] = "すべて"; |
116 $stations[0]['selected'] = (! $station) ? "selected" : ""; | 120 $stations[0]['selected'] = (! $station) ? "selected" : ""; |
117 foreach( $crecs as $c ) { | 121 foreach( $crecs as $c ) { |