diff --git a/system/pages/team.php b/system/pages/team.php index e06d84a93e..0032fa9ba3 100644 --- a/system/pages/team.php +++ b/system/pages/team.php @@ -21,15 +21,7 @@ return; } -$newStyle = ($config['team_style'] == 2); -if(!$newStyle) -{ - echo '

Support in game

- ' . getGroupHeader(); -} - -$group_tmp = array(); -$i = 0; +$groupMember = array(); $groupList = $groups->getGroups(); foreach($groupList as $id => $group) { @@ -40,87 +32,33 @@ if(!count($group_members)) continue; - $members_count = 0; - $groupNames = array(); + $members = array(); foreach($group_members as $member) { if(!admin() && $member->isHidden()) continue; - $members_count++; - $flag = ''; - if($config['account_country']) - $flag = getFlagImage($member->getAccount()->getCountry()); - - $tmp = ''; - if(!$newStyle) - $tmp .= ''; - - $tmp .= ''; - if($config['team_display_status']) - $tmp .= ''; - - if($config['multiworld'] || $config['team_display_world']) - $tmp .= ''; - - $lastLogin = ''; - if($config['team_display_lastlogin']) - { - $lastLogin = 'Never.'; - if($member->getLastLogin() > 0) - $lastLogin = date("j F Y, g:i a", $member->getLastLogin()); - } - - $tmp .= ''; - if($newStyle) - { - if(isset($groupNames[$group->getName()])) - $groupNames[$group->getName()] .= $tmp; - else - $groupNames[$group->getName()] = $tmp; - } - else - echo $tmp; + $lastLogin = 'Never.'; + if($member->getLastLogin() > 0) + $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 + ); } - if($newStyle && $members_count > 0) - { - $group_tmp[$id] = '

' . ucfirst($group->getName()) . 's

-
' . ucfirst($group->getName()) . '' . $flag . ' ' . getPlayerLink($member->getName()) . '' . ($member->isOnline() > 0 ? 'Online' : 'Offline') . '' . getWorldName($member->getWorldId()) . '' . $lastLogin . '
' . getGroupHeader(false) . $groupNames[$group->getName()] . '
'; - } + $groupMember[] = array( + 'group_name' => $group->getName(), + 'members' => $members + ); } -if($newStyle) -{ - for($i = $id; $i >= 0; $i--) - { - if(isset($group_tmp[$i])) - echo $group_tmp[$i]; - } -} -else - echo ''; - -function getGroupHeader($groupField = true) -{ - global $config; - - $ret = ''; - if($groupField) - $ret .= 'Group'; - - $ret .= 'Name'; - - if($config['team_display_status']) - $ret .= 'Status'; - - if($config['multiworld'] || $config['team_display_world']) - $ret .= 'World'; - - if($config['team_display_lastlogin']) - $ret .= 'Last login'; - - $ret .= ''; - return $ret; -} -?> +$twig->display('team.html.twig', array( + 'groupmember' => $groupMember +)); +?> \ No newline at end of file diff --git a/system/templates/team.html.twig b/system/templates/team.html.twig new file mode 100644 index 0000000000..d0c4abc154 --- /dev/null +++ b/system/templates/team.html.twig @@ -0,0 +1,156 @@ +
+ +
+
+ + + + +
Support in game
+ + + + +
+
+ + +
+
+ + {% if config.team_style == 1 %} + + + + + + {% if config.team_display_status %} + + {% endif %} + + {% if (config.multiworld or config.team_display_world) %} + + {% endif %} + + {% if config.team_display_lastlogin %} + + {% endif %} + + + {% for group in groupmember|reverse %} + {% for member in group.members|reverse %} + + + + + + {% if config.team_display_status %} + + {% endif %} + + {% if (config.multiworld or config.team_display_world) %} + + {% endif %} + + {% if config.team_display_lastlogin %} + + {% endif %} + + {% endfor %} + {% endfor %} + + {% elseif config.team_style == 2 %} + {% for group in groupmember|reverse %} +

{{ group.group_name }}

+ +
+ Group + + Name + + Status + + World + + Last login +
{{ group.group_name }} + {% if config.account_country %} + {{ member.flag_image|raw }} + {% endif %} + {{ member.link|raw }} + + {% if member.status %} + Online + {% else %} + Offline + {% endif %} + + {{ member.world_name }} + + {{ member.last_login }} +
+ + + + {% if config.team_display_status %} + + {% endif %} + + {% if (config.multiworld or config.team_display_world) %} + + {% endif %} + + {% if config.team_display_lastlogin %} + + {% endif %} + + + {% for member in group.members %} + + + + {% if config.team_display_status %} + + {% endif %} + + {% if (config.multiworld or config.team_display_world) %} + + {% endif %} + + {% if config.team_display_lastlogin %} + + {% endif %} + + {% endfor %} +
+ Name + + Status + + World + + Last login +
+ {% if config.account_country %} + {{ member.flag_image|raw }} + {% endif %} + {{ member.link|raw }} + + {% if member.status %} + Online + {% else %} + Offline + {% endif %} + + {{ member.world_name }} + + {{ member.last_login }} +
+ {% endfor %} + {% endif %} +
+
+ + + + \ No newline at end of file