Esempio n. 1
0
 public function searchRegistrationByTeamId($teamId)
 {
     // the SQL query to be executed on the database
     $query = "SELECT REGISTRATION_ID, CONVERT(VARCHAR(10),REGISTRATION_ACTIVITY_DATE, 101) AS REGISTRATION_ACTIVITY_DATE,\r\n                            TOURNAMENT_ID, TOURNAMENT_NAME, CONVERT(VARCHAR(10), TOURNAMENT_DATE, 101) AS TOURNAMENT_DATE, \r\n                             Right(IsNull(Convert(Varchar,TOURNAMENT_BEGIN_TIME,100),''),7) AS TOURNAMENT_BEGIN_TIME, \r\n                             Right(IsNull(Convert(Varchar,TOURNAMENT_END_TIME,100),''),7) AS TOURNAMENT_END_TIME, \r\n                             TOURNAMENT_STREET, \r\n                             TOURNAMENT_CITY, \r\n                             TOURNAMENT_STATE_CODE,  \r\n                             TOURNAMENT_ZIP,\r\n                             TEAM_ID, TEAM_NAME,\r\n                             SPORT_TYPE_ID, SPORT_TYPE_NAME\r\n                        FROM dbo.REGISTRATION reg JOIN dbo.TEAM t on (reg.REGISTRATION_TEAM_ID = t.TEAM_ID) \r\n                        JOIN dbo.TOURNAMENT tour on(reg.REGISTRATION_TEAM_TOURNAMENT_ID = tour.TOURNAMENT_ID)\r\n                        join dbo.SPORT_TYPE sp ON (sp.SPORT_TYPE_ID = tour.TOURNAMENT_SPORT_TYPE_ID) WHERE t.TEAM_ID =" . $teamId;
     $results = executeQuery($query);
     $regList = new ArrayObject();
     foreach ($results as $result) {
         $regVO = new RegistrationVO();
         $regVO->set_registrationId($result['REGISTRATION_ID']);
         $regVO->set_activityDate($result['REGISTRATION_ACTIVITY_DATE']);
         $tournament = new Tournament();
         $tournament->set_tournamentName($result['TOURNAMENT_NAME']);
         $tournament->set_tournamentDate($result['TOURNAMENT_DATE']);
         $tournament->set_tournamentBeginTime($result['TOURNAMENT_BEGIN_TIME']);
         $tournament->set_tournamentEndTime($result['TOURNAMENT_END_TIME']);
         $tournament->set_sportTypeId($result['SPORT_TYPE_ID']);
         $tournament->set_sportTypeName($result['SPORT_TYPE_NAME']);
         $tournament->set_tournamentStreet($result['TOURNAMENT_STREET']);
         $tournament->set_tourcenameCity($result['TOURNAMENT_CITY']);
         $tournament->set_tournamentState($result['TOURNAMENT_STATE_CODE']);
         $tournament->set_tournamentZip($result['TOURNAMENT_ZIP']);
         $team = new TeamVO();
         $team->set_teamId($result['TEAM_ID']);
         $team->set_teamName($result['TEAM_NAME']);
         $regVO->set_tournament($tournament);
         $regVO->set_team($team);
         $regList->append($regVO);
     }
     return $regList;
 }
Esempio n. 2
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. 3
0
 public function getTeamByCoachId($coachId)
 {
     // the SQL query to be executed on the database
     $query = "Select TEAM_ID, TEAM_NAME From dbo.TEAM\r\n                    where TEAM_COACH_ID =" . $coachId;
     $results = executeQuery($query);
     $team = new TeamVO();
     foreach ($results as $result) {
         $team->set_teamId($result['TEAM_ID']);
         $team->set_teamName($result['TEAM_NAME']);
     }
     return $team;
 }
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 
    }