Esempio n. 1
0
 $driverarray = array();
 foreach ($xml->driver as $driver) {
     $elo = $driver->elo;
     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;
 }
Esempio n. 2
0
 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;
     }
 }
Esempio n. 3
0
include 'standard/header.php';
?>

<!-- mainpart -->
<?php 
include_once 'dev/driver.php';
include_once 'standard/tools.php';
if (isset($_GET['gridpath']) && isset($_GET['lfsname']) && isset($_GET['histpath'])) {
    $xml = simplexml_load_file($_GET['gridpath']);
    $lfsname = urlencode($_GET['lfsname']);
    $xpath = "/grid/driver[@lfsname=\"" . strval($lfsname) . "\"]";
    $tempdriver = $xml->xpath($xpath);
    if ($tempdriver != false) {
        $tempdriver = $tempdriver[0];
        $driver = new driver($lfsname, $tempdriver->elo);
        $driver->setName($tempdriver->name);
        $driver->setPositionArray(explode("#", $tempdriver->positions));
        $driver->setRaceFinished($tempdriver->racefinished);
        $driver->setRaceStarted($tempdriver->racestarted);
        $xml = simplexml_load_file($_GET['histpath']);
        $xpath = '//driver[@lfsname="' . $driver->getLfsName() . '"]';
        $xpath2 = '//driver[@lfsname="' . $driver->getLfsName() . '"]/..';
        $search = $xml->xpath($xpath);
        $search2 = $xml->xpath($xpath2);
        $highestElo = $search[0];
        $lowestElo = $search[0];
        $index = 0;
        $indexHighest = 0;
        $indexLowest = 0;
        $eloHistoryArray = array();
        foreach ($search as $elo) {