public function searchCaptain($zip) { $db = Database::getInstance(); $mysqli = $db->getConnection(); $query = "SELECT * FROM captain WHERE zip = {$zip}"; $result = $mysqli->query($query); $counter = 0; $captList = array(); include_once "class/Rating.class.php"; while ($news_row = $result->fetch_array()) { $captain = new Captain(); $rating21 = new Rating(); $scoreFromRating = $rating21->retrieveAvgScore($news_row['captain_id']); $captain = $captain->createCaptainObject($captain, $news_row); $captain->setScore($scoreFromRating); $captList[$counter] = $captain; $counter++; } return $captList; }
$captainId = $_GET['captainId']; } elseif ($_SESSION['userType'] == "Captain") { $captainId = $_SESSION['userId']; } $captList = $captain->retrieveCaptainProfile($captainId); $captName = $captList[0]->getFirstName() . " " . $captList[0]->getLastName(); $rating = 0; $street = $captList[0]->getStreet(); $state = $captList[0]->getState(); $city = $captList[0]->getCity(); $zip = $captList[0]->getZip(); $pic = $captList[0]->getCaptainPic(); $address = $street . " " . $city . "," . $state . " " . $zip; $email = $captList[0]->getEmail(); $ratingC = new Rating(); $rating = $ratingC->retrieveAvgScore($captainId); $changeProfileStatus = "Enabled"; if (isset($_GET['captainId']) && isset($_SESSION['userType'])) { if ($_SESSION['userType'] == "Captain") { $session_capt_id = $_SESSION['userId']; $get_capt_id = $_GET['captainId']; if ($session_capt_id == $get_capt_id) { $changeProfileStatus = "Enabled"; } else { $changeProfileStatus = "Disabled"; } } } ?>
<?php if ($_SERVER['REQUEST_METHOD'] != 'POST') { include_once "class/Captain.class.php"; include_once "class/Rating.class.php"; $captList = array(); $captain = new Captain(); $captList = $captain->retrieveCaptain(); for ($i = 0; $i < sizeof($captList); $i++) { $captName = $captList[$i]->getFirstName() . " " . $captList[$i]->getLastName(); $captPic = $captList[$i]->getCaptainPic(); $captId = $captList[$i]->getCaptainId(); $captLocation = $captList[$i]->getCity() . ", " . $captList[$i]->getState() . " " . $captList[$i]->getZip(); $rating = new Rating(); $score = $rating->retrieveAvgScore($captId); ?> <div class="col-xs-6 col-sm-4 col-md-3 captClass"> <div class="thumbnail tb"> <img class="thumbnail-img img-thumbnail" src="<?php echo $captPic; ?> " alt="..."> <div class="caption"> <h3><?php echo $captName; ?> </h3> <div id="captRate" class="captRate" data-score="<?php if ($captId == 81) {