Fixed php short tags
[openemr.git] / contrib / forms / football_injury_audit / view.php
blob6e1bbe855d3da174f6b0819736f9f6898e286aa4
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) 2006-2007 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 invalue($inname) {
42 return (int) trim($_POST[$inname]);
45 function txvalue($txname) {
46 return "'" . trim($_POST[$txname]) . "'";
49 function rbinput($name, $value, $desc, $colname) {
50 global $row;
51 $ret = "<input type='radio' name='$name' value='$value'";
52 if ($row[$colname] == $value) $ret .= " checked";
53 $ret .= " />$desc";
54 return $ret;
57 function rbcell($name, $value, $desc, $colname) {
58 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
61 function cbinput($name, $colname) {
62 global $row;
63 $ret = "<input type='checkbox' name='$name' value='1'";
64 if ($row[$colname]) $ret .= " checked";
65 $ret .= " />";
66 return $ret;
69 function cbcell($name, $desc, $colname) {
70 return "<td width='25%' nowrap>" . cbinput($name, $colname) . "$desc</td>\n";
73 $formid = $_GET['id'];
75 // If Save was clicked, save the info.
77 if ($_POST['bn_save']) {
78 $fiinjmin = (int) $_POST['form_injmin'];
80 // If updating an existing form...
82 if ($formid) {
83 $query = "UPDATE form_football_injury_audit SET " .
84 "fiinjmin = " . invalue('form_injmin') . ", " .
85 "fiinjtime = " . rbvalue('form_injtime') . ", " .
86 "fimatchtype = " . rbvalue('form_matchtype') . ", " .
87 "fimech_tackling = " . cbvalue('form_mech_tackling') . ", " .
88 "fimech_tackled = " . cbvalue('form_mech_tackled') . ", " .
89 "fimech_collision = " . cbvalue('form_mech_collision') . ", " .
90 "fimech_kicked = " . cbvalue('form_mech_kicked') . ", " .
91 "fimech_elbow = " . cbvalue('form_mech_elbow') . ", " .
92 "fimech_nofoul = " . cbvalue('form_mech_nofoul') . ", " .
93 "fimech_oppfoul = " . cbvalue('form_mech_oppfoul') . ", " .
94 "fimech_ownfoul = " . cbvalue('form_mech_ownfoul') . ", " .
95 "fimech_yellow = " . cbvalue('form_mech_yellow') . ", " .
96 "fimech_red = " . cbvalue('form_mech_red') . ", " .
97 "fimech_passing = " . cbvalue('form_mech_passing') . ", " .
98 "fimech_shooting = " . cbvalue('form_mech_shooting') . ", " .
99 "fimech_running = " . cbvalue('form_mech_running') . ", " .
100 "fimech_dribbling = " . cbvalue('form_mech_dribbling') . ", " .
101 "fimech_heading = " . cbvalue('form_mech_heading') . ", " .
102 "fimech_jumping = " . cbvalue('form_mech_jumping') . ", " .
103 "fimech_landing = " . cbvalue('form_mech_landing') . ", " .
104 "fimech_fall = " . cbvalue('form_mech_fall') . ", " .
105 "fimech_stretching = " . cbvalue('form_mech_stretching') . ", " .
106 "fimech_turning = " . cbvalue('form_mech_turning') . ", " .
107 "fimech_throwing = " . cbvalue('form_mech_throwing') . ", " .
108 "fimech_diving = " . cbvalue('form_mech_diving') . ", " .
109 "fimech_overuse = " . cbvalue('form_mech_overuse') . ", " .
110 "fimech_othercon = " . txvalue('form_mech_othercon') . ", " .
111 "fimech_othernon = " . txvalue('form_mech_othernon') . ", " .
112 "fisurface = " . rbvalue('form_surface') . ", " .
113 "fiposition = " . rbvalue('form_position') . ", " .
114 "fifootwear = " . rbvalue('form_footwear') . ", " .
115 "fiside = " . rbvalue('form_side') . ", " .
116 "firemoved = " . rbvalue('form_removed') . " " .
117 "WHERE id = '$formid'";
118 sqlStatement($query);
121 // If adding a new form...
123 else {
124 $query = "INSERT INTO form_football_injury_audit ( " .
125 "fiinjmin, fiinjtime, fimatchtype, " .
126 "fimech_tackling, fimech_tackled, fimech_collision, " .
127 "fimech_kicked, fimech_elbow, fimech_nofoul, fimech_oppfoul, " .
128 "fimech_ownfoul, fimech_yellow, fimech_red, fimech_passing, " .
129 "fimech_shooting, fimech_running, fimech_dribbling, fimech_heading, " .
130 "fimech_jumping, fimech_landing, fimech_fall, fimech_stretching, " .
131 "fimech_turning, fimech_throwing, fimech_diving, fimech_overuse, " .
132 "fimech_othercon, fimech_othernon, fisurface, fiposition, fifootwear, " .
133 "fiside, firemoved " .
134 ") VALUES ( " .
135 invalue('form_injmin') . ", " .
136 rbvalue('form_injtime') . ", " .
137 rbvalue('form_matchtype') . ", " .
138 cbvalue('form_mech_tackling') . ", " .
139 cbvalue('form_mech_tackled') . ", " .
140 cbvalue('form_mech_collision') . ", " .
141 cbvalue('form_mech_kicked') . ", " .
142 cbvalue('form_mech_elbow') . ", " .
143 cbvalue('form_mech_nofoul') . ", " .
144 cbvalue('form_mech_oppfoul') . ", " .
145 cbvalue('form_mech_ownfoul') . ", " .
146 cbvalue('form_mech_yellow') . ", " .
147 cbvalue('form_mech_red') . ", " .
148 cbvalue('form_mech_passing') . ", " .
149 cbvalue('form_mech_shooting') . ", " .
150 cbvalue('form_mech_running') . ", " .
151 cbvalue('form_mech_dribbling') . ", " .
152 cbvalue('form_mech_heading') . ", " .
153 cbvalue('form_mech_jumping') . ", " .
154 cbvalue('form_mech_landing') . ", " .
155 cbvalue('form_mech_fall') . ", " .
156 cbvalue('form_mech_stretching') . ", " .
157 cbvalue('form_mech_turning') . ", " .
158 cbvalue('form_mech_throwing') . ", " .
159 cbvalue('form_mech_diving') . ", " .
160 cbvalue('form_mech_overuse') . ", " .
161 txvalue('form_mech_othercon') . ", " .
162 txvalue('form_mech_othernon') . ", " .
163 rbvalue('form_surface') . ", " .
164 rbvalue('form_position') . ", " .
165 rbvalue('form_footwear') . ", " .
166 rbvalue('form_side') . ", " .
167 rbvalue('form_removed') . " " .
168 ")";
169 $newid = sqlInsert($query);
170 addForm($encounter, "Football Injury Audit", $newid, "football_injury_audit", $pid, $userauthorized);
173 formHeader("Redirecting....");
174 formJump();
175 formFooter();
176 exit;
179 if ($formid) {
180 $row = sqlQuery ("SELECT * FROM form_football_injury_audit WHERE " .
181 "id = '$formid' AND activity = '1'") ;
184 <html>
185 <head>
186 <?php html_header_show();?>
187 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
188 <style>
189 .billcell { font-family: sans-serif; font-size: 10pt }
190 </style>
192 <script type="text/javascript" src="../../../library/dialog.js"></script>
194 <script language="JavaScript">
196 // Pop up the coding window.
197 function docoding() {
198 var width = screen.width - 50;
199 if (!isNaN(top.screenX)) {
200 width -= top.screenX;
201 } else if (!isNaN(top.screenLeft)) {
202 width -= top.screenLeft;
204 if (width > 1000) width = 1000;
205 dlgopen('../../patient_file/encounter/coding_popup.php', '_blank', width, 550);
208 </script>
209 </head>
211 <body <?php echo $top_bg_line;?> topmargin="0" rightmargin="0" leftmargin="2" bottommargin="0" marginwidth="2" marginheight="0">
212 <form method="post" action="<?php echo $rootdir ?>/forms/football_injury_audit/new.php?id=<?php echo $formid ?>"
213 onsubmit="return top.restoreSession()">
215 <center>
217 <p class='title' style='margin-top:8px;margin-bottom:8px'>Football Injury Statistics</p>
219 <table border='1' width='98%'>
221 <tr bgcolor='#dddddd'>
222 <td colspan='2' align='center'><b>Time of Injury</b></td>
223 </tr>
225 <tr>
226 <td nowrap>Match Play</td>
227 <td nowrap>
228 <table width='100%'>
229 <tr>
230 <td nowrap>
231 Min of Injury
232 <input type='text' name='form_injmin' size='4'
233 value='<?php echo addslashes($row['fiinjmin']) ?>' />
234 </td>
235 <?php echo rbcell('form_injtime', '1', 'Warm Up' , 'fiinjtime') ?>
236 <?php echo rbcell('form_injtime', '2', 'Extra Time', 'fiinjtime') ?>
237 <?php echo rbcell('form_injtime', '3', 'Cool Down' , 'fiinjtime') ?>
238 </tr>
239 </table>
240 </td>
241 </tr>
243 <tr>
244 <td nowrap>Training</td>
245 <td nowrap>
246 <table width='100%'>
247 <tr>
248 <?php echo rbcell('form_injtime', '4', 'Warm Up' , 'fiinjtime') ?>
249 <?php echo rbcell('form_injtime', '5', 'During Session', 'fiinjtime') ?>
250 <?php echo rbcell('form_injtime', '6', 'Cool Down' , 'fiinjtime') ?>
251 <?php echo rbcell('form_injtime', '7', 'Rehabilitation', 'fiinjtime') ?>
252 </tr>
253 </table>
254 </td>
255 </tr>
257 <tr>
258 <td nowrap>Match Type</td>
259 <td nowrap>
260 <table width='100%'>
261 <tr>
262 <?php echo rbcell('form_matchtype', '1', 'Premiership' , 'fimatchtype') ?>
263 <?php echo rbcell('form_matchtype', '2', 'FA Cup' , 'fimatchtype') ?>
264 <?php echo rbcell('form_matchtype', '3', 'League Cup' , 'fimatchtype') ?>
265 <?php echo rbcell('form_matchtype', '4', 'Champions League Cup', 'fimatchtype') ?>
266 </tr>
267 <tr>
268 <?php echo rbcell('form_matchtype', '5', 'Championship Match' , 'fimatchtype') ?>
269 <?php echo rbcell('form_matchtype', '6', 'League One Match' , 'fimatchtype') ?>
270 <?php echo rbcell('form_matchtype', '7', 'League Two Match' , 'fimatchtype') ?>
271 <?php echo rbcell('form_matchtype', '8', 'International Match' , 'fimatchtype') ?>
272 </tr>
273 <tr>
274 <?php echo rbcell('form_matchtype', '9', 'Friendly' , 'fimatchtype') ?>
275 <td width='25%'>&nbsp;</td>
276 <td width='25%'>&nbsp;</td>
277 <td width='25%'>&nbsp;</td>
278 </tr>
279 </table>
280 </td>
281 </tr>
283 <tr bgcolor='#dddddd'>
284 <td colspan='2' align='center'><b>Mechanism of Injury</b></td>
285 </tr>
287 <tr>
288 <td nowrap>Contact</td>
289 <td nowrap>
290 <table width='100%'>
291 <tr>
292 <?php echo cbcell('form_mech_tackling' , 'Tackling' , 'fimech_tackling' ) ?>
293 <?php echo cbcell('form_mech_tackled' , 'Tackled' , 'fimech_tackled' ) ?>
294 <?php echo cbcell('form_mech_collision', 'Collision', 'fimech_collision') ?>
295 <?php echo cbcell('form_mech_kicked' , 'Kicked' , 'fimech_kicked' ) ?>
296 </tr>
297 <tr>
298 <?php echo cbcell('form_mech_elbow' , 'Use of Elbow' , 'fimech_elbow' ) ?>
299 <td colspan='3' nowrap>
300 Other:
301 <input type='text' name='form_mech_othercon' size='10'
302 title='Describe other'
303 value='<?php echo addslashes($row['fimech_othercon']) ?>' />
304 </td>
305 </tr>
306 </table>
307 </td>
308 </tr>
310 <tr>
311 <td nowrap>Referee's Sanction</td>
312 <td nowrap>
313 <table width='100%'>
314 <tr>
315 <?php echo cbcell('form_mech_nofoul' , 'No Foul' , 'fimech_nofoul' ) ?>
316 <?php echo cbcell('form_mech_oppfoul', 'Opponent Foul', 'fimech_oppfoul') ?>
317 <?php echo cbcell('form_mech_ownfoul', 'Own Foul' , 'fimech_ownfoul') ?>
318 <td width='25%'>&nbsp;</td>
319 </tr>
320 <tr>
321 <?php echo cbcell('form_mech_yellow' , 'Yellow Card' , 'fimech_yellow' ) ?>
322 <?php echo cbcell('form_mech_red' , 'Red Card' , 'fimech_red' ) ?>
323 <td width='25%'>&nbsp;</td>
324 <td width='25%'>&nbsp;</td>
325 </tr>
326 </table>
327 </td>
328 </tr>
330 <tr>
331 <td nowrap>Non Contact</td>
332 <td nowrap>
333 <table width='100%'>
334 <tr>
335 <?php echo cbcell('form_mech_passing' , 'Passing' , 'fimech_passing' ) ?>
336 <?php echo cbcell('form_mech_shooting' , 'Shooting' , 'fimech_shooting' ) ?>
337 <?php echo cbcell('form_mech_running' , 'Running' , 'fimech_running' ) ?>
338 <?php echo cbcell('form_mech_dribbling', 'Dribbling', 'fimech_dribbling') ?>
339 </tr>
340 <tr>
341 <?php echo cbcell('form_mech_heading' , 'Heading' , 'fimech_heading' ) ?>
342 <?php echo cbcell('form_mech_jumping' , 'Jumping' , 'fimech_jumping' ) ?>
343 <?php echo cbcell('form_mech_landing' , 'Landing' , 'fimech_landing' ) ?>
344 <?php echo cbcell('form_mech_fall' , 'Fall' , 'fimech_fall' ) ?>
345 </tr>
346 <tr>
347 <?php echo cbcell('form_mech_stretching', 'Stretching' , 'fimech_stretching') ?>
348 <?php echo cbcell('form_mech_turning' , 'Twisting/Turning', 'fimech_turning' ) ?>
349 <?php echo cbcell('form_mech_throwing' , 'Throwing' , 'fimech_throwing' ) ?>
350 <?php echo cbcell('form_mech_diving' , 'Diving' , 'fimech_diving' ) ?>
351 </tr>
352 <tr>
353 <?php echo cbcell('form_mech_overuse', 'Overuse', 'fimech_overuse' ) ?>
354 <td colspan='3' nowrap>
355 Other:
356 <input type='text' name='form_mech_othernon' size='10'
357 title='Describe other'
358 value='<?php echo addslashes($row['fimech_othernon']) ?>' />
359 </td>
360 </tr>
361 </table>
362 </td>
363 </tr>
365 <tr bgcolor='#dddddd'>
366 <td colspan='2' align='center'><b>Conditions</b></td>
367 </tr>
369 <tr>
370 <td nowrap>Surface</td>
371 <td nowrap>
372 <table width='100%'>
373 <tr>
374 <?php echo rbcell('form_surface', '1', 'Pitch' , 'fisurface') ?>
375 <?php echo rbcell('form_surface', '2', 'Training' , 'fisurface') ?>
376 <?php echo rbcell('form_surface', '3', 'Artificial' , 'fisurface') ?>
377 <?php echo rbcell('form_surface', '4', 'Indoor' , 'fisurface') ?>
378 </tr>
379 <tr>
380 <?php echo rbcell('form_surface', '5', 'Gym' , 'fisurface') ?>
381 <?php echo rbcell('form_surface', '6', 'Other' , 'fisurface') ?>
382 <td width='25%'>&nbsp;</td>
383 <td width='25%'>&nbsp;</td>
384 </tr>
385 </table>
386 </td>
387 </tr>
389 <tr>
390 <td nowrap>Position</td>
391 <td nowrap>
392 <table width='100%'>
393 <tr>
394 <?php echo rbcell('form_position', '1', 'Defender' , 'fiposition') ?>
395 <?php echo rbcell('form_position', '2', 'Midfield Offensive', 'fiposition') ?>
396 <?php echo rbcell('form_position', '3', 'Midfield Defensive', 'fiposition') ?>
397 <?php echo rbcell('form_position', '4', 'Forward' , 'fiposition') ?>
398 </tr>
399 <tr>
400 <?php echo rbcell('form_position', '5', 'Goal Keeper' , 'fiposition') ?>
401 <?php echo rbcell('form_position', '6', 'Substitute' , 'fiposition') ?>
402 <td width='25%'>&nbsp;</td>
403 <td width='25%'>&nbsp;</td>
404 </tr>
405 </table>
406 </td>
407 </tr>
409 <tr>
410 <td nowrap>Footwear</td>
411 <td nowrap>
412 <table width='100%'>
413 <tr>
414 <?php echo rbcell('form_footwear', '1', 'Molded Stud' , 'fifootwear') ?>
415 <?php echo rbcell('form_footwear', '2', 'Detachable Stud', 'fifootwear') ?>
416 <?php echo rbcell('form_footwear', '3', 'Indoor Shoes' , 'fifootwear') ?>
417 <?php echo rbcell('form_footwear', '4', 'Blades' , 'fifootwear') ?>
418 </tr>
419 </table>
420 </td>
421 </tr>
423 <tr>
424 <td nowrap>Side of Injury</td>
425 <td nowrap>
426 <table width='100%'>
427 <tr>
428 <?php echo rbcell('form_side', '1', 'Left' , 'fiside') ?>
429 <?php echo rbcell('form_side', '2', 'Right' , 'fiside') ?>
430 <?php echo rbcell('form_side', '3', 'Bilateral' , 'fiside') ?>
431 <?php echo rbcell('form_side', '4', 'Not Applicable', 'fiside') ?>
432 </tr>
433 </table>
434 </td>
435 </tr>
437 <tr bgcolor='#dddddd'>
438 <td colspan='2' align='center'><b>Post Injury Sequelae</b></td>
439 </tr>
441 <tr>
442 <td nowrap>Removed from<br>Play/Training<br>after Injury</td>
443 <td nowrap>
444 <table width='100%'>
445 <tr>
446 <?php echo rbcell('form_removed', '1', 'Immediately', 'firemoved') ?>
447 <?php echo rbcell('form_removed', '2', 'Later' , 'firemoved') ?>
448 <?php echo rbcell('form_removed', '3', 'Not at All' , 'firemoved') ?>
449 <td width='25%'>&nbsp;</td>
450 </tr>
451 </table>
452 </td>
453 </tr>
455 </table>
458 <input type='submit' name='bn_save' value='Save' />
459 &nbsp;
460 <input type='button' value='Cancel' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
461 &nbsp;
462 <input type='button' value='Add Injury Diagnosis...' onclick='docoding();'
463 title='Add or change coding for this encounter'
464 style='background-color:#ffff00;' />
465 </p>
467 </center>
469 </form>
470 <?php
472 // TBD: If $alertmsg, display it with a JavaScript alert().
475 </body>
476 </html>