.inc files migration to .inc.php (#5897)
[openemr.git] / contrib / forms / sports_fitness / view.php
blob2d72c21083a2baaca51b58facf056067b0440e84
1 <?php
3 //////////////////////////////////////////////////////////////////////
4 // ------------------ DO NOT MODIFY VIEW.PHP !!! ---------------------
5 // View.php is an exact duplicate of new.php. If you wish to make
6 // any changes, then change new.php and either (recommended) make
7 // view.php a symbolic link to new.php, or copy new.php to view.php.
8 //
9 // And if you check in a change to either module, be sure to check
10 // in the other (identical) module also.
12 // This nonsense will go away if we ever move to subversion.
13 //////////////////////////////////////////////////////////////////////
15 // Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
17 // This program is free software; you can redistribute it and/or
18 // modify it under the terms of the GNU General Public License
19 // as published by the Free Software Foundation; either version 2
20 // of the License, or (at your option) any later version.
22 require_once("../../globals.php");
23 require_once("$srcdir/api.inc.php");
24 require_once("$srcdir/forms.inc.php");
26 use OpenEMR\Core\Header;
28 $row = array();
30 if (! $encounter) { // comes from globals.php
31 die("Internal error: we do not seem to be in an encounter!");
34 function rbvalue($rbname)
36 $tmp = $_POST[$rbname];
37 if (! $tmp) {
38 return "NULL";
41 return "$tmp";
44 function rbinput($name, $value, $desc, $colname)
46 global $row;
47 $ret = "<input type='radio' name='" . attr($name) . "' value='" . attr($value) . "'";
48 if ($row[$colname] == $value) {
49 $ret .= " checked";
52 $ret .= " />" . text($desc);
53 return $ret;
56 $formid = $_GET['id'];
58 // If Save was clicked, save the info.
60 if ($_POST['bn_save']) {
61 // If updating an existing form...
63 if ($formid) {
64 $query = "UPDATE form_sports_fitness SET
65 height_meters = ?,
66 weight_kg = ?,
67 skin_folds_9x = ?,
68 skin_folds_5x = ?,
69 pct_body_fat = ?,
70 method_body_fat = ?,
71 pulse = ?,
72 bps = ?,
73 bpd = ?,
74 beep_level = ?,
75 beep_shuttles = ?,
76 beep_vo2_max = ?,
77 vertical_jump_meters = ?,
78 agility_505 = ?,
79 sit_and_reach_cm = ?,
80 other = ?,
81 WHERE id = ?";
82 sqlStatement($query, array($_POST['form_height_meters'], $_POST['form_weight_kg'], $_POST['form_skin_folds_9x'], $_POST['form_skin_folds_5x'], $_POST['form_pct_body_fat'], rbvalue('form_method_body_fat'),
83 $_POST['form_pulse'], $_POST['form_bps'], $_POST['form_bpd'], $_POST['form_beep_level'], $_POST['form_beep_shuttles'], $_POST['form_beep_vo2_max'], $_POST['form_vertical_jump_meters'],
84 $_POST['form_agility_505'], $_POST['form_sit_and_reach_cm'], $_POST['form_other'], $formid));
85 } else { // If adding a new form...
86 $query = "INSERT INTO form_sports_fitness ( " .
87 "height_meters, weight_kg, skin_folds_9x, skin_folds_5x, " .
88 "pct_body_fat, method_body_fat, pulse, bps, bpd, " .
89 "beep_level, beep_shuttles, beep_vo2_max, " .
90 "vertical_jump_meters, agility_505, sit_and_reach_cm, other " .
91 ") VALUES ( ?, ?, ?, ?, ?, ?, ?, ?,
92 ?, ?, ?, ?, ?, ?, ?, ?)";
94 $newid = sqlInsert($query, array($_POST['form_height_meters'], $_POST['form_weight_kg'], $_POST['form_skin_folds_9x'], $_POST['form_skin_folds_5x'], $_POST['form_pct_body_fat'], rbvalue('form_method_body_fat'),
95 $_POST['form_pulse'], $_POST['form_bps'], $_POST['form_bpd'], $_POST['form_beep_level'], $_POST['form_beep_shuttles'], $_POST['form_beep_vo2_max'], $_POST['form_vertical_jump_meters'],
96 $_POST['form_agility_505'], $_POST['form_sit_and_reach_cm'], $_POST['form_other']));
97 addForm($encounter, "Sports Fitness", $newid, "sports_fitness", $pid, $userauthorized);
101 formHeader("Redirecting....");
102 formJump();
103 formFooter();
104 exit;
107 if ($formid) {
108 $row = sqlQuery("SELECT * FROM form_sports_fitness WHERE " .
109 "id = ? AND activity = '1'", [$formid]) ;
112 <html>
113 <head>
114 <?php Header::setupHeader(); ?>
115 </head>
117 <body class="body_top">
118 <form method="post" action="<?php echo $rootdir ?>/forms/sports_fitness/new.php?id=<?php echo attr_url($formid); ?>"
119 onsubmit="return top.restoreSession()">
121 <center>
124 <table border='1' width='95%'>
126 <tr bgcolor='#dddddd'>
127 <td colspan='2' align='center'><b>Physical + Fitness Tests</b></td>
128 </tr>
130 <tr>
131 <td nowrap>Vitals</td>
132 <td nowrap>
133 <table width='100%'>
134 <tr>
135 <td width='20%' nowrap>
136 Height (meters):
137 </td>
138 <td width='13%' nowrap>
139 <input type='text' name='form_height_meters' size='6'
140 title='Height in meters'
141 value='<?php echo attr($row['height_meters']) ?>' /> &nbsp;
142 </td>
143 <td width='20%' nowrap>
144 Weight (kg):
145 </td>
146 <td width='13%' nowrap>
147 <input type='text' name='form_weight_kg' size='6'
148 title='Weight in kilograms'
149 value='<?php echo attr($row['weight_kg']) ?>' /> &nbsp;
150 </td>
151 <td width='20%' nowrap>
152 &nbsp;
153 </td>
154 <td nowrap>
155 &nbsp;
156 </td>
157 </tr>
158 <tr>
159 <td nowrap>
160 Resting Pulse:
161 </td>
162 <td nowrap>
163 <input type='text' name='form_pulse' size='6'
164 title='Resting pulse rate per minute'
165 value='<?php echo attr($row['pulse']) ?>' /> &nbsp;
166 </td>
167 <td nowrap>
168 Systolic BP:
169 </td>
170 <td nowrap>
171 <input type='text' name='form_bps' size='6'
172 title='mm Hg'
173 value='<?php echo attr($row['bps']) ?>' /> &nbsp;
174 </td>
175 <td nowrap>
176 Dyastolic BP:
177 </td>
178 <td nowrap>
179 <input type='text' name='form_bpd' size='6'
180 title='mm Hg'
181 value='<?php echo attr($row['bps']) ?>' /> &nbsp;
182 </td>
183 </tr>
184 </table>
185 </td>
186 </tr>
188 <tr>
189 <td>Body<br />Composition</td>
190 <td nowrap>
191 <table width='100%'>
192 <tr>
193 <td width='20%' nowrap>
194 Skin Folds 9x:
195 </td>
196 <td width='13%' nowrap>
197 <input type='text' name='form_skin_folds_9x' size='6'
198 title='Total of 9 skin fold readings in cm'
199 value='<?php echo attr($row['skin_folds_9x']) ?>' /> &nbsp;
200 </td>
201 <td width='20%' nowrap>
202 Skin Folds 5x:
203 </td>
204 <td width='13%' nowrap>
205 <input type='text' name='form_skin_folds_5x' size='6'
206 title='Total of 5 skin fold readings in cm'
207 value='<?php echo attr($row['skin_folds_5x']) ?>' /> &nbsp;
208 </td>
209 <td width='20%' nowrap>
210 % Body Fat:
211 </td>
212 <td nowrap>
213 <input type='text' name='form_pct_body_fat' size='6'
214 title='Percent body fat'
215 value='<?php echo attr($row['pct_body_fat']) ?>' /> &nbsp;
216 </td>
217 </tr>
218 <tr>
219 <td colspan='6' nowrap>
220 B.F. Method Used:&nbsp;
221 <?php echo rbinput('form_method_body_fat', 'Caliper', 'Caliper', 'method_body_fat') ?>&nbsp;
222 <?php echo rbinput('form_method_body_fat', 'Electronic', 'Electronic', 'method_body_fat') ?>&nbsp;
223 <?php echo rbinput('form_method_body_fat', 'Hydrostatic', 'Hydrostatic', 'method_body_fat') ?>
224 </td>
225 </tr>
226 </table>
227 </td>
228 </tr>
230 <tr>
231 <td nowrap>Beep Test</td>
232 <td nowrap>
233 <table width='100%'>
234 <tr>
235 <td width='20%' nowrap>
236 Level:
237 </td>
238 <td width='13%' nowrap>
239 <input type='text' name='form_beep_level' size='6'
240 title='Level Reached'
241 value='<?php echo attr($row['beep_level']) ?>' /> &nbsp;
242 </td>
243 <td width='20%' nowrap>
244 Shuttles:
245 </td>
246 <td width='13%' nowrap>
247 <input type='text' name='form_beep_shuttles' size='6'
248 title='Number of shuttles at this level'
249 value='<?php echo attr($row['beep_shuttles']) ?>' /> &nbsp;
250 </td>
251 <td width='20%' nowrap>
252 VO2 Max:
253 </td>
254 <td nowrap>
255 <input type='text' name='form_beep_vo2_max' size='6'
256 title='ml/kg/min'
257 value='<?php echo attr($row['beep_vo2_max']) ?>' /> &nbsp;
258 </td>
259 </tr>
260 </table>
261 </td>
262 </tr>
264 <tr>
265 <td nowrap>Other Tests</td>
266 <td nowrap>
267 <table width='100%'>
268 <tr>
269 <td width='20%' nowrap>
270 Vertical Jump:
271 </td>
272 <td width='13%' nowrap>
273 <input type='text' name='form_vertical_jump_meters' size='6'
274 title='Vertical Jump Test in Meters'
275 value='<?php echo attr($row['vertical_jump_meters']) ?>' /> &nbsp;
276 </td>
277 <td width='20%' nowrap>
278 505 Agility:
279 </td>
280 <td width='13%' nowrap>
281 <input type='text' name='form_agility_505' size='6'
282 title='505 Agility Test in Seconds'
283 value='<?php echo attr($row['agility_505']) ?>' /> &nbsp;
284 </td>
285 <td width='20%' nowrap>
286 Sit &amp; Reach:
287 </td>
288 <td nowrap>
289 <input type='text' name='form_sit_and_reach_cm' size='6'
290 title='Sit and Reach Test in cm + or - ve'
291 value='<?php echo attr($row['sit_and_reach_cm']) ?>' /> &nbsp;
292 </td>
293 </tr>
294 </table>
295 </td>
296 </tr>
298 <tr>
299 <td nowrap>Still More</td>
300 <td nowrap>
301 <textarea name='form_other' rows='8' style='width:100%'><?php echo text($row['other']); ?></textarea>
302 </td>
303 </tr>
305 </table>
308 <input type='submit' name='bn_save' value='Save' />
309 &nbsp;
310 <input type='button' value='Cancel' onclick="parent.closeTab(window.name, false)" />
311 </p>
313 </center>
315 </form>
316 <?php
318 // TBD: If $alertmsg, display it with a JavaScript alert().
321 </body>
322 </html>