From d594fa1a5489f1d184d527e48f63fbb68dba78d7 Mon Sep 17 00:00:00 2001 From: whiteblXK Date: Fri, 3 May 2019 12:47:28 +0200 Subject: [PATCH] Now it will properly shows Available Houses --- system/pages/houses.php | 6 ++-- system/templates/houses.html.twig | 58 ++++++++++++++++--------------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/system/pages/houses.php b/system/pages/houses.php index 32e318a0..5c596059 100644 --- a/system/pages/houses.php +++ b/system/pages/houses.php @@ -114,6 +114,7 @@ if(isset($config['lua']['houseCleanOld'])) { $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'))) { $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'; $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 = 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); } + + $housesSearch = true; } $guild = $db->hasTable('houses', 'guild') ? ' or guildhall' : ''; @@ -187,6 +189,6 @@ $twig->display('houses.html.twig', array( 'townId' => isset($_POST['town']) ? $_POST['town'] : null, 'guild' => $guild, 'cleanOldHouse' => isset($cleanOld) ? $cleanOld : null, - 'housesCount' => isset($houses_count) ? $houses_count : null, + 'housesSearch' => $housesSearch, 'houses' => isset($houses) ? $houses : null )); \ No newline at end of file diff --git a/system/templates/houses.html.twig b/system/templates/houses.html.twig index 16a8ce71..a87bf98a 100644 --- a/system/templates/houses.html.twig +++ b/system/templates/houses.html.twig @@ -31,54 +31,56 @@

{% endif %} - {% if houses is not empty %} + {% if houses is not empty or housesSearch %} - + - {% if housesCount > 0 %} + {% if houses is not empty %} - {% else %} + {% elseif housesSearch %} {% endif %} - {% set i = 0 %} - {% for house in houses %} - {% set i = i + 1 %} - - + {% if houses is not empty %} + {% set i = 0 %} + {% for house in houses %} + {% set i = i + 1 %} + + - + - + - + - - - {% endfor %} + + + {% endfor %} + {% endif %}
Available {{ houseType }} {% if townName is not empty %}in {{ townName }}{% endif %}on {{ config.lua.serverName }}Available {{ houseType }}{% if townName is not empty %} in {{ townName }}{% endif %} on {{ config.lua.serverName }}
Name Size Rent Status  No {{ houseType }} with specified criterias.
- {{ house.name }} -
+ {{ house.name }} + - {{ house.size }} - + {{ house.size }} + - {{ house.rent }} golds - + {{ house.rent }} golds + - {{ house.rentedBy|raw }} - + {{ house.rentedBy|raw }} + -
- - -
-
+
+ + +
+