tests
This commit is contained in:
+35
-24
@@ -34,33 +34,44 @@ class ShopItem extends Item
|
||||
*/
|
||||
public function printControls($shopType = false)
|
||||
{
|
||||
switch ($shopType) {
|
||||
default:
|
||||
$btnValue = "Купить за " . intval($this->cost) . " кр.";
|
||||
$btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
case 'ashop':
|
||||
$btnValue = "Купить за " . intval($this->ecost) . " eкр.";
|
||||
$btnLink = "/ashop.php?buy={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
case 'sell':
|
||||
$btnValue = "Продать";
|
||||
$btnLink = "/shop.php?sell={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
case 'marketgetback':
|
||||
$btnValue = "Снять с продажи";
|
||||
$btnLink = "?back={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
case 'marketshowmore':
|
||||
$btnValue = "Развернуть";
|
||||
$btnLink = "?otdel={$this->otdel}&set={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
}
|
||||
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;
|
||||
|
||||
echo <<<BTN
|
||||
} else {
|
||||
switch ($shopType) {
|
||||
default:
|
||||
$btnValue = "Купить за " . intval($this->cost) . " кр.";
|
||||
$btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
case 'ashop':
|
||||
$btnValue = "Купить за " . intval($this->ecost) . " eкр.";
|
||||
$btnLink = "/ashop.php?buy={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
case 'sell':
|
||||
$btnValue = "Продать";
|
||||
$btnLink = "/shop.php?sell={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
case 'marketgetback':
|
||||
$btnValue = "Снять с продажи";
|
||||
$btnLink = "?back={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
case 'marketshowmore':
|
||||
$btnValue = "Развернуть";
|
||||
$btnLink = "?otdel={$this->otdel}&set={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
}
|
||||
|
||||
echo <<<BTN
|
||||
<p><input type="button" style="background: darkgrey; border: 1px solid grey; border-radius: 2px;" value="{$btnValue}"
|
||||
onclick="location='{$btnLink}'">
|
||||
BTN;
|
||||
if ($this->count > 0) echo "<br><small>В наличии: {$this->count} штук</small>";
|
||||
if ($this->count > 0) echo "<br><small>В наличии: {$this->count} штук</small>";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user