Permalink
Cannot retrieve contributors at this time
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?
golden/summary.1.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
496 lines (441 sloc)
26 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$title = 'Members Page'; | |
require 'layout/header.php'; | |
include (__DIR__."/Utility/surveyData.php"); | |
include (__DIR__."/Utility/dataConnect.php"); | |
include (__DIR__."/Utility/profileData.php"); | |
include (__DIR__."/Utility/hleData.php"); | |
//$AccountName = $_COOKIE['LivingHealthy']; | |
$AccountName = 'hhp14001'; | |
$memberData = new userProfile($AccountName); | |
function weeks_in_month() { | |
$now = new DateTime('now'); | |
$month = $now->format('m'); | |
$year = $now->format('Y'); | |
$start = mktime(0, 0, 0, $month, 1, $year); | |
$end = mktime(0, 0, 0, $month, date('t', $start), $year); | |
$start_week = date('W', $start); | |
$end_week = date('W', $end); | |
if ($end_week < $start_week) { | |
return ((52 + $end_week) - $start_week) + 1; | |
} | |
return ($end_week - $start_week) + 1; | |
} | |
function debug_to_console( $data ) { | |
$output = $data; | |
if ( is_array( $output ) ) | |
$output = implode( ',', $output); | |
echo "<script>console.log( 'Debug Objects: " . $output . "' );</script>"; | |
} | |
$now = new DateTime('now'); | |
$month = $now->format('m'); | |
$year = $now->format('Y'); | |
$currentWeek = $now->format('W'); | |
$isPointsPresentForWeek = array("week1"=>true , "week2"=>false , "week3"=>false, "week4"=>false,"week5" =>false, "week6" => false); | |
$surveyWeek1 = new survey($AccountName, $year, $month, 1); | |
if($surveyWeek1->getIsSurveyPresent()) { | |
$hleWeek1 = new hleData($memberData, $surveyWeek1); | |
$pointsWeek1 = $hleWeek1->getPoints(); | |
} else { | |
$pointsWeek1 = 0; | |
} | |
$surveyWeek2 = new survey($AccountName, $year, $month, 2); | |
if($surveyWeek2->getIsSurveyPresent()) { | |
$hleWeek2 = new hleData($memberData, $surveyWeek2); | |
$pointsWeek2 = $hleWeek2->getPoints(); | |
$isPointsPresentForWeek["week2"] = true; | |
} else { | |
if($currentWeek > 2) | |
{ | |
$pointsWeek2 = $pointsWeek1; | |
} | |
else{ | |
$pointsWeek2 = 0; | |
} | |
} | |
$surveyWeek3 = new survey($AccountName, $year, $month, 3); | |
if($surveyWeek3->getIsSurveyPresent()) { | |
$hleWeek3 = new hleData($memberData, $surveyWeek3); | |
$pointsWeek3 = $hleWeek3->getPoints(); | |
$isPointsPresentForWeek["week3"] = true; | |
} else { | |
if(($currentWeek > 3) AND ($isPointsPresentForWeek["week2"] == true)) | |
{ | |
$pointsWeek3 = $pointsWeek2; | |
} | |
else{ | |
$pointsWeek2 = 0; | |
} | |
} | |
$surveyWeek4 = new survey($AccountName, $year, $month, 4); | |
if($surveyWeek4->getIsSurveyPresent()) { | |
$hleWeek4 = new hleData($memberData, $surveyWeek4); | |
$pointsWeek4 = $hleWeek4->getPoints(); | |
$isPointsPresentForWeek["week4"] = true; | |
} else { | |
if(($currentWeek > 4) AND ($isPointsPresentForWeek["week3"] == true)) | |
{ | |
$pointsWeek4 = $pointsWeek3; | |
} | |
else{ | |
$pointsWeek4 = 0; | |
} | |
} | |
$surveyWeek5 = new survey($AccountName, $year, $month, 5); | |
if($surveyWeek5->getIsSurveyPresent()) { | |
$hleWeek5 = new hleData($memberData, $surveyWeek5); | |
$pointsWeek5 = $hleWeek5->getPoints(); | |
$isPointsPresentForWeek["week5"] = true; | |
} else { | |
if(($currentWeek > 5) AND ($isPointsPresentForWeek["week4"] == true)) | |
{ | |
$pointsWeek5 = $pointsWeek4; | |
} | |
else{ | |
$pointsWeek5 = 0; | |
} | |
} | |
$surveyWeek6 = new survey($AccountName, $year, $month, 6); | |
if($surveyWeek6->getIsSurveyPresent()) { | |
$hleWeek6 = new hleData($memberData, $surveyWeek6); | |
$pointsWeek6 = $hleWeek6->getPoints(); | |
$isPointsPresentForWeek["week6"] = true; | |
} else { | |
if(($currentWeek > 6) AND ($isPointsPresentForWeek["week5"] == true)) | |
{ | |
$pointsWeek6 = $pointsWeek5; | |
} | |
else{ | |
$pointsWeek6 = 0; | |
} | |
} | |
?> | |
<script> | |
function selectedWeek(week) { | |
$.cookie("selectedWeek", week); | |
window.location.href = "survey.php"; | |
} | |
</script> | |
<body> | |
<div class="main-content"> | |
<p style="display: inline; margin-left: 3em;font-size: medium;">Welcome, | |
Rajan | |
</p> | |
<div class="dropdown" style="float: right; margin-right: 5em;margin-top:3px;"> | |
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> | |
Dropdown | |
<span class="caret"></span> | |
</button> | |
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> | |
<li><a href="summary.php">Summary</a></li> | |
<li><a href="profile.php">Profile</a></li> | |
<li><a href="demo.php">Demo</a></li> | |
<li><a href="#">Leaderboard</a></li> | |
<li><a href="#" onclick="location.href = `logout.php`;">Logout</a></li> | |
</ul> | |
</div> | |
<div class="container" style="margin-top:1em;"> | |
<h3>Summary</h3> | |
<div class="row"> | |
<div class="col-md-12"> | |
<div class="panel-group" id="accordion"> | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<h4 class="panel-title"> | |
<a style="text-decoration: none;" data-toggle="collapse" data-parent="#accordion" href="#collapseOne"><img src="./assets/user-male-black-shape.svg" style="height:18px;"> | |
</span>Individual</a> | |
</h4> | |
</div> | |
<div id="collapseOne" class="panel-collapse"> | |
<div class="panel-body"> | |
<div class=""> | |
<div class="col-md-12"> | |
<div class="rTable"> | |
<div class="rTableRow"> | |
<div class="rTableHead"><strong>Week</strong></div> | |
<div class="rTableHead"><strong>Survey Status</strong></div> | |
<div class="rTableHead"><strong>Score</strong></div> | |
<div class="rTableHead"><strong>Rank</strong></div> | |
</div> | |
<div class="rTableRow" <?php if (1 > $weeks_in_month) {?>style="display:none"<?php } ?> > | |
<div class="rTableCellBorder">1st</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"> | |
<input type="button" | |
class="btn btn-primary" | |
value="Available" | |
onclick="selectedWeek('1')"> | |
</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"><?php echo(round($pointsWeek1,2)); ?></div> | |
<div class="rTableCell" style="font-weight: bold;">50</div> | |
</div> | |
<div class="rTableRow" <?php if (2 > $weeks_in_month) {?>style="display:none"<?php } ?> > | |
<div class="rTableCellBorder">2nd</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"> | |
<input type="button" | |
class="btn btn-primary" | |
value="Available" | |
onclick="selectedWeek('2')"> | |
</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"><?php echo(round($pointsWeek2,2)); ?></div> | |
<div class="rTableCell" style="font-weight: bold;">50</div> | |
</div> | |
<div class="rTableRow" <?php if (3 > $weeks_in_month) {?>style="display:none"<?php } ?> > | |
<div class="rTableCellBorder">3rd</div> | |
<div class="rTableCell"> | |
<input type="button" | |
class="btn btn-primary" | |
value="Available" | |
onclick="selectedWeek('3')"> | |
</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"><?php echo(round($pointsWeek3,2)); ?></div> | |
<div class="rTableCell">-</div> | |
</div> | |
<div class="rTableRow" <?php if (4 > $weeks_in_month) {?>style="display:none"<?php } ?> > | |
<div class="rTableCellBorder">4th</div> | |
<div class="rTableCell"> | |
<input type="button" | |
class="btn btn-primary" | |
value="Available" | |
onclick="selectedWeek('4')"> | |
</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"><?php echo(round($pointsWeek4,2)); ?></div> | |
<div class="rTableCell">-</div> | |
</div> | |
<div class="rTableRow" <?php if (5 > $weeks_in_month) {?>style="display:none"<?php } ?> > | |
<div class="rTableCellBorder">5th</div> | |
<div class="rTableCell"> | |
<input type="button" | |
class="btn btn-primary" | |
value="Available" | |
onclick="selectedWeek('5')"> | |
</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"><?php echo(round($pointsWeek5,2)); ?></div> | |
<div class="rTableCell">-</div> | |
</div> | |
<div class="rTableRow" <?php if (6 > $weeks_in_month) {?>style="display:none"<?php } ?> > | |
<div class="rTableCellBorder">6th</div> | |
<div class="rTableCell"> | |
<input type="button" | |
class="btn btn-primary" | |
value="Available" | |
onclick="selectedWeek('6')"> | |
</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"><?php echo(round($pointsWeek6,2)); ?></div> | |
<div class="rTableCell">-</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<h4 class="panel-title"> | |
<a style="text-decoration: none;" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo"><img src="./assets/group.svg" style="height:30px;"> | |
</span>Group: Friends</a> | |
</h4> | |
</div> | |
<div id="collapseTwo" class="panel-collapse collapse"> | |
<div class="panel-body"> | |
<div class="row"> | |
<div class="col-md-12"> | |
<div class="rTable"> | |
<div class="rTableRow"> | |
<div class="rTableHead"><strong>Week</strong></div> | |
<div class="rTableHead"><strong>Summary</strong></div> | |
<div class="rTableHead"><strong>Aggregate</strong></div> | |
<div class="rTableHead"><strong>Group Rank</strong></div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder"><strong>Week 1</strong></div> | |
<div class="rTableCell"> | |
<div class="rTable"> | |
<div class="rTableRow"> | |
<div class="rTableHead"><strong>Member</strong></div> | |
<div class="rTableHead"><strong>Survey Status</strong></div> | |
<div class="rTableHead"><strong>Score</strong></div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Rajan</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"> | |
<input type="button" | |
class="btn btn-success disabled" | |
style="cursor:default;" | |
value="Complete"> | |
</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;">10070</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Vinod</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"> | |
<input type="button" | |
class="btn btn-success disabled" | |
style="cursor:default;" | |
value="Complete"> | |
</div> | |
<div class="rTableCell" style="color:red;font-weight: bold;">10000</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Justin</div> | |
<div class="rTableCell"> | |
<input type="button" | |
class="btn btn-primary" | |
value="Available" | |
data-toggle="modal" data-target="#modalForm"> | |
</div> | |
<div class="rTableCell">-</div> | |
</div> | |
</div> | |
</div> | |
<div class="rTableCell">20070</div> | |
<div class="rTableCell">75</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder"><strong>Week 2</strong></div> | |
<div class="rTableCell"> | |
<div class="rTable"> | |
<div class="rTableRow"> | |
<div class="rTableHead"><strong>Member</strong></div> | |
<div class="rTableHead"><strong>Survey Status</strong></div> | |
<div class="rTableHead"><strong>Score</strong></div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Rajan</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"> | |
<input type="button" | |
class="btn btn-success disabled" | |
style="cursor:default;" | |
value="Complete"> | |
</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;">10070</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Vinod</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"> | |
<input type="button" | |
class="btn btn-success disabled" | |
style="cursor:default;" | |
value="Complete"> | |
</div> | |
<div class="rTableCell" style="color:red;font-weight: bold;">10000</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Justin</div> | |
<div class="rTableCell"> | |
<input type="button" | |
class="btn btn-primary" | |
value="Available" | |
data-toggle="modal" data-target="#modalForm"> | |
</div> | |
<div class="rTableCell">-</div> | |
</div> | |
</div> | |
</div> | |
<div class="rTableCell">20070</div> | |
<div class="rTableCell">75</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder"><strong>Week 3</strong></div> | |
<div class="rTableCell"> | |
<div class="rTable"> | |
<div class="rTableRow"> | |
<div class="rTableHead"><strong>Member</strong></div> | |
<div class="rTableHead"><strong>Survey Status</strong></div> | |
<div class="rTableHead"><strong>Score</strong></div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Rajan</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"> | |
<input type="button" | |
class="btn btn-success disabled" | |
style="cursor:default;" | |
value="Complete"> | |
</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;">10070</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Vinod</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"> | |
<input type="button" | |
class="btn btn-success disabled" | |
style="cursor:default;" | |
value="Complete"> | |
</div> | |
<div class="rTableCell" style="color:red;font-weight: bold;">10000</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Justin</div> | |
<div class="rTableCell"> | |
<input type="button" | |
class="btn btn-primary" | |
value="Available" | |
data-toggle="modal" data-target="#modalForm"> | |
</div> | |
<div class="rTableCell">-</div> | |
</div> | |
</div> | |
</div> | |
<div class="rTableCell">20070</div> | |
<div class="rTableCell">75</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder"><strong>Week 4</strong></div> | |
<div class="rTableCell"> | |
<div class="rTable"> | |
<div class="rTableRow"> | |
<div class="rTableHead"><strong>Member</strong></div> | |
<div class="rTableHead"><strong>Survey Status</strong></div> | |
<div class="rTableHead"><strong>Score</strong></div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Rajan</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"> | |
<input type="button" | |
class="btn btn-success disabled" | |
style="cursor:default;" | |
value="Complete"> | |
</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;">10070</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Vinod</div> | |
<div class="rTableCell" style="color:green;font-weight: bold;"> | |
<input type="button" | |
class="btn btn-success disabled" | |
style="cursor:default;" | |
value="Complete"> | |
</div> | |
<div class="rTableCell" style="color:red;font-weight: bold;">10000</div> | |
</div> | |
<div class="rTableRow"> | |
<div class="rTableCellBorder">Justin</div> | |
<div class="rTableCell"> | |
<input type="button" | |
class="btn btn-primary" | |
value="Available" | |
data-toggle="modal" data-target="#modalForm"> | |
</div> | |
<div class="rTableCell">-</div> | |
</div> | |
</div> | |
</div> | |
<div class="rTableCell">20070</div> | |
<div class="rTableCell">75</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
<?php | |
//include header template | |
require 'layout/footer.php'; | |
?> |