Отображение эффектов уехало в класс UserInfo. #1

This commit is contained in:
lopar
2021-03-11 21:47:52 +02:00
parent 4164046edb
commit 591e896968
4 changed files with 56 additions and 35 deletions
+19
View File
@@ -1,5 +1,6 @@
<?php
namespace Battles;
use Battles\Database\DBPDO;
use Battles\Models\EffectsModel;
class UserInfo extends UserStats
@@ -206,4 +207,22 @@ INFO;
echo '</div><!-- user-info-container -->';
}
public function showUserEffects(): string
{
$effs = DBPDO::INIT()->ofetchAll('SELECT * FROM users_effects WHERE owner_id = ?', $this->id);
$img = UserEffects::$effectImage;
$r = '';
foreach ($effs as $effect) {
$timeleft = timeOut($effect->remaining_time - time());
$r .= "
<div>
<img class='image' src='/i/{$img[$effect->type]}' alt='{$effect->name}'>
<span class='title'>{$effect->name}</span>
<div class='timeleft'>$timeleft</div>
</div>
";
}
return $r;
}
}