mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Guilds List to twig
This commit is contained in:
parent
ed6a740eee
commit
69064839a7
@ -1,126 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Lists of guilds
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Gesior <jerzyskalski@wp.pl>
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @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.<BR/><BR/>Guild statistics are self-updated once per 3 days.<BR/><BR/>';
|
||||
|
||||
//echo '<A HREF="?subtopic=guilds&preview=1">Normal preview</A> / <A HREF="?subtopic=guilds&preview=2">Advanced ranks & statistics</A><BR/><BR/>
|
||||
echo '
|
||||
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
|
||||
<TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN='.($_REQUEST['preview'] == 2 ? '7' : '3').' class="white"><B>Active Guilds on '.$config['lua']['serverName'].'</B></TD></TR>
|
||||
<TR BGCOLOR='.$config['darkborder'].' '.($_REQUEST['preview'] == 2 ? 'ALIGN="CENTER"' : '' ).'>';
|
||||
if($_REQUEST['preview'] == 2) {
|
||||
echo '
|
||||
<TD WIDTH=50><B><A HREF="?subtopic=guilds&preview=2&order=rank">Rank</A></B></TD>
|
||||
<TD WIDTH=32><B>Logo</B></TD>
|
||||
<TD WIDTH=200><B><A HREF="?subtopic=guilds&preview=2&order=name">Guild name</A></B></TD>';
|
||||
/*
|
||||
<TD WIDTH=10><B><A HREF="?subtopic=guilds&preview=2&order=total_members">Members</A></B></TD>
|
||||
<TD WIDTH=10><B><A HREF="?subtopic=guilds&preview=2&order=total_level">Total level</A></B></TD>
|
||||
<TD WIDTH=10><B><A HREF="?subtopic=guilds&preview=2&order=average_level">Average level</A></B></TD>
|
||||
<TD WIDTH=10><B><A HREF="?subtopic=guilds&preview=2&order=frags">Frags</A></B></TD>';*/
|
||||
}
|
||||
else
|
||||
echo '
|
||||
<TD WIDTH=64><B>Logo</B></TD>
|
||||
<TD WIDTH=100%><B>Description</B></TD>
|
||||
<TD WIDTH=50><B> </B></TD>';
|
||||
|
||||
echo '
|
||||
</TR>';
|
||||
$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 '<TR class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'?subtopic=guilds&action=show&guild='.$guild->getName().'\'"';
|
||||
|
||||
echo ' BGCOLOR="' . getStyle($showed_guilds++) . '"><TD ALIGN="CENTER">'.($show_ranks ? $showed_guilds.'.' : '-').'</TD><TD ALIGN="CENTER"><A HREF="?subtopic=guilds&action=show&guild='.$guild->getName().'"><IMG STYLE="border: none" SRC="images/guilds/' .$guild_logo.'" WIDTH=32 HEIGHT=32></A></TD>
|
||||
<TD valign="top"><B>'.$guild->getName().'</B><BR/>';
|
||||
if(admin())
|
||||
echo '<br /><a href="?subtopic=guilds&action=delete_by_admin&guild='.$guild->getName().'">Delete this guild (for ADMIN only!)</a>';
|
||||
echo '</TD>';
|
||||
//<TD ALIGN="CENTER">'.$guild->getCustomField('total_members').'</TD><TD ALIGN="CENTER">'.$guild->getCustomField('total_level').'</TD><TD ALIGN="CENTER">';
|
||||
//if($guild->getCustomField('total_members') > 0)
|
||||
// echo ceil($guild->getCustomField('total_level')/$guild->getCustomField('total_members'));
|
||||
//echo '</TD><TD>'.$guild->getCustomField('frags').'</TD>
|
||||
|
||||
echo '</TR>';
|
||||
}
|
||||
}
|
||||
else
|
||||
echo '<TR BGCOLOR='.$config['lightborder'].'><TD ALIGN="CENTER">-</TD><TD><IMG SRC="images/guilds/' . 'default.gif" WIDTH=64 HEIGHT=64></TD>
|
||||
<TD valign="top" align="center"><B>Create guild</B><BR/>Actually there is no guild on server.' . ($logged ? ' Create first! Press button "Create Guild".' : '') . '</TD>
|
||||
<TD colspan="4">';
|
||||
if($logged)
|
||||
echo '
|
||||
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=create" METHOD=post><TR><TD>
|
||||
<INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$template_path.'/images/global/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
|
||||
</TD></TR></FORM></TABLE>';
|
||||
|
||||
echo '
|
||||
</TD></TR>';
|
||||
}
|
||||
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"), '<br />', $description, $count);
|
||||
if($count < $config['guild_description_lines_limit'])
|
||||
$description = wordwrap(nl2br($description), 60, "<br />", true);
|
||||
$description = $guild->getCustomField('description');
|
||||
$description_with_lines = str_replace(array("\r\n", "\n", "\r"), '<br />', $description, $count);
|
||||
if ($count < $config['guild_description_lines_limit'])
|
||||
$description = wordwrap(nl2br($description), 60, "<br />", true);
|
||||
|
||||
echo '<TR BGCOLOR="' . getStyle($showed_guilds++) . '"><TD><IMG SRC="images/guilds/' . $guild_logo.'" WIDTH=64 HEIGHT=64></TD>
|
||||
<TD valign="top"><B>'.$guild->getName().'</B><BR/>'.$description.'';
|
||||
if(admin())
|
||||
echo '<br /><a href="?subtopic=guilds&action=delete_by_admin&guild='.$guild->getName().'">Delete this guild (for ADMIN only!)</a>';
|
||||
echo '</TD><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="' . getGuildLink($guild->getName(), false) . '" METHOD=post><TR><TD>
|
||||
<INPUT TYPE=image NAME="View" ALT="View" SRC="'.$template_path.'/images/global/buttons/sbutton_view.gif" BORDER=0 WIDTH=120 HEIGHT=18>
|
||||
</TD></TR></FORM></TABLE>
|
||||
</TD></TR>';
|
||||
}
|
||||
}
|
||||
else
|
||||
echo '<TR BGCOLOR='.$config['lightborder'].'><TD><IMG SRC="images/guilds/' . 'default.gif" WIDTH=64 HEIGHT=64></TD>
|
||||
<TD valign="top"><B>Create guild</B><BR/>Actually there is no guild on server.' . ($logged ? ' Create first! Press button "Create Guild".' : '') . '</TD>
|
||||
<TD>';
|
||||
if($logged)
|
||||
echo '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=create" METHOD=post><TR><TD>
|
||||
<INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$template_path.'/images/global/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
|
||||
</TD></TR></FORM></TABLE>';
|
||||
echo '
|
||||
</TD></TR>';
|
||||
}
|
||||
$guildName = $guild->getName();
|
||||
$guilds[] = array('name' => $guildName, 'logo' => $guild_logo, 'link' => getGuildLink($guildName, false), 'description' => $description);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
echo '</TABLE><br><br>';
|
||||
if($logged)
|
||||
echo '<TABLE BORDER=0 WIDTH=100%><TR><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD><TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=guilds&action=create" METHOD=post><TR><TD>
|
||||
<INPUT TYPE=image NAME="Create Guild" ALT="Create Guild" SRC="'.$template_path.'/images/global/buttons/sbutton_createguild.png" BORDER=0 WIDTH=120 HEIGHT=18>
|
||||
</TD></TR></FORM></TABLE></TD><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD></TR></TABLE>
|
||||
<BR />If you have any problem with guilds try:
|
||||
<BR /><a href="?subtopic=guilds&action=cleanup_players">Cleanup players</a> - can\'t join guild/be invited? Can\'t create guild? Try cleanup players.
|
||||
<BR /><a href="?subtopic=guilds&action=cleanup_guilds">Cleanup guilds</a> - 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.<br><TABLE BORDER=0 WIDTH=100%><TR><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD><TD ALIGN=center><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=accountmanagement&redirect=' . getLink('guilds') . '" METHOD=post><TR><TD>
|
||||
<INPUT TYPE=image NAME="Login" ALT="Login" SRC="'.$template_path.'/images/global/buttons/sbutton_login.gif" BORDER=0 WIDTH=120 HEIGHT=18>
|
||||
</TD></TR></FORM></TABLE></TD><TD ALIGN=center><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD></TR></TABLE>';
|
||||
?>
|
||||
$twig->display('guilds.list.html.twig', array(
|
||||
'guilds' => $guilds,
|
||||
'logged' => isset($logged) ? $logged : false,
|
||||
'isAdmin' => admin(),
|
||||
));
|
160
system/templates/guilds.list.html.twig
Normal file
160
system/templates/guilds.list.html.twig
Normal file
@ -0,0 +1,160 @@
|
||||
<div class="TableContainer">
|
||||
<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">Active Guilds on {{ config.lua.serverName }}</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>
|
||||
|
||||
<table class="Table3" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="InnerTableContainer">
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="TableContentContainer">
|
||||
<table class="TableContent" width="100%">
|
||||
<tbody>
|
||||
{% if guilds|length > 0 %}
|
||||
<tr bgcolor="{{ config.vdarkborder }}">
|
||||
<td width="64"><b>Logo</b></td>
|
||||
<td><b>Description</b></td>
|
||||
<td width="12%"><b> </b></td>
|
||||
</tr>
|
||||
|
||||
{% set i = 0 %}
|
||||
{% for guild in guilds %}
|
||||
{% set i = i + 1 %}
|
||||
<tr bgcolor="{{ getStyle(i) }}">
|
||||
<td>
|
||||
<img src="images/guilds/{{ guild.logo }}" width="64" height="64">
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<span{% if guild.description is not empty %} valign="top"{% endif %}>
|
||||
<b>{{ guild.name }}</b>{% if isAdmin %}<a href="?subtopic=guilds&action=delete_by_admin&guild={{ guild.name }}"> - Delete this guild (for ADMIN only!)</a>{% endif %}
|
||||
</span>
|
||||
|
||||
{% if guild.description is not empty %}
|
||||
<br>
|
||||
<span>{{ guild.description }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="border:0px;">
|
||||
<form action="{{ guild.link }}" method="post">
|
||||
<button name="View" alt="View" class="btn btn-secondary" src="{{ template_path }}/images/global/buttons/sbutton_view.gif" style="width: 100%; height: 20px;">
|
||||
View
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr bgcolor="{{ config.lightborder }}">
|
||||
<td valign="top">
|
||||
<b>Create Guild</b>
|
||||
<br/>
|
||||
Actually there is no guild on server.{% if logged %} Create first! Press button "Create Guild"{% endif %}
|
||||
</td>
|
||||
|
||||
{% if logged %}
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<form action="?subtopic=guilds&action=create" method=post>
|
||||
<tr>
|
||||
<td>
|
||||
<button name="Create Guild" alt="Create Guild" class="btn btn-secondary" style="width: 100%; height: 20px;">Create Guild</button>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="{{ template_path }}images/general/blank.gif" width="80" height="1" border="0">
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
{% if logged %}
|
||||
<form action="?subtopic=guilds&action=create" method=post>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="image" name="Create Guild" alt="Create Guild" src="{{ template_path }}/images/global/buttons/sbutton_createguild.png" border=0 style="width: 120px; height: 18px;">
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
{% else %}
|
||||
<b>Before you can create guild you must login.</b>
|
||||
<br/>
|
||||
<form action="?subtopic=accountmanagement&redirect={{ getLink('guilds') }}" method=post>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="image" name="Login" alt="Login" src="{{ template_path }}/images/global/buttons/sbutton_login.gif" border=0 style="width: 120px; height: 18px;">
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if logged %}
|
||||
<br/>
|
||||
If you have any problem with guilds try:
|
||||
<br/>
|
||||
<a href="?subtopic=guilds&action=cleanup_players">Cleanup players</a> - can\'t join guild/be invited? Can\'t create guild? Try cleanup players.
|
||||
<br/>
|
||||
<a href="?subtopic=guilds&action=cleanup_guilds">Cleanup guilds</a> - made guild, you are a leader, but you are not on players list? Cleanup guilds!';
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<img src="{{ template_path }}/images/general/blank.gif" width="80" height="1" border="0">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user