Skip to content

Commit

Permalink
Break Sheet and Speaker Score Output!
Browse files Browse the repository at this point in the history
When a tournament has run its course (Preliminary Rounds) at the end it will open the PersonalJob_Finished file that would allow you to download the Excel version of the database that would allow for easy distribution!
  • Loading branch information
SahasR authored Feb 3, 2020
1 parent 2ca7e9e commit aa3eb6c
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 27 deletions.
100 changes: 100 additions & 0 deletions PersonalJob_Finished.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php
session_start();
$TName = $_SESSION["TName"];
//export.php
$connect = mysqli_connect("localhost", "root", "", "dbtournament");
$sql = "SELECT * FROM savedata";
$result = mysqli_query($connect, $sql);
while($row = mysqli_fetch_array($result)) {
$NumRounds = $row['NumRounds'];
}
$output = '';

if (isset($_POST["btnGo1"])) {
$query = "SELECT * FROM wins ORDER BY Wins DESC, Margins DESC, TotalScore DESC";
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0) {
$output .= '
<table class="table" bordered="1">
<tr>
<th>Position</th>
<th>TeamName</th>
<th>Wins</th>
<th>Margins</th>
<th>TotalScore</th>
</tr>
';
$i = 0;
while($row = mysqli_fetch_array($result))
{
$i = $i +1;
$output .= '
<tr>
<td>'.($i).'</td>
<td>'.$row["TeamName"].'</td>
<td>'.$row["Wins"].'</td>
<td>'.$row["Margins"].'</td>
<td>'.$row["TotalScore"].'</td>
</tr>
';
}
$output .= '</table>';
header('Content-Type: application/xls');
header('Content-Disposition: attachment; filename=Breaks.xls');
echo $output;
}
}

