<?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;
<?php /** * Created by PhpStorm. * User: skhan731 * Date: 4/27/16 * Time: 08:53 */ require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); $sportsVenueId = $_POST['sportsVenueId']; try { //find sports venue $sportsVenue = $logicLayer->findSportVenue(null, $sportsVenueId)->current(); //delete sports venue $logicLayer->deleteSportsVenue($sportsVenue); $successMsg = urlencode("Sports Venue successfully deleted!"); header("Location: ../sportsVenues.php"); } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../sportsVenue.php?status={$error_msg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error"); header("Location: ../sportsVenue.php?status={$errorMsg}"); } exit;
<?php /** * Created by PhpStorm. * User: montanawong * 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}");
<?php /** * Created by PhpStorm. * User: montanawong * Date: 4/23/16 * Time: 13:56 */ require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); //die(var_dump($_POST)); //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: ../teams.php?status={$errorMsg}"); exit; } } try { //trim any whitespace $firstName = trim($_POST['firstName']); $lastName = trim($_POST['lastName']); $userName = trim($_POST['userName']); $password = trim($_POST['password']); $emailAddress = trim($_POST['email']); $studentId = trim($_POST['studentNumber']); $address = trim($_POST['address']); $major = trim($_POST['major']); // this code is used to hash the password into DB. when we register a user.
<?php /** * Created by PhpStorm. * User: montanawong * Date: 5/1/16 * Time: 12:45 */ 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!");
<?php require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); $leagueId = $_POST['leagueId']; try { // find league $league = $logicLayer->findLeague(null, $leagueId)->current(); // delete league $logicLayer->deleteLeague($league); $successMsg = urlencode("League successfully deleted!"); header("Location: ../leagues.php"); //echo $persistenceId; } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../leagues.php?status={$error_msg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error"); header("Location: ../leagues.php?status={$errorMsg}"); } exit;
<?php /** * Created by PhpStorm. * User: montanawong * Date: 4/23/16 * Time: 16:23 */ require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); $sportsVenueId = $_POST['sportsVenueId']; $newVenueName = null; $venueType = null; $address = null; try { // updated information if (trim($_POST['venueName']) == "" or $_POST['venueName'] == null) { $newVenueName = null; } else { $newVenueName = trim($_POST['venueName']); } if (intval($_POST['isIndoor']) != -1) { $venueType = intval($_POST['isIndoor']); } if (trim($_POST['address']) != "" and $_POST['address'] != null) { $address = trim($_POST['address']); } // udpate team $logicLayer->updateSportsVenue($sportsVenueId, $newVenueName, $venueType, $address); $successMsg = urlencode("Sports venue successfully updated!");
<?php /** * Created by PhpStorm. * User: montanawong * Date: 4/23/16 * Time: 16:23 */ 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);
<?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;
<?php /** * Created by PhpStorm. * User: montanawong * Date: 4/23/16 * Time: 16:57 */ 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: ../leagues.php?status={$errorMsg}"); exit; } } try { $persistenceId = $logicLayer->createLeague(trim($_POST['name']), trim($_POST['leagueRules']), trim($_POST['matchRules']), intval(trim($_POST['isIndoor'])), intval(trim($_POST['minTeams'])), intval(trim($_POST['maxTeams'])), intval(trim($_POST['minMembers'])), intval(trim($_POST['maxMembers']))); $successMsg = urlencode("League successfully created!"); header("Location: ../leagues.php?status={$successMsg}"); //echo $persistenceId; } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../leagues.php?status={$error_msg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error"); header("Location: ../leagues.php?status={$errorMsg}"); }
<?php /** * Created by PhpStorm. * User: montanawong * Date: 4/28/16 * Time: 22:05 */ 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: ../sportsVenues.php?status={$errorMsg}"); exit; } } try { $leagueId = intval(trim($_POST['leagueId'])); $sportsVenueId = intval(trim($_POST['sportsVenueId'])); $logicLayer->createLeagueSportsVenue($leagueId, $sportsVenueId); $msg = urlencode("Sports venue assigned to league successfully"); header("Location: ../sportsVenues.php?status={$msg}"); } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../sportsVenues.php?status={$error_msg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error");
<?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 /** * Created by PhpStorm. * User: skhan731 * Date: 4/27/16 * Time: 08:56 */ require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); $newName = null; $newLeagueRules = null; $newMatchRules = null; $newIsIndoor = null; $newMinTeams = null; $newMaxTeams = null; $newMinMembers = null; $newMaxMembers = null; $newWinner = null; $league = null; try { if (intval($_POST['leagueId']) != -1) { $league = $logicLayer->findLeague(null, intval($_POST['leagueId']))->current(); } if (trim($_POST['leagueName']) == "" or $_POST['leagueName'] == null) { $newName = null; } else { $newName = trim($_POST['leagueName']); } if (trim($_POST['leagueRules']) == "" or $_POST['leagueRules'] == null) {
<?php /** * Created by PhpStorm. * User: mwong * Date: 4/28/16 * Time: 1:04 PM */ session_start(); require_once 'autoload.php'; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); try { //return all leagues that dont meet the requirements. $unsatisfiedLeagues = $logicLayer->closeEnrollment(); $num = count($unsatisfiedLeagues); $msg = "Rounds generated and matches fixed. {$num} Leagues still not meeting requirements: "; for ($i = 0; $i < $num; $i++) { $msg .= $unsatisfiedLeagues[$i]->getName() . ' '; } $msg = urlencode($msg); header("Location: ../leagues.php?status={$msg}"); } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../leagues.php?status={$error_msg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error"); echo $e->getTraceAsString(); header("Location: ../leagues.php?status={$errorMsg}"); } exit;
<?php /** * Created by PhpStorm. * User: montanawong * Date: 4/23/16 * Time: 16:23 */ require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; session_start(); $logicLayer = new LogicLayerImpl(); $firstName = null; $lastName = null; $userName = null; $password = null; $emailAddress = null; $studentId = null; $address = null; $major = null; try { //update information if (trim($_POST['firstName'])) { $firstName = trim($_POST['firstName']); } if (trim($_POST['lastName'])) { $lastName = trim($_POST['lastName']); } if (trim($_POST['password'])) { $password = trim($_POST['password']); //$password_hash = password_hash($password, PASSWORD_DEFAULT);
<?php /** * Created by PhpStorm. * User: montanawong * Date: 4/26/16 * Time: 23:19 */ 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 { $team = $logicLayer->findTeam(null, $_POST['teamId'])->current(); $logicLayer->joinTeam($team, null, null, $_SESSION['userId']); $teamName = $team->getName(); $successMsg = urlencode("Team: {$teamName} successfully joined!"); header("Location: ../index.php?status={$successMsg}"); //echo $persistenceId; } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../index.php?status={$error_msg}"); } catch (Exception $e) {
<?php /** * Created by PhpStorm. * User: montanawong * Date: 4/23/16 * Time: 16:23 */ 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: ../teams.php?status={$errorMsg}"); exit; } } try { //store the team in the DB. //league id will be hidden on the form //create a league model to get league obj. //$leagueModel = $logicLayer->createLeague(); //$leagueModel->setId($_POST['leagueId']); $league = $logicLayer->findLeague(null, intval($_POST['leagueId']))->current(); $teamCaptain = $logicLayer->findStudent(null, intval($_SESSION['userId']))->current(); $persistenceId = $logicLayer->createTeam(trim($_POST['teamName']), $teamCaptain, $league); $successMsg = urlencode("Team: {$_POST['teamName']} successfully created!"); header("Location: ../teams.php?status={$successMsg}");
<?php require_once "autoload.php"; use edu\uga\cs\recdawgs\logic\impl\LogicLayerImpl; $logicLayer = new LogicLayerImpl(); $teamId = $_POST['teamId']; try { // find team $team = $logicLayer->findTeam(null, $teamId)->current(); // delete team $logicLayer->deleteTeam($team); $successMsg = urlencode("Team successfully deleted!"); header("Location: ../teams.php"); //echo $persistenceId; } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); die($error_msg); header("Location: ../team.php?status={$error_msg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error"); die($errorMsg); header("Location: ../team.php?status={$errorMsg}"); } exit;
<?php 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: ../createSportsVenue.php?status={$errorMsg}"); exit; } } try { $persistenceId = $logicLayer->createSportsVenue(trim($_POST['venueName']), trim($_POST['isIndoor']), trim($_POST['address'])); $successMsg = urlencode("Sports venue successfully created!"); header("Location: ../createSportsVenue.php?status={$successMsg}"); //echo $persistenceId; } catch (\edu\uga\cs\recdawgs\RDException $rde) { $error_msg = urlencode($rde->string); header("Location: ../createSportsVenue.php?status={$error_msg}"); } catch (Exception $e) { $errorMsg = urlencode("Unexpected error"); header("Location: ../createSportsVenue.php?status={$errorMsg}"); } exit;