small fix

This commit is contained in:
kremsy 2014-02-13 20:48:25 +01:00 committed by Steffen Schröder
parent 6787012047
commit 7b733be0bc

View File

@ -92,6 +92,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
/** /**
* Register a Certain Stat * Register a Certain Stat
*
* @param $statName * @param $statName
* @param $order * @param $order
* @param $headShortCut * @param $headShortCut
@ -168,7 +169,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
//Compute Headline //Compute Headline
$x = $xStart + 55; $x = $xStart + 55;
$statRankings = array(); $statRankings = array();
foreach($this->statArray as $key => $stat) { foreach($this->statArray as $key => $stat) {
$ranking = $this->maniaControl->statisticManager->getStatsRanking($stat["Name"]); $ranking = $this->maniaControl->statisticManager->getStatsRanking($stat["Name"]);
@ -176,7 +177,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$statRankings[$stat["Name"]] = $ranking; $statRankings[$stat["Name"]] = $ranking;
$array[$stat['HeadShortCut']] = $x; $array[$stat['HeadShortCut']] = $x;
$x += $stat["Width"]; $x += $stat["Width"];
}else{ } else {
unset($this->statArray[$key]); unset($this->statArray[$key]);
} }
} }
@ -186,8 +187,9 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
//Description Label //Description Label
$i = 2; $i = 2;
foreach($this->statArray as $statArray) { foreach($this->statArray as $statArray) {
if(!isset($labels[$i])) if (!isset($labels[$i])) {
break; break;
}
/** @var Label_Text $labels [] */ /** @var Label_Text $labels [] */
$labels[$i]->setAction(self::ACTION_SORT_STATS . '.' . $statArray["Name"]); $labels[$i]->setAction(self::ACTION_SORT_STATS . '.' . $statArray["Name"]);
@ -203,6 +205,10 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$i = 1; $i = 1;
$y -= 10; $y -= 10;
if (!isset($statRankings[$order])) {
return;
}
foreach($statRankings[$order] as $playerId => $value) { foreach($statRankings[$order] as $playerId => $value) {
$listPlayer = $this->maniaControl->playerManager->getPlayerByIndex($playerId); $listPlayer = $this->maniaControl->playerManager->getPlayerByIndex($playerId);
if ($i == 15) { if ($i == 15) {