main inventory shown as class, not function

This commit is contained in:
Igor Barkov [iwork] 2019-02-12 20:31:23 +02:00
parent 78c76eb9e7
commit 4bd6ed58a0
4 changed files with 72 additions and 14 deletions

View File

@ -34,7 +34,7 @@ NAME;
}
/**
* Для кнопок управления под картинкой прелмета в зависимости от ситуации.
* Для кнопок управления под картинкой предмета в зависимости от ситуации.
*/
public function printControls()
{

View File

@ -973,8 +973,8 @@ if ($_POST['docompare']) {
букет</A>
</TD>
<?php
echo "<TD valign=top>";
showitem($row);
echo "<TD valign=top> Тут был showitem($row);";
echo "</TD></TR>";
}
}
@ -986,8 +986,8 @@ if ($_POST['docompare']) {
<BR><A HREF="fshop.php?otdel=<?= $_GET['otdel'] ?>&set=<?= $row['id'] ?>&sid=">купить</A>
</TD>
<?php
echo "<TD valign=top>";
showitem($row);
echo "<TD valign=top> Тут был showitem($row);";
echo "</TD></TR>";
}
}

View File

@ -154,7 +154,7 @@ if ($castleOwners['id'] == $user['klan']) { ?>
<?php else: $status = 'Вы не можете забрать эту вещь из арсенала.';
endif; ?>
</TD>
<TD valign=top> <?php showitem($row); ?> </TD>
<TD valign=top> Тут был showitem($row); </TD>
</TR>
<?php endwhile; ?>
</table>
@ -168,7 +168,7 @@ if ($castleOwners['id'] == $user['klan']) { ?>
<IMG SRC="i/sh/<?= $row['img'] ?>">
<BR><A HREF="?add=<?= $row['id'] ?>&sid=&sale=1">сдать в арсенал</A>
</TD>
<TD valign=top> <?php showitem($row); ?> </TD>
<TD valign=top> Тут был showitem($row); </TD>
</TR>
<?php endwhile; ?>
</table>

View File

@ -2167,29 +2167,87 @@ if (input::get('edit')) {
</tr>
<?php endif;
if ($_SESSION['razdel'] == null) {
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND (`type` < 12 OR `type` = 22 OR `type` = 23 OR `type` = 24) AND `setsale` = 0 ORDER BY `update` DESC', $user['id']);
$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` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND (`type` < 12 OR `type` = 22 OR `type` = 23 OR `type` = 24) AND `setsale` = 0 ORDER BY `update` DESC', $user['id']);
}
if ($_SESSION['razdel'] == 1) {
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 12 AND `setsale` = 0 ORDER BY `update` DESC', $user['id']);
$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` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 12 AND `setsale` = 0 ORDER BY `update` DESC', $user['id']);
}
if ($_SESSION['razdel'] == 2) {
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND (`type` > 12 OR `type` != 22 OR `type` != 23 OR `type` != 24) AND `setsale` = 0 ORDER BY `update` DESC', $user['id']);
$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` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND (`type` > 12 OR `type` != 22 OR `type` != 23 OR `type` != 24) AND `setsale` = 0 ORDER BY `update` DESC', $user['id']);
}
if ($_SESSION['razdel'] == 3) {
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` >= 80 AND `type` <= 89 AND `setsale` = 0 ORDER BY `update` ASC', $user['id']);
$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` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `type` >= 80 AND `type` <= 89 AND `setsale` = 0 ORDER BY `update` ASC', $user['id']);
}
if ($_SESSION['razdel'] == 4) {
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 200 AND `setsale` = 0 ORDER BY `update` ASC', $user['id']);
$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` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 200 AND `setsale` = 0 ORDER BY `update` ASC', $user['id']);
}
if ($_SESSION['razdel'] == 5) {
$data = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 199 AND `setsale` = 0 ORDER BY `update` ASC', $user['id']);
$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` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 199 AND `setsale` = 0 ORDER BY `update` ASC', $user['id']);
}
$groupNum = [];
$viewInventory = [];
$getItems = [];
$row = [];
$iteminfo =[];
#while ($row = $data->fetch_assoc()) showitem($row, null, "edit=1&razdel=$_SESSION[razdel]");
while ($row = $data->fetch_assoc()) showitem($row);
#while ($row = $data->fetch_assoc()) showitem($row);
while ($row = $data->fetch_assoc()) $iteminfo[] = new InventoryItem($row);
echo "<table width='100%'>";
foreach ($iteminfo as $ii) {
echo "<tr><td bgcolor='#d3d3d3'>";
$ii->printImage();
$ii->printControls();
echo "</td>";
echo "<td bgcolor='#d3d3d3'>";
$ii->printInfo();
echo "</td></tr>";
}
echo "</table>";
if ($viewInventory and $getItems) {
foreach ($viewInventory as $viewCategiryes) {
echo $viewCategiryes['header'];