забыли параметр функции
This commit is contained in:
parent
32cccc64cf
commit
6c6812f818
@ -10,26 +10,45 @@ class DressedItems
|
||||
protected $DB;
|
||||
private $dressedItem;
|
||||
|
||||
public function __construct() {
|
||||
// Пустой потому что нужны разные запросы.
|
||||
public function __construct($user_id) {
|
||||
$this->userid = $user_id ?? 0;
|
||||
}
|
||||
|
||||
private function getDressedItems($user_id)
|
||||
private function getDressedItems()
|
||||
{
|
||||
try {
|
||||
return db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $user_id);
|
||||
$this->DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->userid);
|
||||
while ($row = $this->DB->fetch_assoc()) {
|
||||
$dressed_item[$row['dressed_slot']] = $row;
|
||||
$this->dressedItem[$row['dressed_slot']] = $row;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo '<div class="debug">getDressedItems: ' . $e . '</div>';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getSlots($user_id)
|
||||
public function getSlots()
|
||||
{
|
||||
while ($row = $this->getDressedItems($user_id)->fetch_assoc()) {
|
||||
return $this->dressedItem;
|
||||
}
|
||||
|
||||
private function runQuery($user_id)
|
||||
{
|
||||
try {
|
||||
$this->DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $user_id);
|
||||
} catch (Exception $e) {
|
||||
echo '<div class="debug">getDressedItems: ' . $e . '</div>';
|
||||
}
|
||||
}
|
||||
public function eeee($user_id)
|
||||
{
|
||||
if (!$this->DB) {
|
||||
$this->runQuery($user_id);
|
||||
}
|
||||
while ($row = $this->DB->fetch_assoc()) {
|
||||
$dressed_item[$row['dressed_slot']] = $row;
|
||||
$this->dressedItem[$row['dressed_slot']] = $row;
|
||||
}
|
||||
return $this->dressedItem;
|
||||
}
|
||||
|
||||
}
|
@ -56,11 +56,12 @@ class User
|
||||
private function UserInfoDoll($isBattle = 0, $isMain = 0)
|
||||
{
|
||||
//https://jsfiddle.net/ngx0yvhc
|
||||
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
|
||||
while ($row = $dressed_items->fetch_assoc()) {
|
||||
$dressed_item[$row['dressed_slot']] = $row;
|
||||
}
|
||||
// $dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
|
||||
// while ($row = $dressed_items->fetch_assoc()) {
|
||||
// $dressed_item[$row['dressed_slot']] = $row;
|
||||
// }
|
||||
$di = new DressedItems();
|
||||
$di->eeee($this->id);
|
||||
|
||||
// for ($i = 1; $i <= 12; $i++) {
|
||||
// echo sprintf('<div class="slot-%s">', $i);
|
||||
@ -79,13 +80,13 @@ class User
|
||||
// }
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
echo sprintf('<div class="slot-%s">', $i);
|
||||
if (isset($di->getSlots($this->id)[$i])) {
|
||||
if (isset($di->eeee($this->id)[$i])) {
|
||||
if (!$isBattle && $isMain) {
|
||||
$itemString = '<a href="?edit=1&drop=%s"><img src="/i/sh/%s" class="item-wrap-normal" alt="%s" title="%s"></a>';
|
||||
echo sprintf($itemString, $i, $di->getSlots($this->id)[$i]['image'], $di->getSlots($this->id)[$i]['name'], $di->getSlots($this->id)[$i]['name']);
|
||||
echo sprintf($itemString, $i, $di->eeee($this->id)[$i]['image'], $di->eeee($this->id)[$i]['name'], $di->eeee($this->id)[$i]['name']);
|
||||
} else {
|
||||
$itemString = '<img src="/i/sh/%s" class="item-wrap-normal tip" alt="%s"><span class="tiptext"><strong>%s</strong></span>';
|
||||
echo sprintf($itemString, $di->getSlots($this->id)[$i]['image'], $di->getSlots($this->id)[$i]['name'], $di->getSlots($this->id)[$i]['name']);
|
||||
echo sprintf($itemString, $di->eeee($this->id)[$i]['image'], $di->eeee($this->id)[$i]['name'], $di->eeee($this->id)[$i]['name']);
|
||||
}
|
||||
} else {
|
||||
echo sprintf('<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [%s]" alt="Пустой слот [%s]">', $i, $i);
|
||||
|
Loading…
Reference in New Issue
Block a user