if (isset($_POST["btnGo1"])) {
$query = "SELECT * FROM speaks ORDER BY Average DESC";
$result = mysqli_query($connect, $query);
$output = '';
if(mysqli_num_rows($result) > 0) {
$output .= '
<table class="table" bordered="1">
<tr>
<th>Position</th>
<th>MemberName<th>
<th>TeamName</th>
<th>SchoolName</th>';


for ($i=1; $i <= $NumRounds ; $i++) {
$output .= '<th>Round'.strval($i).'</th>';
}
$output .= '<th>Average</th>';
$output .= '</tr';
$Pos = 0;
while($row = mysqli_fetch_array($result))
{
$Pos = $Pos + 1;
$output .= '
<tr>
<td>'.($Pos).'</td>
<td>'.$row["MemberName"].'</td>
<td></td>
<td>'.$row["TeamName"].'</td>
<td>'.$row["SchoolName"].'</td>';
for ($i=1; $i <= $NumRounds ; $i++) {
$X = "Round".strval($i);
$output .= '<td>'.$row["$X"].'</td>';
}
$output .= '<td>'.$row["Average"].'</td>';
$output .= '</tr>';
}
$output .= '</table>';
header('Content-Type: application/xls');
header('Content-Disposition: attachment; filename=Speaks.xls');
echo $output;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Completed!</title>
</head>
<body>
<form method="POST"><input type="submit" name="btnGo1" id="btnGo1" value="Get Breaks!"></form>
</body>
</html>
2 changes: 1 addition & 1 deletion PersonalJob_PowerRound.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
$TempArray = Array();
$TempArrayWins = Array();

$sql = "SELECT TeamName from wins ORDER BY Wins DESC";
$sql = "SELECT TeamName from wins ORDER BY Wins DESC, Margins DESC, TotalScore DESC";
$result = $conn->query($sql);
$i=0;
while ($row = $result->fetch_assoc()) {
Expand Down
80 changes: 55 additions & 25 deletions PersonalJob_Reg.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,42 @@
if (isset($_POST["btnAddMember"])) {
$SklName = $_POST["txtSklName"];
$TeamName = $_POST["txtTeamName"];
$TeamMember = $_POST["txtMemberName"];
$Novice = $_POST["lstNovice"];
//echo "$Novice";
$Food = $_POST["lstFood"];
//echo "$Food";
$Number = "";
$Number = $_POST["txtContact"];
$TeamMember1 = $_POST["txtMemberName1"];
$TeamMember2 = $_POST["txtMemberName2"];
$TeamMember3 = $_POST["txtMemberName3"];
$TeamMember4 = $_POST["txtMemberName4"];
$TeamMember5 = $_POST["txtMemberName5"];
// $Novice = $_POST["lstNovice"];
// //echo "$Novice";
// $Food = $_POST["lstFood"];
// //echo "$Food";
// $Number = "";
// $Number = $_POST["txtContact"];

$ValidateBoo = ValidateData($SklName, $TeamName, $TeamMember);
$ValidateBoo = ValidateData($SklName, $TeamName, $TeamMember1, $TeamMember2, $TeamMember3);
if ($ValidateBoo == "true") {
$sql = "INSERT INTO $TName (MemberName, TeamName, SchoolName, Novice, FoodPreference, ContactDetails)
VALUES ('$TeamMember','$TeamName', '$SklName', '$Novice', '$Food', '$Number')";
$sql = "INSERT INTO $TName (MemberName, TeamName, SchoolName)
VALUES ('$TeamMember1','$TeamName', '$SklName')";
//echo "$sql";
$result = $conn->query($sql);
$sql = "INSERT INTO $TName (MemberName, TeamName, SchoolName)
VALUES ('$TeamMember2','$TeamName', '$SklName')";
//echo "$sql";
$result = $conn->query($sql);
$sql = "INSERT INTO $TName (MemberName, TeamName, SchoolName)
VALUES ('$TeamMember3','$TeamName', '$SklName')";
//echo "$sql";
$result = $conn->query($sql);
if ($TeamMember4 <> "") {
$sql = "INSERT INTO $TName (MemberName, TeamName, SchoolName)
VALUES ('$TeamMember4','$TeamName', '$SklName')";
$result = $conn->query($sql);
}
if ($TeamMember5 <> "") {
$sql = "INSERT INTO $TName (MemberName, TeamName, SchoolName)
VALUES ('$TeamMember5','$TeamName', '$SklName')";
$result = $conn->query($sql);
}
}
else {
echo "Some Data is missing";
Expand Down Expand Up @@ -180,38 +202,45 @@ function(event){
</tr>
<tr>
<td>
Enter Team Members Name:
Members Name:
</td>
<td>
<input type="text" name="txtMemberName" id="txtMemberName">
<input type="text" name="txtMemberName1" id="txtMemberName1">
</td>
</tr>
<tr>
<td>
Novice?
Members Name:
</td>
<td>
<select id="lstNovice" name="lstNovice">
<option value="1">YES</option>
<option value="0">NO</option>
</select>
<input type="text" name="txtMemberName2" id="txtMemberName2">
</td>
</tr>
<tr>
<td>
Food Preference:
Members Name:
</td>
<td>
<select id="lstFood" name="lstFood">
<option value="Normal">Normal</option>
<option value="Veg">Vegetarian</option>
</select>
<input type="text" name="txtMemberName3" id="txtMemberName3">
</td>
</tr>
<tr>
<td>Contact Details</td>
<td><input type="text" name="txtContact" id="txtContact"></td>
<td>Optional</td>
<td>
Members Name:
</td>
<td>
<input type="text" name="txtMemberName4" id="txtMemberName4">
</td>
</tr>
<tr>
<td>
Members Name:
</td>
<td>
<input type="text" name="txtMemberName5" id="txtMemberName5">
</td>
</tr>
<tr>
</tr>
<tr>
<td></td>
Expand All @@ -220,6 +249,7 @@ function(event){
</td>
</tr>
</table>

</div>
<div style="float: right; background-color: salmon;">
<table>
Expand Down
3 changes: 2 additions & 1 deletion PersonalJob_SeedRound.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// window.open('PersonalJob_Results.php', '_blank');
// </script>
// }

$NumTeams = $_SESSION["NumTeams"];
$TName = $_SESSION["TName"];
$SeedNum = $_SESSION["NumSeed"];
$NumRounds = $_SESSION["NumRounds"];
Expand Down Expand Up @@ -62,6 +62,7 @@
$Opposition = Array();
$Transition = Array();

$Split = $NumTeams/2;

// echo "$Split";
for ($i=0; $i < $Split; $i++) {
Expand Down
44 changes: 44 additions & 0 deletions PersonalJob_Speaks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
session_start();
$TName = $_SESSION["TName"];
//export.php
$connect = mysqli_connect("localhost", "root", "", "dbtournament");
$output = '';

$query = "SELECT * FROM wins ORDER BY Wins DESC, Margins DESC, TotalScore DESC";
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0) {
$output .= '
<table class="table" bordered="1">
<tr>
<th>Position</th>
<th>TeamName</th>
<th>Wins</th>
<th>Margins</th>
<th>TotalScore</th>
</tr>
';
$i = 0;
while($row = mysqli_fetch_array($result))
{
$i = $i +1;
$output .= '
<tr>
<td>'.($i).'</td>
<td>'.$row["TeamName"].'</td>
<td>'.$row["Wins"].'</td>
<td>'.$row["Margins"].'</td>
<td>'.$row["TotalScore"].'</td>
</tr>
';
}
$output .= '</table>';
header('Content-Type: application/xls');
header('Content-Disposition: attachment; filename=Breaks.xls');
echo $output;
}

if (isset($_POST["btnGo"])) {
header("Location:PersonalJob_Speaks");
}
?>

0 comments on commit aa3eb6c

Please sign in to comment.