Пример #1
0
function GetRecentlyCompletedTournaments($connection)
{
    $tournaments = GetTournaments($connection, '');
    $now = new DateTime("now");
    $currentTournaments = array();
    for ($i = 0; $i < count($tournaments); ++$i) {
        // Get the start date
        $start = new DateTime($tournaments[$i]->StartDate);
        // this is just for testing
        //$start->sub(new DateInterval ( 'P28D' ));
        $endPlusWeek = new DateTime($tournaments[$i]->EndDate);
        // Show the details for a week
        $endPlusWeek->add(new DateInterval('P8D'));
        //echo 'start ' . date ( 'M d', $start->getTimestamp() ) . ', end ' . date ( 'M d', $end->getTimestamp() ) . '<br>';
        if ($start <= $now && $endPlusWeek >= $now) {
            $details = GetTournamentDetails($connection, $tournaments[$i]->TournamentKey);
            if ($details->ChitsPostedDate != TournamentDetails::EMPTYDATE || $details->ClosestToThePinPostedDate != TournamentDetails::EMPTYDATE || $details->PoolPostedDate != TournamentDetails::EMPTYDATE || $details->ScoresPostedDate != TournamentDetails::EMPTYDATE || $tournaments[$i]->MatchPlay == 1) {
                $currentTournaments[] = $tournaments[$i];
            }
        }
    }
    return $currentTournaments;
}
Пример #2
0
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . '/login.php';
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $script_folder . '/functions.php';
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $script_folder . '/tournament_functions.php';
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $wp_folder . '/wp-blog-header.php';
date_default_timezone_set('America/Los_Angeles');
$year = $_GET['year'];
if (!$year) {
    $year = date("Y");
}
$overrideTitle = $year . " Tournament Schedule";
get_header();
echo ' <div id="content-container" class="entry-content">';
echo '    <div id="content" role="main">';
$connection = new mysqli('p:' . $db_hostname, $db_username, $db_password, $db_database);
$tournaments = GetTournaments($connection, $year);
echo '<h2 style="text-align:center">' . $year . ' Tournament Schedule</h2><br>';
echo '<table style="border:none;margin-left:auto;margin-right:auto">' . PHP_EOL;
echo '<thead><tr class="header">';
echo '<th>Date</th>';
echo '<th>Name</th>';
echo '<th>Description</th>';
echo '<th>Scores</th>';
echo '<th>Chits</th>';
echo '<th>Pool</th>';
echo '<th>Closest to Pin</th>';
echo '</tr></thead>' . PHP_EOL;
echo '<tbody>' . PHP_EOL;
for ($i = 0; $i < count($tournaments); ++$i) {
    if ($i % 2 == 0) {
        echo '<tr class="d1">';