mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-29 10:49:22 +02:00
Merge pull request #69 from whiteblXK/master
Move team page to twig template
This commit is contained in:
commit
3b96b21683
@ -21,15 +21,7 @@ if(!$groups->count())
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newStyle = ($config['team_style'] == 2);
|
$groupMember = array();
|
||||||
if(!$newStyle)
|
|
||||||
{
|
|
||||||
echo '<div style="text-align:center"><h2>Support in game</h2></div>
|
|
||||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">' . getGroupHeader();
|
|
||||||
}
|
|
||||||
|
|
||||||
$group_tmp = array();
|
|
||||||
$i = 0;
|
|
||||||
$groupList = $groups->getGroups();
|
$groupList = $groups->getGroups();
|
||||||
foreach($groupList as $id => $group)
|
foreach($groupList as $id => $group)
|
||||||
{
|
{
|
||||||
@ -40,87 +32,33 @@ foreach($groupList as $id => $group)
|
|||||||
if(!count($group_members))
|
if(!count($group_members))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$members_count = 0;
|
$members = array();
|
||||||
$groupNames = array();
|
|
||||||
foreach($group_members as $member)
|
foreach($group_members as $member)
|
||||||
{
|
{
|
||||||
if(!admin() && $member->isHidden())
|
if(!admin() && $member->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$members_count++;
|
|
||||||
$flag = '';
|
|
||||||
if($config['account_country'])
|
|
||||||
$flag = getFlagImage($member->getAccount()->getCountry());
|
|
||||||
|
|
||||||
$tmp = '<tr bgcolor="' . getStyle($i++) . '">';
|
|
||||||
if(!$newStyle)
|
|
||||||
$tmp .= '<td>' . ucfirst($group->getName()) . '</td>';
|
|
||||||
|
|
||||||
$tmp .= '<td>' . $flag . ' ' . getPlayerLink($member->getName()) . '</td>';
|
|
||||||
if($config['team_display_status'])
|
|
||||||
$tmp .= '<td>' . ($member->isOnline() > 0 ? '<span style="color: green"><b>Online</b></span>' : '<span style="color: red"><b>Offline</b></span>') . '</td>';
|
|
||||||
|
|
||||||
if($config['multiworld'] || $config['team_display_world'])
|
|
||||||
$tmp .= '<td><span class="white"><b>' . getWorldName($member->getWorldId()) . '</b></span></td>';
|
|
||||||
|
|
||||||
$lastLogin = '';
|
|
||||||
if($config['team_display_lastlogin'])
|
|
||||||
{
|
|
||||||
$lastLogin = 'Never.';
|
$lastLogin = 'Never.';
|
||||||
if($member->getLastLogin() > 0)
|
if($member->getLastLogin() > 0)
|
||||||
$lastLogin = date("j F Y, g:i a", $member->getLastLogin());
|
$lastLogin = date("j F Y, g:i a", $member->getLastLogin());
|
||||||
|
|
||||||
|
$members[] = array(
|
||||||
|
'group_name' => $group->getName(),
|
||||||
|
'status' => $member->isOnline(),
|
||||||
|
'link' => getPlayerLink($member->getName()),
|
||||||
|
'flag_image' => getFlagImage($member->getAccount()->getCountry()),
|
||||||
|
'world_name' => getWorldName($member->getWorldId()),
|
||||||
|
'last_login' => $lastLogin
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp .= '<td>' . $lastLogin . '</td></tr>';
|
$groupMember[] = array(
|
||||||
if($newStyle)
|
'group_name' => $group->getName(),
|
||||||
{
|
'members' => $members
|
||||||
if(isset($groupNames[$group->getName()]))
|
);
|
||||||
$groupNames[$group->getName()] .= $tmp;
|
|
||||||
else
|
|
||||||
$groupNames[$group->getName()] = $tmp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo $tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($newStyle && $members_count > 0)
|
$twig->display('team.html.twig', array(
|
||||||
{
|
'groupmember' => $groupMember
|
||||||
$group_tmp[$id] = '<div style="text-align:center"><h2>' . ucfirst($group->getName()) . 's</h2></div>
|
));
|
||||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">' . getGroupHeader(false) . $groupNames[$group->getName()] . '</table>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($newStyle)
|
|
||||||
{
|
|
||||||
for($i = $id; $i >= 0; $i--)
|
|
||||||
{
|
|
||||||
if(isset($group_tmp[$i]))
|
|
||||||
echo $group_tmp[$i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo '</table>';
|
|
||||||
|
|
||||||
function getGroupHeader($groupField = true)
|
|
||||||
{
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
$ret = '<tr bgcolor="' . $config['vdarkborder'] . '">';
|
|
||||||
if($groupField)
|
|
||||||
$ret .= '<td width="20%"><span class="white"><b>Group</b></span></td>';
|
|
||||||
|
|
||||||
$ret .= '<td width="40%"><span class="white"><b>Name</b></span></td>';
|
|
||||||
|
|
||||||
if($config['team_display_status'])
|
|
||||||
$ret .= '<td width="20%"><span class="white"><b>Status</b></span></td>';
|
|
||||||
|
|
||||||
if($config['multiworld'] || $config['team_display_world'])
|
|
||||||
$ret .= '<td><span class="white"><b>World</b></span></td>';
|
|
||||||
|
|
||||||
if($config['team_display_lastlogin'])
|
|
||||||
$ret .= '<td width="20%"><span class="white"><b>Last login</b></span></td>';
|
|
||||||
|
|
||||||
$ret .= '</tr>';
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
?>
|
?>
|
156
system/templates/team.html.twig
Normal file
156
system/templates/team.html.twig
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
<div class="TableContainer">
|
||||||
|
<table class="Table1" cellpadding="0" cellspacing="0">
|
||||||
|
<div class="CaptionContainer">
|
||||||
|
<div class="CaptionInnerContainer">
|
||||||
|
<span class="CaptionEdgeLeftTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||||
|
<span class="CaptionEdgeRightTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||||
|
<span class="CaptionBorderTop" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
|
||||||
|
<span class="CaptionVerticalLeft" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
|
||||||
|
<div class="Text" >Support in game</div>
|
||||||
|
<span class="CaptionVerticalRight" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);"></span>
|
||||||
|
<span class="CaptionBorderBottom" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);"></span>
|
||||||
|
<span class="CaptionEdgeLeftBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||||
|
<span class="CaptionEdgeRightBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="InnerTableContainer">
|
||||||
|
<table cellspacing="1" cellpadding="4" border="0" width="100%">
|
||||||
|
{% if config.team_style == 1 %}
|
||||||
|
<tr>
|
||||||
|
<td width="10%">
|
||||||
|
<span><b>Group</b></span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td width="40%">
|
||||||
|
<span><b>Name</b></span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{% if config.team_display_status %}
|
||||||
|
<td width="10%">
|
||||||
|
<span><b>Status</b></span>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if (config.multiworld or config.team_display_world) %}
|
||||||
|
<td width="20%">
|
||||||
|
<span><b>World</b></span>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if config.team_display_lastlogin %}
|
||||||
|
<td width="20%">
|
||||||
|
<span><b>Last login</b></span>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% for group in groupmember|reverse %}
|
||||||
|
{% for member in group.members|reverse %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ group.group_name }}</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{% if config.account_country %}
|
||||||
|
{{ member.flag_image|raw }}
|
||||||
|
{% endif %}
|
||||||
|
{{ member.link|raw }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{% if config.team_display_status %}
|
||||||
|
<td>
|
||||||
|
{% if member.status %}
|
||||||
|
<span style="color: green"><b>Online</b></span>
|
||||||
|
{% else %}
|
||||||
|
<span style="color: red"><b>Offline</b></span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if (config.multiworld or config.team_display_world) %}
|
||||||
|
<td>
|
||||||
|
<span><b>{{ member.world_name }}</b></span>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if config.team_display_lastlogin %}
|
||||||
|
<td>
|
||||||
|
{{ member.last_login }}
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% elseif config.team_style == 2 %}
|
||||||
|
{% for group in groupmember|reverse %}
|
||||||
|
<div style="text-align:center"><h2>{{ group.group_name }}</h2></div>
|
||||||
|
|
||||||
|
<table cellspacing="1" cellpadding="4" border="0" width="100%">
|
||||||
|
<tr>
|
||||||
|
<td width="40%">
|
||||||
|
<span><b>Name</b></span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{% if config.team_display_status %}
|
||||||
|
<td width="20%">
|
||||||
|
<span><b>Status</b></span>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if (config.multiworld or config.team_display_world) %}
|
||||||
|
<td width="20%">
|
||||||
|
<span><b>World</b></span>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if config.team_display_lastlogin %}
|
||||||
|
<td width="20%">
|
||||||
|
<span><b>Last login</b></span>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% for member in group.members %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{% if config.account_country %}
|
||||||
|
{{ member.flag_image|raw }}
|
||||||
|
{% endif %}
|
||||||
|
{{ member.link|raw }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{% if config.team_display_status %}
|
||||||
|
<td>
|
||||||
|
{% if member.status %}
|
||||||
|
<span style="color: green"><b>Online</b></span>
|
||||||
|
{% else %}
|
||||||
|
<span style="color: red"><b>Offline</b></span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if (config.multiworld or config.team_display_world) %}
|
||||||
|
<td>
|
||||||
|
<span><b>{{ member.world_name }}</b></span>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if config.team_display_lastlogin %}
|
||||||
|
<td>
|
||||||
|
{{ member.last_login }}
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
Loading…
x
Reference in New Issue
Block a user