Example #1
0
    }
    if (isset($_GET['sortby'])) {
        if ($_GET['sortby'] == "elo" || $_GET['sortby'] == "highestelo") {
            usort($driverarray, "sortByElo");
        }
        if ($_GET['sortby'] == "finishedraces") {
            usort($driverarray, "sortByFinishedRaces");
        }
        if ($_GET['sortby'] == "startedraces") {
            usort($driverarray, "sortByStartedRaces");
        }
        if ($_GET['sortby'] == "startedfinishedratio") {
            usort($driverarray, "sortByStartedFinishedRatio");
        }
    }
    echo "<table id=\"overview\"><tr>\n\t\t\t\t<th id=\"poshead\">pos.</th>\n\t\t\t\t<th id=\"namehead\">name<a href=\"#name\">*</a></th>\n\t\t\t\t<th id=\"elohead\"><a href=\"" . $_SERVER['PHP_SELF'] . getGetString("sortby", "elo") . "\" title=\"sort by elorating\">elo-rating</a></th>\n\t\t\t\t<th id=\"rhead\"><a href=\"" . $_SERVER['PHP_SELF'] . getGetString("sortby", "startedraces") . "\" title=\"sort by races started\">race<br>started</th>\n\t\t\t\t<th id=\"fhead\"><a href=\"" . $_SERVER['PHP_SELF'] . getGetString("sortby", "finishedraces") . "\" title=\"sort by races finished\">race<br>finished</th>\n\t\t\t\t<th id=\"frhead\"><a href=\"" . $_SERVER['PHP_SELF'] . getGetString("sortby", "startedfinishedratio") . "\" title=\"sort by finished - started ratio\">finished<p>────────</p>started</th>\n\t\t\t\t</tr>";
    foreach ($driverarray as $pos => $driver) {
        echo "<tr>\n\t\t\t<td class=\"poscell\">" . ($pos + 1) . ".</td>\n\t\t\t<td class=\"namecell\"><a href=\"showSingleDriver.php?gridpath=" . GRID_LINK . "&histpath=" . HISTORY_LINK . "&lfsname=" . $driver->getLfsName() . "\">" . $driver->getName() . "</a></td>\n\t\t\t<td class=\"elocell\">" . $driver->getElo() . "</td>\n\t\t\t<td class=\"rcell\">" . $driver->getRaceStarted() . "</td>\n\t\t\t<td class=\"fcell\">" . $driver->getRaceFinished() . "</td>\n\t\t\t<td class=\"frcell\">" . 100 * round(floatval($driver->getRaceFinished()) / floatval($driver->getRaceStarted()), 2) . "%</td>\n\t\t\t</tr>";
    }
    echo "</table>";
} else {
    echo "<p>Dont play with the GET-parameters!!!</p>";
}
function sortByElo($driver1, $driver2)
{
    if ($driver1->getElo() == $driver2->getElo()) {
        return 0;
    }
    if ($driver1->getElo() > $driver2->getElo()) {
        return -1;
    } else {
Example #2
0
$textFormatAliases = array('md', 'markdown', 'text', 'txt', 'source');
$templateHTML = './template.php';
// ---------------------------------------------------------------------------- Configuration
// Still lots of custom stuff below in the code, but eventually it should all
// be here or in external files.
// Var names starting with $_ are a complete pandoc command switch or series of
// switches, whereas those without are filenames, strings or other options, some
// of which will be formed into command switches.
// Should have these options not include the pandoc command switch name or quotes
// and have a section later that forms them. There should also be a common
// command switch assembled to simplify the $command assembly for each format.
require 'config.php';
// ---------------------------------------------------------------------------- End Configuration
// ----
$mdFile = realpath($_SERVER['PATH_TRANSLATED']);
$format = getGetString('format', 'html');
if ($mdFile) {
    // Parse filename bits
    $finfo = pathinfo($mdFile);
    $path = $finfo['dirname'];
    // File system directory name
    $fname = $finfo['basename'];
    // File name with extension, but no path
    $noext = $finfo['filename'];
    // File name without extension and without path
    $extension = $finfo['extension'];
    // File extenstion without dot
    $isIndex = $noext == 'index';
    // Get the URL path to this file from webroot '/', without the filename into $upath
    $uri = $_SERVER['REQUEST_URI'];
    // REQUEST_URL gives empty string