tests
This commit is contained in:
parent
f61dd3f527
commit
313870a1fc
@ -34,6 +34,16 @@ class ShopItem extends Item
|
||||
*/
|
||||
public function printControls($shopType = false)
|
||||
{
|
||||
if ($shopType === 'marketput') {
|
||||
echo <<<BTN
|
||||
<form method="post">
|
||||
<input placeholder="Цена" name="cost">
|
||||
<input type="hidden" name="putId" value="{$this->id}">
|
||||
<br><input type="submit" name="putToMarket" value="Cдать в магазин">
|
||||
</form>
|
||||
BTN;
|
||||
|
||||
} else {
|
||||
switch ($shopType) {
|
||||
default:
|
||||
$btnValue = "Купить за " . intval($this->cost) . " кр.";
|
||||
@ -64,3 +74,4 @@ BTN;
|
||||
if ($this->count > 0) echo "<br><small>В наличии: {$this->count} штук</small>";
|
||||
}
|
||||
}
|
||||
}
|
@ -50,7 +50,11 @@ if ($returningItemId) {
|
||||
} else $status = "Предмет не найден на полках магазина!";
|
||||
}
|
||||
|
||||
if (isset($_POST['puttomarket']) AND $puttingItemPrice) echo "<h1>WHOA!</h1>";
|
||||
if (isset($_POST['putToMarket'])) {
|
||||
if ($puttingItemPrice > 0) {
|
||||
$dress = db::c()->query()->fetch_assoc();
|
||||
} else $status = "Хорошая попытка…";
|
||||
}
|
||||
|
||||
if ($_GET['set']) {
|
||||
|
||||
@ -199,14 +203,6 @@ switch ($shopCategoryTypeNumber) {
|
||||
<link rel=stylesheet href="css/main.css">
|
||||
<script src="js/main.js"></script>
|
||||
<meta charset="utf-8">
|
||||
<SCRIPT LANGUAGE="JavaScript">
|
||||
function sale(name, txt, n, kr) {
|
||||
var s = prompt("Сдать в магазин \"" + txt + "\". Укажите цену:", kr);
|
||||
if ((s != null) && (s !== '')) {
|
||||
location.href = "?sale=" + name + "&kredit=" + s + "&n=" + n;
|
||||
}
|
||||
}
|
||||
</SCRIPT>
|
||||
</HEAD>
|
||||
<body>
|
||||
<div style="float: right;">
|
||||
@ -253,7 +249,8 @@ switch ($shopCategoryTypeNumber) {
|
||||
|
||||
foreach ($iteminfo as $ii) {
|
||||
echo "<tr><td style='width: 150px; text-align: center;'>";
|
||||
$ii->printImage(); ?>
|
||||
$ii->printImage();
|
||||
$ii->printControls('marketput');?>
|
||||
<form method="post">
|
||||
<input placeholder="Цена" name="cost">
|
||||
<br><input type="submit" name="puttomarket" value="Cдать в магазин">
|
||||
|
26
test.php
26
test.php
@ -15,16 +15,16 @@ require_once 'config.php';
|
||||
# $items = []; foreach(фетч того ебучего массива as $value) {$items[$value['id']] = $value}
|
||||
|
||||
$iteminfo =[];
|
||||
$result = db::c()->query('SELECT `shop`.*,
|
||||
`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 `shop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE count > 0 LIMIT 25');
|
||||
//$result = db::c()->query('SELECT `shop`.*,
|
||||
// `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 `shop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE count > 0 LIMIT 25');
|
||||
$result2 = db::c()->query('SELECT `inventory`.*,
|
||||
`magic`.`name` AS `magic_name`,
|
||||
`magic`.`chanse` AS `magic_chanse`,
|
||||
@ -33,9 +33,9 @@ $result2 = db::c()->query('SELECT `inventory`.*,
|
||||
`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 = 11263');
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$iteminfo[] = new ShopItem($row);
|
||||
}
|
||||
//while ($row = $result->fetch_assoc()) {
|
||||
// $iteminfo[] = new ShopItem($row);
|
||||
//}
|
||||
|
||||
while ($row = $result2->fetch_assoc()) {
|
||||
$iteminfo[] = new InventoryItem($row);
|
||||
|
Loading…
Reference in New Issue
Block a user