battles/classes/InventoryItem.php
Igor Barkov (iwork) 35031f1296 ???
2020-07-22 17:04:15 +03:00

49 lines
1.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
class InventoryItem extends Item
{
private $present;
public function __construct($row)
{
parent::__construct($row);
if (isset($row['present'])) {
$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, range(1,12))) {
echo "<a href=/main.php?edit=1&dress={$this->item_id} title='Надеть'>";
parent::printImage();
echo "</a>";
} else {
parent::printImage();
}
}
/**
* Для кнопок управления под картинкой предмета в зависимости от ситуации.
*/
public function printControls()
{
//FIXME Сменить заглушку на нормальную функцию!!
echo <<<BTN
<p><button class="button danger" onclick="location.href='/admin.php'">Выбросить</button>
BTN;
}
public function getId()
{
return $this->item_id;
}
}