Превращение таблиц в css grid.

This commit is contained in:
lopar 2020-07-05 18:09:55 +03:00
parent 3ec3d3956c
commit cb17a5ba8b
3 changed files with 171 additions and 15 deletions

View File

@ -67,6 +67,7 @@ EMPTY_SLOT;
public function showUserInfo()
{
$starSign = star_sign($this->borndate);
$dressed_item = [];
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
while ($row = $dressed_items->fetch_assoc()) {
@ -184,7 +185,7 @@ USERINFO;
</div>
</td>
<td width="100%">
Имя {$this->login} <br>
Уровень {$this->level} <br>
Сила {$this->strength} <br>
Ловкость {$this->dexterity} <br>
Интуиция {$this->intuition} <br>
@ -194,26 +195,118 @@ USERINFO;
Находится в {$this->getRoomName($this->room)}<br>
</td>
<td style="vertical-align: top; width: 100px; text-align: center;">
<img src="i/zodiac/<?= star_sign($this->borndate); ?>.png" alt="Родовой знак">
<img src="i/zodiac/{$starSign}.png" alt="Родовой знак">
</td>
</tr>
</table>
USERINFO;
if ($this->married) {
echo sprintf('<a href = "inf.php?%s" target = _blank ><img alt = "В браке с %s" src = "i/married.gif" title = "В браке с %s"></a >', $this->married, $this->married, $this->married);
}
/////////////////////////
}
// if (isset($dressed_item[1])) {
// $this->showItem($dressed_item[1]);
// }
// if (isset($dressed_item[2])) {
// $this->showItem($dressed_item[2]);
// }
// if (isset($dressed_item[4])) {
// $this->showItem($dressed_item[4]);
// }
public function showUserInfo2()
{
$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;
}
echo '<div class="user-info-container">';
echo '<div class="slot-1">';
if (isset($dressed_item[1])) {
$this->showItem($dressed_item[1]);
} else {
$this->showItem(1);
}
echo '</div>';
echo '<div class="slot-2">';
if (isset($dressed_item[2])) {
$this->showItem($dressed_item[2]);
} else {
$this->showItem(2);
}
echo '</div>';
echo '<div class="slot-3">';
if (isset($dressed_item[3])) {
$this->showItem($dressed_item[3]);
} else {
$this->showItem(3);
}
echo '</div>';
echo '<div class="slot-4">';
if (isset($dressed_item[4])) {
$this->showItem($dressed_item[4]);
} else {
$this->showItem(4);
}
echo '</div>';
echo '<div class="slot-5">';
if (isset($dressed_item[5])) {
$this->showItem($dressed_item[5]);
} else {
$this->showItem(5);
}
echo '</div>';
echo '<div class="slot-6">';
if (isset($dressed_item[6])) {
$this->showItem($dressed_item[6]);
} else {
$this->showItem(6);
}
echo '</div>';
echo '<div class="slot-7">';
if (isset($dressed_item[7])) {
$this->showItem($dressed_item[7]);
} else {
$this->showItem(7;
}
echo '</div>';
echo '<div class="slot-8">';
if (isset($dressed_item[8])) {
$this->showItem($dressed_item[8]);
} else {
$this->showItem(8);
}
echo '</div>';
echo '<div class="slot-lower">';
if (isset($dressed_item[9])) {
$this->showItem($dressed_item[9]);
} else {
$this->showItem(9);
}
if (isset($dressed_item[10])) {
$this->showItem($dressed_item[10]);
} else {
$this->showItem(10);
}
if (isset($dressed_item[11])) {
$this->showItem($dressed_item[11]);
} else {
$this->showItem(11);
}
echo '</div>';
echo '<div class="slot-image">';
echo sprintf('<img src="/i/shadow/%s" width="200" height="430" alt="%s">', $this->shadow, $this->login);
echo '</div>';
echo '<div class="user-signs">';
echo sprintf('<img src="i/zodiac/%s.png" alt="Родовой знак">', star_sign($this->borndate));
echo '</div>';
echo '<div class="user-info">';
echo <<<USERINFO
Уровень {$this->level} <br>
Сила {$this->strength} <br>
Ловкость {$this->dexterity} <br>
Интуиция {$this->intuition} <br>
Выносливость {$this->endurance} <br>
Интеллект {$this->intelligence} <br>
Мудрость {$this->wisdom} <br>
Находится в {$this->getRoomName($this->room)}
USERINFO;
echo '</div>';
echo '</div>';
}
}

View File

@ -300,10 +300,11 @@ span.error {
color: #8F0000;
}
img.tip+span.tiptext {
img.tip + span.tiptext {
display: none
}
img.tip:hover+span.tiptext {
img.tip:hover + span.tiptext {
border: #c0c0c0 1px dotted;
padding: 5px 20px 5px 5px;
display: block;
@ -315,4 +316,66 @@ img.tip:hover+span.tiptext {
position: absolute;
top: 10px;
text-decoration: none
}
/* Отображение информации о персонаже в inf.php (класс User.php) */
div.user-info-container {
display: grid;
grid-template-columns: 100px 200px 100px auto 100px;
grid-template-rows: repeat(4, 100px) auto;
grid-gap: 10px;
}
div.user-info-container > div.slot-1,
div.user-info-container > div.slot-2,
div.user-info-container > div.slot-3,
div.user-info-container > div.slot-4 {
grid-column: 1;
}
div.user-info-container > div.slot-5,
div.user-info-container > div.slot-6,
div.user-info-container > div.slot-7,
div.user-info-container > div.slot-8 {
grid-column: 3;
}
div.user-info-container > div.slot-1,
div.user-info-container > div.slot-5 {
grid-row: 1;
}
div.user-info-container > div.slot-2,
div.user-info-container > div.slot-6 {
grid-row: 2;
}
div.user-info-container > div.slot-3,
div.user-info-container > div.slot-7 {
grid-row: 3;
}
div.user-info-container > div.slot-4,
div.user-info-container > div.slot-8 {
grid-row: 4;
}
div.user-info-container > div.slot-image {
grid-column: 2;
grid-row: 1 / 5;
}
div.user-info-container > div.slot-lower {
grid-column: 1 / 4;
grid-row: 5;
text-align: center;
}
div.user-info-container > div.user-info {
grid-column: 4;
grid-row: 1 / 6;
}
div.user-info-container > div.user-signs {
grid-column: 5;
grid-row: 1 / 6;
}

View File

@ -50,7 +50,7 @@ if (empty($user->id)): ?>
die(file_get_contents('customuserdata/' . $user['id']));
}
try {
$user->showUserInfo();
$user->showUserInfo2();
} catch (Exception $e) {
echo "<div class='private'>Ошибка классового генератора персонажа showUserInfo(): {$e}</div>";
} ?>