Exemplo n.º 1
0
});
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>";
}
?>

    <?php 
echo $matchUI->listUpcomingMatches($teamObj);
?>
</body>