function EditTeam($inTeamId, $inSportId = null, $inTeamName = null, $inCoachId = null, $inSubCoachIds = null) { $db = new MySQL("localhost", "root", "n4UVFpHeHr", "bulilit"); $db->connect(); $teams = GetTeam($inTeamId); $coaches; foreach ($teams as $team) { $coaches = $team->coachIds; } if ($coaches == null) { AddTeamHeadCoach($inTeamId, $inCoachId); } else { $query = $db->query("UPDATE TeamCoach SET HeadCoach='Yes' WHERE TeamID=" . $inTeamId . " and CoachID=" . $inCoachId . "") or die("Error updating team Head Coach"); } if ($coaches == null) { AddTeamSubCoaches($inTeamId, $inSubCoachIds); } else { foreach ($inSubCoachIds as $s) { $query = $db->query("UPDATE TeamCoach SET HeadCoach='No' WHERE TeamID=" . $inTeamId . " and CoachID=" . $s . "") or die("Error updating team Assistant Coaches"); } } $query = $db->query("UPDATE Team SET SportID=" . $inSportId . ", TeamName='" . $inTeamName . "' WHERE TeamID=" . $inTeamId) or die("Error updating team name"); }
EditTeam($_POST["teamId"], $_POST["sport"], $_POST["teamName"], $_POST["coach"], $_POST["subCoaches"]); echo 'You have successfully edited ' . $_POST["teamName"] . ' with team id ' . $_POST["teamId"] . '!'; echo '<br />'; } else { if ($_POST["teamName"] != null) { AddTeam($_POST["sport"], $_POST["teamName"], $_POST["coach"], $_POST["subCoaches"]); echo 'You have successfully added ' . $_POST["teamName"] . '!'; echo '<br />'; } else { $teamId = "2"; if (isset($_GET["teamId"])) { $teamId = $_GET["teamId"]; } else { $teamId = null; } $teams = GetTeam($teamId); foreach ($teams as $team) { $teamName = $team->teamName; $sport = $team->sportId; } ?> <!--Start insert--> <div class="main"> <div class="header"> <div class="header_resize"> <!-- <div class="logo"> <h1><a href="#">Cream<span>Burn</span> <small>put your slogan here</small></a></h1> </div> --> <div class="clr"></div> <div class="htext"> </div>
<div class="content"> <div class="content_resize"> <div class="mainbar"> <div class="addPracticeForm"> <form action="addPractice.php" method="post"> <input type="hidden" name="id" value="<?php echo $practiceId; ?> "/> Select Team: <select name="team" id="selectTeam"> <?php //Set team ID $team = GetTeam(); echo '<option value="0" id="0">Select Here</option>'; foreach ($team as $t) { $teamId = $t->id; $teamName = $t->teamName; echo '<option value="' . $teamId . '" id="' . $teamId . '">' . $teamName . '</option>'; } ?> </select> <br /> <div id="playerList"> <input type="button" onClick="addTextBox()" value="add"/> </div> Date: <input type="text" name="date" id="txtDate" value="<?php echo $practiceDate;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <?php include 'DAO/teamDao.php'; $teamId = $_GET["teamId"]; $team = GetTeam($teamId); foreach ($team as $t) { $teamName = $t->teamName; $teamGrade = $t->teamGrade; $squadId = $t->squadId; $coachId = $t->coachId; $sport = $t->sport; } if ("Edit" == $_POST["submit"]) { $teamId = $_POST["teamId"]; $teamName = $_POST["teamName"]; $teamGrade = $_POST["teamGrade"]; $squadId = $_POST["squadId"]; $coachId = $_POST["coachId"]; $sport = $_POST["sport"]; EditTeam($teamId, $teamName, $teamGrade, $squadId, $coachId, $sport); echo "You have successfully edited " . $teamName . "!"; echo '<br>'; echo "<a href='/searchTeam.php'>back to search</a>"; } else { if ($teamId == null) {
if ($teamId != null) { $teams = GetTeam($teamId, null, null); } else { if ($teamName == null && $teamCoach == null) { $teams = GetTeam(); } else { if ($teamName != null && $teamCoach != null) { $teams = GetTeam(null, $teamName, $teamCoach); } else { if ($teamCoach != null) { $teams = GetTeam(null, null, $teamCoach); } else { if ($teamName != null) { $teams = GetTeam(null, $teamName, null); } else { $teams = GetTeam(); } } } } } $counter = 0; foreach ($teams as $team) { $id = $team->id; if ($counter % 2 == 1) { echo "<tr class='alt'>"; } else { echo "<tr>"; } $counter++; $coachIds = $team->coachIds;
DeleteCompetition($deleteCompetition); } if ($competitionId != null) { $competitions = GetCompetition($competitionId, null, null); } else { $competitions = GetCompetition(); } $counter = 0; foreach ($competitions as $competition) { $id = $competition->id; if ($counter % 2 == 1) { echo "<tr class='alt'>"; } else { echo "<tr>"; } $teamArray = GetTeam($competition->teamId); $counter++; ?> <?php echo '<td class="small"><input type="radio" value="' . $id . '" name="editCompetitionId">'; ?> <?php echo '<td class="small"><input type="checkbox" value="' . $id . '" name="deleteCompetitionId[]">'; ?> <td><font face="Arial, Helvetica, sans-serif"><?php echo $id; ?> </font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $competition->compName; ?>