<?php /** * Created by PhpStorm. * User: skhan731 * Date: 4/29/2016 * Time: 3:15 PM */ require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); $matchId = $_POST['matchId']; try { // find match $match = $logicLayer->findMatch(null, $matchId)->current(); $match->setIsCompleted(true); $logicLayer->resolveMatchScore($_POST['homeTeamScore'], $_POST['awayTeamScore'], $match); $successMsg = urlencode("Match score successfully resolved!"); header("Location: ../index.php"); } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../index.php?status={$error_msg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error"); header("Location: ../index.php?status={$errorMsg}"); } exit;
* Date: 4/23/16 * Time: 17:22 */ session_start(); require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); //check to make sure none of the data is null or empty foreach ($_POST as $inputData) { if ($inputData == "" or $inputData == null) { $errorMsg = urlencode("Missing form field"); header("Location: ../index.php?status={$errorMsg}"); exit; } } try { $match = $logicLayer->findMatch(null, $_POST['matchId'])->current(); $teamCaptain = $logicLayer->findStudent(null, $_SESSION['userId'])->current(); //assuming only the team captains can enter scores $persistenceId = $logicLayer->enterMatchScore($teamCaptain, $match, intval(trim($_POST['homeTeamScore'])), intval(trim($_POST['awayTeamScore']))); $successMsg = urlencode("Scores input successfully!"); header("Location: ../index.php?status={$successMsg}"); echo $persistenceId; } catch (\edu\uga\cs\recdawgs\RDException $rde) { $errorMsg = urlencode($rde->string); header("Location: ../index.php?status={$errorMsg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error"); header("Location: ../index.php?status={$errorMsg}"); } exit;