diff --git a/admin/db_config.php b/admin/db_config.php index 5a2bbb7..ea7d7c5 100644 --- a/admin/db_config.php +++ b/admin/db_config.php @@ -7,15 +7,21 @@ $dbUsername = "USERNAME"; $dbPassword = "PASSWORD"; $dbName = "DBNAME"; - /*////// USER-CONFIGURABLE VARIABLES HERE ///////// + +/*///// MISC VARIABLES /////// +////////////////////////////*/ + +// The maximum number of tourneys we show on the home page +$tourneyCardLimit = 6; + + +/*///////////////////////////////////////////////// I don't recommend you change these, but if you know what you're doing, have at 'er - /////////////////////////////////////////////////*/ - $userTableName = "users"; // name of the table containing user data $gameDataTableName = "games"; // table containing replay data $tournamentDataTableName = "tournaments"; // tournament data table diff --git a/display/general_results.php b/display/general_results.php index 992913c..353b9f7 100644 --- a/display/general_results.php +++ b/display/general_results.php @@ -10,6 +10,7 @@ session_start(); + @@ -117,7 +118,7 @@ session_start();

General Information

-
+

 


@@ -185,24 +186,24 @@ session_start(); "; - // TODO; - - // CREATE OUTPUT DISPLAY - document.getElementById("divisionDisplay").innerHTML = html; } function toggleInformationDisplay() { - console.log("echo"); + // Used to swap between 'general information' and 'recent tourney results' on the home page var infoDiv = document.getElementById("generalResultsDisplayPanel"); var tourneyDiv = document.getElementById("tourneyResultsDisplayPanel"); @@ -69,4 +63,25 @@ function toggleInformationDisplay() { infoDiv.style.display = "block"; tourneyDiv.style.display = "none"; } +} + +function refreshTourneyDisplay() { + // Used to refresh the data in the iframe on the main page, under the 'recent tourney results' + // Grab the division buttons by their name + var divisionButtons = document.getElementsByName("resultsDivision"); + var currentDivision = ""; + + + // Loop through the division buttons and see which one is checked + // Set the current division to that option + for (var i = 0; i < divisionButtons.length; i++) { + if (divisionButtons[i].checked) { + currentDivision = divisionButtons[i].value; + } + } + + // Create variable for easier readability + var html = ""; + + document.getElementById("recentTourneyDisplay").innerHTML = html; } \ No newline at end of file diff --git a/styles/data_display.css b/styles/data_display.css index 03523fa..078d940 100644 --- a/styles/data_display.css +++ b/styles/data_display.css @@ -321,6 +321,16 @@ margin-top: 5%; } + #tourneyResultsDisplayPanel { + order: 2; + width: 92%; + margin-right: 0; + padding-left: 2%; + padding-right: 2%; + margin-top: 5%; + } + + #divisionDisplayPanel { order: 1; width: 94%; diff --git a/styles/primary.css b/styles/primary.css index fd44729..e7db73a 100644 --- a/styles/primary.css +++ b/styles/primary.css @@ -9,6 +9,11 @@ width: 100%; } +.newLineThin { + width: 100%; + margin: 0 !important; +} + .disabled { pointer-events: none; cursor: default; diff --git a/styles/tourney_results.css b/styles/tourney_results.css new file mode 100644 index 0000000..8db32c8 --- /dev/null +++ b/styles/tourney_results.css @@ -0,0 +1,55 @@ +.recentTourneyResultsPanel { + display: flex; + flex-direction: column; + flex-wrap: nowrap; + justify-content: center; + text-align: center; + align-items: center; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; +} + +.recentTourneyFrame { + flex-grow: 1; + flex-shrink: 1; + margin: auto; + padding: 0; + border: none; + max-width: 100%; +} + +.tourneyCard { + border: 2px solid rgb(0, 0, 255); + border-radius: 20px; + box-shadow: 0px 2px 4px; + width: 100%; + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; + padding-top: 5px; + padding-bottom: 5px; +} + + +.tourneyCardHeader { + width: 100%; + text-align: left; + margin: 0; + padding-left: 10px; + padding-right: 10px; + font-weight: bold; +} + +.tourneyCardLeft { + text-align: left; + margin: 0; + padding-left: 10px; + padding-right: 10px; +} + +.tourneyCardRight { + text-align: right; + margin: 0; + padding-left: 10px; + padding-right: 10px; +} \ No newline at end of file diff --git a/tournament/recent_results.php b/tournament/recent_results.php new file mode 100644 index 0000000..573aeec --- /dev/null +++ b/tournament/recent_results.php @@ -0,0 +1,96 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + // Get the division from the page + $division = $_GET["division"]; + + // If we want all the data, we don't need to select a division in the SQL query + if ($division == "all") { + $sqlGetTourneyInfo = $conn->prepare("SELECT tournamentName,tournamentDate,tournamentDivision,numPlayers,winningTeamName,winner1,winner2,winner3,winner4 FROM " . $tournamentDataTableName . " ORDER BY tournamentDate DESC LIMIT $tourneyCardLimit"); + } else { + $sqlGetTourneyInfo = $conn->prepare("SELECT tournamentName,tournamentDate,tournamentDivision,numPlayers,winningTeamName,winner1,winner2,winner3,winner4 FROM " . $tournamentDataTableName . " WHERE tournamentDivision='" . $division . "' ORDER BY tournamentDate DESC LIMIT $tourneyCardLimit"); + } + + $sqlGetTourneyInfo->execute(); + +} catch (PDOException $e) { // failed connection + echo "Connection failed: " . $e->getMessage(); +} + +$tourneyResults = $sqlGetTourneyInfo->fetchAll(PDO::FETCH_ASSOC); + +?> + + + + + + + + + + + + no title + + + +
+ format('M j, Y'); + echo (" +
+

$tourneyName

+

+

$tourneyDate

+

$winningTeamName

+

+

$division

+

$winner1

+

+

" . $numPlayers . "v" . $numPlayers . "

"); + if ($numPlayers >= 2) { + echo "

$winner2

"; + } + echo "

"; + if ($numPlayers >= 3) { + echo (" +

+

$winner3

+

"); + } + if ($numPlayers == 4) { + echo (" +

+

$winner4

+

"); + } + echo ("
+

 

+ "); + } + ?> +
+ + + + \ No newline at end of file