From 600316a94a7e40c5fef364d6f98abc3e509131ad Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Tue, 13 Mar 2012 11:36:26 +0100 Subject: Initial commit --- templates/highscores.tpl.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 templates/highscores.tpl.php (limited to 'templates/highscores.tpl.php') diff --git a/templates/highscores.tpl.php b/templates/highscores.tpl.php new file mode 100644 index 0000000..9bc889f --- /dev/null +++ b/templates/highscores.tpl.php @@ -0,0 +1,35 @@ +

Highscores

+ +getHighscores(); + + /* + * Sort multidimensional array according to $array[][1] + */ + + $sortArray = array(); + foreach ($highscores as $key => $value) { + $sortArray[$key] = $value[1]; + } + array_multisort($sortArray, SORT_DESC, SORT_NUMERIC, $highscores); + + $place = 0; + + foreach ($highscores as $highscore) { + if ($highscore[1] <= 21) { + $place++; + } + if ($place != 0) { + echo "Place $place: "; + } + $score = round($highscore[1], 2); + echo" $highscore[0] with $score Points in $highscore[2] games
\n"; + } + +?> + +

+Back to menu -- cgit v1.2.3