2019-01-11 21:57:15 +00:00
< ? php
class InventoryItem extends Item
{
2019-01-12 09:47:23 +00:00
private $present ;
2019-01-12 10:04:24 +00:00
private $artefact ;
2019-01-12 09:47:23 +00:00
public function __construct ( $row )
{
parent :: __construct ( $row );
$this -> present = $row [ 'present' ];
2019-01-12 10:04:24 +00:00
$this -> artefact = $row [ 'artefact' ];
if ( $this -> artefact ) $this -> name = <<< NAME
2019-01-12 10:12:02 +00:00
< b style = 'color: darkorange;' > { $this -> name } </ b >< img src = " // { $_SERVER [ 'SERVER_NAME' ] } /i/artefact1.gif " >
2019-01-12 10:04:24 +00:00
NAME ;
2019-01-12 09:47:23 +00:00
}
2019-01-11 21:57:15 +00:00
public function printInfo ()
{
parent :: printBaseInfo ();
parent :: printRequirements ();
parent :: printBonuses ();
2019-01-12 09:50:05 +00:00
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 ()
{
2019-01-11 22:30:12 +00:00
if ( ! in_array ( $this -> type ,[ 12 , 50 , 200 ])) {
2019-01-11 22:40:51 +00:00
echo " <a href=// { $_SERVER [ 'SERVER_NAME' ] } /admin/admin.php> " ;
2019-01-11 22:30:12 +00:00
parent :: printImage ();
echo " </a> " ;
}
else parent :: printImage ();
2019-01-11 22:18:18 +00:00
}
2019-01-11 21:57:15 +00:00
/**
* Для кнопок управления под картинкой прелмета в зависимости от ситуации .
*/
public function printControls ()
{
echo <<< BTN
< p >< input type = " button " style = " background: darkgrey; border: 1px solid grey; border-radius: 2px; " value = " Надеть "
onclick = " location='/admin.php' " >
< input type = " button " style = " background: brown; border: 1px solid grey; color: white border-radius: 2px; " value = " Выбросить "
onclick = " location='/admin.php' " >
BTN ;
}
}