コード例 #1
0
ファイル: CoachDAO.php プロジェクト: themohr/cis665
 public function getCoachList()
 {
     // the SQL query to be executed on the database
     $query = "Select COACH_ID, COACH_LNAME, COACH_FNAME,  COACH_EMAIL_ADDRESS, COACH_PASSWORD From dbo.COACH\r\n                    Order by COACH_FNAME";
     // call the executeQuery method (in dbConnExec.php)
     // and return the result
     $results = executeQuery($query);
     $coachList = new ArrayObject();
     foreach ($results as $result) {
         $coach = new CoachVO();
         $coach->set_coachId($result['COACH_ID']);
         $coach->set_fname($result['COACH_FNAME']);
         $coach->set_lname($result['COACH_LNAME']);
         $coach->set_password($result['COACH_PASSWORD']);
         $coach->set_emailAddress($result['COACH_EMAIL_ADDRESS']);
         // $coach->set_teamName($result['COACH_TEAM_NAME']);
         $coachList->append($coach);
     }
     return $coachList;
 }
コード例 #2
0
ファイル: FormRegister.php プロジェクト: themohr/cis665
 function insertCoach($arrayObj)
 {
     $coachDao = new CoachDAO();
     $coach = new CoachVO();
     $coach->set_fname($arrayObj[0]);
     $coach->set_lname($arrayObj[1]);
     $coach->set_emailAddress($arrayObj[2]);
     $coach->set_password($arrayObj[3]);
     $coachDao->cudCoach($coach, CREATE);
 }
コード例 #3
0
ファイル: FormProfile.php プロジェクト: themohr/cis665
    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 
    }