Moving towards HTML5 and CSS3 compatibility. revision 2.
[openemr.git] / contrib / forms / soccer_injury / view.php
blob67ac91c3b2bc8462e085fb365820024e8c5458d2
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) $tmp = '0';
34 return "'$tmp'";
37 function cbvalue($cbname) {
38 return $_POST[$cbname] ? '1' : '0';
41 function rbinput($name, $value, $desc, $colname) {
42 global $row;
43 $ret = "<input type='radio' name='$name' value='$value'";
44 if ($row[$colname] == $value) $ret .= " checked";
45 $ret .= " />$desc";
46 return $ret;
49 function rbcell($name, $value, $desc, $colname) {
50 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
53 function cbinput($name, $colname) {
54 global $row;
55 $ret = "<input type='checkbox' name='$name' value='1'";
56 if ($row[$colname]) $ret .= " checked";
57 $ret .= " />";
58 return $ret;
61 function cbcell($name, $desc, $colname) {
62 return "<td width='25%' nowrap>" . cbinput($name, $colname) . "$desc</td>\n";
65 $formid = $_GET['id'];
67 // If Save was clicked, save the info.
69 if ($_POST['bn_save']) {
70 $tmp = strtotime($_POST['time'] . $_POST['timeampm']);
71 if ($tmp < 0) die("Time is not valid!");
72 $siinjtime = date("H:i:s", $tmp);
74 $simech_other = '';
75 if ($_POST['activity'] == '7') {
76 $simech_other = $_POST['activity_other'];
78 else if ($_POST['activity'] == '23') {
79 $simech_other = $_POST['activity_nc_other'];
82 $sitreat_other = '';
83 if ($_POST['treat_10']) {
84 $sitreat_other = $_POST['treat_other'];
87 // If updating an existing form...
89 if ($formid) {
90 $query = "UPDATE form_soccer_injury SET " .
91 "siinjtime = '$siinjtime', " .
92 "sigametime = " . rbvalue('gameplay') . ", " .
93 "simechanism = " . rbvalue('activity') . ", " .
94 "simech_other = '$simech_other', " .
95 "sisurface = " . rbvalue('surface') . ", " .
96 "siposition = " . rbvalue('position') . ", " .
97 "sifootwear = " . rbvalue('footwear') . ", " .
98 "siequip_1 = " . cbvalue('equip_1') . ", " .
99 "siequip_2 = " . cbvalue('equip_2') . ", " .
100 "siequip_3 = " . cbvalue('equip_3') . ", " .
101 "siequip_4 = " . cbvalue('equip_4') . ", " .
102 "siequip_5 = " . cbvalue('equip_5') . ", " .
103 "siequip_6 = " . cbvalue('equip_6') . ", " .
104 "siside = " . rbvalue('side') . ", " .
105 "siremoved = " . rbvalue('removed') . ", " .
106 "sitreat_1 = " . cbvalue('treat_1') . ", " .
107 "sitreat_2 = " . cbvalue('treat_2') . ", " .
108 "sitreat_3 = " . cbvalue('treat_3') . ", " .
109 "sitreat_4 = " . cbvalue('treat_4') . ", " .
110 "sitreat_5 = " . cbvalue('treat_5') . ", " .
111 "sitreat_6 = " . cbvalue('treat_6') . ", " .
112 "sitreat_7 = " . cbvalue('treat_7') . ", " .
113 "sitreat_8 = " . cbvalue('treat_8') . ", " .
114 "sitreat_9 = " . cbvalue('treat_9') . ", " .
115 "sitreat_10 = " . cbvalue('treat_10') . ", " .
116 "sitreat_other = '$sitreat_other', " .
117 "sinoreturn = " . cbvalue('noreturn') . " " .
118 "WHERE id = '$formid'";
119 sqlStatement($query);
122 // If adding a new form...
124 else {
125 $query = "INSERT INTO form_soccer_injury ( " .
126 "siinjtime, sigametime, simechanism, simech_other, sisurface, " .
127 "siposition, sifootwear, " .
128 "siequip_1, siequip_2, siequip_3, siequip_4, siequip_5, siequip_6, " .
129 "siside, siremoved, " .
130 "sitreat_1, sitreat_2, sitreat_3, sitreat_4, sitreat_5, " .
131 "sitreat_6, sitreat_7, sitreat_8, sitreat_9, sitreat_10, " .
132 "sitreat_other, sinoreturn " .
133 ") VALUES ( " .
134 "'$siinjtime', " .
135 rbvalue('gameplay') . ", " .
136 rbvalue('activity') . ", " .
137 "'$simech_other', " .
138 rbvalue('surface') . ", " .
139 rbvalue('position') . ", " .
140 rbvalue('footwear') . ", " .
141 cbvalue('equip_1') . ", " .
142 cbvalue('equip_2') . ", " .
143 cbvalue('equip_3') . ", " .
144 cbvalue('equip_4') . ", " .
145 cbvalue('equip_5') . ", " .
146 cbvalue('equip_6') . ", " .
147 rbvalue('side') . ", " .
148 rbvalue('removed') . ", " .
149 cbvalue('treat_1') . ", " .
150 cbvalue('treat_2') . ", " .
151 cbvalue('treat_3') . ", " .
152 cbvalue('treat_4') . ", " .
153 cbvalue('treat_5') . ", " .
154 cbvalue('treat_6') . ", " .
155 cbvalue('treat_7') . ", " .
156 cbvalue('treat_8') . ", " .
157 cbvalue('treat_9') . ", " .
158 cbvalue('treat_10') . ", " .
159 "'$sitreat_other', " .
160 cbvalue('noreturn') . " " .
161 ")";
162 $newid = sqlInsert($query);
163 addForm($encounter, "Football Injury", $newid, "soccer_injury", $pid, $userauthorized);
166 formHeader("Redirecting....");
167 formJump();
168 formFooter();
169 exit;
172 $siinjtime = '';
173 $siampm = '';
174 if ($formid) {
175 $row = sqlQuery ("SELECT * FROM form_soccer_injury WHERE " .
176 "id = '$formid' AND activity = '1'") ;
177 $siinjtime = substr($row['siinjtime'], 0, 5);
178 $siampm = 'am';
179 $siinjhour = substr($siinjtime, 0, 2);
180 if ($siinjhour > 12) {
181 $siampm = 'pm';
182 $siinjtime = substr($siinjhour + 500 - 12, 1, 2) . substr($siinjtime, 2);
186 <html>
187 <head>
188 <?php html_header_show();?>
189 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
190 <style>
191 .billcell { font-family: sans-serif; font-size: 10pt }
192 </style>
193 <script language="JavaScript">
195 </script>
196 </head>
198 <body class="body_top">
199 <form method="post" action="<?php echo $rootdir ?>/forms/soccer_injury/new.php?id=<?php echo $formid ?>" onsubmit="return top.restoreSession()">
201 <center>
203 <p class='title' style='margin-top:8px;margin-bottom:8px'>Football Injury Statistics</p>
205 <table border='1'>
207 <tr bgcolor='#dddddd'>
208 <td colspan='2' align='center'><b>Time of Injury</b></td>
209 </tr>
211 <tr>
212 <td nowrap>Time</td>
213 <td nowrap>
214 <input type='text' name='time' size='5' title='Hour or hh:mm' value='<?php echo $siinjtime ?>' />&nbsp;
215 <input type='radio' name='timeampm' value='am'<?php if ($siampm == 'am') echo ' checked' ?> />am&nbsp;
216 <input type='radio' name='timeampm' value='pm'<?php if ($siampm == 'pm') echo ' checked' ?> />pm&nbsp;
217 </td>
218 </tr>
220 <tr>
221 <td nowrap>Game Play</td>
222 <td nowrap>
223 <table width='100%'>
224 <tr>
225 <?php echo rbcell('gameplay', '1', '1st Quarter', 'sigametime') ?>
226 <?php echo rbcell('gameplay', '2', '2nd Quarter', 'sigametime') ?>
227 <?php echo rbcell('gameplay', '3', '3rd Quarter', 'sigametime') ?>
228 <?php echo rbcell('gameplay', '4', '4th Quarter', 'sigametime') ?>
229 </tr>
230 <tr>
231 <?php echo rbcell('gameplay', '5', 'Warm Up' , 'sigametime') ?>
232 <?php echo rbcell('gameplay', '6', 'Extra Time', 'sigametime') ?>
233 <?php echo rbcell('gameplay', '7', 'Cool Down' , 'sigametime') ?>
234 <td width='25%'>&nbsp;</td>
235 </tr>
236 </table>
237 </td>
238 </tr>
240 <tr>
241 <td nowrap>Training</td>
242 <td nowrap>
243 <table width='100%'>
244 <tr>
245 <?php echo rbcell('gameplay', '11', 'Warm Up' , 'sigametime') ?>
246 <?php echo rbcell('gameplay', '12', 'During Session', 'sigametime') ?>
247 <?php echo rbcell('gameplay', '13', 'Cool Down' , 'sigametime') ?>
248 <td width='25%'>&nbsp;</td>
249 </tr>
250 </table>
251 </td>
252 </tr>
254 <tr bgcolor='#dddddd'>
255 <td colspan='2' align='center'><b>Mechanism of Injury</b></td>
256 </tr>
258 <tr>
259 <td nowrap>Contact</td>
260 <td nowrap>
261 <table width='100%'>
262 <tr>
263 <?php echo rbcell('activity', '1', 'Tackling' , 'simechanism') ?>
264 <?php echo rbcell('activity', '2', 'Tackled' , 'simechanism') ?>
265 <?php echo rbcell('activity', '3', 'Collision' , 'simechanism') ?>
266 <?php echo rbcell('activity', '4', 'Kicked' , 'simechanism') ?>
267 </tr>
268 <tr>
269 <?php echo rbcell('activity', '5', 'Use of Elbow', 'simechanism') ?>
270 <?php echo rbcell('activity', '6', 'Hit by Ball' , 'simechanism') ?>
271 <td colspan='2' nowrap>
272 <?php echo rbinput('activity', '7', 'Other:', 'simechanism') ?>
273 <input type='text' name='activity_other' size='10'
274 title='Describe other'
275 value='<?php echo addslashes($row['simech_other']) ?>' />
276 </td>
277 </tr>
278 </table>
279 </td>
280 </tr>
282 <tr>
283 <td nowrap>Non Contact</td>
284 <td nowrap>
285 <table width='100%'>
286 <tr>
287 <?php echo rbcell('activity', '11', 'Passing' , 'simechanism') ?>
288 <?php echo rbcell('activity', '12', 'Shooting' , 'simechanism') ?>
289 <?php echo rbcell('activity', '13', 'Running' , 'simechanism') ?>
290 <?php echo rbcell('activity', '14', 'Dribbling' , 'simechanism') ?>
291 </tr>
292 <tr>
293 <?php echo rbcell('activity', '15', 'Heading' , 'simechanism') ?>
294 <?php echo rbcell('activity', '16', 'Jumping' , 'simechanism') ?>
295 <?php echo rbcell('activity', '17', 'Landing' , 'simechanism') ?>
296 <?php echo rbcell('activity', '18', 'Fall' , 'simechanism') ?>
297 </tr>
298 <tr>
299 <?php echo rbcell('activity', '19', 'Stretching' , 'simechanism') ?>
300 <?php echo rbcell('activity', '20', 'Twist/Turning', 'simechanism') ?>
301 <?php echo rbcell('activity', '21', 'Throwing' , 'simechanism') ?>
302 <?php echo rbcell('activity', '22', 'Diving' , 'simechanism') ?>
303 </tr>
304 <tr>
305 <td colspan='4' nowrap>
306 <?php echo rbinput('activity', '23', 'Other:', 'simechanism') ?>
307 <input type='text' name='activity_nc_other' size='10'
308 title='Describe other'
309 value='<?php echo addslashes($row['simech_other']) ?>' />
310 </td>
311 </tr>
312 </table>
313 </td>
314 </tr>
316 <tr bgcolor='#dddddd'>
317 <td colspan='2' align='center'><b>Conditions</b></td>
318 </tr>
320 <tr>
321 <td nowrap>Surface</td>
322 <td nowrap>
323 <table width='100%'>
324 <tr>
325 <?php echo rbcell('surface', '1', 'Pitch' , 'sisurface') ?>
326 <?php echo rbcell('surface', '2', 'Training' , 'sisurface') ?>
327 <?php echo rbcell('surface', '3', 'Artificial' , 'sisurface') ?>
328 <?php echo rbcell('surface', '4', 'All Weather', 'sisurface') ?>
329 </tr>
330 <tr>
331 <?php echo rbcell('surface', '5', 'Indoor' , 'sisurface') ?>
332 <?php echo rbcell('surface', '6', 'Gym' , 'sisurface') ?>
333 <?php echo rbcell('surface', '7', 'Other' , 'sisurface') ?>
334 <td width='25%'>&nbsp;</td>
335 </tr>
336 </table>
337 </td>
338 </tr>
340 <tr>
341 <td nowrap>Position</td>
342 <td nowrap>
343 <table width='100%'>
344 <tr>
345 <?php echo rbcell('position', '1', 'Defender' , 'siposition') ?>
346 <?php echo rbcell('position', '2', 'Midfield Offense', 'siposition') ?>
347 <?php echo rbcell('position', '3', 'Midfield Defense', 'siposition') ?>
348 <?php echo rbcell('position', '4', 'Wing Back' , 'siposition') ?>
349 </tr>
350 <tr>
351 <?php echo rbcell('position', '5', 'Forward' , 'siposition') ?>
352 <?php echo rbcell('position', '6', 'Striker' , 'siposition') ?>
353 <?php echo rbcell('position', '7', 'Goal Keeper' , 'siposition') ?>
354 <?php echo rbcell('position', '8', 'Starting Lineup' , 'siposition') ?>
355 </tr>
356 <tr>
357 <?php echo rbcell('position', '9', 'Substitute' , 'siposition') ?>
358 <td width='25%'>&nbsp;</td>
359 <td width='25%'>&nbsp;</td>
360 <td width='25%'>&nbsp;</td>
361 </tr>
362 </table>
363 </td>
364 </tr>
366 <tr>
367 <td nowrap>Footwear</td>
368 <td nowrap>
369 <table width='100%'>
370 <tr>
371 <?php echo rbcell('footwear', '1', 'Molded Cleat' , 'sifootwear') ?>
372 <?php echo rbcell('footwear', '2', 'Detachable Cleats', 'sifootwear') ?>
373 <?php echo rbcell('footwear', '3', 'Indoor Shoes' , 'sifootwear') ?>
374 <?php echo rbcell('footwear', '4', 'Turf Shoes' , 'sifootwear') ?>
375 </tr>
376 </table>
377 </td>
378 </tr>
380 <tr>
381 <td nowrap>Other Equipment</td>
382 <td nowrap>
383 <table width='100%'>
384 <tr>
385 <?php echo cbcell('equip_1', 'Shin Pads' , 'siequip_1') ?>
386 <?php echo cbcell('equip_2', 'Gloves' , 'siequip_2') ?>
387 <?php echo cbcell('equip_3', 'Ankle Strapping', 'siequip_3') ?>
388 <?php echo cbcell('equip_4', 'Knee Strapping' , 'siequip_4') ?>
389 </tr>
390 <tr>
391 <?php echo cbcell('equip_5', 'Bracing' , 'siequip_5') ?>
392 <?php echo cbcell('equip_6', 'Synthetic Cast' , 'siequip_6') ?>
393 <td width='25%'>&nbsp;</td>
394 <td width='25%'>&nbsp;</td>
395 </tr>
396 </table>
397 </td>
398 </tr>
400 <tr>
401 <td nowrap>Side of Injury</td>
402 <td nowrap>
403 <table width='100%'>
404 <tr>
405 <?php echo rbcell('side', '1', 'Left' , 'siside') ?>
406 <?php echo rbcell('side', '2', 'Right' , 'siside') ?>
407 <?php echo rbcell('side', '3', 'Bilateral' , 'siside') ?>
408 <?php echo rbcell('side', '4', 'Not Applicable', 'siside') ?>
409 </tr>
410 </table>
411 </td>
412 </tr>
414 <tr bgcolor='#dddddd'>
415 <td colspan='2' align='center'><b>Post Injury Sequelae</b></td>
416 </tr>
418 <tr>
419 <td nowrap>Removed from<br>Play/Training<br>after Injury</td>
420 <td nowrap>
421 <table width='100%'>
422 <tr>
423 <?php echo rbcell('removed', '1', 'Immediately', 'siremoved') ?>
424 <?php echo rbcell('removed', '2', 'Later' , 'siremoved') ?>
425 <?php echo rbcell('removed', '3', 'Not at All' , 'siremoved') ?>
426 <td width='25%'>&nbsp;</td>
427 </tr>
428 </table>
429 </td>
430 </tr>
432 <tr>
433 <td nowrap>Medical Treatment<br>Sought from</td>
434 <td nowrap>
435 <table width='100%'>
436 <tr>
437 <?php echo cbcell('treat_1', 'Hospital A&amp;E Dept', 'sitreat_1') ?>
438 <?php echo cbcell('treat_2', 'General Practitioner' , 'sitreat_2') ?>
439 <?php echo cbcell('treat_3', 'Physiotherapist' , 'sitreat_3') ?>
440 <?php echo cbcell('treat_4', 'Nurse' , 'sitreat_4') ?>
441 </tr>
442 <tr>
443 <?php echo cbcell('treat_5', 'Hospital Specialist' , 'sitreat_5') ?>
444 <?php echo cbcell('treat_6', 'Osteopath' , 'sitreat_6') ?>
445 <?php echo cbcell('treat_7', 'Chiropractor' , 'sitreat_7') ?>
446 <?php echo cbcell('treat_8', 'Sports Massage Th' , 'sitreat_8') ?>
447 </tr>
448 <tr>
449 <?php echo cbcell('treat_9', 'Sports Physician' , 'sitreat_9') ?>
450 <td colspan='3' nowrap>
451 <?php echo cbinput('treat_10', 'sitreat_10') ?>Other:
452 <input type='text' name='treat_other' size='10'
453 title='Describe other'
454 value='<?php echo addslashes($row['sitreat_other']) ?>' />
455 </td>
456 </tr>
457 </table>
458 </td>
459 </tr>
461 <tr>
462 <td colspan='2' nowrap>
463 If player is unlikely to return to play please check here:
464 <?php echo cbinput('noreturn', 'sinoreturn') ?>
465 </td>
466 </tr>
468 </table>
471 <input type='submit' name='bn_save' value='Save' />
472 &nbsp;
473 <input type='button' value='Cancel' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
474 </p>
476 </center>
478 </form>
479 <?php
481 // TBD: If $alertmsg, display it with a JavaScript alert().
484 </body>
485 </html>