<?php
/**
@file
@brief 指定された宴会を見る
@version $Id: detail.php,v 1.6 2005/03/14 16:12:43 minahito Exp $
*/

require_once "../../mainfile.php";
require_once XOOPS_ROOT_PATH."/header.php";
require_once XOOPS_ROOT_PATH."/modules/exFrame/frameloader.php";

require_once "./class/global.php";

require_once "xoops/user.php";

require_once "xoops/perm.php";
	

$exXoopsUser=new exXoopsUserObject($xoopsUser);

$id = isset($_GET['id']) ? intval($_GET['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 か、権限がありません");

$eHandler = bxParty::getHandler('entry');
$members = $eHandler->getObjects(new Criteria('id',$party->getVar('id'),'='),null,'entry_date');

// template 処理
$xoopsOption['template_main'] = 'bxparty_detail.html';
$xoopsTpl->assign('party',$party->getStructure());
$time=0;
foreach($members as $m) {
	$xoopsTpl->append('members',$m->getStructure());
	$time+=$m->getVar('entry_date');
}
$xoopsTpl->assign('special_date',count($members) ? intval($time / (count($members))) : 0 ); 
$xoopsTpl->assign('xoopsUser',$exXoopsUser->getStructure());

include_once XOOPS_ROOT_PATH.'/include/comment_view.php';

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