parent:: test

This commit is contained in:
lopar 2019-01-11 22:26:10 +02:00
parent ec59f2726e
commit 5151a5bc61
3 changed files with 27 additions and 26 deletions

View File

@ -1,25 +0,0 @@
<?php
class ItemClass extends Item
{
public function ShopInfo()
{
parent::printBaseInfo();
echo "<br>Цена" . $this->wrap($this->cost);
parent::printRequirements();
parent::printBonuses();
}
public function EkrShopInfo()
{
parent::printBaseInfo();
echo "<br>Цена" . $this->wrap($this->ecost);
parent::printRequirements();
parent::printBonuses();
}
public function PresentInfo()
{
parent::printBaseInfo();
}
}

25
classes/ShopItem.php Normal file
View File

@ -0,0 +1,25 @@
<?php
class ShopItem extends Item
{
public function printInfo()
{
parent::printBaseInfo();
echo "<br>Цена" . $this->wrap($this->cost) . " пымпочек";
parent::printRequirements();
parent::printBonuses();
}
/**
* Для кнопок управления под картинкой прелмета в зависимости от ситуации.
*/
public function printControls()
{
echo <<<BTN
<br><input type="button" style="background: darkgrey; border: 1px solid grey; border-radius: 2px;" value="Купить"
onclick="location='/admin.php'">
<br><input type="button" style="background: orangered; border: 1px solid crimson; color: white; border-radius: 2px;" value="Уничтожить предмет"
onclick="location='/forum.php'">
BTN;
}
}

View File

@ -17,13 +17,14 @@ require_once 'config.php';
$result = db::c()->query('SELECT * FROM `shop` WHERE count > 0');
while ($row = $result->fetch_assoc()) {
$iteminfo[] = new ItemClass($row);
$iteminfo[] = new ShopItem($row);
}
echo "<table width='100%'><th colspan='2'>Товары магазина</th>";
foreach ($iteminfo as $ii) {
echo "<tr><td bgcolor='#d3d3d3'>";
$ii->printImage();
$ii->printControls();
echo "</td>";
echo "<td bgcolor='#d3d3d3'>";
$ii->ShopInfo();