battles/classes/InventoryItem.php

47 lines
1.3 KiB
PHP
Raw Normal View History

2019-01-11 21:57:15 +00:00
<?php
class InventoryItem extends Item
{
2019-01-12 09:47:23 +00:00
private $present;
public function __construct($row)
{
parent::__construct($row);
$this->present = $row['present'];
}
2019-01-11 21:57:15 +00:00
public function printInfo()
{
parent::printAllInfo();
if ($this->present) {
echo "<p style='color: maroon; font-style: italic'>Это подарок от {$this->present}. Вы не можете передать его кому-либо ещё.</p>";
}
2019-01-11 21:57:15 +00:00
}
2019-01-11 22:18:18 +00:00
public function printImage()
{
if (!in_array($this->item_type, [12, 50, 200])) {
echo "<a href=//{$_SERVER['SERVER_NAME']}/main.php?edit=1&dress={$this->item_id} title='Надеть'>";
2019-01-11 22:30:12 +00:00
parent::printImage();
echo "</a>";
} else {
parent::printImage();
2019-01-11 22:30:12 +00:00
}
2019-01-11 22:18:18 +00:00
}
2019-01-11 21:57:15 +00:00
/**
* Для кнопок управления под картинкой предмета в зависимости от ситуации.
2019-01-11 21:57:15 +00:00
*/
public function printControls()
{
echo <<<BTN
2019-01-12 10:28:46 +00:00
<p><input type="button" style="background: brown; border: 1px solid grey; color: white; border-radius: 2px;" value="Выбросить"
2019-01-11 21:57:15 +00:00
onclick="location='/admin.php'">
BTN;
}
2019-01-16 16:26:16 +00:00
public function getId()
{
return $this->item_id;
2019-01-16 16:26:16 +00:00
}
2019-01-11 21:57:15 +00:00
}