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