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

@ -20,11 +20,11 @@ class ShopItem extends Item
`bron1`,`bron2`,`bron3`,`bron4`,`maxu`,`minu`,`magic`,`nlevel`,`nalign`,`dategoden`,`goden`,`otdel`,
`artefact`, `koll`) VALUES (?i,?i,"?s",?i,?i,?i,"?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,
?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,"?s",?i,?i)
', $this->id, $owner, $this->name, $this->type, $this->massa, $this->cost, $this->img, $this->maxdur,$this->isrep,$this->gsila,$this->glovk,$this->ginta,$this->gintel,
$this->ghp,$this->gnoj,$this->gtopor,$this->gdubina,$this->gmech,$this->gfire,$this->gwater,$this->gair,$this->gearth,$this->glight,$this->ggray,$this->gdark,
$this->needident,$this->nsila,$this->nlovk,$this->ninta,$this->nintel,$this->nmudra,$this->nvinos, $this->nnoj,$this->ntopor,$this->ndubina,$this->nmech,
$this->nfire,$this->nwater,$this->nair, $this->nearth,$this->nlight,$this->ngray,$this->ndark,$this->mfkrit,$this->mfakrit,$this->mfuvorot,$this->mfauvorot,
$this->bron1,$this->bron2,$this->bron3,$this->bron4,$this->maxu,$this->minu,$this->magic,$this->nlevel,$this->nalign,$this->dategoden,$this->goden,$this->razdel,
', $this->id, $owner, $this->name, $this->type, $this->massa, $this->cost, $this->img, $this->maxdur, $this->isrep, $this->gsila, $this->glovk, $this->ginta, $this->gintel,
$this->ghp, $this->gnoj, $this->gtopor, $this->gdubina, $this->gmech, $this->gfire, $this->gwater, $this->gair, $this->gearth, $this->glight, $this->ggray, $this->gdark,
$this->needident, $this->nsila, $this->nlovk, $this->ninta, $this->nintel, $this->nmudra, $this->nvinos, $this->nnoj, $this->ntopor, $this->ndubina, $this->nmech,
$this->nfire, $this->nwater, $this->nair, $this->nearth, $this->nlight, $this->ngray, $this->ndark, $this->mfkrit, $this->mfakrit, $this->mfuvorot, $this->mfauvorot,
$this->bron1, $this->bron2, $this->bron3, $this->bron4, $this->maxu, $this->minu, $this->magic, $this->nlevel, $this->nalign, $this->dategoden, $this->goden, $this->razdel,
$this->artefact, $this->koll);
}
}
@ -45,7 +45,15 @@ class ShopItem extends Item
break;
case 'sell':
$btnValue = "Продать";
$btnLink = "/shop.php?sell={$this->id}&rnd=".mt_rand();
$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;
}

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">