<?php include 'includes/header.php'; spl_autoload_register(function ($class_name) { include '/Users/montanawong/Sites/RecDawgs/src/' . str_replace('\\', '/', $class_name) . '.php'; }); use edu\uga\cs\recdawgs\presentation as Presentation; if (!isset($_POST) || !isset($_POST['teamId'])) { $errorMsg = urlencode("Team not found."); header("Location: teams.php?status={$errorMsg}"); } $teamId = $_POST['teamId']; $teamUI = new Presentation\TeamUI(); $teamObj = $teamUI->getTeam($teamId); $leagueId = $teamObj->getParticipatesInLeague()->getId(); $matchUI = new Presentation\MatchUI(); ?> <body> <?php echo $teamUI->listTeamInformation(null, $teamId); ?> <?php //only allow updating team if the user is team captain if ($teamObj->getCaptain()->getId() == $_SESSION['userId']) { echo "<h3>Update Team Information </h3>\n <form method='POST' action='php/doUpdateTeam.php'>\n <label for='teamName'>Team Name</label>\n <input name='teamName' placeholder='New Team name'>\n <input name='teamId' id='teamId' type='hidden' value='{$teamId}'>\n <input name='leagueId' id='leagueId' type='hidden' value='{$leagueId}'\n <p>\n <input type='submit' value = 'Update Team'>\n </p>\n </form>"; echo "<br/><h3>Delete Team (Unreversable)</h3><br/>\n <form method='POST' action='php/doDeleteTeam.php'>\n <input name='teamId' id='teamId' type='hidden' value='{$teamId}'>\n <p>\n <input type='submit' value = 'Delete Team'>\n </p>\n </form>"; } ?>
include 'includes/header.php'; spl_autoload_register(function ($class_name) { include '/Users/montanawong/Sites/RecDawgs/src/' . str_replace('\\', '/', $class_name) . '.php'; }); use edu\uga\cs\recdawgs\presentation as Presentation; ?> <body> <div class="container"> <h3>My Teams</h3> <form action="team.php" method="post"> <div class="form-group"> <select name="teamId" id="teamId"> <option value="-1">---SELECT TEAM TO VIEW---</option> <?php $teamUI = new Presentation\TeamUI(); echo $teamUI->listAllContainingStudent(null, $_SESSION['userId']); ?> </select> </div> <div class="form-group"> <input type="submit" value="View team"> </div> </form> </div> </body> <?php include 'includes/footer.php';