Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
include("./layout/header.php");
include_once (__DIR__."/Utility/dataConnect.php");
include_once (__DIR__."/Utility/profileData.php");
include_once (__DIR__."/Utility/groupFunctions.php");
session_start();
$AccountName = 'hhp14001';
$memberData = new userProfile($AccountName);
function debug_to_console( $data ) {
$output = $data;
if ( is_array( $output ) )
$output = implode( ',', $output);
echo "<script>console.log( 'Debug Objects: " . $output . "' );</script>";
}
function phpAlert($msg) {
echo '<script type="text/javascript">alert("' . $msg . '")</script>';
}
//$invites = array('GroupID'=>'1', 'GroupName'=>'grp1');
$invites = checkInvites($AccountName);
if($invites) {
$groupID = array_keys($invites);
$groupName = array_values($invites);
$msg = "You have new group invite/s. Go to groups page.";
phpAlert($msg);
}
if(isset($AccountName)) {
if (isset($_POST['submit'])) {
if(isset($_POST['DateOfBirth'])) {
$memberData->setDOB($_POST["DateOfBirth"]);
}
if(isset($_POST["GeneticGender"])) {
$memberData->setGeneticGender($_POST["GeneticGender"]);
} else {
$memberData->setGeneticGender("Male");
}
if(isset($_POST["Weight"])) {
$memberData->setWeight($_POST["Weight"]);
}
if(isset($_POST["HeightFeet"])) {
$memberData->setHeightFeet($_POST["HeightFeet"]);
}
if(isset($_POST["HeightInches"])) {
$memberData->setHeightInches($_POST["HeightInches"]);
}
if(isset($_POST["MaritalStatus"])) {
$memberData->setMaritalStatus($_POST["MaritalStatus"]);
} else {
$memberData->setMaritalStatus("Single");
}
if(isset($_POST["Occupation"])) {
$memberData->setOccupation($_POST["Occupation"]);
}
if(isset($_POST["LevelOfEducation"])) {
$memberData->setLevelOfEducation($_POST["LevelOfEducation"]);
} else {
$memberData->setLevelOfEducation("College");
}
if(isset($_POST["IncomeRange"])) {
$memberData->setIncomeRange($_POST["IncomeRange"]);
}
if(isset($_POST["ReligiousObservance"])) {
$memberData->setReligiousObservance($_POST["ReligiousObservance"]);
} else {
$memberData->setReligiousObservance("Moderately");
}
if(isset($_POST["ResidentialSetting"])) {
$memberData->setResidentialSetting($_POST["ResidentialSetting"]);
} else {
$memberData->setResidentialSetting("Urban");
}
if(isset($_POST["Ethnicity"])) {
$memberData->setEthnicity($_POST["Ethnicity"]);
}
if(isset($_POST["Medication"])) {
$memberData->setMedication($_POST["Medication"]);
}
if(isset($_POST["DrivingHistory"])) {
$memberData->setDrivingHistory($_POST["DrivingHistory"]);
} else {
$memberData->setDrivingHistory("0 Accidents per year");
}
if(isset($_POST["CreditScore"])) {
$memberData->setCreditScore($_POST["CreditScore"]);
} else {
$memberData->setCreditScore("500-750");
}
if(isset($_POST["DietChoices"])) {
$memberData->setDietChoices($_POST["DietChoices"]);
} else {
$memberData->setDietChoices("None");
}
if(isset($_POST["IsDisabled"])) {
$memberData->setIsDisabled($_POST["IsDisabled"]);
} else {
$memberData->setIsDisabled("no");
}
if(isset($_POST["IsDiabetic"])) {
$memberData->setIsDiabetic($_POST["IsDiabetic"]);
} else {
$memberData->setIsDiabetic("no");
}
if(isset($_POST["IsSmoker"])) {
$memberData->setIsSmoker($_POST["IsSmoker"]);
} else {
$memberData->setIsSmoker("non-smoker");
}
if(isset($_POST["DiseaseCountLowRisk"])) {
$memberData->setDiseaseCountLowRisk($_POST["DiseaseCountLowRisk"]);
}
if(isset($_POST["DiseaseCountMidRisk"])) {
$memberData->setDiseaseCountMidRisk($_POST["DiseaseCountMidRisk"]);
}
if(isset($_POST["DiseaseCountHighRisk"])) {
$memberData->setDiseaseCountHighRisk($_POST["DiseaseCountHighRisk"]);
}
$memberData->writeProfile();
}
}
?>
<body>
<div class="container">
<header class="clearfix">
<h1>User Profile: <b><?php echo $AccountName; ?></b> </h1>
<div style="float:right;">
<nav style="float:left;">
<a href="summary.php" data-info="Summary"><span class = "glyphicon glyphicon-stats"></a>
<a href="leaderboard.php" data-info="Leaderboard"><span class = "glyphicon glyphicon-star"></a>
<a href="profile.php" data-info="Your Profile"><span class = "glyphicon glyphicon-user"></span></a>
</nav>
<a href="feedback.php" data-info="Feedback" style="float:right;">
<img src="assets/feedback.svg"
title="Feedback"
data-info="Feedback"
style="width:2.5em;height:2.5em;margin-left:5px;margin-bottom:5px;">
<figcaption style="text-decoration: none;color:#003153;font-size:small;">Feedback</figcaption>
</a>
</div>
</header>
<div class="main">
<form class="cbp-mc-form" name="myForm" id="profile" method="post" onsubmit="return validateForm()" action="">
<div class="cbp-mc-column">
<label>Birth date*</label>
<input required style="height:2em;" type="date" name="DateOfBirth" value="<?php echo ($memberData->getIsProfilePresent()=='true')? (htmlspecialchars($memberData->getDOB())): ""; ?>">
<label>Biological Gender*</label>
<input type="radio" name="GeneticGender" value="Male" class="form-radio" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getGeneticGender()=='Male')? 'checked': ''; ?> >
<span class="form-radio-span">Male</span>
<input type="radio" name="GeneticGender" value="Female" id="radio-one" class="form-radio" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getGeneticGender()=='Female')? 'checked': ''; ?> >
<span class="form-radio-span">Female</span>
<label>Height*</label>
<div style="display:inline-block;height:2.5em;">
<input required min="1" type="number" name="HeightFeet" style="width:25%; float:left;height:2em;" value="<?php echo ($memberData->getIsProfilePresent()=='true')? (htmlspecialchars($memberData->getHeightFeet())): ""; ?>">
<span style="float:left;margin:1em;">feet</span>
</div>
<div style="display:inline-block;height:2.5em;">
<input required type="number" name="HeightInches" style="width:25%; float:left;height:2em;" value="<?php echo ($memberData->getIsProfilePresent()=='true')? (htmlspecialchars($memberData->getHeightInches())): ""; ?>">
<span style="float:left;margin:1em;">inches</span>
</div>
<label>Weight*</label>
<div style="display:inline-block;height:2.5em;">
<input required min="10" type="number" name="Weight" style="width: 50%;float:left;height:2em;" value="<?php echo ($memberData->getIsProfilePresent()=='true')? (htmlspecialchars($memberData->getWeight())): ""; ?>">
<span style="float:left;margin:1em;">pounds</span><br/>
</div>
<label>Marital Status*</label>
<input class="form-radio" type="radio" name="MaritalStatus" value="Single" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getMaritalStatus()=='Single')? 'checked': ''; ?>>
<span class="form-radio-span">Single</span>
<input class="form-radio" type="radio" name="MaritalStatus" value="Married" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getMaritalStatus()=='Married')? 'checked': ''; ?>>
<span class="form-radio-span">Married</span>
<input class="form-radio" type="radio" name="MaritalStatus" value="Separated" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getMaritalStatus()=='Separated')? 'checked': ''; ?>>
<span class="form-radio-span">Separated</span>
<input class="form-radio" type="radio" name="MaritalStatus" value="Divorced" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getMaritalStatus()=='Divorced')? 'checked': ''; ?>>
<span class="form-radio-span">Divorced</span>
<input class="form-radio" type="radio" name="MaritalStatus" value="Widowed" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getMaritalStatus()=='Widowed')? 'checked': ''; ?>>
<span class="form-radio-span">Widowed</span>
<label>Level of Education*</label>
<input class="form-radio" type="radio" name="LevelOfEducation" value="Below High School" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getLevelOfEducation()=='Below High School')? 'checked': ''; ?>>
<span class="form-radio-span">Below High School</span>
<input class="form-radio" type="radio" name="LevelOfEducation" value="High School" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getLevelOfEducation()=='High School')? 'checked': ''; ?>>
<span class="form-radio-span">High School</span>
<input class="form-radio" type="radio" name="LevelOfEducation" value="College" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getLevelOfEducation()=='College')? 'checked': ''; ?>>
<span class="form-radio-span">College</span>
<input class="form-radio" type="radio" name="LevelOfEducation" value="Graduate Degree" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getLevelOfEducation()=='Graduate Degree')? 'checked': ''; ?>>
<span class="form-radio-span">Graduate Degree</span>
</div>
<div class="cbp-mc-column">
<label>Any Disabilities?*</label>
<input class="form-radio" type="radio" name="IsDisabled" value="yes" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getIsDisabled()=='yes')? 'checked': ''; ?>>
<span class="form-radio-span">Yes</span>
<input class="form-radio" type="radio" name="IsDisabled" value="no" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getIsDisabled()=='no')? 'checked': ''; ?>>
<span class="form-radio-span">No</span>
<label>Are you a Smoker?*</label>
<input class="form-radio" type="radio" name="IsSmoker" value="smoker" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getIsSmoker()=='smoker')? 'checked': ''; ?>>
<span class="form-radio-span">Yes</span>
<input class="form-radio" type="radio" name="IsSmoker" value="non-Smoker" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getIsSmoker()=='non-Smoker')? 'checked': ''; ?>>
<span class="form-radio-span">No</span>
<label>Are you Diabetic?*</label>
<input class="form-radio" type="radio" name="IsDiabetic" value="yes" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getIsDiabetic()=='yes')? 'checked': ''; ?>>
<span class="form-radio-span">Yes</span>
<input class="form-radio" type="radio" name="IsDiabetic" value="no" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getIsDiabetic()=='no')? 'checked': ''; ?>>
<span class="form-radio-span">No</span>
<label>Current Occupation</label>
<select required name="Occupation" value="Graduate Degree">
<option value = "Student" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='Student')? 'selected': ''; ?>>Student
</option>
<option value = "Management, Business, and Finance" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='mgmt')? 'selected': ''; ?> >Management, Business, and Finance
</option>
<option value = "Professional and Related Services" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='Professional and Related Services')? 'selected': ''; ?> >
Professional and Related Services
</option>
<option value = "Sales and Related Services" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='Sales and Related Services')? 'selected': ''; ?> >Sales and Related
</option>
<option value = "Office and Administrative Support" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='Office and Administrative Support')? 'selected': ''; ?> >Office and Administrative Support
</option>
<option value = "Farming, Fishing and Forestry" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='Farming, Fishing and Forestry')? 'selected': ''; ?> >Farming, Fishing and Forestry
</option>
<option value = "Construction and Extraction" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='Construction and Extraction')? 'selected': ''; ?> >Construction and Extraction
</option>
<option value = "Installation, Maintenance and Repair" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='Installation, Maintenance and Repair')? 'selected': ''; ?> >Installation, Maintenance and Repair
</option>
<option value = "Production" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='Production')? 'selected': ''; ?> >Production
</option>
<option value = "Transportation and Material Moving" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='Transportation and Material Moving')? 'selected': ''; ?> >Transportation and Material Moving
</option>
<option value = "Unenployed" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getOccupation()=='Unenployed')? 'selected': ''; ?> >Unemployed
</option>
</select>
<label>Annual Income</label>
<select required name="IncomeRange">
<option value = "<25000" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getIncomeRange()=='<25000')? 'selected': ''; ?> >
< 25,000
</option>
<option value = "25000-50000" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getIncomeRange()=='25000-50000')? 'selected': ''; ?> >25,000 - 50,000
</option>
<option value = "50000-75000" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getIncomeRange()=='50000-75000')? 'selected': 'false'; ?>>50,000 - 75,000
</option>
<option value = "75000-100000" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getIncomeRange()=='75000-100000')? 'selected': ''; ?> >75,000 - 100,000
</option>
<option value = ">100000" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getIncomeRange()=='>100000')? 'selected': ''; ?> > 100,000
</option>
</select>
<label>Religion</label>
<input class="form-radio" type="radio" name="ReligiousObservance" value="None" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getReligiousObservance()=='None')? 'checked': ''; ?>>
<span class="form-radio-span">None</span>
<input class="form-radio" type="radio" name="ReligiousObservance" value="Strongly" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getReligiousObservance()=='Strongly')? 'checked': ''; ?>>
<span class="form-radio-span">Strongly</span>
<input class="form-radio" type="radio" name="ReligiousObservance" value="Moderately" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getReligiousObservance()=='Moderately')? 'checked': ''; ?>>
<span class="form-radio-span">Moderately</span>
<label>Type of Residence</label>
<input class="form-radio" type="radio" name="ResidentialSetting" value="Rural" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getResidentialSetting()=='Rural')? 'checked': ''; ?>>
<span class="form-radio-span">Rural</span>
<input class="form-radio" type="radio" name="ResidentialSetting" value="Urban" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getResidentialSetting()=='Urban')? 'checked': ''; ?>>
<span class="form-radio-span">Urban</span>
<input class="form-radio" type="radio" name="ResidentialSetting" value="Suburban" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getResidentialSetting()=='Suburban')? 'checked': ''; ?>>
<span class="form-radio-span">Suburban</span>
<label>How is your driving history?*</label>
<input class="form-radio" type="radio" name="DrivingHistory" value="0 Accidents per year" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getDrivingHistory()=='0 Accidents per year')? 'checked': ''; ?> >
<span class="form-radio-span">0 Accidents per year</span>
<input class="form-radio" type="radio" name="DrivingHistory" value="1 Accident per year" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getDrivingHistory()=='1 Accidents per year')? 'checked': ''; ?> >
<span class="form-radio-span">1 Accident per year</span>
<input class="form-radio" type="radio" name="DrivingHistory" value="2 or more accidents per year" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getDrivingHistory()=='2 or more accidents per year')? 'checked': ''; ?> >
<span class="form-radio-span">2 or more accidents per year</span>
</div>
<div class="cbp-mc-column">
<label>Ethnicity</label>
<select required name="Ethnicity">
<option value="Americal Indian, or Alaskan Native" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getEthnicity()=='American Indian, or Alaskan Native')? 'selected': ''; ?> >American Indian or Alaskan Native
</option>
<option value="Asian" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getEthnicity()=='Asian')? 'selected': ''; ?> >Asian
</option>
<option value="Black or African American" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getEthnicity()=='Black or African American')? 'selected': ''; ?> >Black or African American
</option>
<option value="Hispanic/Latino" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getEthnicity()=='Hispanic/Latino')? 'selected': ''; ?> >Hispanic/Latino
</option>
<option value="Caucasion" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getEthnicity()=='Caucasion')? 'selected': ''; ?> >Caucasian
</option>
<option value="Other" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getEthnicity()=='Other')? 'selected': ''; ?> >Other
</option>
</select>
<label>Medication for any pre-existing condition</label>
<textarea value = "<?php echo ($memberData->getIsProfilePresent()==true)? htmlspecialchars($memberData->getMedication()): ''; ?>"></textarea>
<label>credit score</label>
<input class="form-radio" type="radio" name="CreditScore" value="Below 500" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getCreditScore()=='Below 500')? 'checked': ''; ?> >
<span class="form-radio-span">Below 500</span>
<input class="form-radio" type="radio" name="CreditScore" value="500-750" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getCreditScore()=='500-750')? 'checked': ''; ?> >
<span class="form-radio-span">500-750</span>
<input class="form-radio" type="radio" name="CreditScore" value="Above 750" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getCreditScore()=='Above 750')? 'checked': ''; ?> >
<span class="form-radio-span">Above 750</span>
<label>Preferred Diet</label>
<input class="form-radio" type="radio" name="DietChoices" value="None" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getDietChoices()=='None')? 'checked': ''; ?> >
<span class="form-radio-span">None</span>
<input class="form-radio" type="radio" name="DietChoices" value="Vegetarian" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getDietChoices()=='Vegetarian')? 'checked': ''; ?> >
<span class="form-radio-span">Vegetarian</span>
<input class="form-radio" type="radio" name="DietChoices" value="Vegan" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getDietChoices()=='Vegan')? 'checked': ''; ?> >
<span class="form-radio-span">Vegan</span>
<input class="form-radio" type="radio" name="DietChoices" value="Pescatarian" <?php echo ($memberData->getIsProfilePresent()=='true' && $memberData->getDietChoices()=='Pescatarian')? 'checked': ''; ?> >
<span class="form-radio-span">Pescatarian</span>
<label>Number of less severe diseases</label>
<select required name="DiseaseCountLowRisk">
<option value="0" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountLowRisk()=='0')? 'selected': ''; ?> >0
</option>
<option value="1" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountLowRisk()=='1')? 'selected': ''; ?> >1
</option>
<option value="2" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountLowRisk()=='2')? 'selected': ''; ?> >2
</option>
<option value="3" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountLowRisk()=='3')? 'selected': ''; ?> >3
</option>
<option value="4" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountLowRisk()=='4')? 'selected': ''; ?> >4
</option>
</select>
<label>Number of moderately severe diseases</label>
<select required name="DiseaseCountMidRisk">
<option value="0" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountMidRisk()=='0')? 'selected': ''; ?> >0
</option>
<option value="1" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountMidRisk()=='1')? 'selected': ''; ?> >1
</option>
<option value="2" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountMidRisk()=='2')? 'selected': ''; ?> >2
</option>
<option value="3" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountMidRisk()=='3')? 'selected': ''; ?> >3
</option>
<option value="4" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountMidRisk()=='4')? 'selected': ''; ?> >4
</option>
</select>
<label>Number of highly severe diseases</label>
<select required name="DiseaseCountHighRisk">
<option value="0" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountHighRisk()=='0')? 'selected': ''; ?> >0
</option>
<option value="1" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountHighRisk()=='1')? 'selected': ''; ?> >1
</option>
<option value="2" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountHighRisk()=='2')? 'selected': ''; ?> >2
</option>
<option value="3" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountHighRisk()=='3')? 'selected': ''; ?> >3
</option>
<option value="4" <?php echo ($memberData->getIsProfilePresent()==true && $memberData->getDiseaseCountHighRisk()=='4')? 'selected': ''; ?> >4
</option>
</select>
</div>
<div class="cbp-mc-submit-wrap"><input class="cbp-mc-submit" type="submit" name="submit" value="Save" /></div>
</form>
</div>
</div>
</body>
<script>
window.onload = function () {
var form = document.getElementById('myForm');
form.button.onclick = function (){
for(var i=0; i < form.elements.length; i++){
if(form.elements[i].value === '' && form.elements[i].hasAttribute('required')){
alert('There are some required fields!');
return false;
}
}
form.submit();
};
};
</script>