0"; if (!$mechaGrpAdm) $whereSlag .= ' AND vHidden = 0'; ?>

Volleybattle Matches


'; echo ''; echo ''; echo '
'; echo 'Latest entries uploaded:

'; echo '
'; echo ''; $numsThumbs = 0; $sql = "SELECT v.*, e.entID, e.vTurn, e.entRandom, e.entExt , date_format(e.entModify,'%c/%e @ %l:%i %p') as entDatez FROM $m.volleyMatches v, $m.entries e WHERE v.vHidden = 0 AND v.slagID = e.slagID AND e.entSize > 0 ORDER BY e.entCreated DESC LIMIT 10"; if ( !($result = $dbMain->mecha_query($sql)) ) { $dbMain->mecha_breakd('Could not retrieve volleybattle thumbs.', $sql); } while ($row = $dbMain->mecha_fetchrow($result)) { $vid = $row[volleyID]; $vTitle = $row[volleyTitle]; $slagid = $row[slagID]; $entid = $row[entID]; $imgSrc = 'slags/'.$slagid.'/'.$entid.$row[entRandom].'-t2seth.'.$row[entExt]; // set status if ($row[volleyStart] > $when){ $stat = 'upcoming'; }elseif ($row[volleyEnd] > $when){ $stat = 'ongoing'; }else{ $stat = 'ended'; } $tmpEarr = explode(" ", $row[volleyEnd]); $tmpEdate = explode("-", $tmpEarr[0]); $tmpEtime = explode(":", $tmpEarr[1]); // $tmpTimez = mktime($tmpEtime[0], $tmpEtime[1], $tmpEtime[2], $tmpEdate[1], $tmpEdate[2]-2, $tmpEdate[0]); $voteBegin = date('Y-m-d H:i:s',$tmpTimez); $canVoteNow = ($voteBegin <= $when) ? 1 : 0; ///////////////////////////////////////////////////////////////////////////// $tmpEarr = explode(" ", $row[volleyStart]); $tmpEdate = explode("-", $tmpEarr[0]); $tmpEtime = explode(":", $tmpEarr[1]); // $tmpTimez = mktime($tmpEtime[0], $tmpEtime[1], $tmpEtime[2], $tmpEdate[1], $tmpEdate[2], $tmpEdate[0]); $tmpNumEnts = $row[numEnts]; // determine # of entries actually displayed in contest if ($stat == 'upcoming' || $stat == 'ongoing') { $currentTurn = 1; $battleOngoing = ''; $roundloop = $row[numRounds] * 2; $tmpBeginArr = explode(" ", $row[volleyStart]); $tmpBdate = explode("-", $tmpBeginArr[0]); $tmpBtime = explode(":", $tmpBeginArr[1]); for($i=1; $i <= $roundloop; $i++) // $i is the current round { // hour minute second month day year $tmpTimez = mktime($tmpBtime[0], $tmpBtime[1], $tmpBtime[2], $tmpBdate[1], $tmpBdate[2] + ($i*2), $tmpBdate[0]); $roundArr[$i] = date('Y-m-d H:i:s',$tmpTimez); if ($when >= $roundArr[$i]){ $currentTurn++; $battleOngoing = 1; } } $tmpNumEnts = ($battleOngoing) ? $currentTurn : 0; //stubborn first entry fix: if ($row[volleyStart] <= $when && $tmpNumEnts == 0) $tmpNumEnts = 1; } ######################################################### // okay to show this thumb?? if ($row[vTurn] <= $tmpNumEnts && $numsThumbs < 4) //ok to show { echo ''; $numsThumbs++; } } $dbMain->mecha_freeresult($result); echo '
'; echo ''; echo ''.$vTitle.''; echo '
'.$row[entDatez]; echo '
'; echo '
'; } ############################################################################################ ############################################################################################ ############################################################################################ ############################################################################################ ############################################################################################ ?>
mecha_query($sql)) ) { $dbMain->mecha_breakd('Could not retrieve number of volleys to display.', $sql); } $mems = $dbMain->mecha_numrows($result); $dbMain->mecha_freeresult($result); // if there are no slags for the criteria, set variable (to display below) unset($noResultsFound); if ($mems == 0) { $noResultsFound = ''; $noResultsFound .= ''; } // $divide = $mems / $display; $pages = ceil($divide); if(!$pid || $pid < 1) { $pid = "1"; } elseif($pid >= $pages) { $pid = $pages; } if($pid == "1") { $start = "0"; } else { $start = $display * ($pid - 1); } echo ''; echo ""; echo ""; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ""; //query matches $query = "select volleyID, vHidden, volleyStart, volleyEnd, volleyTitle, numRounds, numEnts, numCmts, winnerID, forfeitID , date_format(volleyStart,'%c/%d/%y') as startTime , date_format(volleyEnd,'%c/%d/%y') as endTime FROM $m.volleyMatches $whereSlag ORDER BY $junk LIMIT $start,$display"; if ( !($result = $dbMain->mecha_query($query)) ) { $dbMain->mecha_breakd('Could not retrieve volleybattle list data.', $query); } while($row = $dbMain->mecha_fetchrow($result)) { // set style for slag title link if ($row[volleyStart] > $when){ $vWinner = 'n/a'; $stat = 'upcoming'; $statcell = ''; }elseif ($row[volleyEnd] > $when){ $vWinner = 'n/a'; $stat = 'ongoing'; $statcell = ''; }else{ $vWinner = ''.getMember($row[winnerID]).''; $stat = 'ended'; $statcell = ''; } // if ($row[forfeitID] > 0) $vWinner = ''.getMember($row[winnerID]).''; // set status $tmpEarr = explode(" ", $row[volleyEnd]); $tmpEdate = explode("-", $tmpEarr[0]); $tmpEtime = explode(":", $tmpEarr[1]); // $tmpTimez = mktime($tmpEtime[0], $tmpEtime[1], $tmpEtime[2], $tmpEdate[1], $tmpEdate[2]-2, $tmpEdate[0]); $voteBegin = date('Y-m-d H:i:s',$tmpTimez); $canVoteNow = ($voteBegin <= $when) ? 1 : 0; $canVoteDisplay = date("n/j/Y",strtotime($voteBegin)); ///////////////////////////////////////////////////////////////////////////// $tmpEarr = explode(" ", $row[volleyStart]); $tmpEdate = explode("-", $tmpEarr[0]); $tmpEtime = explode(":", $tmpEarr[1]); // $tmpTimez = mktime($tmpEtime[0], $tmpEtime[1], $tmpEtime[2], $tmpEdate[1], $tmpEdate[2], $tmpEdate[0]); $matchStart = date('Y-m-d H:i:s',$tmpTimez); $matchStartDisplay = date("n/j/Y",strtotime($matchStart)); if (($canVoteNow) && $stat != 'ended') { $stat = 'vote'; $statcell = ''; // }elseif ($stat == 'upcoming'){ // $showstat = 'Battle begins: '.$matchStartDisplay.''; // }elseif ($stat == 'ongoing'){ // $showstat = 'Voting starts: '.$canVoteDisplay.''; } $tmpNumEnts = $row[numEnts]; // determine # of entries actually displayed in contest if ($stat == 'upcoming' || $stat == 'ongoing') { $currentTurn = 1; $battleOngoing = ''; $roundloop = $row[numRounds] * 2; $tmpBeginArr = explode(" ", $row[volleyStart]); $tmpBdate = explode("-", $tmpBeginArr[0]); $tmpBtime = explode(":", $tmpBeginArr[1]); for($i=1; $i <= $roundloop; $i++) // $i is the current round { // hour minute second month day year $tmpTimez = mktime($tmpBtime[0], $tmpBtime[1], $tmpBtime[2], $tmpBdate[1], $tmpBdate[2] + ($i*2), $tmpBdate[0]); $roundArr[$i] = date('Y-m-d H:i:s',$tmpTimez); if ($when >= $roundArr[$i]){ $currentTurn++; $battleOngoing = 1; } } $tmpNumEnts = ($battleOngoing) ? $currentTurn : 0; //stubborn first entry fix: if ($row[volleyStart] <= $when && $tmpNumEnts == 0) $tmpNumEnts = 1; } $vTitleText = ''.$row[volleyTitle].''; $cmtsLink = ''.$row[numCmts].''; $entsLink = ''.$tmpNumEnts.''; // display, if not hidden if ($row[vHidden] == 0 || ($mechaGrpAdm)) { if ($alternate == "1") { $color = $altRow; $alternate = "2"; } else { $color = "#FFFFFF"; $alternate = "1"; } echo ''; echo ''; echo $statcell; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } } $dbMain->mecha_freeresult($result); // if no results, display message (set above, after the pagination query) if ($noResultsFound) echo $noResultsFound; echo ""; echo "'; echo ''; include "global/footer.php"; ?>