parent:: test
This commit is contained in:
parent
ec59f2726e
commit
5151a5bc61
@ -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
25
classes/ShopItem.php
Normal 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;
|
||||
}
|
||||
}
|
3
test.php
3
test.php
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user