Show all involved users correctly

This commit is contained in:
Keir Nellyer 2016-06-29 22:13:13 -04:00
parent 1c73d2a793
commit c076a46078

View File

@ -262,6 +262,24 @@ function getReporters($reportId)
return $reportReasons;
}
/**
* @param Snapshot $snapshot
* @param Report $report
* @return User[]
*/
function getInvolvedUsers($snapshot, $report)
{
$involvedUsers = $snapshot->getPlayers();
$involvedUsers[$report->getSuspect()->getId()] = $report->getSuspect();
/** @var User $reporter */
foreach ($report->getReporters() as $reporter) {
$involvedUsers[$reporter->getId()] = $reporter;
}
return $involvedUsers;
}
/**
* @param Message $messageA
* @param Message $messageB
@ -422,6 +440,8 @@ if ($validId)
$reporterUsernames[count($reporterUsernames)] = $reporter->getUsername();
}
$involvedUsers = getInvolvedUsers($snapshot, $report);
// TODO Calculate time since last report
// TODO actually calculate time
$lastReportTime = new DateTime('1999-01-12');
@ -487,10 +507,10 @@ if ($validId)
<h4><i class="fa fa-users"></i>&nbsp;&nbsp;&nbsp;Users</h4>
<hr>
<?php foreach($snapshot->getPlayers() as $player): ?>
<img src="http://cravatar.eu/avatar/<?= $player->getUUID() ?>/55.png" class="pull-left" />
&nbsp;&nbsp;<b class="name"><?= $player->getUsername() ?></b> <span class="label label-staff name"><?= $player->getRank() ?></span><br> <!-- TODO different styling for different ranks -->&nbsp;
<code style="font-size: 11px;"><?= $player->getUUID() ?></code>
<?php foreach($involvedUsers as $user): ?>
<img src="http://cravatar.eu/avatar/<?= $user->getUUID() ?>/55.png" class="pull-left" />
&nbsp;&nbsp;<b class="name"><?= $user->getUsername() ?></b> <span class="label label-staff name"><?= $user->getRank() ?></span><br> <!-- TODO different styling for different ranks -->&nbsp;
<code style="font-size: 11px;"><?= $user->getUUID() ?></code>
<br><br>
<?php endforeach; ?>
</div>