private function loadGrid($path) { $xml = simplexml_load_file($path); foreach ($xml->driver as $driver) { $lfsname = $driver->lfsname; $name = $driver->name; $racestarted = $driver->racestarted; $racefinished = $driver->racefinished; $elo = $driver->elo; $positionString = explode("#", $driver->positions); $positions = array(); foreach ($positionString as $key => $val) { $positions[$key + 1] = $val + 0; } $newDriver = new driver($lfsname, $elo); $newDriver->setName($name); $newDriver->setPositionArray($positions); $newDriver->setRaceFinished($racefinished); $newDriver->setRaceStarted($racestarted); $this->drivers[strval($lfsname)] = $newDriver; } }
if ($_GET['sortby'] == "highestelo") { $xpath = '//driver[@lfsname="' . $driver->lfsname . '"]'; $search = $xml2->xpath($xpath); $highestElo = $search[0]; foreach ($search as $elo) { if (intval($elo) > intval($highestElo)) { $highestElo = $elo; } } $elo = $highestElo; } $tempDriver = new driver($driver->lfsname, $elo); $tempDriver->setName($driver->name); $tempDriver->setRaceFinished($driver->racefinished); $tempDriver->setRaceStarted($driver->racestarted); $tempDriver->setPositionArray(explode("#", $driver->positions)); if (isset($_GET['finishlimit'])) { if (intval($driver->racefinished) < intval($_GET['finishlimit'])) { continue; } } if (isset($_GET['startlimit'])) { if (intval($driver->racestarted) < intval($_GET['startlimit'])) { continue; } } $driverarray[] = $tempDriver; } $additionalparameter = ""; if (isset($_GET['finishlimit'])) { $additionalparameter .= "&finishlimit=" . $_GET['finishlimit'];