LFG_ACCESS_SITE_ADMINISTRATOR, LFG_CLASS => LFG_ACCESS_SITE_ADMINISTRATOR, LFG_SERVER => LFG_ACCESS_SITE_ADMINISTRATOR, LFG_ZONE => LFG_ACCESS_SITE_ADMINISTRATOR, LFG_INSTANCE => LFG_ACCESS_SITE_USER, LFG_CHARACTER => LFG_ACCESS_SITE_USER, LFG_GUILD => LFG_ACCESS_SITE_USER); function LFG_View_browse_printRow($data, $type, $access, $phrases) { global $access_require; $link_item = LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $data['name'], array('type' => $type, 'id' => $data['id'])); $row = ( $access > LFG_ACCESS_SITE_ADMINISTRATOR ) ? " \n \n" : " \n \n"; switch ( $type ) { case LFG_CLASS: $row .= "
\n"; break; default: break; } $row .= " $link_item\n
\n "; if ( $access <= $access_require[$type] ) { $link_edit = LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['edit'], array('type' => LFG_TYPE_EDIT, 'sub_type' => $type, 'id' => $data['id'])); $link_delete = LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['delete'], array('type' => LFG_TYPE_DELETE, 'sub_type' => $type, 'id' => $data['id'])); $row .= "\n \n $link_edit\n $link_delete\n "; } $row .= "\n \n"; return $row; } function LFG_View_browse() { if ( !array_key_exists('type', $_REQUEST) ) { throw new LFG_Exception("INTERNAL", "", "missing type parameter"); } $access = ( key_exists('user_access', $_SESSION) ) ? $_SESSION['user_access'] : LFG_ACCESS_SITE_GUEST; // // Get parameters and query for the data // $type = $_REQUEST['type']; $id = ( array_key_exists('id', $_REQUEST) ) ? $_REQUEST['id'] : null; $sub_type = ( array_key_exists('sub_type', $_REQUEST) ) ? $_REQUEST['sub_type'] : null; $sub_id = ( array_key_exists('sub_id', $_REQUEST) ) ? $_REQUEST['sub_id'] : null; $list = ( array_key_exists('list', $_REQUEST) && (bool)($_REQUEST['list']) ); $user_id = ( array_key_exists('user_id', $_SESSION) ) ? $_SESSION['user_id'] : null; $result = ( $list ) ? $GLOBALS['LFG_Model']->getRestricted($type, null, $sub_type, $id, $user_id) : $GLOBALS['LFG_Model']->getRestricted($type, $id, $sub_type, null, $user_id); // Create the breadcrumbs $nav = LFG_Controller_buildNav($type, $sub_type, $id, $list); global $access_require; $body = "\n"; if ( $list ) { $phrases = $GLOBALS['Phrasebook']->getPhrases($type.'_add', 'edit', 'delete', 'none'); if ( count($result) > 0 ) { foreach ( $result as $row ) { $body .= LFG_View_browse_printRow($row, $type, $access, $phrases); } } else { $body .= " ".$GLOBALS['Phrasebook']->getPhrase('none').'\n'; } if ( ( $access <= $access_require[$type] ) ) { $args = array('type' => LFG_TYPE_ADD, 'sub_type' => $type); if ( !is_null($id) ) { $args['parent'] = $id; } $body .= " \n"; } } else { $result = $result[0]; switch ( $type ) { case LFG_GAME: $phrases = $GLOBALS['Phrasebook']->getPhrases('add', LFG_CLASS.'_plural', LFG_ZONE.'_plural', LFG_SERVER.'_plural'); if ( $access > LFG_ACCESS_SITE_ADMINISTRATOR ) { $body .= " \n"; $body .= " \n"; $body .= " \n"; } else { $body .= " \n"; $body .= " "; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " "; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " "; $body .= " \n"; $body .= " \n"; } break; case LFG_CLASS: $body .= " \n"; break; case LFG_ZONE: $body .= " \n"; break; case LFG_SERVER: $phrases = $GLOBALS['Phrasebook']->getPhrases('add', LFG_INSTANCE.'_plural', LFG_CHARACTER.'_plural', LFG_GUILD.'_plural'); if ( $access >= LFG_ACCESS_SITE_USER ) { $body .= " \n"; $body .= " \n"; $body .= " \n"; } else { $body .= " \n"; $body .= " \n"; $body .= " \n"; } break; case LFG_GUILD: $phrases = $GLOBALS['Phrasebook']->getPhrases(LFG_INSTANCE_MEMBERS.'_plural', LFG_INSTANCE.'_plural'); $body .= " \n"; $body .= " \n"; break; case LFG_CHARACTER: $phrases = $GLOBALS['Phrasebook']->getPhrases(LFG_CLASS, LFG_SERVER, LFG_GUILD, 'guild_rank_master', 'guild_rank_officer', 'guild_rank_member', 'none'); $class = $GLOBALS['LFG_Model']->get(LFG_CLASS, array('id' => $result['class'])); $server = $GLOBALS['LFG_Model']->get(LFG_SERVER, array('id' => $result['server'])); // Class $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; // Server $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; if ( !is_null($result['guild']) ) { $ranks = array($phrases['guild_rank_master'], $phrases['guild_rank_officer'], $phrases['guild_rank_member']); $guild = $GLOBALS['LFG_Model']->get(LFG_GUILD, array('id' => $result['guild'])); $body .= " \n"; } else { $body .= " \n"; } $body .= " \n"; if ( array_key_exists('user_id', $_SESSION) && $_SESSION['user_id'] == $result['user'] ) { $access = LFG_ACCESS_SITE_ADMINISTRATOR; // So that edit/delete links below are shown } break; case LFG_INSTANCE: $admin = ( $user_id == $result['owner'] || $access >= LFG_ACCESS_ADMINISTRATOR ); $phrases = $GLOBALS['Phrasebook']->getPhrases('class', 'admin', 'name', 'instance_promote', 'instance_rank', 'instance_rank_leader', 'instance_rank_inviter', 'instance_rank_member', 'instance_rank_standby'); $members = $GLOBALS['LFG_Model']->getInstance($id); $body .= " \n"; $body .= " "; if ( $admin ) { $body .= " \n"; } $body .= " \n"; // Leader $body .= " \n"; $body .= " \n"; $body .= " \n"; if ( $admin ) { $body .= " \n"; } $body .= " \n"; // Members $ranks = array('instance_rank_standby', 'instance_rank_member', 'instance_rank_inviter'); for ($i=2; $i>=0; $i--) { for ($j=0; $j{$phrases[$ranks[$i]]}\n"; } $body .= " \n"; if ( $admin ) { $body .= " \n"; } $body .= " \n"; } } break; } if ( $access <= LFG_ACCESS_SITE_ADMINISTRATOR ) { $phrases = $GLOBALS['Phrasebook']->getPhrases('edit', 'delete'); $body .= " \n"; } } $body .= "
".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases[$type.'_add'], $args)."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_CLASS.'_plural'], array('type' => LFG_CLASS, 'id' => $id, 'list' => 1))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_ZONE.'_plural'], array('type' => LFG_ZONE, 'id' => $id, 'list' => 1))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_SERVER.'_plural'], array('type' => LFG_SERVER, 'id' => $id, 'list' => 1))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_CLASS.'_plural'], array('type' => LFG_CLASS, 'id' => $id, 'list' => 1))."".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['add'], array('type' => LFG_TYPE_ADD, 'sub_type' => LFG_CLASS, 'parent' => $result['id']))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_ZONE.'_plural'], array('type' => LFG_ZONE, 'id' => $id, 'list' => 1))."".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['add'], array('type' => LFG_TYPE_ADD, 'sub_type' => LFG_ZONE, 'parent' => $result['id']))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_SERVER.'_plural'], array('type' => LFG_SERVER, 'id' => $id, 'list' => 1))."".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['add'], array('type' => LFG_TYPE_ADD, 'sub_type' => LFG_SERVER, 'parent' => $result['id']))."
".$GLOBALS['Phrasebook']->getPhrase('color').":
 
