mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Houses page to twig
This commit is contained in:
parent
24319ddc7a
commit
35e4cd4596
@ -123,7 +123,8 @@ else {
|
||||
'/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'),
|
||||
'/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'),
|
||||
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'),
|
||||
'/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2')
|
||||
'/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2'),
|
||||
'/^houses\/view\/?$/' => array('subtopic' => 'houses', 'page' => 'view')
|
||||
);
|
||||
|
||||
foreach($rules as $rule => $redirect) {
|
||||
|
@ -5,309 +5,188 @@
|
||||
* @package MyAAC
|
||||
* @author Gesior <jerzyskalski@wp.pl>
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @author whiteblXK
|
||||
* @copyright 2019 MyAAC
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Houses';
|
||||
|
||||
$errors = array();
|
||||
if(!$db->hasColumn('houses', 'name')) {
|
||||
echo 'Houses list is not available on this server.';
|
||||
$errors[] = 'Houses list is not available on this server.';
|
||||
|
||||
$twig->display('houses.html.twig', array(
|
||||
'errors' => $errors
|
||||
));
|
||||
return;
|
||||
}
|
||||
$rent = trim(strtolower($config['lua']['houseRentPeriod']));
|
||||
if($rent != 'yearly' && $rent != 'monthly' && $rent != 'weekly' && $rent != 'daily')
|
||||
$rent = 'never';
|
||||
|
||||
$rentType = trim(strtolower($config['lua']['houseRentPeriod']));
|
||||
if($rentType != 'yearly' && $rentType != 'monthly' && $rentType != 'weekly' && $rentType != 'daily')
|
||||
$rentType = 'never';
|
||||
|
||||
$state = '';
|
||||
$order = '';
|
||||
$type = '';
|
||||
?>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
|
||||
<td>
|
||||
<?php
|
||||
if(isset($_GET['page']) && $_GET['page'] == 'view' && isset($_REQUEST['house']))
|
||||
{
|
||||
$beds = array("", "one", "two", "three", "fourth", "fifth");
|
||||
$houseName = $_REQUEST['house'];
|
||||
$houseId = (Validator::number($_REQUEST['house']) ? $_REQUEST['house'] : -1);
|
||||
$house = $db->query('SELECT * FROM ' . $db->tableName('houses') . ' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($houseName) . ' OR `id` = ' . $db->quote($houseId));
|
||||
|
||||
if($house->rowCount() > 0)
|
||||
{
|
||||
$house = $house->fetch();
|
||||
$houseId = $house['id'];
|
||||
if(isset($_GET['page']) && $_GET['page'] == 'view' && isset($_REQUEST['house']))
|
||||
{
|
||||
$beds = array("", "one", "two", "three", "fourth", "fifth");
|
||||
$houseName = $_REQUEST['house'];
|
||||
$houseId = (Validator::number($_REQUEST['house']) ? $_REQUEST['house'] : -1);
|
||||
$selectHouse = $db->query('SELECT * FROM ' . $db->tableName('houses') . ' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($houseName) . ' OR `id` = ' . $db->quote($houseId));
|
||||
|
||||
$title = $house['name'] . ' - ' . $title;
|
||||
echo '
|
||||
<table border="0" cellspacing="1" cellpadding="4">
|
||||
<tr><td valign="top">';
|
||||
$img_path = 'images/houses/' . $houseId . '.gif';
|
||||
if(file_exists($img_path))
|
||||
echo '<img src="' . $img_path . '">';
|
||||
else
|
||||
echo '<img src="images/houses/default.jpg">';
|
||||
$house = array();
|
||||
if($selectHouse->rowCount() > 0)
|
||||
{
|
||||
$house = $selectHouse->fetch();
|
||||
$houseId = $house['id'];
|
||||
|
||||
echo '
|
||||
</td>
|
||||
<td valign="top"><B>' . $house['name'] . '</b><br>This house ';
|
||||
$houseBeds = $house['beds'];
|
||||
if($houseBeds > 0)
|
||||
echo 'has ' . (isset($beds[$houseBeds]) ? $beds[$houseBeds] : $houseBeds) . ' bed' . ($houseBeds > 1 ? 's' : '');
|
||||
else
|
||||
echo 'dont have any beds';
|
||||
$title = $house['name'] . ' - ' . $title;
|
||||
|
||||
echo '.<br/><br/>The house has a size of <b>' . $house['size'] . ' square meters</b>.';
|
||||
$imgPath = 'images/houses/' . $houseId . '.gif';
|
||||
if(!file_exists($imgPath)) {
|
||||
$imgPath = 'images/houses/default.jpg';
|
||||
}
|
||||
|
||||
if($rent != 'never')
|
||||
echo ' The ' . $rent . ' rent is <b>' . $house['rent'] . ' gold</b> and will be debited to the bank account on <b>' . $config['lua']['serverName'] . '</b>.';
|
||||
$bedsMessage = null;
|
||||
$houseBeds = $house['beds'];
|
||||
if($houseBeds > 0)
|
||||
$bedsMessage = 'House have ' . (isset($beds[$houseBeds]) ? $beds[$houseBeds] : $houseBeds) . ' bed' . ($houseBeds > 1 ? 's' : '');
|
||||
else
|
||||
$bedsMessage = 'This house dont have any beds';
|
||||
|
||||
$houseOwner = $house['owner'];
|
||||
if($houseOwner > 0)
|
||||
{
|
||||
$guild = NULL;
|
||||
echo '<br/><br/>The house has been rented by ';
|
||||
if(isset($house['guild']) && $house['guild'] == 1)
|
||||
{
|
||||
$guild = new OTS_Guild();
|
||||
$guild->load($houseOwner);
|
||||
echo getGuildLink($guild->getName());
|
||||
}
|
||||
else
|
||||
echo getCreatureName($houseOwner);
|
||||
$houseOwner = $house['owner'];
|
||||
if($houseOwner > 0)
|
||||
{
|
||||
$guild = NULL;
|
||||
$owner = null;
|
||||
if(isset($house['guild']) && $house['guild'] == 1)
|
||||
{
|
||||
$guild = new OTS_Guild();
|
||||
$guild->load($houseOwner);
|
||||
$owner = getGuildLink($guild->getName());
|
||||
}
|
||||
else
|
||||
$owner = getCreatureName($houseOwner);
|
||||
|
||||
echo '.';
|
||||
if($rentType != 'never' && $house['paid'] > 0)
|
||||
{
|
||||
$who = '';
|
||||
if($guild)
|
||||
$who = $guild->getName();
|
||||
else
|
||||
{
|
||||
$player = new OTS_Player();
|
||||
$player->load($houseOwner);
|
||||
if($player->isLoaded())
|
||||
{
|
||||
$sexs = array('She', 'He');
|
||||
$who = $sexs[$player->getSex()];
|
||||
}
|
||||
}
|
||||
$owner .= ' ' . $who . ' has paid the rent until ' . date("M d Y, H:i:s", $house['paid']) . ' CEST.';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
$errors[] = 'House with name ' . $houseName . ' does not exists.';
|
||||
|
||||
if($rent != 'never' && $house['paid'] > 0)
|
||||
{
|
||||
$who = '';
|
||||
if($guild)
|
||||
$who = $guild->getName();
|
||||
else
|
||||
{
|
||||
$player = new OTS_Player();
|
||||
$player->load($houseOwner);
|
||||
if($player->isLoaded())
|
||||
{
|
||||
$sexs = array('She', 'He');
|
||||
$who = $sexs[$player->getSex()];
|
||||
}
|
||||
}
|
||||
echo ' ' . $who . ' has paid the rent until <b>' . date("M d Y, H:i:s", $house['paid']) . ' CEST</b>.';
|
||||
}
|
||||
}
|
||||
$twig->display('houses.view.html.twig', array(
|
||||
'errors' => $errors,
|
||||
'imgPath' => isset($imgPath) ? $imgPath : null,
|
||||
'houseName' => isset($house['name']) ? $house['name'] : null,
|
||||
'bedsMessage' => isset($bedsMessage) ? $bedsMessage : null,
|
||||
'houseSize' => isset($house['size']) ? $house['size'] : null,
|
||||
'houseRent' => isset($house['rent']) ? $house['rent'] : null,
|
||||
'owner' => isset($owner) ? $owner : null,
|
||||
'rentType' => isset($rentType) ? $rentType : null
|
||||
));
|
||||
|
||||
echo '</TD></TR></TABLE>';
|
||||
}
|
||||
else
|
||||
echo 'House with name ' . $houseName . ' does not exists.';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '
|
||||
Here you can see the list of all available houses, flats' . ($db->hasTable('houses', 'guild') ? ' or guildhall' : '') . '.
|
||||
Click on any view button to get more information about a house or adjust
|
||||
the search criteria and start a new search.<br/><br/>';
|
||||
if(isset($config['lua']['houseCleanOld'])) {
|
||||
$cleanOld = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60));
|
||||
if($cleanOld > 0 || $rent != 'never')
|
||||
{
|
||||
echo '<b>Every morning during global server save there is automatic house cleaning. Server delete house owners who have not logged in last ' . $cleanOld . ' days';
|
||||
if($rent != 'never')
|
||||
{
|
||||
echo ' or have not paid ' . $rent . ' house rent. Remember to leave money for a rent in ';
|
||||
$bank = getBoolean($config['lua']['bankSystem']);
|
||||
if($bank)
|
||||
echo 'your house bank account or ';
|
||||
if (count($errors) > 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
echo 'depo in same city where you have house!';
|
||||
}
|
||||
else
|
||||
echo '.';
|
||||
$cleanOldHouse = null;
|
||||
if(isset($config['lua']['houseCleanOld'])) {
|
||||
$cleanOldHouse = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60));
|
||||
}
|
||||
|
||||
echo '</b><br/><br/>';
|
||||
}
|
||||
}
|
||||
if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) && (isset($_POST['type']) || !$db->hasColumn('houses', 'guild')))
|
||||
{
|
||||
$townName = $config['towns'][$_POST['town']];
|
||||
$order = $_POST['order'];
|
||||
$orderby = '`name`';
|
||||
if(!empty($order))
|
||||
{
|
||||
if($order == 'size')
|
||||
$orderby = '`size`';
|
||||
else if($order == 'rent')
|
||||
$orderby = '`rent`';
|
||||
}
|
||||
|
||||
echo '<br/>';
|
||||
$town = 'town';
|
||||
if($db->hasColumn('houses', 'town_id'))
|
||||
$town = 'town_id';
|
||||
else if($db->hasColumn('houses', 'townid'))
|
||||
$town = 'townid';
|
||||
|
||||
if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order'])
|
||||
&& (isset($_POST['type']) || !$db->hasColumn('houses', 'guild')))
|
||||
{
|
||||
$order = $_POST['order'];
|
||||
$orderby = '`name`';
|
||||
if(!empty($order))
|
||||
{
|
||||
if($order == 'size')
|
||||
$orderby = '`size`';
|
||||
else if($order == 'rent')
|
||||
$orderby = '`rent`';
|
||||
}
|
||||
$whereby = '`' . $town . '` = ' .(int)$_POST['town'];
|
||||
$state = $_POST['state'];
|
||||
if(!empty($state))
|
||||
$whereby .= ' AND `owner` ' . ($state == 'free' ? '' : '!'). '= 0';
|
||||
|
||||
$town = 'town';
|
||||
if($db->hasColumn('houses', 'town_id'))
|
||||
$town = 'town_id';
|
||||
else if($db->hasColumn('houses', 'townid'))
|
||||
$town = 'townid';
|
||||
|
||||
$whereby = '`' . $town . '` = ' .(int)$_POST['town'];
|
||||
$state = $_POST['state'];
|
||||
if(!empty($state))
|
||||
$whereby .= ' AND `owner` ' . ($state == 'free' ? '' : '!'). '= 0';
|
||||
$type = isset($_POST['type']) ? $_POST['type'] : NULL;
|
||||
if($type == 'guildhalls' && !$db->hasColumn('houses', 'guild'))
|
||||
$type = 'all';
|
||||
|
||||
$type = isset($_POST['type']) ? $_POST['type'] : NULL;
|
||||
if($type == 'guildhalls' && !$db->hasColumn('houses', 'guild'))
|
||||
$type = 'all';
|
||||
if(!empty($type) && $type != 'all')
|
||||
$whereby .= ' AND `guild` ' . ($type == 'guildhalls' ? '!' : '') . '= 0';
|
||||
|
||||
if(!empty($type) && $type != 'all')
|
||||
$whereby .= ' AND `guild` ' . ($type == 'guildhalls' ? '!' : '') . '= 0';
|
||||
$houses_info = $db->query('SELECT * FROM `houses` WHERE ' . $whereby. ' ORDER BY ' . $orderby);
|
||||
$houses_count = $houses_info->rowCount();
|
||||
|
||||
$houses_info = $db->query('SELECT * FROM `houses` WHERE ' . $whereby. ' ORDER BY ' . $orderby);
|
||||
$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();
|
||||
foreach($players_info->fetchAll() as $player)
|
||||
$players[$player['houseid']] = array('name' => $player['ownername']);
|
||||
|
||||
echo '
|
||||
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
|
||||
<TR BGCOLOR='.$config['vdarkborder'].'>
|
||||
<TD COLSPAN=6 class="white"><B>Available ' . ($type == 'guildhalls' ? 'Guildhalls' : 'Houses and Flats').' in '.$config['towns'][$_POST['town']].' on <b>'.$config['lua']['serverName'].'</b></B></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR='.$config['darkborder'].'>';
|
||||
if($houses_info->rowCount() > 0)
|
||||
{
|
||||
echo '
|
||||
<TD WIDTH=40%><B>Name</B></TD>
|
||||
<TD WIDTH=10%><B>Size</B></TD>
|
||||
<TD WIDTH=10%><B>Rent</B></TD>
|
||||
$houses = array();
|
||||
foreach($houses_info->fetchAll() as $house)
|
||||
{
|
||||
$owner = isset($players[$house['id']]) ? $players[$house['id']] : array();
|
||||
|
||||
<TD WIDTH=40%><B>Status</B></TD>
|
||||
<TD> </TD>';
|
||||
}
|
||||
else
|
||||
echo '<TD>No ' . ($type == 'guildhalls' ? 'guildhalls' : 'houses') . ' with specified criterias.</TD>';
|
||||
$houseRent = null;
|
||||
if($db->hasColumn('houses', 'guild') && $house['guild'] == 1 && $house['owner'] != 0)
|
||||
{
|
||||
$guild = new OTS_Guild();
|
||||
$guild->load($house['owner']);
|
||||
$houseRent = 'Rented by ' . getGuildLink($guild->getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!empty($owner['name']))
|
||||
$houseRent = 'Rented by ' . getPlayerLink($owner['name']);
|
||||
else
|
||||
$houseRent = 'Free';
|
||||
}
|
||||
|
||||
echo '</TR>';
|
||||
$houses[] = array('owner' => $owner, 'name' => $house['name'], 'size' => $house['size'], 'rent' => $house['rent'], 'rentedBy' => $houseRent);
|
||||
}
|
||||
}
|
||||
|
||||
$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();
|
||||
foreach($players_info->fetchAll() as $player)
|
||||
$players[$player['houseid']] = array('name' => $player['ownername']);
|
||||
|
||||
$rows = 1;
|
||||
foreach($houses_info->fetchAll() as $house)
|
||||
{
|
||||
$owner = isset($players[$house['id']]) ? $players[$house['id']] : array();
|
||||
echo
|
||||
'<TR BGCOLOR="'.getStyle($rows).'">
|
||||
<TD WIDTH="40%"><NOBR>'.$house['name'].'</TD>
|
||||
<TD WIDTH="10%"><NOBR>'.$house['size'].' sqm</TD>
|
||||
<TD WIDTH="10%"><NOBR>'.$house['rent'].' gold</TD>
|
||||
<TD WIDTH="40%"><NOBR>';
|
||||
if($db->hasColumn('houses', 'guild') && $house['guild'] == 1 && $house['owner'] != 0)
|
||||
{
|
||||
$guild = new OTS_Guild();
|
||||
$guild->load($house['owner']);
|
||||
echo 'Rented by ' . getGuildLink($guild->getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!empty($owner['name']))
|
||||
echo 'Rented by ' . getPlayerLink($owner['name']);
|
||||
else
|
||||
echo
|
||||
'Free';
|
||||
}
|
||||
|
||||
echo '
|
||||
</TD>
|
||||
<TD>
|
||||
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
|
||||
<FORM ACTION=?subtopic=houses&page=view METHOD=post>
|
||||
<TR><TD>
|
||||
<INPUT TYPE=hidden NAME=house VALUE="'.$house['name'].'">
|
||||
<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>';
|
||||
$rows++;
|
||||
}
|
||||
echo
|
||||
'</TABLE>'.
|
||||
'<br/><br/>';
|
||||
}
|
||||
|
||||
echo '
|
||||
<form method="post">
|
||||
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
|
||||
<TR BGCOLOR=' . $config['vdarkborder'] . '>
|
||||
<TD COLSPAN=4 class="white"><B>House Search</B></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR=' . $config['darkborder'] . '>
|
||||
<TD WIDTH=25%><B>Town</B></TD>
|
||||
<TD WIDTH=25%><B>Status</B></TD>
|
||||
<TD WIDTH=25%><B>Order</B></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR=' . $config['darkborder'] . '>
|
||||
<TD VALIGN=top ROWSPAN=2>';
|
||||
$townId = isset($_POST['town']) ? $_POST['town'] : '';
|
||||
$i = 0;
|
||||
$checked = false;
|
||||
foreach($config['towns'] as $id => $name)
|
||||
{
|
||||
if($id == 0)
|
||||
continue;
|
||||
|
||||
$i++;
|
||||
if(((empty($townId) && !empty($name)) || $id == $townId) && !$checked)
|
||||
{
|
||||
$add = 'CHECKED';
|
||||
$checked = true;
|
||||
}
|
||||
else
|
||||
$add = '';
|
||||
|
||||
if(!empty($name))
|
||||
echo '<INPUT TYPE=radio NAME="town" id="town_' . $id . '" VALUE="'.$id.'" '.$add.'><label for="town_' . $id . '"> '.$name.'</label><BR>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</TD>
|
||||
<TD VALIGN=top>
|
||||
<INPUT TYPE=radio NAME="state" id="state_all" VALUE="" '.(empty($state) ? 'CHECKED' : '').'><label for="state_all"> all states</label><br/>
|
||||
<INPUT TYPE=radio NAME="state" id="state_free" VALUE="free" '.($state == 'free' ? 'CHECKED' : '').'><label for="state_free"> free</label><br/>
|
||||
<INPUT TYPE=radio NAME="state" id="state_rented" VALUE="rented" '.($state == 'rented' ? 'CHECKED' : '').'><label for="state_rented"> rented</label><br/>
|
||||
</TD>
|
||||
<TD VALIGN=top ROWSPAN=2>
|
||||
<INPUT TYPE=radio NAME="order" id="order_name" VALUE="" '.(empty($order) ? 'CHECKED' : '').'><label for="order_name"> by name</label><br/>
|
||||
<INPUT TYPE=radio NAME="order" id="order_size" VALUE="size" '.($order == 'size' ? 'CHECKED' : '').'><label for="order_size"> by size</label><br/>
|
||||
<INPUT TYPE=radio NAME="order" id="order_rent" VALUE="rent" '.($order == 'rent' ? 'CHECKED' : '').'><label for="order_rent"> by rent</label><br/>
|
||||
</TD>
|
||||
</TR>';
|
||||
|
||||
if($db->hasColumn('houses', 'guild')) {
|
||||
echo '
|
||||
<TR BGCOLOR='.$config['darkborder'].'>
|
||||
<TD VALIGN=top>
|
||||
<INPUT TYPE=radio NAME="type" VALUE="" '.(empty($type) ? 'CHECKED' : '').'> all<BR>
|
||||
<INPUT TYPE=radio NAME="type" VALUE="houses" '.($type == 'houses' ? 'CHECKED' : '').'> houses and flats<BR>
|
||||
<INPUT TYPE=radio NAME="type" VALUE="guildhalls" '.($type == 'guildhalls' ? 'CHECKED' : '').'> guildhalls<BR>
|
||||
</TD>
|
||||
</TR>';
|
||||
}
|
||||
echo '
|
||||
</TABLE>
|
||||
<BR>
|
||||
<CENTER>
|
||||
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD>
|
||||
' . $twig->render('buttons.submit.html.twig') . '
|
||||
</TD></TR></FORM></TABLE>
|
||||
</CENTER>';
|
||||
}
|
||||
echo '
|
||||
</TD>
|
||||
<TD><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
';
|
||||
?>
|
||||
$guild = $db->hasTable('houses', 'guild') ? ' or guildhall' : '';
|
||||
$twig->display('houses.html.twig', array(
|
||||
'state' => $state,
|
||||
'order' => $order,
|
||||
'type' => $type,
|
||||
'houseType' => $type == 'guildhalls' ? 'Guildhalls' : 'Houses and Flats',
|
||||
'townName' => isset($townName) ? $townName : null,
|
||||
'townId' => isset($_POST['town']) ? $_POST['town'] : null,
|
||||
'guild' => $guild,
|
||||
'cleanOldHouse' => isset($cleanOld) ? $cleanOld : null,
|
||||
'housesCount' => isset($houses_count) ? $houses_count : null,
|
||||
'houses' => isset($houses) ? $houses : null
|
||||
));
|
166
system/templates/houses.html.twig
Normal file
166
system/templates/houses.html.twig
Normal file
@ -0,0 +1,166 @@
|
||||
<div class="TableContainer">
|
||||
{% if errors is not empty %}
|
||||
{% for error in errors %}
|
||||
<p class="error">{{ error }}</p>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<table class="Table1" cellpadding="0" cellspacing="0" style="background-color: {{ config.lightborder }}">
|
||||
<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" >House Search</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>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div class="InnerTableContainer">
|
||||
Here you can see the list of all available houses, flats{{ guildString }}.
|
||||
Click on any view button to get more information about a house or adjust
|
||||
the search criteria and start a new search.
|
||||
<br><br>
|
||||
{% if cleanOldHouse is not empty or rentType != 'never' %}
|
||||
Every morning during global server save there is automatic house cleaning. Server delete house owners who have not logged in last {{ cleanOldHouse }} days{% if rentType != 'never' %} or have not paid {{ rentType }} house rent. Remember to leave money for a rent in {% if config.lua.bankSystem is not empty %}your house bank or {% else %}depo in same city where you have house!{% endif %}{% else %}.{% endif %}
|
||||
<br><br>
|
||||
{% endif %}
|
||||
|
||||
{% if houses is not empty %}
|
||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
||||
<tbody>
|
||||
<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>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="{{ config.darkborder }}">
|
||||
{% if housesCount > 0 %}
|
||||
<td width="40%"><b>Name</b></td>
|
||||
<td width="10%"><b>Size</b></td>
|
||||
<td width="10%"><b>Rent</b></td>
|
||||
|
||||
<td width="40%"><b>Status</b></td>
|
||||
<td> </td>
|
||||
{% else %}
|
||||
<td>No {{ houseType }} with specified criterias.</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
|
||||
{% set i = 0 %}
|
||||
{% for house in houses %}
|
||||
{% set i = i + 1 %}
|
||||
<tr bgcolor="{{ getStyle(i) }}">
|
||||
<td width="40%">
|
||||
{{ house.name }}
|
||||
</td>
|
||||
|
||||
<td width="10%">
|
||||
{{ house.size }}
|
||||
</td>
|
||||
|
||||
<td width="10%">
|
||||
{{ house.rent }} golds
|
||||
</td>
|
||||
|
||||
<td width="40%">
|
||||
{{ house.rentedBy|raw }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<form action="{{ getLink('houses/view') }}" method="post">
|
||||
<input type="hidden" name="house" value="{{ house.name }}">
|
||||
<button name="View" alt="View" class="btn btn-secondary" width="120" height="18">View</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
<form action="{{ getLink('houses') }}" method="post">
|
||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
||||
<tbody>
|
||||
<tr bgcolor="{{ config.vdarkborder }}">
|
||||
<td colspan="4" class="white"><b>House Search</b></td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="{{ config.darkborder }}">
|
||||
<td width="25%"><b>Town</b></td>
|
||||
<td width="25%"><b>Status</b></td>
|
||||
<td width="25%"><b>Order</b></td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="{{ config.darkborder }}">
|
||||
<td valign="top" rowspan="2">
|
||||
{% set checked = false %}
|
||||
{% for id, name in config.towns if id > 0 %}
|
||||
{% if ((townId is empty and name is not empty) or id == townId) and not checked %}
|
||||
{% set variable = "checked" %}
|
||||
{% set checked = true %}
|
||||
{% else %}
|
||||
{% set variable = "" %}
|
||||
{% endif %}
|
||||
|
||||
<input type="radio" name="town" id="town_{{ id }}" value="{{ id }}"{% if variable is defined %} {{ variable }}{% endif %}>
|
||||
<label for="town_{{ id }}"> {{ name }}</label>
|
||||
<br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
||||
<td valign="top">
|
||||
<input type="radio" name="state" id="state_all" value=""{% if state is empty %} checked{% endif %}>
|
||||
<label for="state_all">all states</label><br>
|
||||
|
||||
<input type="radio" name="state" id="state_free" value="free"{% if state == 'free' %} checked{% endif %}>
|
||||
<label for="state_free">free</label><br>
|
||||
|
||||
<input type="radio" name="state" id="state_rented" value="rented"{% if state == 'rented' %} checked{% endif %}>
|
||||
<label for="state_rented">rented</label><br>
|
||||
</td>
|
||||
|
||||
<td valign="top" rowspan="2">
|
||||
<input type="radio" name="order" id="order_name" value=""{% if order is empty %} checked{% endif %}>
|
||||
<label for="order_name"> by name</label><br>
|
||||
|
||||
<input type="radio" name="order" id="order_size" value="size"{% if order == 'size' %} checked{% endif %}>
|
||||
<label for="order_size"> by size</label><br>
|
||||
|
||||
<input type="radio" name="order" id="order_rent" value="rent"{% if order == 'rent' %} checked{% endif %}>
|
||||
<label for="order_rent"> by rent</label><br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="{{ config.darkborder }}">
|
||||
<td valign="top">
|
||||
<input type="radio" name="type" value=""{% if type is empty %} checked{% endif %}> all<br>
|
||||
<input type="radio" name="type" value="houses"{% if type == 'houses' %} checked{% endif %}> houses and flats<br>
|
||||
<input type="radio" name="type" value="guildhalls"{% if type == 'guildhalls' %} checked{% endif %}> guildhalls<br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tbody>
|
||||
<tr align="center">
|
||||
<td>
|
||||
{{ include('buttons.submit.html.twig') }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
51
system/templates/houses.view.html.twig
Normal file
51
system/templates/houses.view.html.twig
Normal file
@ -0,0 +1,51 @@
|
||||
<div class="TableContainer">
|
||||
{% if errors is not empty %}
|
||||
{% for error in errors %}
|
||||
<p class="error">{{ error }}</p>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<table class="Table1" cellpadding="0" cellspacing="0" style="background-color: {{ config.lightborder }}">
|
||||
<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" >{{ houseName }}</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>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div class="InnerTableContainer">
|
||||
<table border="0" cellpadding="4" cellspacing="1" width="100%">
|
||||
<tr style="display: inline-flex;">
|
||||
<td><img src="{{ imgPath }}"></td>
|
||||
<td>
|
||||
{{ bedsMessage }} and has a size of <b>{{ houseSize }} square meters</b>.
|
||||
|
||||
{% if rentType != 'never' %}
|
||||
The {{ rentType }} is <b>{{ houseRent }} gold</b> and will be debited to the bank account on <b>{{ config.lua.serverName }}</b>.
|
||||
{% endif %}
|
||||
<br>
|
||||
|
||||
{% if owner is not empty %}
|
||||
The house has been rented by <b>{{ owner|raw }}</b>.
|
||||
{% else %}
|
||||
No one has bought this house yet.
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
<br><br>
|
Loading…
x
Reference in New Issue
Block a user