forked from TeamSBF/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
assessments.php
180 lines (163 loc) · 8.82 KB
/
assessments.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php require_once"header.php";
$msg = "";
if (isset($_POST['submitAssessments']))
{
$_POST['userID'] = $user->id;
$assessmentValidator = new assessment($_POST);
$assessmentReturn = $assessmentValidator->validateAssessments();
if($assessmentReturn =="SUCCESS")
{
$msg = ["Assessment Selection Completed.",1];
}else
{
$msg = ["Please select one or more assessments",0];
}
}
if (isset($_POST['submitData']))
{
$_POST['userID'] = $user->id;
unset($_POST['submitData']);
// printr($_POST);
$assessmentValidator = new assessment($_POST);
$assessmentReturn = $assessmentValidator->validateAssessmentData();
if($assessmentReturn =="SUCCESS")
$msg = ["Assessment submitted successfully.",1];
else {
$msg = ["Failed to submit assessment data",0];
}
}
$array = ["Chairstand" =>["30 Second Chair Stand","Lower body strength evaluation. Assess strength for climbing stairs, walking, and getting out of a chair, car, or tub. Number of full stands that can be completed in 30 seconds with arms folded across chest. If the arms are pulled away from the chest or you rock back and forward to help you stand that is unacceptable and the test will be stopped at that point. You may rest while siting on the chair and continue if you are still within the 30 seconds.","ChairStand","m0APvLqZr5E"],
"ArmCurl"=>["Arm Curl","Assess upper body strength, needed for performing household and other activities involving lifting and carrying things such as groceries, suitcases and grandchildren. Number of bicep curls – lifting the weight from the arm extended up to the shoulder and back down – that can be completed in 30 seconds holding a 5 lb weight (for women) or an 8 lb weight (for men). You may not use the back to help “throw” the weight up. The weight must come up and touch the shoulder and the return to the lowered position should be with control, not just dropping the arm. You may rest in the down position and continue with lifts if you are still within the 30 seconds.","ArmCurl","m0APvLqZr5E" ],
"StepTest"=>["2-Minute Step Test","Aerobic endurance test. Number of full steps completed in 2 minutes, raising the knee to a point halfway between the kneecap and the hip on each step. If the knee does not come up high enough you will be reminded to lift it higher. If you are testing yourself at home stand in front of a mirror so you can assess the knee height.","Steptest","m0APvLqZr5E" ],
"FootUpAndGo"=>["8 Foot Up and Go","Assess agility and dynamic balance needed for quick maneuvering such as getting on or off a bus, getting up to attend to something in the kitchen, going to the bathroom, or getting up to answer the phone. Number of seconds it takes to get up out of a chair, walk 8 feet, turn around a cone, and return to the chair and sit down. The entire movement must be in control. You may use your hands to help get up from the chair and to sit back down.","FootUpandGo","m0APvLqZr5E"],
"unilateralbalancetest"=>["Unilateral Balance Test","Fall risk evaluation. Balance test determined by how long you can stand on one foot without moving, or touching the lifted foot back to the ground. The lifted leg may not be braced against the support leg, lift the lower leg up and to the rear till the knee is at 90 degrees. Not acceptable is excessive movement of arms or body to hold position","Unilateral","m0APvLqZr5E"],
"FunctionalReach"=>["Functional Reach","Assess balance in a forward motion. Reach as far forward as you can keep your arm parallel to the yardstick without touching the wall or taking a step forward. Do not overreach and risk falling.","Functional","m0APvLqZr5E"]
];?>
<div class="background">
<!-- Accordion -->
<?php
$find = QueryFactory::Build('select');
$find->Select("Chairstand","ArmCurl","StepTest","FootUpAndGo","leftunilateralbalancetest","rightunilateralbalancetest","FunctionalReach")->From('assessments')->Where(['userID', '=', $user->id,"AND"],['DateCompleted','=',0]);
$find->Limit();
$res = DatabaseManager::Query($find);
$result=$res->Result();
$left = $result["leftunilateralbalancetest"];
$right =$result["rightunilateralbalancetest"];
$result["unilateralbalancetest"]=[$left,$right];
unset($result["leftunilateralbalancetest"],$result["rightunilateralbalancetest"]);
$time = QueryFactory::Build('select');
$time->Select("NextAssessment")->From("users")->Where(["id","=",$user->id])->limit();
$time = DatabaseManager::Query($time);
$time =$time->Result()["NextAssessment"];
//echo $time;
?>
<h1 class="demoHeaders">Assessments</h1>
<?php
//show next assessment date
if($time > 0 && $time > time())
{
echo "<h2>next assessment on ". date("F d, Y",$time). "</h2>";
}
?>
<form method="post">
<?php if(is_array($msg)) echo PartialParser::Parse("div",["content"=>$msg[0], "classes"=>($msg[1] === 1?"success":"error")]); ?>
<div id="accordion">
<?php
//get row count
$keys = array_keys($array);
$rowCount = $res->RowCount();
//set up accordion tabs
for($x=0;$x<count($keys);$x++){
$key = $keys[$x];
if($rowCount > 0)
{
if($result[$key] < -1)
{
continue;
}
else if(is_array($result[$key]))
{
$con = true;
foreach($result[$key] as $val)
{
if($val > -2)
{
$con = false;
}
}
if($con)
{
continue;
}
}
}?>
<h2><?php echo $array[$key][0];?></h2>
<div>
<?php
//if need to select assessments
if($rowCount<1)
{?>
<input type="checkbox" name="<?php echo $array[$key][2];?>">Select if you would like to do
<?php }
else if($time <= time())// && $time > 0)
{?>
<?php if($key==="unilateralbalancetest") {
if($result[$key][0]>= -1) {
if ($result[$key][0] < 0) {
$minutes = $seconds = "";
}
else {
$seconds =intval($result[$key][0]);
$minutes =(int)($seconds/60);
$seconds%=60;
$seconds=($seconds<0?"":$seconds);
$minutes=($minutes<0?"":$minutes);
}?>
Left Unilateral: <input type="number" name="left<?=$key;?>[]" value="<?=$minutes?>"> minutes
<input type="number" name="left<?=$key;?>[]" value="<?=$seconds?>"> seconds<br>
<?php }
if($result[$key][1]>= -1) {
if ($result[$key][0] < 0) {
$minutes = $seconds = "";
}
else {
$seconds =intval($result[$key][0]);
$minutes =(int)($seconds/60);
$seconds%=60;
$seconds=($seconds<0?"":$seconds);
$minutes=($minutes<0?"":$minutes);
}?>
Right Unilateral: <input type="number" name="right<?=$key;?>[]" value="<?=$minutes?>"> minutes
<input type="number" name="right<?=$key;?>[]" value="<?=$seconds?>"> seconds<br>
<?php }
}
else
{?>
<input type="number" name="<?php echo $keys[$x];?>" value="<?php if($result[$key] >-1){echo $result[$key];} ?>" min="0">
<?php }
}?>
<p>Definition:<?php echo $array[$keys[$x]][1];?></p>
<iframe width="100%" height="315" src="https://www.youtube.com/embed/<?php echo $array[$keys[$x]][3];?>" frameborder="0" allowfullscreen></iframe>
</div>
<?php }?>
</div>
<?php if($rowCount < 1 || ($time > 0 && $time <= time()))
{?>
<button type="submit" name="<?php echo($rowCount<1?"submitAssessments":"submitData"); ?>" >Submit</button>
<?php } ?>
</form>
<?php if(1==2){?>
<h2>Previous Tests</h2>
<table>
<thead>
<?php
foreach($keys as $key)
{
echo "<th>$key</th>";
}
?>
</thead>
</table>
<?php }?>
</div>
<?php require_once"footer.php";?>