Exemplo n.º 1
0
 function testLog()
 {
     $table = new FoosTable(dirname(__FILE__) . '/testData/');
     $table->loadCurrentStatus();
     $table->setLogMaxSize(15);
     $table->calculateScore();
     $log = $table->getLog();
     $this->assertEqual(count($log), 15);
     $this->assertEqual(count($log[0]), 11);
 }
Exemplo n.º 2
0
        
                    var playerChart = new google.visualization.Table(document.getElementById('player_chart'));
                    playerChart.draw(playerTable, playerOptions);
        
                    // Log data
                    var logTable = new google.visualization.DataTable();
                    logTable.addColumn('string', 'Game #');
        
                    <?php 
foreach ($table->getPlayersWithoutIgnoredOnes() as $player) {
    echo "logTable.addColumn('number', '" . $player->getName() . "');\n";
}
echo "logTable.addRows([";
$i = 1;
$matches = $table->getMatches();
foreach ($table->getLog() as $logEntry) {
    $index = max(count($matches) - ($maxGamesInGraph + 1) + $i, 0);
    $match = $matches[$index];
    if ($match instanceof FoosMatch) {
        echo "['" . $match->getPlayer1()->getName() . " vs. " . $match->getPlayer2()->getName() . " (" . date('d F Y g:i A', $match->getTimestamp()) . ")" . "'";
        foreach ($table->getPlayersWithoutIgnoredOnes() as $player) {
            echo "," . round($logEntry[$player->getNormalizedName()]);
        }
        echo "],\n";
    }
    $i++;
}
echo "]);";
?>
        
                    var logOptions = {