示例#1
0
 public static function nextActive()
 {
     $stmt = parent::$conn->prepare("SELECT * FROM contest WHERE contest_start = 0 ORDER BY contest_id ASC LIMIT 1");
     $contest = new contest($stmt);
     if ($contest->found()) {
         return $contest;
     }
     $stmt = parent::$conn->prepare("SELECT contest_name, contest_desc FROM contest GROUP BY contest_name, contest_desc ORDER BY COUNT(*) ASC, RAND() LIMIT 1");
     $randcontest = new contest($stmt);
     if (!$randcontest->found()) {
         return new contest(['name' => 'Placeholder', 'desc' => '-']);
     }
     return new contest(['name' => $randcontest->name, 'desc' => $randcontest->desc]);
 }
示例#2
0
?>

	<div id="contests">
		<?php 
echo $contest->count();
?>
 contests found <?php 
if ($max == 10) {
    ?>
(10 newest shown - <a href="/manage/contest/all">click here to show all</a>)<?php 
}
?>
	</div>

	<?php 
while ($contest->found() && $i++ < $max) {
    ?>
	<div id="<?php 
    echo $i;
    ?>
">
		<?php 
    if ($contest->start == 0) {
        echo $contest->name, ': ', $contest->desc, ' [queued]';
    } else {
        if ($contest->end == 0) {
            echo $contest->name, ': ', $contest->desc, ' [active since ', date('H:i:s d-m-Y', $contest->start), ']';
        } else {
            echo $contest->name, ': ', $contest->desc, ' [', date('H:i:s d-m-Y', $contest->start), '] to [', date('H:i:s d-m-Y', $contest->end), ']';
            $medal = $contest->medal();
            while ($medal->found()) {