added a way (beta... still need work) to change the sort order.
This commit is contained in:
31
class.php
31
class.php
@@ -102,6 +102,37 @@ class ps4 {
|
||||
|
||||
}
|
||||
|
||||
function games_reorder($games,$orderby="last_played_desc") {
|
||||
function totaltime_asc($a,$b) {
|
||||
return ($a["game_total_time"] <= $b["game_total_time"]) ? -1 : 1;
|
||||
}
|
||||
function totaltime_desc($a,$b) {
|
||||
return ($a["game_total_time"] >= $b["game_total_time"]) ? -1 : 1;
|
||||
}
|
||||
|
||||
|
||||
function firstplayed_asc($a,$b) {
|
||||
return ($a["game_played_first"] <= $b["game_played_first"]) ? -1 : 1;
|
||||
}
|
||||
function firstplayed_desc($a,$b) {
|
||||
return ($a["game_played_first"] >= $b["game_played_first"]) ? -1 : 1;
|
||||
}
|
||||
|
||||
function lastplayed_asc($a,$b) {
|
||||
if ($a["game_played_last"] == -1) { $a["game_played_last"] = (round(microtime(true) * 1000)); }
|
||||
if ($b["game_played_last"] == -1) { $b["game_played_last"] = (round(microtime(true) * 1000)); }
|
||||
return ($a["game_played_last"] <= $b["game_played_last"]) ? -1 : 1;
|
||||
}
|
||||
function lastplayed_desc($a,$b) {
|
||||
if ($a["game_played_last"] == -1) { $a["game_played_last"] = (round(microtime(true) * 1000)); }
|
||||
if ($b["game_played_last"] == -1) { $b["game_played_last"] = (round(microtime(true) * 1000)); }
|
||||
return ($a["game_played_last"] >= $b["game_played_last"]) ? -1 : 1;
|
||||
}
|
||||
|
||||
usort($games, $orderby);
|
||||
return $games;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user