<?php
/**
@brief 登録されている宴会の一覧を表示する
*/

include "../../mainfile.php";
include_once XOOPS_ROOT_PATH."/header.php";
include_once XOOPS_ROOT_PATH."/modules/exFrame/frameloader.php";
include_once "./class/global.php";
include_once "./include/PartyFilter.php";

require_once "xoops/user.php";

exPerm::GuardRedirect('list',XOOPS_URL,_MD_BXPARTY_ERRMES_PERM);

$exXoopsUser=new exXoopsUserObject($xoopsUser);

$handler = bxParty::getHandler('party');
$filter = exPerm::Guard('list_all') ? new PartyAdminFilter() : new PartyFilter();

$partys = $handler->getObjects($filter->getCriteria());

// もし１件もパーティがなかったら条件をゆるめる
if(!count($partys)&&!$filter->end_) {
	header('location: '.$_SERVER['SCRIPT_NAME'].'?end=1' );
	exit;
}

// template 処理
$xoopsOption['template_main'] = 'bxparty_index.html';
foreach($partys as $p) {
	$xoopsTpl->append('partys',$p->getStructure());
}
$xoopsTpl->assign('xoopsUser',$exXoopsUser->getStructure());
$xoopsTpl->assign('filter',$filter->getStructure());

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