Fixes for refreshing and closing logic when an issue is saved.
[openemr.git] / interface / patient_file / summary / add_edit_issue.php
blob4ca9c583ed79778e3a7f7c152bd4e9e2caac5105
1 <?php
2 // Copyright (C) 2005-2010 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 require_once("../../globals.php");
10 require_once("$srcdir/lists.inc");
11 require_once("$srcdir/patient.inc");
12 require_once("$srcdir/acl.inc");
13 require_once("$srcdir/options.inc.php");
14 require_once("$srcdir/../custom/code_types.inc.php");
15 require_once("$srcdir/csv_like_join.php");
17 if ($ISSUE_TYPES['football_injury']) {
18 // Most of the logic for the "football injury" issue type comes from this
19 // included script. We might eventually refine this approach to support
20 // a plug-in architecture for custom issue types.
21 require_once("$srcdir/football_injury.inc.php");
23 if ($ISSUE_TYPES['ippf_gcac']) {
24 // Similarly for IPPF issues.
25 require_once("$srcdir/ippf_issues.inc.php");
28 $diagnosis_types = array();
29 foreach ($code_types as $code => $data) {
30 if ($data['diag']) {
31 array_push($diagnosis_types, $code);
34 if (count($diagnosis_types) < 1) {
35 $diagnosis_type = 'ICD9';
36 } else {
37 $diagnosis_type = csv_like_join($diagnosis_types);
40 $issue = $_REQUEST['issue'];
41 $thispid = 0 + (empty($_REQUEST['thispid']) ? $pid : $_REQUEST['thispid']);
42 $info_msg = "";
44 // A nonempty thisenc means we are to link the issue to the encounter.
45 $thisenc = 0 + (empty($_REQUEST['thisenc']) ? 0 : $_REQUEST['thisenc']);
47 // A nonempty thistype is an issue type to be forced for a new issue.
48 $thistype = empty($_REQUEST['thistype']) ? '' : $_REQUEST['thistype'];
50 $thisauth = acl_check('patients', 'med');
51 if ($issue && $thisauth != 'write') die("Edit is not authorized!");
52 if ($thisauth != 'write' && $thisauth != 'addonly') die("Add is not authorized!");
54 $tmp = getPatientData($thispid, "squad");
55 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
56 die("Not authorized for this squad!");
58 function QuotedOrNull($fld) {
59 if ($fld) return "'$fld'";
60 return "NULL";
63 function rbvalue($rbname) {
64 $tmp = $_POST[$rbname];
65 if (! $tmp) $tmp = '0';
66 return "'$tmp'";
69 function cbvalue($cbname) {
70 return $_POST[$cbname] ? '1' : '0';
73 function invalue($inname) {
74 return (int) trim($_POST[$inname]);
77 function txvalue($txname) {
78 return "'" . trim($_POST[$txname]) . "'";
81 function rbinput($name, $value, $desc, $colname) {
82 global $irow;
83 $ret = "<input type='radio' name='$name' value='$value'";
84 if ($irow[$colname] == $value) $ret .= " checked";
85 $ret .= " />$desc";
86 return $ret;
89 function rbcell($name, $value, $desc, $colname) {
90 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
93 // Given an issue type as a string, compute its index.
94 function issueTypeIndex($tstr) {
95 global $ISSUE_TYPES;
96 $i = 0;
97 foreach ($ISSUE_TYPES as $key => $value) {
98 if ($key == $tstr) break;
99 ++$i;
101 return $i;
104 // If we are saving, then save and close the window.
106 if ($_POST['form_save']) {
108 $i = 0;
109 $text_type = "unknown";
110 foreach ($ISSUE_TYPES as $key => $value) {
111 if ($i++ == $_POST['form_type']) $text_type = $key;
114 $form_begin = fixDate($_POST['form_begin'], '');
115 $form_end = fixDate($_POST['form_end'], '');
117 if ($text_type == 'football_injury') {
118 $form_injury_part = $_POST['form_injury_part'];
119 $form_injury_type = $_POST['form_injury_type'];
121 else {
122 $form_injury_part = $_POST['form_medical_system'];
123 $form_injury_type = $_POST['form_medical_type'];
126 if ($issue) {
128 $query = "UPDATE lists SET " .
129 "type = '" . $text_type . "', " .
130 "title = '" . $_POST['form_title'] . "', " .
131 "comments = '" . $_POST['form_comments'] . "', " .
132 "begdate = " . QuotedOrNull($form_begin) . ", " .
133 "enddate = " . QuotedOrNull($form_end) . ", " .
134 "returndate = " . QuotedOrNull($form_return) . ", " .
135 "diagnosis = '" . $_POST['form_diagnosis'] . "', " .
136 "occurrence = '" . $_POST['form_occur'] . "', " .
137 "classification = '" . $_POST['form_classification'] . "', " .
138 "reinjury_id = '" . $_POST['form_reinjury_id'] . "', " .
139 "referredby = '" . $_POST['form_referredby'] . "', " .
140 "injury_grade = '" . $_POST['form_injury_grade'] . "', " .
141 "injury_part = '" . $form_injury_part . "', " .
142 "injury_type = '" . $form_injury_type . "', " .
143 "outcome = '" . $_POST['form_outcome'] . "', " .
144 "destination = '" . $_POST['form_destination'] . "', " .
145 "reaction ='" . $_POST['form_reaction'] . "' " .
146 "WHERE id = '$issue'";
147 sqlStatement($query);
148 if ($text_type == "medication" && enddate != '') {
149 sqlStatement('UPDATE prescriptions SET '
150 . 'medication = 0 where patient_id = ' . $thispid
151 . " and upper(trim(drug)) = '" . strtoupper($_POST['form_title']) . "' "
152 . ' and medication = 1' );
155 } else {
157 $issue = sqlInsert("INSERT INTO lists ( " .
158 "date, pid, type, title, activity, comments, begdate, enddate, returndate, " .
159 "diagnosis, occurrence, classification, referredby, user, groupname, " .
160 "outcome, destination, reinjury_id, injury_grade, injury_part, injury_type, " .
161 "reaction " .
162 ") VALUES ( " .
163 "NOW(), " .
164 "'$thispid', " .
165 "'" . $text_type . "', " .
166 "'" . $_POST['form_title'] . "', " .
167 "1, " .
168 "'" . $_POST['form_comments'] . "', " .
169 QuotedOrNull($form_begin) . ", " .
170 QuotedOrNull($form_end) . ", " .
171 QuotedOrNull($form_return) . ", " .
172 "'" . $_POST['form_diagnosis'] . "', " .
173 "'" . $_POST['form_occur'] . "', " .
174 "'" . $_POST['form_classification'] . "', " .
175 "'" . $_POST['form_referredby'] . "', " .
176 "'" . $$_SESSION['authUser'] . "', " .
177 "'" . $$_SESSION['authProvider'] . "', " .
178 "'" . $_POST['form_outcome'] . "', " .
179 "'" . $_POST['form_destination'] . "', " .
180 "'" . $_POST['form_reinjury_id'] . "', " .
181 "'" . $_POST['form_injury_grade'] . "', " .
182 "'" . $form_injury_part . "', " .
183 "'" . $form_injury_type . "', " .
184 "'" . $_POST['form_reaction'] . "' " .
185 ")");
189 if ($text_type == 'football_injury') issue_football_injury_save($issue);
190 if ($text_type == 'ippf_gcac' ) issue_ippf_gcac_save($issue);
191 if ($text_type == 'contraceptive' ) issue_ippf_con_save($issue);
193 // If requested, link the issue to a specified encounter.
194 if ($thisenc) {
195 $query = "INSERT INTO issue_encounter ( " .
196 "pid, list_id, encounter " .
197 ") VALUES ( " .
198 "'$thispid', '$issue', '$thisenc'" .
199 ")";
200 sqlStatement($query);
203 $tmp_title = addslashes($ISSUE_TYPES[$text_type][2] . ": $form_begin " .
204 substr($_POST['form_title'], 0, 40));
206 // Close this window and redisplay the updated list of issues.
208 echo "<html><body><script language='JavaScript'>\n";
209 if ($info_msg) echo " alert('$info_msg');\n";
211 echo " if (parent.refreshIssue) parent.refreshIssue($issue,'$tmp_title');\n";
212 echo " else if (opener) opener.location.reload();\n";
213 echo " else parent.location.reload();\n";
214 echo " if (parent.$ && parent.$.fancybox) parent.$.fancybox.close();\n";
215 echo " else window.close();\n";
217 echo "</script></body></html>\n";
218 exit();
221 $irow = array();
222 if ($issue)
223 $irow = sqlQuery("SELECT * FROM lists WHERE id = $issue");
224 else if ($thistype)
225 $irow['type'] = $thistype;
227 $type_index = 0;
229 if (!empty($irow['type'])) {
230 foreach ($ISSUE_TYPES as $key => $value) {
231 if ($key == $irow['type']) break;
232 ++$type_index;
236 <html>
237 <head>
238 <?php html_header_show();?>
239 <title><?php echo $issue ? xl('Edit') : xl('Add New'); ?><?php xl('Issue','e',' '); ?></title>
240 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
242 <style>
244 td, input, select, textarea {
245 font-family: Arial, Helvetica, sans-serif;
246 font-size: 10pt;
249 div.section {
250 border: solid;
251 border-width: 1px;
252 border-color: #0000ff;
253 margin: 0 0 0 10pt;
254 padding: 5pt;
257 </style>
259 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
260 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
261 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
262 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
263 <script type="text/javascript" src="../../../library/textformat.js"></script>
264 <script type="text/javascript" src="../../../library/dialog.js"></script>
266 <script language="JavaScript">
268 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
270 var aitypes = new Array(); // issue type attributes
271 var aopts = new Array(); // Option objects
272 <?php
273 // "Clickoptions" is a feature by Mark Leeds that provides for one-click
274 // access to preselected lists of issues in each category. Here we get
275 // the issue titles from the user-customizable file and write JavaScript
276 // statements that will build an array of arrays of Option objects.
278 $clickoptions = array();
279 if (is_file($GLOBALS['OE_SITE_DIR'] . "/clickoptions.txt"))
280 $clickoptions = file($GLOBALS['OE_SITE_DIR'] . "/clickoptions.txt");
281 $i = 0;
282 foreach ($ISSUE_TYPES as $key => $value) {
283 echo " aitypes[$i] = " . $value[3] . ";\n";
284 echo " aopts[$i] = new Array();\n";
285 foreach($clickoptions as $line) {
286 $line = trim($line);
287 if (substr($line, 0, 1) != "#") {
288 if (strpos($line, $key) !== false) {
289 $text = addslashes(substr($line, strpos($line, "::") + 2));
290 echo " aopts[$i][aopts[$i].length] = new Option('$text', '$text', false, false);\n";
294 ++$i;
298 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
300 // React to selection of an issue type. This loads the associated
301 // shortcuts into the selection list of titles, and determines which
302 // rows are displayed or hidden.
303 function newtype(index) {
304 var f = document.forms[0];
305 var theopts = f.form_titles.options;
306 theopts.length = 0;
307 var i = 0;
308 for (i = 0; i < aopts[index].length; ++i) {
309 theopts[i] = aopts[index][i];
311 document.getElementById('row_titles').style.display = i ? '' : 'none';
312 // Show or hide various rows depending on issue type, except do not
313 // hide the comments or referred-by fields if they have data.
314 var comdisp = (aitypes[index] == 1) ? 'none' : '';
315 var revdisp = (aitypes[index] == 1) ? '' : 'none';
316 var injdisp = (aitypes[index] == 2) ? '' : 'none';
317 var nordisp = (aitypes[index] == 0) ? '' : 'none';
318 // reaction row should be displayed only for medication allergy.
319 var alldisp = (index == <?php echo issueTypeIndex('allergy'); ?>) ? '' : 'none';
320 document.getElementById('row_enddate' ).style.display = comdisp;
321 // Note that by default all the issues will not show the active row
322 // (which is desired functionality, since then use the end date
323 // to inactivate the item.)
324 document.getElementById('row_active' ).style.display = revdisp;
325 document.getElementById('row_diagnosis' ).style.display = comdisp;
326 document.getElementById('row_occurrence' ).style.display = comdisp;
327 document.getElementById('row_classification').style.display = injdisp;
328 document.getElementById('row_reaction' ).style.display = alldisp;
329 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
330 document.getElementById('row_comments' ).style.display = (f.form_comments.value ) ? '' : revdisp;
331 <?php if ($GLOBALS['athletic_team']) { ?>
332 document.getElementById('row_returndate' ).style.display = comdisp;
333 document.getElementById('row_injury_grade' ).style.display = injdisp;
334 document.getElementById('row_injury_part' ).style.display = injdisp;
335 document.getElementById('row_injury_type' ).style.display = injdisp;
336 document.getElementById('row_medical_system').style.display = nordisp;
337 document.getElementById('row_medical_type' ).style.display = nordisp;
338 // Change label text of 'title' row depending on issue type:
339 document.getElementById('title_diagnosis').innerHTML = '<b>' +
340 (index == <?php echo issueTypeIndex('allergy'); ?> ?
341 '<?php echo xl('Allergy') ?>' :
342 (index == <?php echo issueTypeIndex('general'); ?> ?
343 '<?php echo xl('Title') ?>' :
344 '<?php echo xl('Text Diagnosis') ?>')) +
345 ':</b>';
346 <?php } else { ?>
347 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
348 <?php } ?>
349 <?php
350 if ($ISSUE_TYPES['football_injury']) {
351 // Generate more of these for football injury fields.
352 issue_football_injury_newtype();
354 if ($ISSUE_TYPES['ippf_gcac'] && !$_POST['form_save']) {
355 // Generate more of these for gcac and contraceptive fields.
356 if (empty($issue) || $irow['type'] == 'ippf_gcac' ) issue_ippf_gcac_newtype();
357 if (empty($issue) || $irow['type'] == 'contraceptive') issue_ippf_con_newtype();
362 // If a clickoption title is selected, copy it to the title field.
363 function set_text() {
364 var f = document.forms[0];
365 f.form_title.value = f.form_titles.options[f.form_titles.selectedIndex].text;
366 f.form_titles.selectedIndex = -1;
369 // Process click on Delete link.
370 function deleteme() {
371 dlgopen('../deleter.php?issue=<?php echo $issue ?>', '_blank', 500, 450);
372 return false;
375 // Called by the deleteme.php window on a successful delete.
376 function imdeleted() {
377 closeme();
380 function closeme() {
381 if (parent.$) parent.$.fancybox.close();
382 window.close();
385 // Called when the Active checkbox is clicked. For consistency we
386 // use the existence of an end date to indicate inactivity, even
387 // though the simple verion of the form does not show an end date.
388 function activeClicked(cb) {
389 var f = document.forms[0];
390 if (cb.checked) {
391 f.form_end.value = '';
392 } else {
393 var today = new Date();
394 f.form_end.value = '' + (today.getYear() + 1900) + '-' +
395 (today.getMonth() + 1) + '-' + today.getDate();
399 // Called when resolved outcome is chosen and the end date is entered.
400 function outcomeClicked(cb) {
401 var f = document.forms[0];
402 if (cb.value == '1'){
403 var today = new Date();
404 f.form_end.value = '' + (today.getYear() + 1900) + '-' +
405 (today.getMonth() + 1) + '-' + today.getDate();
406 f.form_end.focus();
410 // This is for callback by the find-code popup.
411 // Appends to or erases the current list of diagnoses.
412 function set_related(codetype, code, selector, codedesc) {
413 var f = document.forms[0];
414 var s = f.form_diagnosis.value;
415 if (code) {
416 if (s.length > 0) s += ';';
417 s += codetype + ':' + code;
418 } else {
419 s = '';
421 f.form_diagnosis.value = s;
424 // This invokes the find-code popup.
425 function sel_diagnosis() {
426 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo $diagnosis_type ?>', '_blank', 500, 400);
429 // Check for errors when the form is submitted.
430 function validate() {
431 var f = document.forms[0];
432 if (! f.form_title.value) {
433 alert("<?php xl('Please enter a title!','e'); ?>");
434 return false;
436 top.restoreSession();
437 return true;
440 // Supports customizable forms (currently just for IPPF).
441 function divclick(cb, divid) {
442 var divstyle = document.getElementById(divid).style;
443 if (cb.checked) {
444 divstyle.display = 'block';
445 } else {
446 divstyle.display = 'none';
448 return true;
451 </script>
453 </head>
455 <body class="body_top" style="padding-right:0.5em">
457 <form method='post' name='theform' action='add_edit_issue.php?issue=<?php echo $issue ?>&thisenc=<?php echo $thisenc ?>'
458 onsubmit='return validate()'>
460 <table border='0' width='100%'>
462 <tr>
463 <td valign='top' width='1%' nowrap><b><?php xl('Type','e'); ?>:</b></td>
464 <td>
465 <?php
466 $index = 0;
467 foreach ($ISSUE_TYPES as $value) {
468 if ($issue || $thistype) {
469 if ($index == $type_index) {
470 echo $value[1];
471 echo "<input type='hidden' name='form_type' value='$index'>\n";
473 } else {
474 echo " <input type='radio' name='form_type' value='$index' onclick='newtype($index)'";
475 if ($index == $type_index) echo " checked";
476 echo " />" . $value[1] . "&nbsp;\n";
478 ++$index;
481 </td>
482 </tr>
484 <tr id='row_titles'>
485 <td valign='top' nowrap>&nbsp;</td>
486 <td valign='top'>
487 <select name='form_titles' size='4' onchange='set_text()'>
488 </select> <?php xl('(Select one of these, or type your own title)','e'); ?>
489 </td>
490 </tr>
492 <tr>
493 <td valign='top' id='title_diagnosis' nowrap><b><?php echo $GLOBALS['athletic_team'] ? xl('Text Diagnosis') : xl('Title'); ?>:</b></td>
494 <td>
495 <input type='text' size='40' name='form_title' value='<?php echo $irow['title'] ?>' style='width:100%' />
496 </td>
497 </tr>
499 <tr id='row_diagnosis'>
500 <td valign='top' nowrap><b><?php xl('Diagnosis Code','e'); ?>:</b></td>
501 <td>
502 <input type='text' size='50' name='form_diagnosis'
503 value='<?php echo $irow['diagnosis'] ?>' onclick='sel_diagnosis()'
504 title='<?php xl('Click to select or change diagnoses','e'); ?>'
505 style='width:100%' readonly />
506 </td>
507 </tr>
509 <!-- For Athletic Teams -->
511 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_grade'>
512 <td valign='top' nowrap><b><?php xl('Grade of Injury','e'); ?>:</b></td>
513 <td>
514 <?php
515 echo generate_select_list('form_injury_grade', 'injury_grade', $irow['injury_grade'], '');
517 </td>
518 </tr>
520 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_part'>
521 <td valign='top' nowrap><b><?php xl('Injured Body Part','e'); ?>:</b></td>
522 <td>
523 <?php
524 echo generate_select_list('form_injury_part', 'injury_part', $irow['injury_part'], '');
526 </td>
527 </tr>
529 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_type'>
530 <td valign='top' nowrap><b><?php xl('Injury Type','e'); ?>:</b></td>
531 <td>
532 <?php
533 echo generate_select_list('form_injury_type', 'injury_type', $irow['injury_type'], '');
535 </td>
536 </tr>
538 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_system'>
539 <td valign='top' nowrap><b><?php xl('Medical System','e'); ?>:</b></td>
540 <td>
541 <?php
542 echo generate_select_list('form_medical_system', 'medical_system', $irow['injury_part'], '');
544 </td>
545 </tr>
547 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_type'>
548 <td valign='top' nowrap><b><?php xl('Medical Type','e'); ?>:</b></td>
549 <td>
550 <?php
551 echo generate_select_list('form_medical_type', 'medical_type', $irow['injury_type'], '');
553 </td>
554 </tr>
556 <!-- End For Athletic Teams -->
558 <tr>
559 <td valign='top' nowrap><b><?php xl('Begin Date','e'); ?>:</b></td>
560 <td>
562 <input type='text' size='10' name='form_begin' id='form_begin'
563 value='<?php echo $irow['begdate'] ?>'
564 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
565 title='<?php xl('yyyy-mm-dd date of onset, surgery or start of medication','e'); ?>' />
566 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
567 id='img_begin' border='0' alt='[?]' style='cursor:pointer'
568 title='<?php xl('Click here to choose a date','e'); ?>' />
569 </td>
570 </tr>
572 <tr id='row_enddate'>
573 <td valign='top' nowrap><b><?php xl('End Date','e'); ?>:</b></td>
574 <td>
575 <input type='text' size='10' name='form_end' id='form_end'
576 value='<?php echo $irow['enddate'] ?>'
577 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
578 title='<?php xl('yyyy-mm-dd date of recovery or end of medication','e'); ?>' />
579 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
580 id='img_end' border='0' alt='[?]' style='cursor:pointer'
581 title='<?php xl('Click here to choose a date','e'); ?>' />
582 &nbsp;(<?php xl('leave blank if still active','e'); ?>)
583 </td>
584 </tr>
586 <tr id='row_active'>
587 <td valign='top' nowrap><b><?php xl('Active','e'); ?>:</b></td>
588 <td>
589 <input type='checkbox' name='form_active' value='1' <?php echo $irow['enddate'] ? "" : "checked"; ?>
590 onclick='activeClicked(this);'
591 title='<?php xl('Indicates if this issue is currently active','e'); ?>' />
592 </td>
593 </tr>
595 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_returndate'>
596 <td valign='top' nowrap><b><?php xl('Returned to Play','e'); ?>:</b></td>
597 <td>
598 <input type='text' size='10' name='form_return' id='form_return'
599 value='<?php echo $irow['returndate'] ?>'
600 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
601 title='<?php xl('yyyy-mm-dd date returned to play','e'); ?>' />
602 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
603 id='img_return' border='0' alt='[?]' style='cursor:pointer'
604 title='<?php xl('Click here to choose a date','e'); ?>' />
605 &nbsp;(<?php xl('leave blank if still active','e'); ?>)
606 </td>
607 </tr>
609 <tr id='row_occurrence'>
610 <td valign='top' nowrap><b><?php xl('Occurrence','e'); ?>:</b></td>
611 <td>
612 <?php
613 // Modified 6/2009 by BM to incorporate the occurrence items into the list_options listings
614 generate_form_field(array('data_type'=>1,'field_id'=>'occur','list_id'=>'occurrence','empty_title'=>'SKIP'), $irow['occurrence']);
616 </td>
617 </tr>
619 <tr id='row_classification'>
620 <td valign='top' nowrap><b><?php xl('Classification','e'); ?>:</b></td>
621 <td>
622 <select name='form_classification'>
623 <?php
624 foreach ($ISSUE_CLASSIFICATIONS as $key => $value) {
625 echo " <option value='$key'";
626 if ($key == $irow['classification']) echo " selected";
627 echo ">$value\n";
630 </select>
631 </td>
632 </tr>
634 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_reinjury_id'>
635 <td valign='top' nowrap><b><?php xl('Re-Injury?','e'); ?>:</b></td>
636 <td>
637 <select name='form_reinjury_id'>
638 <option value='0'><?php echo xl('No'); ?></option>
639 <?php
640 $pres = sqlStatement(
641 "SELECT id, begdate, title " .
642 "FROM lists WHERE " .
643 "pid = '$thispid' AND " .
644 "type = 'football_injury' AND " .
645 "activity = 1 " .
646 "ORDER BY begdate DESC"
648 while ($prow = sqlFetchArray($pres)) {
649 echo " <option value='" . $prow['id'] . "'";
650 if ($prow['id'] == $irow['reinjury_id']) echo " selected";
651 echo ">" . $prow['begdate'] . " " . $prow['title'] . "\n";
654 </select>
655 </td>
656 </tr>
657 <!--Reaction For Medication Allergy--!>
658 <tr id='row_reaction'>
659 <td valign='top' nowrap><b><?php echo htmlspecialchars( xl('Reaction') ,ENT_NOQUOTES); ?>:</b></td>
660 <td>
661 <input type='text' size='40' name='form_reaction' value='<?php echo $irow['reaction'] ?>'
662 style='width:100%' title='<?php echo htmlspecialchars(xl('Allergy Reaction'),ENT_QUOTES); ?>' />
663 </td>
664 </tr>
665 <!--End of reaction--!>
666 <tr<?php if ($GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_referredby'>
667 <td valign='top' nowrap><b><?php xl('Referred by','e'); ?>:</b></td>
668 <td>
669 <input type='text' size='40' name='form_referredby' value='<?php echo $irow['referredby'] ?>'
670 style='width:100%' title='<?php xl('Referring physician and practice','e'); ?>' />
671 </td>
672 </tr>
674 <tr id='row_comments'>
675 <td valign='top' nowrap><b><?php xl('Comments','e'); ?>:</b></td>
676 <td>
677 <textarea name='form_comments' rows='4' cols='40' wrap='virtual' style='width:100%'><?php echo $irow['comments'] ?></textarea>
678 </td>
679 </tr>
681 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
682 <td valign='top' nowrap><b><?php xl('Outcome','e'); ?>:</b></td>
683 <td>
684 <?php
685 echo generate_select_list('form_outcome', 'outcome', $irow['outcome'], '', '', '', 'outcomeClicked(this);');
687 </td>
688 </tr>
690 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
691 <td valign='top' nowrap><b><?php xl('Destination','e'); ?>:</b></td>
692 <td>
693 <?php if (true) { ?>
694 <input type='text' size='40' name='form_destination' value='<?php echo $irow['destination'] ?>'
695 style='width:100%' title='GP, Secondary care specialist, etc.' />
696 <?php } else { // leave this here for now, please -- Rod ?>
697 <?php echo rbinput('form_destination', '1', 'GP' , 'destination') ?>&nbsp;
698 <?php echo rbinput('form_destination', '2', 'Secondary care spec', 'destination') ?>&nbsp;
699 <?php echo rbinput('form_destination', '3', 'GP via physio' , 'destination') ?>&nbsp;
700 <?php echo rbinput('form_destination', '4', 'GP via podiatry' , 'destination') ?>
701 <?php } ?>
702 </td>
703 </tr>
705 </table>
707 <?php
708 if ($ISSUE_TYPES['football_injury']) {
709 issue_football_injury_form($issue);
711 if ($ISSUE_TYPES['ippf_gcac']) {
712 if (empty($issue) || $irow['type'] == 'ippf_gcac')
713 issue_ippf_gcac_form($issue, $thispid);
714 if (empty($issue) || $irow['type'] == 'contraceptive')
715 issue_ippf_con_form($issue, $thispid);
719 <center>
722 <input type='submit' name='form_save' value='<?php xl('Save','e'); ?>' />
724 <?php if ($issue && acl_check('admin', 'super')) { ?>
725 &nbsp;
726 <input type='button' value='<?php xl('Delete','e'); ?>' style='color:red' onclick='deleteme()' />
727 <?php } ?>
729 &nbsp;
730 <input type='button' value='<?php xl('Cancel','e'); ?>' onclick='closeme();' />
732 </p>
733 </center>
735 </form>
736 <script language='JavaScript'>
737 newtype(<?php echo $type_index ?>);
738 Calendar.setup({inputField:"form_begin", ifFormat:"%Y-%m-%d", button:"img_begin"});
739 Calendar.setup({inputField:"form_end", ifFormat:"%Y-%m-%d", button:"img_end"});
740 Calendar.setup({inputField:"form_return", ifFormat:"%Y-%m-%d", button:"img_return"});
741 </script>
742 </body>
743 </html>