Report handlers are now parsed and displayed correctly.
This commit is contained in:
parent
db5327d2e4
commit
3ecb4c7fb8
@ -6,6 +6,9 @@
|
|||||||
/** @var String */
|
/** @var String */
|
||||||
private $serverName;
|
private $serverName;
|
||||||
|
|
||||||
|
/** @var Player|Null */
|
||||||
|
private $handler;
|
||||||
|
|
||||||
/** @var Player */
|
/** @var Player */
|
||||||
private $suspect;
|
private $suspect;
|
||||||
|
|
||||||
@ -16,13 +19,15 @@
|
|||||||
* Report constructor.
|
* Report constructor.
|
||||||
* @param Int $id
|
* @param Int $id
|
||||||
* @param String $serverName
|
* @param String $serverName
|
||||||
|
* @param Player|Null $handler
|
||||||
* @param Player $suspect
|
* @param Player $suspect
|
||||||
* @param SplObjectStorage $reporters
|
* @param SplObjectStorage $reporters
|
||||||
*/
|
*/
|
||||||
function Report($id, $serverName, $suspect, $reporters)
|
function Report($id, $serverName, $handler, $suspect, $reporters)
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->serverName = $serverName;
|
$this->serverName = $serverName;
|
||||||
|
$this->handler = $handler;
|
||||||
$this->suspect = $suspect;
|
$this->suspect = $suspect;
|
||||||
$this->reporters = $reporters;
|
$this->reporters = $reporters;
|
||||||
}
|
}
|
||||||
@ -43,6 +48,14 @@
|
|||||||
return $this->serverName;
|
return $this->serverName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Player|Null
|
||||||
|
*/
|
||||||
|
public function getHandler()
|
||||||
|
{
|
||||||
|
return $this->handler;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Player
|
* @return Player
|
||||||
*/
|
*/
|
||||||
|
@ -60,9 +60,10 @@ function toReport($reportData, $players)
|
|||||||
{
|
{
|
||||||
$id = $reportData["id"];
|
$id = $reportData["id"];
|
||||||
$serverName = $reportData["serverName"];
|
$serverName = $reportData["serverName"];
|
||||||
|
$handler = array_key_exists("handler", $reportData) ? getPlayer($players, $reportData["handler"]) : null;
|
||||||
$suspect = getPlayer($players, $reportData["suspect"]);
|
$suspect = getPlayer($players, $reportData["suspect"]);
|
||||||
$reporters = toReporters($players, $reportData["reporters"]);
|
$reporters = toReporters($players, $reportData["reporters"]);
|
||||||
return new Report($id, $serverName, $suspect, $reporters);
|
return new Report($id, $serverName, $handler, $suspect, $reporters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,20 +240,20 @@ function removeBadCharacters($input)
|
|||||||
$messages = $snapshot->getMessages();
|
$messages = $snapshot->getMessages();
|
||||||
|
|
||||||
foreach($messages as $message):
|
foreach($messages as $message):
|
||||||
$typeId = $message->getType();
|
$typeId = $message->getType();
|
||||||
$typeDisplayName = Message::$TYPE_DISPLAY_NAMES[$typeId];
|
$typeDisplayName = Message::$TYPE_DISPLAY_NAMES[$typeId];
|
||||||
$isPM = $typeId == Message::TYPE_PM;
|
$isPM = $typeId == Message::TYPE_PM;
|
||||||
|
|
||||||
// If this is a PM, then the "-> <recipient>" suffix will be applied.
|
// If this is a PM, then the "-> <recipient>" suffix will be applied.
|
||||||
$involved = $message->getSender()->getUsername() . ($isPM ? " -> " . $message->getRecipients()[0]->getUsername() : "");
|
$involved = $message->getSender()->getUsername() . ($isPM ? " -> " . $message->getRecipients()[0]->getUsername() : "");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<span class="label <?php if($isPM) echo "label-primary chat pm"; else echo "label-info chat"; ?>" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"><?= $typeDisplayName ?></span>
|
<span class="label <?php if($isPM) echo "label-primary chat pm"; else echo "label-info chat"; ?>" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"><?= $typeDisplayName ?></span>
|
||||||
<span class="black"><?= $involved; ?>:</span> <?= $message->getMessage(); ?>
|
<span class="black"><?= $involved; ?>:</span> <?= $message->getMessage(); ?>
|
||||||
|
|
||||||
<?php if ($message != end($messages)){ // Don't break on the last element ?>
|
<?php if ($message != end($messages)){ // Don't break on the last element ?>
|
||||||
<br>
|
<br>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -287,7 +288,12 @@ function removeBadCharacters($input)
|
|||||||
<span class="label label-pill label-default"><?= $time ?></span><br>
|
<span class="label label-pill label-default"><?= $time ?></span><br>
|
||||||
<span class="label label-pill label-success">Reported by <?= $reportersString ?></span><br>
|
<span class="label label-pill label-success">Reported by <?= $reportersString ?></span><br>
|
||||||
<span class="label label-pill label-danger">Suspect is <?= $report->getSuspect()->getUsername() ?></span><br>
|
<span class="label label-pill label-danger">Suspect is <?= $report->getSuspect()->getUsername() ?></span><br>
|
||||||
<span class="label label-pill label-warning">Staff Member assigned is TODO</span><br><!-- TODO -->
|
<span class="label label-pill label-warning">
|
||||||
|
<?php
|
||||||
|
$handler = $report->getHandler();
|
||||||
|
echo $handler != null ? "Staff Member assigned is " . $handler->getUsername() : "No Staff Member assigned";
|
||||||
|
?>
|
||||||
|
</span><br><!-- TODO -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
@ -297,7 +303,7 @@ function removeBadCharacters($input)
|
|||||||
<?php foreach($snapshot->getPlayers() as $player): ?>
|
<?php foreach($snapshot->getPlayers() as $player): ?>
|
||||||
<img src="http://cravatar.eu/avatar/<?= $player->getUUID() ?>/55.png" class="pull-left" />
|
<img src="http://cravatar.eu/avatar/<?= $player->getUUID() ?>/55.png" class="pull-left" />
|
||||||
<b class="name"><?= $player->getUsername() ?></b> <span class="label label-staff name">TODO</span><br> <!-- TODO -->
|
<b class="name"><?= $player->getUsername() ?></b> <span class="label label-staff name">TODO</span><br> <!-- TODO -->
|
||||||
<code style="font-size: 11px;"><?= $player->getUUID() ?></code>
|
<code style="font-size: 11px;"><?= $player->getUUID() ?></code>
|
||||||
<br><br>
|
<br><br>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user