game/_incl_data/class/Moderation/UserRegistrationList.php

36 lines
1.0 KiB
PHP

<?php
namespace Moderation;
use Core\Db;
use DateTime;
use DateTimeImmutable;
use User;
class UserRegistrationList
{
public function get(DateTime $date)
{
$from = $date->getTimestamp();
$to = $date->modify('+ 1 day')->getTimestamp();
$list = Db::getRows("select id, banned, molch1, battle, host_reg, online from users where timereg between ? and ? and bot_id = 0 and bithday != '01.01.1800' order by id", [$from, $to]);
$str = '';
foreach ($list as $user) {
$time = new DateTime();
$loginColor = 'black';
if ($user['banned']) {
$loginColor = 'red';
}
if ($user['online'] > $time->modify('- 10 minutes')->getTimestamp()) {
$loginColor = 'green';
}
if ($user['molch1'] > 0) {
$molch1Duration = new DateTimeImmutable($user['molch1']);
}
$str .= "<li><span style='color: $loginColor'>" . User::getLogin($user['id'] . "</span>");
}
}
}