Files
battles/classes/InventoryItem.php
T
2020-07-21 18:03:46 +03:00

47 lines
1.3 KiB
PHP

<?php
class InventoryItem extends Item
{
private $present;
public function __construct($row)
{
parent::__construct($row);
$this->present = $row['present'];
}
public function printInfo()
{
parent::printAllInfo();
if ($this->present) {
echo "<p style='color: maroon; font-style: italic'>Это подарок от {$this->present}. Вы не можете передать его кому-либо ещё.</p>";
}
}
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='Надеть'>";
parent::printImage();
echo "</a>";
} else {
parent::printImage();
}
}
/**
* Для кнопок управления под картинкой предмета в зависимости от ситуации.
*/
public function printControls()
{
echo <<<BTN
<p><input type="button" style="background: brown; border: 1px solid grey; color: white; border-radius: 2px;" value="Выбросить"
onclick="location='/admin.php'">
BTN;
}
public function getId()
{
return $this->item_id;
}
}