diff --git a/system/pages/guilds/list_of_guilds.php b/system/pages/guilds/list_of_guilds.php index 2463e191..74b790fe 100644 --- a/system/pages/guilds/list_of_guilds.php +++ b/system/pages/guilds/list_of_guilds.php @@ -1,126 +1,39 @@ + * @author Slawkens + * @author whiteblXK + * @copyright 2019 MyAAC + * @link http://my-aac.org + */ +defined('MYAAC') or die('Direct access not allowed!'); $guilds_list = new OTS_Guilds_List(); - -if(!isset($_REQUEST['preview'])) - $_REQUEST['preview'] = 1; - $guilds_list->orderBy("name"); -//echo 'Guilds needs to have atleast 4 members, otherwise it will be deleted automatically after 4 days.

Guild statistics are self-updated once per 3 days.

'; - -//echo 'Normal preview / Advanced ranks & statistics

-echo ' - - - '; -if($_REQUEST['preview'] == 2) { - echo ' - - - '; - /* - - - - ';*/ -} -else - echo ' - - - '; - -echo ' - '; -$showed_guilds = 0; - -if($_REQUEST['preview'] == 2) +$guilds = array(); +if(count($guilds_list) > 0) { - if(count($guilds_list) > 0) - { - foreach($guilds_list as $guild) - { - $guild_logo = $guild->getCustomField('logo_name'); - if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo)) - $guild_logo = "default.gif"; - - echo ' - '; - // - - echo ''; - } - } - else - echo ' - - '; -} -else -{ - if(count($guilds_list) > 0) - { - foreach($guilds_list as $guild) - { - $guild_logo = $guild->getCustomField('logo_name'); - if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo)) - $guild_logo = "default.gif"; + foreach ($guilds_list as $guild) { + $guild_logo = $guild->getCustomField('logo_name'); + if (empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo)) + $guild_logo = "default.gif"; - $description = $guild->getCustomField('description'); - $description_with_lines = str_replace(array("\r\n", "\n", "\r"), '
', $description, $count); - if($count < $config['guild_description_lines_limit']) - $description = wordwrap(nl2br($description), 60, "
", true); + $description = $guild->getCustomField('description'); + $description_with_lines = str_replace(array("\r\n", "\n", "\r"), '
', $description, $count); + if ($count < $config['guild_description_lines_limit']) + $description = wordwrap(nl2br($description), 60, "
", true); - echo ' - '; - } - } - else - echo ' - - '; -} + $guildName = $guild->getName(); + $guilds[] = array('name' => $guildName, 'logo' => $guild_logo, 'link' => getGuildLink($guildName, false), 'description' => $description); + } +}; - -echo '
Active Guilds on '.$config['lua']['serverName'].'
RankLogoGuild nameMembersTotal levelAverage levelFragsLogoDescription
'.($show_ranks ? $showed_guilds.'.' : '-').''.$guild->getName().'
'; - if(admin()) - echo '
Delete this guild (for ADMIN only!)'; - echo '
'.$guild->getCustomField('total_members').''.$guild->getCustomField('total_level').''; - //if($guild->getCustomField('total_members') > 0) - // echo ceil($guild->getCustomField('total_level')/$guild->getCustomField('total_members')); - //echo ''.$guild->getCustomField('frags').'
-Create guild
Actually there is no guild on server.' . ($logged ? ' Create first! Press button "Create Guild".' : '') . '
'; - if($logged) - echo ' -
- -
'; - - echo ' -
'.$guild->getName().'
'.$description.''; - if(admin()) - echo '
Delete this guild (for ADMIN only!)'; - echo '
- -
-
Create guild
Actually there is no guild on server.' . ($logged ? ' Create first! Press button "Create Guild".' : '') . '
'; - if($logged) - echo '
- -
'; - echo ' -


'; -if($logged) - echo '
- -
-
If you have any problem with guilds try: -
Cleanup players - can\'t join guild/be invited? Can\'t create guild? Try cleanup players. -
Cleanup guilds - made guild, you are a leader, but you are not on players list? Cleanup guilds!'; -else - echo 'Before you can create guild you must login.
- -
'; -?> \ No newline at end of file +$twig->display('guilds.list.html.twig', array( + 'guilds' => $guilds, + 'logged' => isset($logged) ? $logged : false, + 'isAdmin' => admin(), +)); \ No newline at end of file diff --git a/system/templates/guilds.list.html.twig b/system/templates/guilds.list.html.twig new file mode 100644 index 00000000..a24cbb67 --- /dev/null +++ b/system/templates/guilds.list.html.twig @@ -0,0 +1,160 @@ +
+
+
+ + + + +
Active Guilds on {{ config.lua.serverName }}
+ + + + +
+
+ + + + + + + +
+
+ + + + + + +
+
+ + + {% if guilds|length > 0 %} + + + + + + + {% set i = 0 %} + {% for guild in guilds %} + {% set i = i + 1 %} + + + + + + + + {% endfor %} + {% else %} + + + + {% if logged %} + + {% endif %} + + {% endif %} + +
LogoDescription 
+ + + + {{ guild.name }}{% if isAdmin %} - Delete this guild (for ADMIN only!){% endif %} + + + {% if guild.description is not empty %} +
+ {{ guild.description }} + {% endif %} +
+ + + + + + +
+
+ +
+
+
+ Create Guild +
+ Actually there is no guild on server.{% if logged %} Create first! Press button "Create Guild"{% endif %} +
+ + + + + + +
+ +
+
+
+
+
+
+
+
+ + + + + + + + + + + +
+ + + + + {% if logged %} + + + + + + {% else %} + Before you can create guild you must login. +
+ + + + + + {% endif %} + +
+ +
+ +
+ + {% if logged %} +
+ If you have any problem with guilds try: +
+ Cleanup players - can\'t join guild/be invited? Can\'t create guild? Try cleanup players. +
+ Cleanup guilds - made guild, you are a leader, but you are not on players list? Cleanup guilds!'; + {% endif %} +
+ +
+ + + +