*/ require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); $newTeamName = null; $student = null; $league = null; try { // updated information if (trim($_POST['teamName']) == "" or $_POST['teamName'] == null) { $newTeamName = null; } else { $newTeamName = trim($_POST['teamName']); } if (intval($_SESSION['userId']) != -1) { $student = $logicLayer->findStudent(null, intval($_SESSION['userId']))->current(); } if (intval($_POST['leagueId']) != -1) { $league = $logicLayer->findLeague(null, intval($_POST['leagueId']))->current(); } // find team $team = $logicLayer->findTeam(null, $_POST['teamId'])->current(); // update team $logicLayer->updateTeam($team->getName(), $newTeamName, $student, $league, null); $successMsg = urlencode("Team name successfully updated to {$newTeamName}!"); header("Location: ../teams.php?status={$successMsg}"); //echo $persistenceId; } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../teams.php?status={$error_msg}"); } catch (Exception $e) {
* 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;
<?php require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; use edu\uga\cs\recdawgs\entity\impl as Entity; $logicLayer = new LogicLayerImpl(); $userName = trim($_POST['userName']); try { // find admin or student $adminModel = new Entity\AdministratorImpl(); $adminModel->setUserName($userName); $admin = $logicLayer->findAdmin($adminModel, -1)->current(); $studentModel = new Entity\StudentImpl(); $studentModel->setUserName($userName); $student = $logicLayer->findStudent($studentModel, -1)->current(); // reset password $logicLayer->resetPassword($student, $admin); $successMsg = urlencode("Password successfully reset!"); header("Location: ../login.php?status={$successMsg}"); } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../login.php?status={$error_msg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error"); header("Location: ../login.php?status={$errorMsg}"); } exit;
<?php require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); $userId = $_POST['userId']; try { // find user $user = $logicLayer->findStudent(null, $userId)->current(); // delete user $logicLayer->deleteUser($user); $successMsg = urlencode("User successfully deleted!"); header("Location: ../logout.php"); //echo $persistenceId; } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../profile.php?status={$error_msg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error"); header("Location: ../profile.php?status={$errorMsg}"); } exit;
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 { $user = null; if ($_SESSION['userType'] == 0) { $user = $logicLayer->findStudent(null, $_SESSION['userId'])->current(); } else { $user = $logicLayer->findAdmin(null, $_SESSION['userId'])->current(); } $match = $logicLayer->findMatch(null, $_POST['matchId'])->current(); $match->setDate($_POST['date']); $logicLayer->objectLayer->storeMatch($match); $successMsg = urlencode("Match scheduled 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}");