-
-
Save LaocheXe/65be0a43db565f55e03194ed8852f05e to your computer and use it in GitHub Desktop.
Rules page, current issue - Displays each game, then ladder - 3 games, game_id 1, game_id 1 & 2m game_id 1, 2, & 3 - list ladders that way as well,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/***********************************/ | |
// www.defiantz.org // | |
// rules.php // | |
// For eWL // | |
// created by // | |
// Travis "LaocheXe" Thoene // | |
/***********************************/ | |
// TODO - Broken, Need to get fix later | |
if (!defined('e107_INIT')) | |
{ | |
require_once("../../class2.php"); | |
} | |
e107::lan('rules'); //('rules', true); | |
define('PAGE_NAME', LAN_eWL_RULES); | |
require_once(HEADERF); | |
e107::meta('keywords', 'rules'); // Do we need more for this page? | |
$sql = e107::getDB(); | |
$sql1 = e107::getDB(); | |
$sql2 = e107::getDB(); | |
$tp = e107::getParser(); | |
//$ns = e107::getRender(); | |
$text = ''; | |
//$ladderid = $_GET['id']; | |
//$generalid = $_GET['id']; | |
// TODO - Update This To Show General Rules, Ladder Rules, Etc... | |
if(!$sql->count('ewl_rules')) | |
{ | |
// If No Rules Listed Yet | |
$text = LAN_eWL_RULES_NONEYET; | |
e107::getRender()->tablerender(LAN_eWL_RULES, $text); | |
require_once(FOOTERF); | |
exit; | |
} | |
$text .= " | |
<table width='100%' align='center' border='0' cellspacing='0' cellpadding='5'> | |
<tr> | |
<td width='100%' valign='top' align='left'> | |
<table width='100%' border='0' cellspacing='0' cellpadding='0'> | |
<tr> | |
<td width='50%' valign='top' align='left'> | |
"; | |
// if this is looking at ladder rule info | |
//if() | |
//{ | |
//} | |
// else look at full list of rules, and ladders | |
//else | |
//{ | |
/** OLD CODE - | |
//GATEGORYS FOR GENERAL RULES - eXe | |
$getgcats=mysql_query("SELECT gid,gruletitle FROM grules ORDER by gruletitle"); | |
while(list($gid,$gruletitle)=mysql_fetch_row($getgcats)){ | |
$thisgcategory=$thisgcategory."$out[bulletleft] <a href='$url[base]/$file[rules]?rulesid=#rule$gid'>$gruletitle</a><br>";} | |
//GAMES | |
$getgames=mysql_query("SELECT id,gamename FROM games WHERE status='1' ORDER by gamename"); | |
while(list($gid,$gamename)=mysql_fetch_row($getgames)){ | |
$thisladder=$thisladder."<b>+ $gamename</b><br>"; | |
$thissolaris=$thissolaris."<b>+ $gamename</b><br>"; | |
//LADDERS | |
$getladders=mysql_query("SELECT id,laddername FROM ladders WHERE gameon='$gid' ORDER by laddername"); | |
while(list($lid,$laddername)=mysql_fetch_row($getladders)){ | |
$thisladder=$thisladder."$out[bulletleft] <a href='$url[base]/$file[rules]?ladderid=$lid'>$laddername</a><br>";} | |
//Solaris - eXe | |
$getsladders=mysql_query("SELECT id,laddername FROM sladders WHERE gameon='$gid' ORDER by laddername"); | |
while(list($lid,$laddername)=mysql_fetch_row($getsladders)){ | |
$thissolaris=$thissolaris."$out[bulletleft] <a href='$url[base]/$file[srules]?ladderid=$lid'>$laddername</a><br>";} | |
} | |
**/ | |
$sqlGeneralCatagories = "SELECT rule_id,rule_name,ladder_id FROM `#ewl_rules` WHERE ladder_id = 0 ORDER by rule_name"; | |
//$sqlLaddersCatagories = "SELECT r.rule_id, r.rule_name, l.ladder_id, g.game_id FROM `#ewl_rules` AS r LEFT JOIN `#ewl_ladders` AS l ON l.ladder_id = r.ladder_id LEFT JOIN `#ewl_games` AS g on g.game_id = l.game_id"; | |
//$sqlGamesCatagories = "SELECT game_id, game_name FROM `#ewl_games` ORDER BY game_name"; | |
//$sqlLaddersCatagories = "SELECT l.ladder_id, l.ladder_name, l.game_id FROM `#ewl_ladders` AS l LEFT JOIN `#ewl_games` AS g ON g.game_id = l.game_id"; | |
$text .= " | |
<table width='100%' border='0' cellspacing='0' cellpadding='0'> | |
<tr> | |
<td width='100%' valign='top' align='left'> | |
<strong><font class='catfont'>General Rules</font></strong> | |
<hr class='catfont' size='1'> | |
"; | |
// First While works, second breaks the code. | |
$generalRules = $sql->gen($sqlGeneralCatagories); // Maybe use retrive instead of gen | |
while($glist=$sql->fetch($sqlGeneralCatagories)) | |
{ | |
$generalSet .= "<font class='catfont'>»</font><a href='rules.php?ruleid=".$glist['rule_id']."'>".$glist['rule_name']."</a><br>"; | |
} | |
// Make Select Statement for Games instead of e107 method? | |
//$games = $sql->select('ewl_games', 'game_id, game_name, game_status', 'game_status = 1'); | |
//$sqlGamesCatagories = "SELECT game_id, game_name, game_status FROM `#ewl_games` ORDER BY game_name ASC"; | |
//$gamesList = $sql->gen($sqlGamesCatagories); | |
//$theGames = array(); | |
//while($gameList=$sql->fetch($sqlGamesCatagories)) //returns first sql entry with above #sql->select | |
//for($i = 1; $i <= 1; $i++) | |
//{ | |
//$listGames = $sql1->retrieve('ewl_games', 'game_id, game_name, game_status', 'game_status = 1 ORDER BY game_name ASC', true); | |
$listGamesHere = "SELECT game_id, game_name, game_status FROM `#ewl_games` WHERE game_status = 1 ORDER BY game_name ASC"; | |
$listGames = $sql1->gen($listGamesHere); | |
while(list($game_id, $game_name)=$sql1->fetch($listGames)) | |
{ | |
//foreach($games as $game['game_name'] => $game_name) | |
//{ | |
$gameSet .= "<b>+ ".$game_name."</b><br>"; | |
//} | |
$sqlLaddersCatagories = "SELECT ladder_id, ladder_name FROM `#ewl_ladders` WHERE game_id = ".$game_id.""; | |
$getLadders = $sql1->gen($sqlLaddersCatagories); | |
while(list($ladder_id, $ladder_name)=$sql1->fetch($getLadders)) | |
{ | |
$gameLadders .= " <font class='catfont'>»</font><a href='rules.php?ruleid=".$ladder_id."'>".$ladder_name."</a><br>"; | |
var_dump($ladder_name); | |
} | |
//$gameLadderSet .= "".$gameSet."".$gameLadders; | |
var_dump($ladder_name); | |
print_r($getLadders); | |
} | |
$gameLadderSet .= "".$gameSet."".$gameLadders; | |
$text .= " | |
".$generalSet." | |
</td> | |
</tr> | |
</table> | |
<br> | |
<br> | |
<table width='100%' border'0' cellspacing='0' cellpadding='0'> | |
<tr> | |
<td width='100%' valign='top' align='left'> | |
<strong><font class='catfont'>Ladder Rules</font></strong> | |
<hr class='catfont' size='1'> | |
".$gameLadderSet." | |
</td> | |
</tr> | |
</table> | |
</td> | |
<td width='10' valign='top' align='center'> </td> | |
<td width='50%' valign='top' align='left'> | |
"; | |
//} | |
// List the rules on the right side - New query, LEFT JOIN user_id | |
$generalRulesDisplay = "SELECT r.rule_id, r.rule_name, r.rule_description, r.rule_datestamp, u.user_id, u.user_name FROM `#ewl_rules` AS r | |
LEFT JOIN `#user` AS u ON r.user_id = u.user_id | |
WHERE r.ladder_id = 0"; | |
$sql->gen($generalRulesDisplay); | |
while($rules=$sql->fetch($generalRulesDisplay)) | |
{ | |
// TODO - MAKE LAN's FOR THE NEEDED LINES | |
$ruleBody = $tp->toHTML($rules['rule_description'], true, 'DESCRIPTION'); // 'DESCRIPTION' might be removed | |
$text .= "<table width='100%' border='0' cellspacing='0' cellpadding='0'> | |
<tr> | |
<td width='50%' valign='top' align='left'> | |
<strong><font class='catfont'>".$rules['rule_name']."</font></strong> | |
<hr class='catfont' size='1'> | |
".$ruleBody."<p align='right'><small>Last Updated was on ".$tp->toDate($rules['rule_datestamp'])." by <a href='$site[mainurl]/profile.php?lookup=".$rules['user_id']."'>".$rules['user_name']."</a></small></p></td> | |
</tr> | |
</table> | |
<br> | |
"; | |
} | |
$text .= " | |
</td> | |
</tr> | |
</table> | |
<br> | |
</td> | |
</tr> | |
</table> | |
"; | |
e107::getRender()->tablerender(LAN_eWL_RULES, $text); | |
require_once(FOOTERF); | |
exit; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment