mirror of
https://github.com/slawkens/myaac.git
synced 2025-06-13 16:24:29 +02:00
Now it will properly shows Available Houses
This commit is contained in:
parent
35e4cd4596
commit
d594fa1a54
@ -114,6 +114,7 @@ if(isset($config['lua']['houseCleanOld'])) {
|
|||||||
$cleanOldHouse = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60));
|
$cleanOldHouse = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$housesSearch = false;
|
||||||
if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) && (isset($_POST['type']) || !$db->hasColumn('houses', 'guild')))
|
if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) && (isset($_POST['type']) || !$db->hasColumn('houses', 'guild')))
|
||||||
{
|
{
|
||||||
$townName = $config['towns'][$_POST['town']];
|
$townName = $config['towns'][$_POST['town']];
|
||||||
@ -146,7 +147,6 @@ if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) &&
|
|||||||
$whereby .= ' AND `guild` ' . ($type == 'guildhalls' ? '!' : '') . '= 0';
|
$whereby .= ' AND `guild` ' . ($type == 'guildhalls' ? '!' : '') . '= 0';
|
||||||
|
|
||||||
$houses_info = $db->query('SELECT * FROM `houses` WHERE ' . $whereby. ' ORDER BY ' . $orderby);
|
$houses_info = $db->query('SELECT * FROM `houses` WHERE ' . $whereby. ' ORDER BY ' . $orderby);
|
||||||
$houses_count = $houses_info->rowCount();
|
|
||||||
|
|
||||||
$players_info = $db->query("SELECT `houses`.`id` AS `houseid` , `players`.`name` AS `ownername` FROM `houses` , `players` , `accounts` WHERE `players`.`id` = `houses`.`owner` AND `accounts`.`id` = `players`.`account_id`");
|
$players_info = $db->query("SELECT `houses`.`id` AS `houseid` , `players`.`name` AS `ownername` FROM `houses` , `players` , `accounts` WHERE `players`.`id` = `houses`.`owner` AND `accounts`.`id` = `players`.`account_id`");
|
||||||
$players = array();
|
$players = array();
|
||||||
@ -175,6 +175,8 @@ if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) &&
|
|||||||
|
|
||||||
$houses[] = array('owner' => $owner, 'name' => $house['name'], 'size' => $house['size'], 'rent' => $house['rent'], 'rentedBy' => $houseRent);
|
$houses[] = array('owner' => $owner, 'name' => $house['name'], 'size' => $house['size'], 'rent' => $house['rent'], 'rentedBy' => $houseRent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$housesSearch = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$guild = $db->hasTable('houses', 'guild') ? ' or guildhall' : '';
|
$guild = $db->hasTable('houses', 'guild') ? ' or guildhall' : '';
|
||||||
@ -187,6 +189,6 @@ $twig->display('houses.html.twig', array(
|
|||||||
'townId' => isset($_POST['town']) ? $_POST['town'] : null,
|
'townId' => isset($_POST['town']) ? $_POST['town'] : null,
|
||||||
'guild' => $guild,
|
'guild' => $guild,
|
||||||
'cleanOldHouse' => isset($cleanOld) ? $cleanOld : null,
|
'cleanOldHouse' => isset($cleanOld) ? $cleanOld : null,
|
||||||
'housesCount' => isset($houses_count) ? $houses_count : null,
|
'housesSearch' => $housesSearch,
|
||||||
'houses' => isset($houses) ? $houses : null
|
'houses' => isset($houses) ? $houses : null
|
||||||
));
|
));
|
@ -31,54 +31,56 @@
|
|||||||
<br><br>
|
<br><br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if houses is not empty %}
|
{% if houses is not empty or housesSearch %}
|
||||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr bgcolor="{{ config.vdarkborder }}">
|
<tr bgcolor="{{ config.vdarkborder }}">
|
||||||
<td colspan="6" class="white"><b>Available {{ houseType }} {% if townName is not empty %}in {{ townName }}{% endif %}on <b>{{ config.lua.serverName }}</b></b></td>
|
<td colspan="6" class="white"><b>Available {{ houseType }}{% if townName is not empty %} in {{ townName }}{% endif %} on <b>{{ config.lua.serverName }}</b></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr bgcolor="{{ config.darkborder }}">
|
<tr bgcolor="{{ config.darkborder }}">
|
||||||
{% if housesCount > 0 %}
|
{% if houses is not empty %}
|
||||||
<td width="40%"><b>Name</b></td>
|
<td width="40%"><b>Name</b></td>
|
||||||
<td width="10%"><b>Size</b></td>
|
<td width="10%"><b>Size</b></td>
|
||||||
<td width="10%"><b>Rent</b></td>
|
<td width="10%"><b>Rent</b></td>
|
||||||
|
|
||||||
<td width="40%"><b>Status</b></td>
|
<td width="40%"><b>Status</b></td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
{% else %}
|
{% elseif housesSearch %}
|
||||||
<td>No {{ houseType }} with specified criterias.</td>
|
<td>No {{ houseType }} with specified criterias.</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% set i = 0 %}
|
{% if houses is not empty %}
|
||||||
{% for house in houses %}
|
{% set i = 0 %}
|
||||||
{% set i = i + 1 %}
|
{% for house in houses %}
|
||||||
<tr bgcolor="{{ getStyle(i) }}">
|
{% set i = i + 1 %}
|
||||||
<td width="40%">
|
<tr bgcolor="{{ getStyle(i) }}">
|
||||||
{{ house.name }}
|
<td width="40%">
|
||||||
</td>
|
{{ house.name }}
|
||||||
|
</td>
|
||||||
|
|
||||||
<td width="10%">
|
<td width="10%">
|
||||||
{{ house.size }}
|
{{ house.size }}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td width="10%">
|
<td width="10%">
|
||||||
{{ house.rent }} golds
|
{{ house.rent }} golds
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td width="40%">
|
<td width="40%">
|
||||||
{{ house.rentedBy|raw }}
|
{{ house.rentedBy|raw }}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<form action="{{ getLink('houses/view') }}" method="post">
|
<form action="{{ getLink('houses/view') }}" method="post">
|
||||||
<input type="hidden" name="house" value="{{ house.name }}">
|
<input type="hidden" name="house" value="{{ house.name }}">
|
||||||
<button name="View" alt="View" class="btn btn-secondary" width="120" height="18">View</button>
|
<button name="View" alt="View" class="btn btn-secondary" width="120" height="18">View</button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<br>
|
<br>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user