Moving towards HTML5 and CSS3 compatibility. revision 2.
[openemr.git] / contrib / forms / soccer_injury / new.php
blob4ff1e09afaa392293ab021be3d1eda6bc9a94481
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 ?>"
200 onsubmit="return top.restoreSession()">
202 <center>
204 <p class='title' style='margin-top:8px;margin-bottom:8px'>Football Injury Statistics</p>
206 <table border='1'>
208 <tr bgcolor='#dddddd'>
209 <td colspan='2' align='center'><b>Time of Injury</b></td>
210 </tr>
212 <tr>
213 <td nowrap>Time</td>
214 <td nowrap>
215 <input type='text' name='time' size='5' title='Hour or hh:mm' value='<?php echo $siinjtime ?>' />&nbsp;
216 <input type='radio' name='timeampm' value='am'<?php if ($siampm == 'am') echo ' checked' ?> />am&nbsp;
217 <input type='radio' name='timeampm' value='pm'<?php if ($siampm == 'pm') echo ' checked' ?> />pm&nbsp;
218 </td>
219 </tr>
221 <tr>
222 <td nowrap>Game Play</td>
223 <td nowrap>
224 <table width='100%'>
225 <tr>
226 <?php echo rbcell('gameplay', '1', '1st Quarter', 'sigametime') ?>
227 <?php echo rbcell('gameplay', '2', '2nd Quarter', 'sigametime') ?>
228 <?php echo rbcell('gameplay', '3', '3rd Quarter', 'sigametime') ?>
229 <?php echo rbcell('gameplay', '4', '4th Quarter', 'sigametime') ?>
230 </tr>
231 <tr>
232 <?php echo rbcell('gameplay', '5', 'Warm Up' , 'sigametime') ?>
233 <?php echo rbcell('gameplay', '6', 'Extra Time', 'sigametime') ?>
234 <?php echo rbcell('gameplay', '7', 'Cool Down' , 'sigametime') ?>
235 <td width='25%'>&nbsp;</td>
236 </tr>
237 </table>
238 </td>
239 </tr>
241 <tr>
242 <td nowrap>Training</td>
243 <td nowrap>
244 <table width='100%'>
245 <tr>
246 <?php echo rbcell('gameplay', '11', 'Warm Up' , 'sigametime') ?>
247 <?php echo rbcell('gameplay', '12', 'During Session', 'sigametime') ?>
248 <?php echo rbcell('gameplay', '13', 'Cool Down' , 'sigametime') ?>
249 <td width='25%'>&nbsp;</td>
250 </tr>
251 </table>
252 </td>
253 </tr>
255 <tr bgcolor='#dddddd'>
256 <td colspan='2' align='center'><b>Mechanism of Injury</b></td>
257 </tr>
259 <tr>
260 <td nowrap>Contact</td>
261 <td nowrap>
262 <table width='100%'>
263 <tr>
264 <?php echo rbcell('activity', '1', 'Tackling' , 'simechanism') ?>
265 <?php echo rbcell('activity', '2', 'Tackled' , 'simechanism') ?>
266 <?php echo rbcell('activity', '3', 'Collision' , 'simechanism') ?>
267 <?php echo rbcell('activity', '4', 'Kicked' , 'simechanism') ?>
268 </tr>
269 <tr>
270 <?php echo rbcell('activity', '5', 'Use of Elbow', 'simechanism') ?>
271 <?php echo rbcell('activity', '6', 'Hit by Ball' , 'simechanism') ?>
272 <td colspan='2' nowrap>
273 <?php echo rbinput('activity', '7', 'Other:', 'simechanism') ?>
274 <input type='text' name='activity_other' size='10'
275 title='Describe other'
276 value='<?php echo addslashes($row['simech_other']) ?>' />
277 </td>
278 </tr>
279 </table>
280 </td>
281 </tr>
283 <tr>
284 <td nowrap>Non Contact</td>
285 <td nowrap>
286 <table width='100%'>
287 <tr>
288 <?php echo rbcell('activity', '11', 'Passing' , 'simechanism') ?>
289 <?php echo rbcell('activity', '12', 'Shooting' , 'simechanism') ?>
290 <?php echo rbcell('activity', '13', 'Running' , 'simechanism') ?>
291 <?php echo rbcell('activity', '14', 'Dribbling' , 'simechanism') ?>
292 </tr>
293 <tr>
294 <?php echo rbcell('activity', '15', 'Heading' , 'simechanism') ?>
295 <?php echo rbcell('activity', '16', 'Jumping' , 'simechanism') ?>
296 <?php echo rbcell('activity', '17', 'Landing' , 'simechanism') ?>
297 <?php echo rbcell('activity', '18', 'Fall' , 'simechanism') ?>
298 </tr>
299 <tr>
300 <?php echo rbcell('activity', '19', 'Stretching' , 'simechanism') ?>
301 <?php echo rbcell('activity', '20', 'Twist/Turning', 'simechanism') ?>
302 <?php echo rbcell('activity', '21', 'Throwing' , 'simechanism') ?>
303 <?php echo rbcell('activity', '22', 'Diving' , 'simechanism') ?>
304 </tr>
305 <tr>
306 <td colspan='4' nowrap>
307 <?php echo rbinput('activity', '23', 'Other:', 'simechanism') ?>
308 <input type='text' name='activity_nc_other' size='10'
309 title='Describe other'
310 value='<?php echo addslashes($row['simech_other']) ?>' />
311 </td>
312 </tr>
313 </table>
314 </td>
315 </tr>
317 <tr bgcolor='#dddddd'>
318 <td colspan='2' align='center'><b>Conditions</b></td>
319 </tr>
321 <tr>
322 <td nowrap>Surface</td>
323 <td nowrap>
324 <table width='100%'>
325 <tr>
326 <?php echo rbcell('surface', '1', 'Pitch' , 'sisurface') ?>
327 <?php echo rbcell('surface', '2', 'Training' , 'sisurface') ?>
328 <?php echo rbcell('surface', '3', 'Artificial' , 'sisurface') ?>
329 <?php echo rbcell('surface', '4', 'All Weather', 'sisurface') ?>
330 </tr>
331 <tr>
332 <?php echo rbcell('surface', '5', 'Indoor' , 'sisurface') ?>
333 <?php echo rbcell('surface', '6', 'Gym' , 'sisurface') ?>
334 <?php echo rbcell('surface', '7', 'Other' , 'sisurface') ?>
335 <td width='25%'>&nbsp;</td>
336 </tr>
337 </table>
338 </td>
339 </tr>
341 <tr>
342 <td nowrap>Position</td>
343 <td nowrap>
344 <table width='100%'>
345 <tr>
346 <?php echo rbcell('position', '1', 'Defender' , 'siposition') ?>
347 <?php echo rbcell('position', '2', 'Midfield Offense', 'siposition') ?>
348 <?php echo rbcell('position', '3', 'Midfield Defense', 'siposition') ?>
349 <?php echo rbcell('position', '4', 'Wing Back' , 'siposition') ?>
350 </tr>
351 <tr>
352 <?php echo rbcell('position', '5', 'Forward' , 'siposition') ?>
353 <?php echo rbcell('position', '6', 'Striker' , 'siposition') ?>
354 <?php echo rbcell('position', '7', 'Goal Keeper' , 'siposition') ?>
355 <?php echo rbcell('position', '8', 'Starting Lineup' , 'siposition') ?>
356 </tr>
357 <tr>
358 <?php echo rbcell('position', '9', 'Substitute' , 'siposition') ?>
359 <td width='25%'>&nbsp;</td>
360 <td width='25%'>&nbsp;</td>
361 <td width='25%'>&nbsp;</td>
362 </tr>
363 </table>
364 </td>
365 </tr>
367 <tr>
368 <td nowrap>Footwear</td>
369 <td nowrap>
370 <table width='100%'>
371 <tr>
372 <?php echo rbcell('footwear', '1', 'Molded Cleat' , 'sifootwear') ?>
373 <?php echo rbcell('footwear', '2', 'Detachable Cleats', 'sifootwear') ?>
374 <?php echo rbcell('footwear', '3', 'Indoor Shoes' , 'sifootwear') ?>
375 <?php echo rbcell('footwear', '4', 'Turf Shoes' , 'sifootwear') ?>
376 </tr>
377 </table>
378 </td>
379 </tr>
381 <tr>
382 <td nowrap>Other Equipment</td>
383 <td nowrap>
384 <table width='100%'>
385 <tr>
386 <?php echo cbcell('equip_1', 'Shin Pads' , 'siequip_1') ?>
387 <?php echo cbcell('equip_2', 'Gloves' , 'siequip_2') ?>
388 <?php echo cbcell('equip_3', 'Ankle Strapping', 'siequip_3') ?>
389 <?php echo cbcell('equip_4', 'Knee Strapping' , 'siequip_4') ?>
390 </tr>
391 <tr>
392 <?php echo cbcell('equip_5', 'Bracing' , 'siequip_5') ?>
393 <?php echo cbcell('equip_6', 'Synthetic Cast' , 'siequip_6') ?>
394 <td width='25%'>&nbsp;</td>
395 <td width='25%'>&nbsp;</td>
396 </tr>
397 </table>
398 </td>
399 </tr>
401 <tr>
402 <td nowrap>Side of Injury</td>
403 <td nowrap>
404 <table width='100%'>
405 <tr>
406 <?php echo rbcell('side', '1', 'Left' , 'siside') ?>
407 <?php echo rbcell('side', '2', 'Right' , 'siside') ?>
408 <?php echo rbcell('side', '3', 'Bilateral' , 'siside') ?>
409 <?php echo rbcell('side', '4', 'Not Applicable', 'siside') ?>
410 </tr>
411 </table>
412 </td>
413 </tr>
415 <tr bgcolor='#dddddd'>
416 <td colspan='2' align='center'><b>Post Injury Sequelae</b></td>
417 </tr>
419 <tr>
420 <td nowrap>Removed from<br>Play/Training<br>after Injury</td>
421 <td nowrap>
422 <table width='100%'>
423 <tr>
424 <?php echo rbcell('removed', '1', 'Immediately', 'siremoved') ?>
425 <?php echo rbcell('removed', '2', 'Later' , 'siremoved') ?>
426 <?php echo rbcell('removed', '3', 'Not at All' , 'siremoved') ?>
427 <td width='25%'>&nbsp;</td>
428 </tr>
429 </table>
430 </td>
431 </tr>
433 <tr>
434 <td nowrap>Medical Treatment<br>Sought from</td>
435 <td nowrap>
436 <table width='100%'>
437 <tr>
438 <?php echo cbcell('treat_1', 'Hospital A&amp;E Dept', 'sitreat_1') ?>
439 <?php echo cbcell('treat_2', 'General Practitioner' , 'sitreat_2') ?>
440 <?php echo cbcell('treat_3', 'Physiotherapist' , 'sitreat_3') ?>
441 <?php echo cbcell('treat_4', 'Nurse' , 'sitreat_4') ?>
442 </tr>
443 <tr>
444 <?php echo cbcell('treat_5', 'Hospital Specialist' , 'sitreat_5') ?>
445 <?php echo cbcell('treat_6', 'Osteopath' , 'sitreat_6') ?>
446 <?php echo cbcell('treat_7', 'Chiropractor' , 'sitreat_7') ?>
447 <?php echo cbcell('treat_8', 'Sports Massage Th' , 'sitreat_8') ?>
448 </tr>
449 <tr>
450 <?php echo cbcell('treat_9', 'Sports Physician' , 'sitreat_9') ?>
451 <td colspan='3' nowrap>
452 <?php echo cbinput('treat_10', 'sitreat_10') ?>Other:
453 <input type='text' name='treat_other' size='10'
454 title='Describe other'
455 value='<?php echo addslashes($row['sitreat_other']) ?>' />
456 </td>
457 </tr>
458 </table>
459 </td>
460 </tr>
462 <tr>
463 <td colspan='2' nowrap>
464 If player is unlikely to return to play please check here:
465 <?php echo cbinput('noreturn', 'sinoreturn') ?>
466 </td>
467 </tr>
469 </table>
472 <input type='submit' name='bn_save' value='Save' />
473 &nbsp;
474 <input type='button' value='Cancel' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
475 </p>
477 </center>
479 </form>
480 <?php
482 // TBD: If $alertmsg, display it with a JavaScript alert().
485 </body>
486 </html>