*/ 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>Resolve Match Score</h3> <br> <?php $matchUI = new Presentation\MatchUI(); echo $matchUI->listMatchInfo(null, $_POST['matchId']); ?> <p> <form id="resolveMatchScore" action="php/doResolveMatchScore.php" method="post"> <div class="form-group"> <label for="homeTeamScore">New Home Team Score</label> <br> <input name="homeTeamScore" id="homeTeamScore" type="text"> </div> <div class="form-group"> <label for="awayTeamScore">New Away Team Score</label> <br>
//show a simple form with 2 fields, one for home score and one for away score //****later- also add logic to prevent non captains of the matches from inputting score. ////form should send user to doEnterMatchScore.php if (!isset($_POST) || !isset($_POST['matchId'])) { $errorMsg = urlencode("invalid match"); header("Location: match.php?status={$errorMsg}"); } $matchId = $_POST['matchId']; ?> <body> <div class="container"> <h3>Enter Match Score</h3> <br> <?php $matchUI = new Presentation\MatchUI(); echo $matchUI->listMatchInfo(null, $matchId); ?> <p> <form id="enterMatchScore" action="php/doEnterMatchScore.php" method="post"> <div class="form-group"> <label for="homeTeamScore">Home Team Score</label> <br> <input name="homeTeamScore" id="homeTeamScore" type="text"> </div> <div class="form-group"> <label for="awayTeamScore">Away Team Score</label> <br> <input name="awayTeamScore" id="awayTeamScore" type="text">
<?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>"; } ?>
$awayPoints = -1; if ($numScoreReports >= 2) { $scores = $scoreReportUI->getScores($_POST['matchId']); $homePoints = intval($scores[0]['homeScore']); $awayPoints = intval($scores[0]['awayScore']); //die(var_dump($scores)); } echo $matchUI->listMatchInfo(null, $_POST['matchId'], $homePoints, $awayPoints); echo $scoreReportUI->showMatchReports($_POST['matchId']); if ($_SESSION['userType'] == 0 && $numScoreReports <= 1) { echo "<h2>Enter match score</h2> <br/>\n <form action='enterMatchScore.php' method='post'>\n <input type = 'hidden' name = 'matchId' value = '{$_POST['matchId']}'>\n <input type='submit' name='Click here to input match score' id='enterMatchScore'>\n </form>\n <br/>"; } ?> <?php if ($_SESSION['userType'] == 1 && $numScoreReports >= 2) { // $scores = $scoreReportUI->getScores($_POST['matchId']); //if($scores[0]['homeScore'] != $scores[1]['homeScore'] && $scores[0]['awayScore'] != $scores[1]['awayScore']) { $matchUI = new Presentation\MatchUI(); echo "<h3>Resolve match score</h3>"; echo $matchUI->listResolveMatchScoreButton($_POST['matchId']); // } } ?> </body> </html>