moving to imgclass

This commit is contained in:
Igor Barkov [iwork] 2019-01-16 18:26:16 +02:00
parent cb29429a2a
commit 813a741b2a
2 changed files with 20 additions and 11 deletions

View File

@ -43,4 +43,9 @@ NAME;
onclick="location='/admin.php'"> onclick="location='/admin.php'">
BTN; BTN;
} }
public function getId()
{
return $this->id;
}
} }

View File

@ -32,7 +32,7 @@ if ($_SESSION['receiverName']) {
} else { } else {
$receiverId = $receiver['id']; $receiverId = $receiver['id'];
$submit = filter_input(INPUT_POST, 'action'); $submit = filter_input(INPUT_POST, 'action');
$sendItemId = filter_input(INPUT_POST,'item_id'); $sendItemId = filter_input(INPUT_POST, 'item_id');
$telegraphText = filter_input(INPUT_POST, 'message'); $telegraphText = filter_input(INPUT_POST, 'message');
if ($submit == 'sendMessage' && $telegraphText && $user['money'] >= 1) { if ($submit == 'sendMessage' && $telegraphText && $user['money'] >= 1) {
@ -52,8 +52,8 @@ if ($_SESSION['receiverName']) {
db::c()->query('UPDATE `users` SET `money` = `money` - 1 WHERE id=?i', $user['id']); db::c()->query('UPDATE `users` SET `money` = `money` - 1 WHERE id=?i', $user['id']);
db::c()->query('UPDATE `inventory` SET `owner` = ?i WHERE `id`= ?i AND `owner`= ?i', $receiverId, $sendItemId, $_SESSION['uid']); db::c()->query('UPDATE `inventory` SET `owner` = ?i WHERE `id`= ?i AND `owner`= ?i', $receiverId, $sendItemId, $_SESSION['uid']);
//TODO: Добавить логи и статистику. //TODO: Добавить логи и статистику.
$statusMessage = 'Предмет "' . $res['name'] . '" передан персонажу ' . $receiverId; $statusMessage = 'Предмет "' . $res['name'] . '" передан персонажу ' . $receiverId;
db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, 'Почтовый перевод: '. $res['name'] .' от персонажа ' .$user['login']. '.'); db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, 'Почтовый перевод: ' . $res['name'] . ' от персонажа ' . $user['login'] . '.');
} }
} }
$queryItems = db::c()->query('SELECT `inventory`.*, $queryItems = db::c()->query('SELECT `inventory`.*,
@ -64,6 +64,10 @@ if ($_SESSION['receiverName']) {
`magic`.`targeted` AS `magic_targeted`, `magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`, `magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0 AND `present` = "?s" AND `artefact` = 0 ORDER BY `update` DESC', $_SESSION['uid'], null); `magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0 AND `present` = "?s" AND `artefact` = 0 ORDER BY `update` DESC', $_SESSION['uid'], null);
$iteminfo = [];
while ($row = $queryItems->fetch_assoc()) {
$iteminfo[] = new InventoryItem($row);
}
} }
} }
?> ?>
@ -107,22 +111,22 @@ if ($_SESSION['receiverName']) {
<td valign=top align=right> <td valign=top align=right>
<table class="zebra" WIDTH=100%"> <table class="zebra" WIDTH=100%">
<th colspan="2">Передача предметов</th> <th colspan="2">Передача предметов</th>
<?php while ($row = $queryItems->fetch_assoc()): ?> <?php foreach ($iteminfo as $ii): ?>
<tr> <tr>
<td align=center> <td bgcolor='#d3d3d3'>
<img src="i/sh/<?= $row['img'] ?>"><br> <?php $ii->printImage(); ?>
<form method="post"> <form method="post">
<input type="hidden" name="action" value="sendItem"> <input type="hidden" name="action" value="sendItem">
<input type="hidden" name="item_id" value="<?= $row['id'] ?>"> <input type="hidden" name="item_id" value="<?= $ii->getId() ?>">
<input type="submit" value="Передать за 1кр."> <input type="submit" value="Передать за 1кр.">
</form> </form>
</td> </td>
<td valign=top> <td bgcolor='#d3d3d3'>
<?php showitem($row, '','',true); ?> <?php $ii->printInfo(); ?>
</td> </td>
</tr> </tr>
<?php endwhile ?> <?php endforeach; ?>
<?php if ($queryItems->getNumRows() == 0): ?> <?php if (empty($queryItems->getNumRows())): ?>
<tr> <tr>
<td align=center bgcolor=#C7C7C7>Нечего передавать...</td> <td align=center bgcolor=#C7C7C7>Нечего передавать...</td>
</tr> </tr>