unsale to class

This commit is contained in:
Igor Barkov [iwork] 2019-02-15 14:16:40 +02:00
parent 4ad04b9571
commit 5b20c5060b
2 changed files with 54 additions and 19 deletions

View File

@ -47,6 +47,14 @@ class ShopItem extends Item
$btnValue = "Продать";
$btnLink = "/shop.php?sell={$this->id}&rnd=" . mt_rand();
break;
case 'marketback':
$btnValue = "Снять товар с продажи";
$btnLink = "/?back={$this->id}&rnd=" . mt_rand();
break;
case 'marketshowmore':
$btnValue = "Развернуть";
$btnLink = "/?max={$this->name}&rnd=" . mt_rand();
break;
}
echo <<<BTN

View File

@ -102,6 +102,24 @@ if (($_GET['set'] OR $_POST['set'])) {
}
}
if ($get === 'unsale') {
$data = db::c()->query('SELECT `inventory`.*,
`magic`.`name` AS `magic_name`,
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img`,
0 AS `maxdur`
FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `setsale` > 0 AND `dressed` = 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']);
$iteminfo = [];
while ($row = $data->fetch_assoc()) {
$iteminfo[] = new ShopItem($row);
}
}
$shopCategoryTypeNumber = empty($_GET['otdel']) ?: $_GET['otdel'];
switch ($shopCategoryTypeNumber) {
default:
@ -231,20 +249,29 @@ switch ($shopCategoryTypeNumber) {
<?php
}
} elseif ($get === 'unsale') {
$data = db::c()->query('SELECT * FROM `inventory` WHERE `setsale` > 0 AND `dressed` = 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']);
while ($row = $data->fetch_assoc()) {
?>
<TR>
<TD align=center style="width:150px"><IMG SRC="i/sh/<?= $row['img'] ?>">
<BR><A HREF="?back=<?= $row['id'] ?>">забрать</A>
</TD>
<TD valign=top>
<?php showitem($row); ?>
</TD>
</TR>
<?php
foreach ($iteminfo as $ii) {
echo "<tr><td style='width: 150px; text-align: center;'>";
$ii->printImage();
$ii->printControls('marketback');
echo "</td>";
echo "<td style='vertical-align: top;'>";
$ii->printInfo();
echo "</td></tr>";
}
// while ($row = $data->fetch_assoc()) {
// ?>
<!-- <TR>-->
<!-- <TD align=center style="width:150px"><IMG SRC="i/sh/--><?//= $row['img'] ?><!--">-->
<!-- <BR><A HREF="?back=--><?//= $row['id'] ?><!--">забрать</A>-->
<!-- </TD>-->
<!-- <TD valign=top>-->
<!-- --><?php //showitem($row); ?>
<!-- </TD>-->
<!-- </TR>-->
<!-- --><?php
// }
} else {
$data = db::c()->query('SELECT DISTINCT `img`, `name`, `nalign`, `massa` FROM `inventory` WHERE `dressed` = 0 AND `setsale` > 0 AND `present` = "?s" AND `otdel` = "?s" GROUP BY `img` ORDER BY `cost` ASC', '', $_GET['otdel']);
$replacements = ['+1','+2','+3','+4','+5',' (мф)'];
@ -255,7 +282,7 @@ switch ($shopCategoryTypeNumber) {
<TR>
<TD align=center>
<IMG SRC="i/sh/<?= $row['img'] ?>" ALT="">
<BR><A HREF="?&max=<?= $item_name ?>">подробнее</A>
<BR><A HREF="?max=<?= $item_name ?>">подробнее</A>
</TD>
<TD valign=top>
<?= $item_name ?> <img src="i/align_<?= $row['nalign'] ?>.gif">