Esempio n. 1
0
 function insertTeam($arrayObj)
 {
     $teamDAO = new TeamDAO();
     $teamVO = new TeamVO();
     $teamVO->set_teamName($arrayObj[0]);
     $teamVO->set_coachEmailAddress($arrayObj[1]);
     $teamDAO->cudTeam($teamVO, CREATE);
 }
Esempio n. 2
0
while ($iterator->valid()) {
    $coach = $iterator->current();
    echo 'CoachName: ' . $coach->get_fname() . ' ' . $coach->get_lname() . ', CoachId: ' . $coach->get_coachId() . ', Email=' . $coach->get_emailAddress();
    echo '<br />';
    $iterator->next();
}
echo '<br />';
echo 'Login test';
echo '<br />';
$loginResult = $coachDAO->login("*****@*****.**", "1234");
echo '$loginResult: ' . $loginResult;
echo '<br />';
echo '<br />';
echo 'Team List test';
echo '<br />';
$teamDAO = new TeamDAO();
$team = $teamDAO->getTeamByCoachId(61);
echo 'teamID: ' . $team->get_teamId() . ', Team Name: ' . $team->get_teamName();
echo '<br />';
$playerDAO = new PlayerDAO();
$playerList = $playerDAO->getPlayersByTeamId(20);
$iterator = $playerList->getIterator();
echo 'Player List test';
echo '<br />';
while ($iterator->valid()) {
    $player = $iterator->current();
    echo 'PlayerName: ' . $player->get_fname() . ' ' . $player->get_lname() . ',TeamName=' . $player->get_teamName() . ', PlayerId: ' . $player->get_playerId() . ', Email=' . $player->get_email();
    echo '<br />';
    $iterator->next();
}
$locDAO = new LocationsDAO();
Esempio n. 3
0
error_reporting(E_ALL);
/* 
 * Authors: Dennis Mohr, Nick Hoyle, Hemang Vyas
 * Date: 03/03/2016
 * Description: Profile page allows coach to view, update, delete and add a team
 *  
 */
