Skip to content

Commit

Permalink
Added an option to disable the countdown timer
Browse files Browse the repository at this point in the history
  • Loading branch information
zsbzsb committed Feb 2, 2014
1 parent 79a5662 commit 66a2239
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 73 deletions.
148 changes: 80 additions & 68 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,26 @@
echo '<br><h3>The '.$rows[0]['Title'].' is around the corner</h3>';
echo '<br><h3>It will begin on '.$rows[0]['BeginTime'].' with theme selection a few weeks earlier</h3>';
}
$stmt = $connection->prepare("SELECT CountdownStart FROM jams WHERE ID = ?;");
$stmt->execute(array($ActiveJamID));
$rows = $stmt->fetchAll();
date_default_timezone_set('UTC');
echo '<script src="countdown.js" type="text/javascript"></script>';
$tm = strtotime($rows[0]['CountdownStart']);
$diff = $tm - time();
$hi = "hour";
if ($diff >= 86400) $hi = "day";
echo '<div style="display: block; margin: 15px auto; width: 300px; height 60px;">
<script type="application/javascript">
var countdown = new Countdown({
time: '.$diff.',
width:240,
height:60,
rangeHi:"'.$hi.'",
style:"flip" }); </script></div>';
if ($CountdownEnabled)
{
$stmt = $connection->prepare("SELECT CountdownStart FROM jams WHERE ID = ?;");
$stmt->execute(array($ActiveJamID));
$rows = $stmt->fetchAll();
date_default_timezone_set('UTC');
echo '<script src="countdown.js" type="text/javascript"></script>';
$tm = strtotime($rows[0]['CountdownStart']);
$diff = $tm - time();
$hi = "hour";
if ($diff >= 86400) $hi = "day";
echo '<div style="display: block; margin: 15px auto; width: 300px; height 60px;">
<script type="application/javascript">
var countdown = new Countdown({
time: '.$diff.',
width:240,
height:60,
rangeHi:"'.$hi.'",
style:"flip" }); </script></div>';
}
}
else if ($WaitingOnTheme)
{
Expand All @@ -64,23 +67,26 @@
echo '<br><h3>The theme will be announced for the '.$rows[0]['Title'].' in just a short while</h3>';
echo '<br><h3>Keep watching this page for the theme announcement</h3>';
echo '<br><h3>Oh, and for the billionth time, the jam will begin on '.$rows[0]['BeginTime'].'</h3>';
$stmt = $connection->prepare("SELECT CountdownStart FROM jams WHERE ID = ?;");
$stmt->execute(array($ActiveJamID));
$rows = $stmt->fetchAll();
date_default_timezone_set('UTC');
echo '<script src="countdown.js" type="text/javascript"></script>';
$tm = strtotime($rows[0]['CountdownStart']);
$diff = $tm - time();
$hi = "hour";
if ($diff >= 86400) $hi = "day";
echo '<div style="display: block; margin: 15px auto; width: 300px; height 60px;">
<script type="application/javascript">
var countdown = new Countdown({
time: '.$diff.',
width:240,
height:60,
rangeHi:"'.$hi.'",
style:"flip" }); </script></div>';
if ($CountdownEnabled)
{
$stmt = $connection->prepare("SELECT CountdownStart FROM jams WHERE ID = ?;");
$stmt->execute(array($ActiveJamID));
$rows = $stmt->fetchAll();
date_default_timezone_set('UTC');
echo '<script src="countdown.js" type="text/javascript"></script>';
$tm = strtotime($rows[0]['CountdownStart']);
$diff = $tm - time();
$hi = "hour";
if ($diff >= 86400) $hi = "day";
echo '<div style="display: block; margin: 15px auto; width: 300px; height 60px;">
<script type="application/javascript">
var countdown = new Countdown({
time: '.$diff.',
width:240,
height:60,
rangeHi:"'.$hi.'",
style:"flip" }); </script></div>';
}
}
else if ($ThemeVisible)
{
Expand All @@ -90,23 +96,26 @@
echo '<br><h3>The theme has been chosen for '.$rows[0]['Title'].'</h3>';
echo '<br><h3>Base your game on "'.$rows[0]['ChosenTheme'].'"!</h3>';
echo '<br><h3>And get ready to rumble....<br> The jam will begin on '.$rows[0]['BeginTime'].'</h3>';
$stmt = $connection->prepare("SELECT CountdownStart FROM jams WHERE ID = ?;");
$stmt->execute(array($ActiveJamID));
$rows = $stmt->fetchAll();
date_default_timezone_set('UTC');
echo '<script src="countdown.js" type="text/javascript"></script>';
$tm = strtotime($rows[0]['CountdownStart']);
$diff = $tm - time();
$hi = "hour";
if ($diff >= 86400) $hi = "day";
echo '<div style="display: block; margin: 15px auto; width: 300px; height 60px;">
<script type="application/javascript">
var countdown = new Countdown({
time: '.$diff.',
width:240,
height:60,
rangeHi:"'.$hi.'",
style:"flip" }); </script></div>';
if ($CountdownEnabled)
{
$stmt = $connection->prepare("SELECT CountdownStart FROM jams WHERE ID = ?;");
$stmt->execute(array($ActiveJamID));
$rows = $stmt->fetchAll();
date_default_timezone_set('UTC');
echo '<script src="countdown.js" type="text/javascript"></script>';
$tm = strtotime($rows[0]['CountdownStart']);
$diff = $tm - time();
$hi = "hour";
if ($diff >= 86400) $hi = "day";
echo '<div style="display: block; margin: 15px auto; width: 300px; height 60px;">
<script type="application/javascript">
var countdown = new Countdown({
time: '.$diff.',
width:240,
height:60,
rangeHi:"'.$hi.'",
style:"flip" }); </script></div>';
}
}
else if ($JamRunning)
{
Expand All @@ -116,23 +125,26 @@
echo '<br><h3>The '.$rows[0]['Title'].' is now in progress!</h3>';
echo '<br><h3>Get a move on it and base your game on "'.$rows[0]['ChosenTheme'].'"!</h3>';
echo '<br><h3>Don'."'".'t forget the jam and all submissions will end on '.$rows[0]['EndTime'].'</h3>';
$stmt = $connection->prepare("SELECT CountdownEnd FROM jams WHERE ID = ?;");
$stmt->execute(array($ActiveJamID));
$rows = $stmt->fetchAll();
date_default_timezone_set('UTC');
echo '<script src="countdown.js" type="text/javascript"></script>';
$tm = strtotime($rows[0]['CountdownEnd']);
$diff = $tm - time();
$hi = "hour";
if ($diff >= 86400) $hi = "day";
echo '<div style="display: block; margin: 15px auto; width: 300px; height 60px;">
<script type="application/javascript">
var countdown = new Countdown({
time: '.$diff.',
width:240,
height:60,
rangeHi:"'.$hi.'",
style:"flip" }); </script></div>';
if ($CountdownEnabled)
{
$stmt = $connection->prepare("SELECT CountdownEnd FROM jams WHERE ID = ?;");
$stmt->execute(array($ActiveJamID));
$rows = $stmt->fetchAll();
date_default_timezone_set('UTC');
echo '<script src="countdown.js" type="text/javascript"></script>';
$tm = strtotime($rows[0]['CountdownEnd']);
$diff = $tm - time();
$hi = "hour";
if ($diff >= 86400) $hi = "day";
echo '<div style="display: block; margin: 15px auto; width: 300px; height 60px;">
<script type="application/javascript">
var countdown = new Countdown({
time: '.$diff.',
width:240,
height:60,
rangeHi:"'.$hi.'",
style:"flip" }); </script></div>';
}
}
else if ($JamCompleted)
{
Expand Down
12 changes: 7 additions & 5 deletions settings/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@
$NextJamQued = false; // Generally Used with theme selection
$WaitingOnTheme = false; // Used when voting is finished and before the theme is visible
$ThemeVisible = false; // Used when voting is finished before the jam is running
$JamRunning = false; // Used with submitting and editing game entries
$JamRunning = true; // Used with submitting and editing game entries
$JamCompleted = false; // Used with editing game entries before the next jam

/* Any of the following may be active at any time - note above and make smart choices */
$ThemeSuggestionsOpen = false;

$ThemeVotingOpen = false;

$AddGamesActive = false;
$AddGamesActive = true;

$EditGamesActive = false;
$EditGamesActive = true;

$ThemeResultsVisible = false;

$JamGalleryActive = false;
$JamGalleryActive = true;

$CountdownEnabled = false;

/* $ActiveJam must be set to a valid jam ID in the database */
$ActiveJamID = -1;
$ActiveJamID = 1;
$MaxSuggestions = 2;
$MaxVotes = 4;
?>

0 comments on commit 66a2239

Please sign in to comment.