view keywordTable.php @ 157:00b5ed67d792

mod: xmlrpcをテスト的に追加(まだ途中)
author Sushi-k <epgrec@park.mda.or.jp>
date Tue, 30 Mar 2010 19:00:39 +0900
parents 57676bb30f64
children
line wrap: on
line source

<?php
include_once('config.php');
include_once( INSTALL_PATH . '/Smarty/Smarty.class.php' );
include_once( INSTALL_PATH . "/DBRecord.class.php" );
include_once( INSTALL_PATH . "/reclib.php" );
include_once( INSTALL_PATH . "/Reservation.class.php" );
include_once( INSTALL_PATH . "/Keyword.class.php" );
// include_once( INSTALL_PATH . "/Settings.class.php" );


$weekofdays = array( "", "", "羂", "", "", "", "", "" );
$prgtimes = array();
for( $i=0 ; $i < 25; $i++ ) {
	$prgtimes[$i] = $i == 24 ? "" : $i."鐔";
}

// 域若若鴻

if( isset($_POST["add_keyword"]) ) {
	if( $_POST["add_keyword"] == 1 ) {
		try {
			$rec = new Keyword();
			$rec->keyword = $_POST['k_search'];
			$rec->type = $_POST['k_type'];
			$rec->category_id = $_POST['k_category'];
			$rec->channel_id = $_POST['k_station'];
			$rec->use_regexp = $_POST['k_use_regexp'];
			$rec->weekofday = $_POST['k_weekofday'];
			$rec->prgtime   = $_POST['k_prgtime'];
			$rec->autorec_mode = $_POST['autorec_mode'];
			
			// 牙私膣絎茵
			$rec->reservation();
		}
		catch( Exception $e ) {
			exit( $e->getMessage() );
		}
	}
}


$keywords = array();
try {
	$recs = Keyword::createRecords(KEYWORD_TBL);
	foreach( $recs as $rec ) {
		$arr = array();
		$arr['id'] = $rec->id;
		$arr['keyword'] = $rec->keyword;
		$arr['type'] = $rec->type == "*" ? "鴻" : $rec->type;
		
		if( $rec->channel_id ) {
			$crec = new DBRecord(CHANNEL_TBL, "id", $rec->channel_id );
			$arr['channel'] = $crec->name;
		}
		else $arr['channel'] = '鴻';
		
		if( $rec->category_id ) {
			$crec = new DBRecord(CATEGORY_TBL, "id", $rec->category_id );
			$arr['category'] = $crec->name_jp;
		}
		else $arr['category'] = '鴻';
		
		$arr['use_regexp'] = $rec->use_regexp;
		
		$arr['weekofday'] = $weekofdays["$rec->weekofday"];
		
		$arr['prgtime'] = $prgtimes["$rec->prgtime"];
		
		$arr['autorec_mode'] = $RECORD_MODE[(int)$rec->autorec_mode]['name'];
		
		array_push( $keywords, $arr );
	}
}
catch( Exception $e ) {
	exit( $e->getMessage() );
}

$smarty = new Smarty();

$smarty->assign( "keywords", $keywords );
$smarty->assign( "sitetitle", "牙祉若若膊∞" );
$smarty->display( "keywordTable.html" );
?>