Clickmap Graphical API and Pain Form
[openemr.git] / contrib / forms / sports_fitness / view.php
blob4a6ddb1a1fb2bf3d5b448b777f5c2cb2f95ac33f
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) {
32 $tmp = $_POST[$rbname];
33 if (! $tmp) return "NULL";
34 return "'$tmp'";
37 function rbinput($name, $value, $desc, $colname) {
38 global $row;
39 $ret = "<input type='radio' name='$name' value='$value'";
40 if ($row[$colname] == $value) $ret .= " checked";
41 $ret .= " />$desc";
42 return $ret;
45 $formid = $_GET['id'];
47 // If Save was clicked, save the info.
49 if ($_POST['bn_save']) {
51 // If updating an existing form...
53 if ($formid) {
54 $query = "UPDATE form_sports_fitness SET " .
55 "height_meters = '" . $_POST['form_height_meters'] . "', " .
56 "weight_kg = '" . $_POST['form_weight_kg'] . "', " .
57 "skin_folds_9x = '" . $_POST['form_skin_folds_9x'] . "', " .
58 "skin_folds_5x = '" . $_POST['form_skin_folds_5x'] . "', " .
59 "pct_body_fat = '" . $_POST['form_pct_body_fat'] . "', " .
60 "method_body_fat = " . rbvalue('form_method_body_fat') . ", " .
61 "pulse = '" . $_POST['form_pulse'] . "', " .
62 "bps = '" . $_POST['form_bps'] . "', " .
63 "bpd = '" . $_POST['form_bpd'] . "', " .
64 "beep_level = '" . $_POST['form_beep_level'] . "', " .
65 "beep_shuttles = '" . $_POST['form_beep_shuttles'] . "', " .
66 "beep_vo2_max = '" . $_POST['form_beep_vo2_max'] . "', " .
67 "vertical_jump_meters = '" . $_POST['form_vertical_jump_meters'] . "', " .
68 "agility_505 = '" . $_POST['form_agility_505'] . "', " .
69 "sit_and_reach_cm = '" . $_POST['form_sit_and_reach_cm'] . "', " .
70 "other = '" . $_POST['form_other'] . "' " .
71 "WHERE id = '$formid'";
72 sqlStatement($query);
75 // If adding a new form...
77 else {
78 $query = "INSERT INTO form_sports_fitness ( " .
79 "height_meters, weight_kg, skin_folds_9x, skin_folds_5x, " .
80 "pct_body_fat, method_body_fat, pulse, bps, bpd, " .
81 "beep_level, beep_shuttles, beep_vo2_max, " .
82 "vertical_jump_meters, agility_505, sit_and_reach_cm, other " .
83 ") VALUES ( " .
84 "'" . $_POST['form_height_meters'] . "', " .
85 "'" . $_POST['form_weight_kg'] . "', " .
86 "'" . $_POST['form_skin_folds_9x'] . "', " .
87 "'" . $_POST['form_skin_folds_5x'] . "', " .
88 "'" . $_POST['form_pct_body_fat'] . "', " .
89 rbvalue('form_method_body_fat') . ", " .
90 "'" . $_POST['form_pulse'] . "', " .
91 "'" . $_POST['form_bps'] . "', " .
92 "'" . $_POST['form_bpd'] . "', " .
93 "'" . $_POST['form_beep_level'] . "', " .
94 "'" . $_POST['form_beep_shuttles'] . "', " .
95 "'" . $_POST['form_beep_vo2_max'] . "', " .
96 "'" . $_POST['form_vertical_jump_meters'] . "', " .
97 "'" . $_POST['form_agility_505'] . "', " .
98 "'" . $_POST['form_sit_and_reach_cm'] . "', " .
99 "'" . $_POST['form_other'] . "' " .
100 ")";
101 $newid = sqlInsert($query);
102 addForm($encounter, "Sports Fitness", $newid, "sports_fitness", $pid, $userauthorized);
105 formHeader("Redirecting....");
106 formJump();
107 formFooter();
108 exit;
111 if ($formid) {
112 $row = sqlQuery ("SELECT * FROM form_sports_fitness WHERE " .
113 "id = '$formid' AND activity = '1'") ;
116 <html>
117 <head>
118 <?php html_header_show();?>
119 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
120 <script language="JavaScript">
121 </script>
122 </head>
124 <body class="body_top">
125 <form method="post" action="<?php echo $rootdir ?>/forms/sports_fitness/new.php?id=<?php echo $formid ?>"
126 onsubmit="return top.restoreSession()">
128 <center>
131 <table border='1' width='95%'>
133 <tr bgcolor='#dddddd'>
134 <td colspan='2' align='center'><b>Physical + Fitness Tests</b></td>
135 </tr>
137 <tr>
138 <td nowrap>Vitals</td>
139 <td nowrap>
140 <table width='100%'>
141 <tr>
142 <td width='20%' nowrap>
143 Height (meters):
144 </td>
145 <td width='13%' nowrap>
146 <input type='text' name='form_height_meters' size='6'
147 title='Height in meters'
148 value='<?php echo addslashes($row['height_meters']) ?>' /> &nbsp;
149 </td>
150 <td width='20%' nowrap>
151 Weight (kg):
152 </td>
153 <td width='13%' nowrap>
154 <input type='text' name='form_weight_kg' size='6'
155 title='Weight in kilograms'
156 value='<?php echo addslashes($row['weight_kg']) ?>' /> &nbsp;
157 </td>
158 <td width='20%' nowrap>
159 &nbsp;
160 </td>
161 <td nowrap>
162 &nbsp;
163 </td>
164 </tr>
165 <tr>
166 <td nowrap>
167 Resting Pulse:
168 </td>
169 <td nowrap>
170 <input type='text' name='form_pulse' size='6'
171 title='Resting pulse rate per minute'
172 value='<?php echo addslashes($row['pulse']) ?>' /> &nbsp;
173 </td>
174 <td nowrap>
175 Systolic BP:
176 </td>
177 <td nowrap>
178 <input type='text' name='form_bps' size='6'
179 title='mm Hg'
180 value='<?php echo addslashes($row['bps']) ?>' /> &nbsp;
181 </td>
182 <td nowrap>
183 Dyastolic BP:
184 </td>
185 <td nowrap>
186 <input type='text' name='form_bpd' size='6'
187 title='mm Hg'
188 value='<?php echo addslashes($row['bps']) ?>' /> &nbsp;
189 </td>
190 </tr>
191 </table>
192 </td>
193 </tr>
195 <tr>
196 <td>Body<br>Composition</td>
197 <td nowrap>
198 <table width='100%'>
199 <tr>
200 <td width='20%' nowrap>
201 Skin Folds 9x:
202 </td>
203 <td width='13%' nowrap>
204 <input type='text' name='form_skin_folds_9x' size='6'
205 title='Total of 9 skin fold readings in cm'
206 value='<?php echo addslashes($row['skin_folds_9x']) ?>' /> &nbsp;
207 </td>
208 <td width='20%' nowrap>
209 Skin Folds 5x:
210 </td>
211 <td width='13%' nowrap>
212 <input type='text' name='form_skin_folds_5x' size='6'
213 title='Total of 5 skin fold readings in cm'
214 value='<?php echo addslashes($row['skin_folds_5x']) ?>' /> &nbsp;
215 </td>
216 <td width='20%' nowrap>
217 % Body Fat:
218 </td>
219 <td nowrap>
220 <input type='text' name='form_pct_body_fat' size='6'
221 title='Percent body fat'
222 value='<?php echo addslashes($row['pct_body_fat']) ?>' /> &nbsp;
223 </td>
224 </tr>
225 <tr>
226 <td colspan='6' nowrap>
227 B.F. Method Used:&nbsp;
228 <?php echo rbinput('form_method_body_fat', 'Caliper' , 'Caliper' , 'method_body_fat') ?>&nbsp;
229 <?php echo rbinput('form_method_body_fat', 'Electronic' , 'Electronic' , 'method_body_fat') ?>&nbsp;
230 <?php echo rbinput('form_method_body_fat', 'Hydrostatic', 'Hydrostatic', 'method_body_fat') ?>
231 </td>
232 </tr>
233 </table>
234 </td>
235 </tr>
237 <tr>
238 <td nowrap>Beep Test</td>
239 <td nowrap>
240 <table width='100%'>
241 <tr>
242 <td width='20%' nowrap>
243 Level:
244 </td>
245 <td width='13%' nowrap>
246 <input type='text' name='form_beep_level' size='6'
247 title='Level Reached'
248 value='<?php echo addslashes($row['beep_level']) ?>' /> &nbsp;
249 </td>
250 <td width='20%' nowrap>
251 Shuttles:
252 </td>
253 <td width='13%' nowrap>
254 <input type='text' name='form_beep_shuttles' size='6'
255 title='Number of shuttles at this level'
256 value='<?php echo addslashes($row['beep_shuttles']) ?>' /> &nbsp;
257 </td>
258 <td width='20%' nowrap>
259 VO2 Max:
260 </td>
261 <td nowrap>
262 <input type='text' name='form_beep_vo2_max' size='6'
263 title='ml/kg/min'
264 value='<?php echo addslashes($row['beep_vo2_max']) ?>' /> &nbsp;
265 </td>
266 </tr>
267 </table>
268 </td>
269 </tr>
271 <tr>
272 <td nowrap>Other Tests</td>
273 <td nowrap>
274 <table width='100%'>
275 <tr>
276 <td width='20%' nowrap>
277 Vertical Jump:
278 </td>
279 <td width='13%' nowrap>
280 <input type='text' name='form_vertical_jump_meters' size='6'
281 title='Vertical Jump Test in Meters'
282 value='<?php echo addslashes($row['vertical_jump_meters']) ?>' /> &nbsp;
283 </td>
284 <td width='20%' nowrap>
285 505 Agility:
286 </td>
287 <td width='13%' nowrap>
288 <input type='text' name='form_agility_505' size='6'
289 title='505 Agility Test in Seconds'
290 value='<?php echo addslashes($row['agility_505']) ?>' /> &nbsp;
291 </td>
292 <td width='20%' nowrap>
293 Sit &amp; Reach:
294 </td>
295 <td nowrap>
296 <input type='text' name='form_sit_and_reach_cm' size='6'
297 title='Sit and Reach Test in cm + or - ve'
298 value='<?php echo addslashes($row['sit_and_reach_cm']) ?>' /> &nbsp;
299 </td>
300 </tr>
301 </table>
302 </td>
303 </tr>
305 <tr>
306 <td nowrap>Still More</td>
307 <td nowrap>
308 <textarea name='form_other' rows='8' style='width:100%'><?php echo $row['other'] ?></textarea>
309 </td>
310 </tr>
312 </table>
315 <input type='submit' name='bn_save' value='Save' />
316 &nbsp;
317 <input type='button' value='Cancel' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
318 </p>
320 </center>
322 </form>
323 <?php
325 // TBD: If $alertmsg, display it with a JavaScript alert().
328 </body>
329 </html>