<?php
/**
@file
@brief Entry Party パーティ参加処理 
@version $Id: entry.php,v 1.8 2005/03/13 08:45:41 minahito Exp $
*/

$xoopsOption['nocommon']=true;
include_once "../../mainfile.php";
include_once XOOPS_ROOT_PATH."/modules/exFrame/frameloader.php";
include_once "class/global.php";

// Form を読み込む
include_once "exComponent/Input.php";
include_once "include/EntryForm.php";

// session_start
include_once XOOPS_ROOT_PATH."/include/common.php";
include_once XOOPS_ROOT_PATH."/header.php";

if(!is_object($xoopsUser))
	redirect_header(XOOPS_URL."/user.php",2,"登録会員でなければエントリーできません");

exPerm::GuardRedirect('post_entry','index.php',_MD_BXPARTY_ERRMES_PERM);

$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; 
if($id<=0)
	redirect_header("./index.php",1,"無効な宴会 ID です");

$pHandler = bxParty::getHandler('party');
$party = $pHandler->get($id);
if(!bxParty::Guard($party))
	redirect_header("./index.php",1,"無効な宴会 ID です");

if($party->getVar('limit_date')<time())
	redirect_header("./index.php",1,"受付が終わっています");

$compo = new exInputComponent(null,new EntryInputComponentRender(),'edit_entry',
	new EntryForm($party),new exSuccessForwardConfig(EXFORWARD_LOCATION,'entry_confirm.php'));

switch($compo->init()) {
	case COMPONENT_INIT_FAIL:
		die;
		break;

	case ACTIONFORM_INIT_FAIL:
		print $compo->form_->getHtmlErrors();
		$compo->display();
		break;

	case COMPONENT_INIT_SUCCESS:
		$compo->display();
		break;
}


include_once XOOPS_ROOT_PATH."/footer.php";
?>