Exemplo n.º 1
0
 function testDeleteMatch()
 {
     $table = new FoosTable(dirname(__FILE__) . '/testData/');
     $table->loadCurrentStatus();
     $matches = $table->getMatches();
     $match = $matches[3];
     $this->assertEqual($table->getNumberOfMatches(), 37);
     $this->assertTrue($table->deleteMatch($match->getTimestamp()));
     $this->assertEqual($table->getNumberOfMatches(), 36);
     $this->assertFalse($table->deleteMatch($match->getTimestamp()));
     $this->assertEqual($table->getNumberOfMatches(), 36);
 }
Exemplo n.º 2
0
<?php

//** Model **//
require_once 'foos.class.php';
//** Constants **//
$workingPath = '/userhome/marek/foos/';
//** Controller **//
// Delete
if (isset($_GET['delete'])) {
    $timestamp = $_GET['delete'] * 1;
    $tmpTable = new FoosTable($workingPath);
    $tmpTable->loadCurrentStatus();
    $tmpTable->deleteMatch($timestamp);
    $tmpTable->saveToFile();
    // Remove ?delete=xxx part from URL
    header('Location: foos.php');
    die;
}
// Current data
$table = new FoosTable($workingPath);
$maxGamesInGraph = 50;
$table->setLogMaxSize($maxGamesInGraph);
$table->loadCurrentStatus();
$table->calculateScore();
// Table with data 48h old (to display changes)
$tableOld = new FoosTable($workingPath);
$tableOld->loadStatusForTime(time() - 48 * 60 * 60);
$tableOld->calculateScore();
//** View **//
?>
<!doctype html>