comparison Keyword.class.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 f5a9f0eb4858
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 . "/reclib.php" ); 4 include_once( INSTALL_PATH . "/reclib.php" );
5 include_once( INSTALL_PATH . "/Reservation.class.php" ); 5 include_once( INSTALL_PATH . "/Reservation.class.php" );
6 include_once( INSTALL_PATH . '/Settings.class.php' );
6 7
7 class Keyword extends DBRecord { 8 class Keyword extends DBRecord {
8 9
10 protected $settings;
11
9 public function __construct($property = null, $value = null ) { 12 public function __construct($property = null, $value = null ) {
13 $this->settings = Settings::factory();
14
10 try { 15 try {
11 parent::__construct(TBL_PREFIX.KEYWORD_TBL, $property, $value ); 16 parent::__construct(KEYWORD_TBL, $property, $value );
12 } 17 }
13 catch( Exception $e ) { 18 catch( Exception $e ) {
14 throw $e; 19 throw $e;
15 } 20 }
16 } 21 }
17 22
18 private function getPrograms() { 23 private function getPrograms() {
19 if( $this->id == 0 ) return false; 24 if( $this->id == 0 ) return false;
20 25
21 // ちょっと先を検索する 26 // ちょっと先を検索する
22 $options = " WHERE starttime > '".date("Y-m-d H:i:s", time() + PADDING_TIME + 120 )."'"; 27 $options = " WHERE starttime > '".date("Y-m-d H:i:s", time() + $this->settings->padding_time + 120 )."'";
23 28
24 if( $this->keyword != "" ) { 29 if( $this->keyword != "" ) {
25 if( $this->use_regexp ) { 30 if( $this->use_regexp ) {
26 $options .= " AND CONCAT(title,description) REGEXP '".mysql_real_escape_string($this->keyword)."'"; 31 $options .= " AND CONCAT(title,description) REGEXP '".mysql_real_escape_string($this->keyword)."'";
27 } 32 }
44 49
45 $options .= " ORDER BY starttime ASC"; 50 $options .= " ORDER BY starttime ASC";
46 51
47 $recs = array(); 52 $recs = array();
48 try { 53 try {
49 $recs = DBRecord::createRecords( TBL_PREFIX.PROGRAM_TBL, $options ); 54 $recs = DBRecord::createRecords( PROGRAM_TBL, $options );
50 } 55 }
51 catch( Exception $e ) { 56 catch( Exception $e ) {
52 throw $e; 57 throw $e;
53 } 58 }
54 59
96 throw $e; 101 throw $e;
97 } 102 }
98 // 一気にキャンセル 103 // 一気にキャンセル
99 foreach( $precs as $rec ) { 104 foreach( $precs as $rec ) {
100 try { 105 try {
101 $reserve = new DBRecord( TBL_PREFIX.RESERVE_TBL, "program_id", $rec->id ); 106 $reserve = new DBRecord( RESERVE_TBL, "program_id", $rec->id );
102 // 自動予約されたもののみ削除 107 // 自動予約されたもののみ削除
103 if( $reserve->autorec ) { 108 if( $reserve->autorec ) {
104 Reservation::cancel( $reserve->id ); 109 Reservation::cancel( $reserve->id );
105 usleep( 100 ); // あんまり時間を空けないのもどう? 110 usleep( 100 ); // あんまり時間を空けないのもどう?
106 } 111 }