".$GLOBALS['Phrasebook']->getPhrase('capacity').":{$result['capacity']}
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_CHARACTER.'_plural'], array('type' => LFG_CHARACTER, 'sub_type' => LFG_SERVER, 'id' => $id, 'list' => 1))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_INSTANCE.'_plural'], array('type' => LFG_INSTANCE, 'sub_type' => LFG_SERVER, 'id' => $id, 'list' => 1))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_GUILD.'_plural'], array('type' => LFG_GUILD, 'sub_type' => LFG_SERVER, 'id' => $id, 'list' => 1))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_CHARACTER.'_plural'], array('type' => LFG_CHARACTER, 'sub_type' => LFG_SERVER, 'id' => $id, 'list' => 1))."".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['add'], array('type' => LFG_TYPE_ADD, 'sub_type' => LFG_CHARACTER, 'parent' => $id))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_INSTANCE.'_plural'], array('type' => LFG_INSTANCE, 'sub_type' => LFG_SERVER, 'id' => $id, 'list' => 1))."".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['add'], array('type' => LFG_TYPE_ADD, 'sub_type' => LFG_INSTANCE, 'parent' => $id))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_GUILD.'_plural'], array('type' => LFG_GUILD, 'sub_type' => LFG_SERVER, 'id' => $id, 'list' => 1))."".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['add'], array('type' => LFG_TYPE_ADD, 'sub_type' => LFG_GUILD, 'parent' => $id))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_INSTANCE_MEMBERS.'_plural'], array('type' => LFG_CHARACTER, 'sub_type' => LFG_GUILD, 'id' => $id, 'is_list' => 1))."
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $phrases[LFG_INSTANCE.'_plural'], array('type' => LFG_INSTANCE, 'sub_type' => LFG_GUILD, 'id' => $id, 'is_list' => 1))."
{$phrases[LFG_CLASS]}:".LFG_Controller_printLink(LFG_PAGE_BROWSE, $class[0]['name'], array('type' => LFG_CLASS, 'id' => $result['class']))."
{$phrases[LFG_SERVER]}:".LFG_Controller_printLink(LFG_PAGE_BROWSE, $server[0]['name'], array('type' => LFG_SERVER, 'id' => $result['class']))."
{$phrases[LFG_GUILD]}:".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $guild[0]['name'], array('type' => LFG_GUILD, 'id' => $result['guild']))." ({$ranks[$guild[0]['guild_access']]}){$phrases['none']}
{$phrases['instance_rank']}{$phrases['name']}{$phrases['class']}{$phrases['admin']}
{$phrases['instance_rank_leader']}".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $members[0]['name'], array('type' => LFG_CHARACTER, 'id' => $members[0]['id']))." 
".LFG_Controller_PrintLink(LFG_PAGE_BROWSE, $members[$i][$j]['name'], array('type' => LFG_CHARACTER, 'id' => $members[$i][$j]['name']))."\n"; $body .= " ".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['instance_uninvite'], array('type' => LFG_TYPE_UNINVITE, 'id' => $id, 'sub_id' => $members[$i][$j]['id']))."\n"; $body .= " ".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['instance_promote'], array('type' => LFG_TYPE_PROMOTE, 'id' => $id, 'sub_id' => $members[$i][$j]['id']))."\n"; $body .= " ".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['instance_demote'], array('type' => LFG_TYPE_DEMOTE, 'id' => $id, 'sub_id' => $members[$i][$j]['id']))."\n"; $body .= "
\n"; $body .= " ".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['edit'], array('type' => LFG_TYPE_EDIT, 'sub_type' => $type, 'id' => $result['id'])); $body .= " ".LFG_Controller_PrintLink(LFG_PAGE_FORM, $phrases['delete'], array('type' => LFG_TYPE_DELETE, 'sub_type' => $type, 'id' => $result['id'])); $body .= "
\n"; return array('body' => $body, 'breadcrumb' => $nav); } ?>