require_once 'dao/PlayerDAO.php';
require_once 'dao/TeamDAO.php';
require_once 'controller/FormRoster.php';
require_once 'controller/FormTeam.php';
require_once "dao/LocationsDAO.php";
require_once "dao/RegistrationDAO.php";
$processPlayer = new FormRoster();
$playerDAO = new PlayerDAO();
$teamDAO = new TeamDAO();
$processTeam = new FormTeam();
$teamId = "";
if (isset($_SESSION['coachId'])) {
    $teamVO = $teamDAO->getTeamByCoachId($_SESSION['coachId']);
    $teamId = $teamVO->get_teamId();
}
// If a team is created
if (isset($teamId) && $teamId !== "") {
    ?>
        <h1>Team Roster</h1>
	<div class="content">
		<?php 
    if (isset($_POST['Action']) && $_POST['Action'] == "Delete") {
        $result = $processPlayer->deletePlayer($_POST['PlayerId']);
        if ($result == 1) {
Esempio n. 4
0
    function displayForm($valid = true)
    {
        if (!$valid) {
            echo "<p>Error's detected: please review messages below.";
        }
        $user = $_SESSION['emailAddress'];
        $coachDao = new CoachDAO();
        $teamDao = new TeamDAO();
        $resultCoach = "";
        $resultTeam = "";
        if (!isset($_POST['process'])) {
            //   $coach = $coachDao->getCoachByCoachUserId($user);
            //   $team = $teamDao->getTeamByCoachId($coach->get_coachId());
        } else {
            $updateCoach = new CoachVO();
            $updateTeam = new TeamVO();
            $updateCoach->set_emailAddress($_POST['form']['emailAddress']);
            $updateCoach->set_oldEmailAddress($_POST['form']['oldEmailAddress']);
            $updateCoach->set_fname($_POST['form']['fname']);
            $updateCoach->set_lname($_POST['form']['lname']);
            $updateCoach->set_password($_POST['form']['password']);
            //
            $resultCoach = $coachDao->cudCoach($updateCoach, UPDATE);
            if ($resultCoach == 1) {
                $user = $_POST['form']['emailAddress'];
            }
            $teamId = $_POST['form']['teamId'];
            $teamName = $_POST['form']['teamName'];
            $oldTeamName = $_POST['form']['oldTeamName'];
            $updateTeam->set_teamName($teamName);
            $updateTeam->set_oldTeamName($oldTeamName);
            $updateTeam->set_teamId($teamId);
            $updateTeam->set_coachEmailAddress($_POST['form']['emailAddress']);
            // echo '<br/>';
            //
            if (isset($teamId) && $teamId != "") {
                if ($teamName != "") {
                    //  echo 'Team UPDATE';
                    // print_r($updateTeam);
                    $resultTeam = $teamDao->cudTeam($updateTeam, UPDATE);
                }
            } else {
                if ($teamName != "") {
                    //  echo 'Team Create';
                    // print_r($updateTeam);
                    $resultTeam = $teamDao->cudTeam($updateTeam, CREATE);
                }
            }
        }
        if ($resultCoach == 1 && $resultTeam == 1) {
            echo '' . "Record updated successfully" . '<br/>';
        }
        $coach = $coachDao->getCoachByCoachUserId($user);
        $team = $teamDao->getTeamByCoachId($coach->get_coachId());
        $_SESSION['emailAddress'] = $coach->get_emailAddress();
        $_SESSION['fname'] = $coach->get_fname();
        $_SESSION['lname'] = $coach->get_lname();
        $_SESSION['coachId'] = $coach->get_coachId();
        $fNameValue = $coach->get_fname();
        $lNameValue = $coach->get_lname();
        $teamNameValue = "";
        if (isset($team)) {
            $teamIdValue = $team->get_teamId();
            $teamNameValue = $team->get_teamName();
        }
        $emailValue = $user;
        $passwordValue = $coach->get_password();
        /*
        $fNameError = (isset($GLOBALS['form']['fname']['error']) && !empty($GLOBALS['form']['fname']['error']) ? ' <span class="error">Error: ' . htmlentities($GLOBALS['form']['fname']['error']) . "</span>" : "" );
        		$fNameValue = (isset($GLOBALS['form']['fname']['response']) && !empty($GLOBALS['form']['fname']['response']) ? ' value="' . htmlentities($GLOBALS['form']['fname']['response']) .'""' : "");
        		
        		$lNameError = (isset($GLOBALS['form']['lname']['error']) && !empty($GLOBALS['form']['lname']['error']) ? ' <span class="error">Error: ' . htmlentities($GLOBALS['form']['lname']['error']) . "</span>" : "" );
        		$lNameValue = (isset($GLOBALS['form']['lname']['response']) && !empty($GLOBALS['form']['lname']['response']) ? ' value="' . htmlentities($GLOBALS['form']['lname']['response']) .'""' : "");
        
        		$teamNameError = (isset($GLOBALS['form']['teamName']['error']) && !empty($GLOBALS['form']['teamName']['error']) ? ' <span class="error">Error: ' . htmlentities($GLOBALS['form']['teamName']['error']) . "</span>" : "" );
        		$teamNameValue = (isset($GLOBALS['form']['teamName']['response']) && !empty($GLOBALS['form']['teamName']['response']) ? ' value="' . htmlentities($GLOBALS['form']['teamName']['response']) .'""' : "");
        		
        		$emailError = (isset($GLOBALS['form']['emailAddress']['error']) && !empty($GLOBALS['form']['emailAddress']['error']) ? ' <span class="error">Error: ' . htmlentities($GLOBALS['form']['emailAddress']['error']) . "</span>" : "" );
        		$emailValue = (isset($GLOBALS['form']['emailAddress']['response']) && !empty($GLOBALS['form']['emailAddress']['response']) ? ' value="' . htmlentities($GLOBALS['form']['emailAddress']['response']) .'""' : "");
        		
        		$passwordError = (isset($GLOBALS['form']['password']['error']) && !empty($GLOBALS['form']['password']['error']) ? ' <span class="error">Error: ' . htmlentities($GLOBALS['form']['password']['error']) . "</span>" : "" );
        *
        */
        ?>
	<!--	<div class="forms">
			<form class="form" action="<?php 
        //php echo $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
        ?>
" method="POST">
				<label for="fname">First Name:</label> <input type="text" name="form[fname]"<?php 
        //php echo $fNameValue;
        ?>
><?php 
        //php echo $fNameError;
        ?>
<br>
				<label for="lname">Last Name:</label> <input type="text" name="form[lname]"<?php 
        //php echo $lNameValue;
        ?>
><?php 
        //php echo $lNameError;
        ?>
<br>
				<label for="teamName">Team Name:</label><input type="text" name="form[teamName]"<?php 
        //php echo $teamNameValue;
        ?>
><?php 
        //php echo $teamNameError;
        ?>
<br>
		 		<label for="emailAddress">Email Address:</label><input type="email" name="form[emailAddress]"<?php 
        //php echo $emailValue;
        ?>
><?php 
        //php echo $emailError;
        ?>
<br>
				<label for="password">Password:</label><input type="password" name="form[password]"><?php 
        //php echo $passwordError;
        ?>
<br>
				<input type="submit" name="process" value="Update">
			</form>
		</div>
 -->
 
 
 
                <div class="forms">
			<form name="formProfile" class="form" action="<?php 
        echo $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
        ?>
" method="POST">
                            <label for="fname">First Name:</label> <input type="text" name="form[fname]" value="<?php 
        echo $fNameValue;
        ?>
"><br>
				<label for="lname">Last Name:</label> <input type="text" name="form[lname]" value="<?php 
        echo $lNameValue;
        ?>
"><br>
				<label for="teamName">Team Name:</label><input type="text" name="form[teamName]" value="<?php 
        echo $teamNameValue;
        ?>
"><br>
                                <input type="hidden" name="form[oldTeamName]" value="<?php 
        echo $teamNameValue;
        ?>
">
                                <input type="hidden" name="form[teamId]" value="<?php 
        echo $teamIdValue;
        ?>
">
		 		<label for="emailAddress">Email Address:</label><input type="email" name="form[emailAddress]" value="<?php 
        echo $emailValue;
        ?>
"><br>
                                <input type="hidden" name="form[oldEmailAddress]" value="<?php 
        echo $emailValue;
        ?>
">
				<label for="password">Password:</label><input type="password" name="form[password]" value="<?php 
        echo $passwordValue;
        ?>
"><br>
				<input type="submit" name="process" value="Update">
			</form>
		</div>
 
		
<?php 
    }