<thead> <tr> <th>Title</th> <th>Suggestions Open</th> <th>Jam Start</th> <th>Status</th> </tr> </thead> <tbody> <?php foreach ($jams as $jam) { echo ' <tr class="jamrow" jamviewurl="' . $routes->generate('jam_page', array('id' => $jam['id'])) . '"> <td>' . $jam['title'] . '</td> <td>' . date(DATETIME_FORMAT, SuggestionsBegin($jam)) . '</td> <td>' . date(DATETIME_FORMAT, JamBegins($jam)) . '</td> <td>' . JamStatusString($jam['status']) . '</td> </tr>'; } ?> </tbody> </table> <?php if (count($jams) == 0) { echo 'Nothing was found :('; } ?> </div> </div> <script>
<?php require SCRIPTROOT . 'jamstates.php'; $stmt = $dbconnection->prepare('SELECT * FROM jams ORDER BY suggestionsbegin DESC;'); $stmt->execute(); $rows = $stmt->fetchAll(); $jams = array(); foreach ($rows as $row) { $jam = array(); $jam['id'] = $row['id']; $jam['title'] = $row['title']; $jam['status'] = $row['status']; $jam['suggestionsbegin'] = SuggestionsBegin($row); $jam['votingbegins'] = VotingBegins($row); $jam['themeannounce'] = ThemeAnnounce($row); $jam['jambegins'] = JamBegins($row); $jam['submissionsbegin'] = SubmissionsBegin($row); $jam['submissionsend'] = SubmissionsEnd($row); $jam['judgingends'] = JudgingEnds($row); array_push($jams, $jam); } SendResponse($jams);
function JamRemainingTime($Jam) { if ($Jam['status'] == JamStatus::Disabled || $Jam['status'] == JamStatus::Complete) { return 0; } else { if ($Jam['status'] == JamStatus::Judging) { return JudgingEnds($Jam) - time(); } else { if ($Jam['status'] == JamStatus::ReceivingGameSubmissions) { return SubmissionsEnd($Jam) - time(); } else { if ($Jam['status'] == JamStatus::JamRunning) { return SubmissionsBegin($Jam) - time(); } else { if ($Jam['status'] == JamStatus::ThemeAnnounced) { return JamBegins($Jam) - time(); } else { if ($Jam['status'] == JamStatus::ThemeVoting) { return ThemeAnnounce($Jam) - time(); } else { if ($Jam['status'] == JamStatus::WaitingThemeApprovals) { return VotingBegins($Jam) - time(); } else { if ($Jam['status'] == JamStatus::ReceivingSuggestions) { return ApprovalsBegin($Jam) - time(); } else { if ($Jam['status'] == JamStatus::WaitingSuggestionsStart) { return SuggestionsBegin($Jam) - time(); } } } } } } } } } }
<div class="row"> <h2 class="text-center"><strong><a href="<?php echo $routes->generate('jam_page', array('id' => $id)); ?> "><?php echo $jam['title']; ?> </a></strong></h2> <h4 class="text-center text-muted"><?php echo date(DATE_FORMAT, JamBegins($jam)) . ' to ' . date(DATE_FORMAT, SubmissionsBegin($jam)); ?> </h4> <?php if (isset($jam['selectedtheme'])) { echo '<h2 class="text-center text-warning aftertag" aftertag="is the chosen theme">\'<i>' . $jam['selectedtheme'] . '</i>\'</h2>'; } ?> <?php require TEMPLATEROOT . 'countdown.php'; ?> <hr /> </div>
</blockquote> </div> <hr />'; } if (count($news) == 0) { echo '<h4 class="pull-left">Nothing was found :(</h4>'; } ?> </div> <!-- Upcoming Jams --> <div class="col-md-4 col-md-offset-1"> <h3 id="jams"><strong>Upcoming Jams</strong></h3> <?php foreach ($jams as $jam) { echo ' <div class="row"> <a href="' . $routes->generate('jam_page', array('id' => $jam['id'])) . '"> <h4 class="pull-left inline">' . $jam['title'] . '</h4> <h4 class="pull-right inline"><small>' . date(DATETIME_FORMAT, JamBegins($jam)) . '</small></h4> </a> </div> <hr />'; } if (count($jams) == 0) { echo '<h4 class="pull-left">Nothing was found :(</h4>'; } ?> </div> </div>