Clean up of Issues and made Issues compliant with NIST.
[openemr.git] / interface / patient_file / summary / add_edit_issue.php
blob569fc3d5462f6057342516c45eade47088d212b7
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 = $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";
210 echo " window.close();\n";
211 echo " if ( opener ) { opener.location.reload(); } else { parent.location.reload(); } \n";
212 echo " if (parent.refreshIssue) parent.refreshIssue($issue,'$tmp_title'); if ( parent.$ ) parent.$.fn.fancybox.close();\n";
213 echo "</script></body></html>\n";
214 exit();
217 $irow = array();
218 if ($issue)
219 $irow = sqlQuery("SELECT * FROM lists WHERE id = $issue");
220 else if ($thistype)
221 $irow['type'] = $thistype;
223 $type_index = 0;
225 if (!empty($irow['type'])) {
226 foreach ($ISSUE_TYPES as $key => $value) {
227 if ($key == $irow['type']) break;
228 ++$type_index;
232 <html>
233 <head>
234 <?php html_header_show();?>
235 <title><?php echo $issue ? xl('Edit') : xl('Add New'); ?><?php xl('Issue','e',' '); ?></title>
236 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
238 <style>
240 td, input, select, textarea {
241 font-family: Arial, Helvetica, sans-serif;
242 font-size: 10pt;
245 div.section {
246 border: solid;
247 border-width: 1px;
248 border-color: #0000ff;
249 margin: 0 0 0 10pt;
250 padding: 5pt;
253 </style>
255 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
256 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
257 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
258 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
259 <script type="text/javascript" src="../../../library/textformat.js"></script>
260 <script type="text/javascript" src="../../../library/dialog.js"></script>
262 <script language="JavaScript">
264 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
266 var aitypes = new Array(); // issue type attributes
267 var aopts = new Array(); // Option objects
268 <?php
269 // "Clickoptions" is a feature by Mark Leeds that provides for one-click
270 // access to preselected lists of issues in each category. Here we get
271 // the issue titles from the user-customizable file and write JavaScript
272 // statements that will build an array of arrays of Option objects.
274 $clickoptions = array();
275 if (is_file($GLOBALS['OE_SITE_DIR'] . "/clickoptions.txt"))
276 $clickoptions = file($GLOBALS['OE_SITE_DIR'] . "/clickoptions.txt");
277 $i = 0;
278 foreach ($ISSUE_TYPES as $key => $value) {
279 echo " aitypes[$i] = " . $value[3] . ";\n";
280 echo " aopts[$i] = new Array();\n";
281 foreach($clickoptions as $line) {
282 $line = trim($line);
283 if (substr($line, 0, 1) != "#") {
284 if (strpos($line, $key) !== false) {
285 $text = addslashes(substr($line, strpos($line, "::") + 2));
286 echo " aopts[$i][aopts[$i].length] = new Option('$text', '$text', false, false);\n";
290 ++$i;
294 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
296 // React to selection of an issue type. This loads the associated
297 // shortcuts into the selection list of titles, and determines which
298 // rows are displayed or hidden.
299 function newtype(index) {
300 var f = document.forms[0];
301 var theopts = f.form_titles.options;
302 theopts.length = 0;
303 var i = 0;
304 for (i = 0; i < aopts[index].length; ++i) {
305 theopts[i] = aopts[index][i];
307 document.getElementById('row_titles').style.display = i ? '' : 'none';
308 // Show or hide various rows depending on issue type, except do not
309 // hide the comments or referred-by fields if they have data.
310 var comdisp = (aitypes[index] == 1) ? 'none' : '';
311 var revdisp = (aitypes[index] == 1) ? '' : 'none';
312 var injdisp = (aitypes[index] == 2) ? '' : 'none';
313 var nordisp = (aitypes[index] == 0) ? '' : 'none';
314 // reaction row should be displayed only for medication allergy.
315 var alldisp = (index == <?php echo issueTypeIndex('allergy'); ?>) ? '' : 'none';
316 document.getElementById('row_enddate' ).style.display = comdisp;
317 // Note that by default all the issues will not show the active row
318 // (which is desired functionality, since then use the end date
319 // to inactivate the item.)
320 document.getElementById('row_active' ).style.display = revdisp;
321 document.getElementById('row_diagnosis' ).style.display = comdisp;
322 document.getElementById('row_occurrence' ).style.display = comdisp;
323 document.getElementById('row_classification').style.display = injdisp;
324 document.getElementById('row_reaction' ).style.display = alldisp;
325 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
326 document.getElementById('row_comments' ).style.display = (f.form_comments.value ) ? '' : revdisp;
327 <?php if ($GLOBALS['athletic_team']) { ?>
328 document.getElementById('row_returndate' ).style.display = comdisp;
329 document.getElementById('row_injury_grade' ).style.display = injdisp;
330 document.getElementById('row_injury_part' ).style.display = injdisp;
331 document.getElementById('row_injury_type' ).style.display = injdisp;
332 document.getElementById('row_medical_system').style.display = nordisp;
333 document.getElementById('row_medical_type' ).style.display = nordisp;
334 // Change label text of 'title' row depending on issue type:
335 document.getElementById('title_diagnosis').innerHTML = '<b>' +
336 (index == <?php echo issueTypeIndex('allergy'); ?> ?
337 '<?php echo xl('Allergy') ?>' :
338 (index == <?php echo issueTypeIndex('general'); ?> ?
339 '<?php echo xl('Title') ?>' :
340 '<?php echo xl('Text Diagnosis') ?>')) +
341 ':</b>';
342 <?php } else { ?>
343 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
344 <?php } ?>
345 <?php
346 if ($ISSUE_TYPES['football_injury']) {
347 // Generate more of these for football injury fields.
348 issue_football_injury_newtype();
350 if ($ISSUE_TYPES['ippf_gcac'] && !$_POST['form_save']) {
351 // Generate more of these for gcac and contraceptive fields.
352 if (empty($issue) || $irow['type'] == 'ippf_gcac' ) issue_ippf_gcac_newtype();
353 if (empty($issue) || $irow['type'] == 'contraceptive') issue_ippf_con_newtype();
358 // If a clickoption title is selected, copy it to the title field.
359 function set_text() {
360 var f = document.forms[0];
361 f.form_title.value = f.form_titles.options[f.form_titles.selectedIndex].text;
362 f.form_titles.selectedIndex = -1;
365 // Process click on Delete link.
366 function deleteme() {
367 dlgopen('../deleter.php?issue=<?php echo $issue ?>', '_blank', 500, 450);
368 return false;
371 // Called by the deleteme.php window on a successful delete.
372 function imdeleted() {
373 closeme();
376 function closeme() {
377 if ( parent.$ ) parent.$.fn.fancybox.close();
378 window.close();
381 // Called when the Active checkbox is clicked. For consistency we
382 // use the existence of an end date to indicate inactivity, even
383 // though the simple verion of the form does not show an end date.
384 function activeClicked(cb) {
385 var f = document.forms[0];
386 if (cb.checked) {
387 f.form_end.value = '';
388 } else {
389 var today = new Date();
390 f.form_end.value = '' + (today.getYear() + 1900) + '-' +
391 (today.getMonth() + 1) + '-' + today.getDate();
395 // Called when resolved outcome is chosen and the end date is entered.
396 function outcomeClicked(cb) {
397 var f = document.forms[0];
398 if (cb.value == '1'){
399 var today = new Date();
400 f.form_end.value = '' + (today.getYear() + 1900) + '-' +
401 (today.getMonth() + 1) + '-' + today.getDate();
402 f.form_end.focus();
406 // This is for callback by the find-code popup.
407 // Appends to or erases the current list of diagnoses.
408 function set_related(codetype, code, selector, codedesc) {
409 var f = document.forms[0];
410 var s = f.form_diagnosis.value;
411 if (code) {
412 if (s.length > 0) s += ';';
413 s += codetype + ':' + code;
414 } else {
415 s = '';
417 f.form_diagnosis.value = s;
420 // This invokes the find-code popup.
421 function sel_diagnosis() {
422 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo $diagnosis_type ?>', '_blank', 500, 400);
425 // Check for errors when the form is submitted.
426 function validate() {
427 var f = document.forms[0];
428 if (! f.form_title.value) {
429 alert("<?php xl('Please enter a title!','e'); ?>");
430 return false;
432 top.restoreSession();
433 return true;
436 // Supports customizable forms (currently just for IPPF).
437 function divclick(cb, divid) {
438 var divstyle = document.getElementById(divid).style;
439 if (cb.checked) {
440 divstyle.display = 'block';
441 } else {
442 divstyle.display = 'none';
444 return true;
447 </script>
449 </head>
451 <body class="body_top" style="padding-right:0.5em">
453 <form method='post' name='theform' action='add_edit_issue.php?issue=<?php echo $issue ?>&thisenc=<?php echo $thisenc ?>'
454 onsubmit='return validate()'>
456 <table border='0' width='100%'>
458 <tr>
459 <td valign='top' width='1%' nowrap><b><?php xl('Type','e'); ?>:</b></td>
460 <td>
461 <?php
462 $index = 0;
463 foreach ($ISSUE_TYPES as $value) {
464 if ($issue || $thistype) {
465 if ($index == $type_index) {
466 echo $value[1];
467 echo "<input type='hidden' name='form_type' value='$index'>\n";
469 } else {
470 echo " <input type='radio' name='form_type' value='$index' onclick='newtype($index)'";
471 if ($index == $type_index) echo " checked";
472 echo " />" . $value[1] . "&nbsp;\n";
474 ++$index;
477 </td>
478 </tr>
480 <tr id='row_titles'>
481 <td valign='top' nowrap>&nbsp;</td>
482 <td valign='top'>
483 <select name='form_titles' size='4' onchange='set_text()'>
484 </select> <?php xl('(Select one of these, or type your own title)','e'); ?>
485 </td>
486 </tr>
488 <tr>
489 <td valign='top' id='title_diagnosis' nowrap><b><?php echo $GLOBALS['athletic_team'] ? xl('Text Diagnosis') : xl('Title'); ?>:</b></td>
490 <td>
491 <input type='text' size='40' name='form_title' value='<?php echo $irow['title'] ?>' style='width:100%' />
492 </td>
493 </tr>
495 <tr id='row_diagnosis'>
496 <td valign='top' nowrap><b><?php xl('Diagnosis Code','e'); ?>:</b></td>
497 <td>
498 <input type='text' size='50' name='form_diagnosis'
499 value='<?php echo $irow['diagnosis'] ?>' onclick='sel_diagnosis()'
500 title='<?php xl('Click to select or change diagnoses','e'); ?>'
501 style='width:100%' readonly />
502 </td>
503 </tr>
505 <!-- For Athletic Teams -->
507 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_grade'>
508 <td valign='top' nowrap><b><?php xl('Grade of Injury','e'); ?>:</b></td>
509 <td>
510 <?php
511 echo generate_select_list('form_injury_grade', 'injury_grade', $irow['injury_grade'], '');
513 </td>
514 </tr>
516 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_part'>
517 <td valign='top' nowrap><b><?php xl('Injured Body Part','e'); ?>:</b></td>
518 <td>
519 <?php
520 echo generate_select_list('form_injury_part', 'injury_part', $irow['injury_part'], '');
522 </td>
523 </tr>
525 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_type'>
526 <td valign='top' nowrap><b><?php xl('Injury Type','e'); ?>:</b></td>
527 <td>
528 <?php
529 echo generate_select_list('form_injury_type', 'injury_type', $irow['injury_type'], '');
531 </td>
532 </tr>
534 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_system'>
535 <td valign='top' nowrap><b><?php xl('Medical System','e'); ?>:</b></td>
536 <td>
537 <?php
538 echo generate_select_list('form_medical_system', 'medical_system', $irow['injury_part'], '');
540 </td>
541 </tr>
543 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_type'>
544 <td valign='top' nowrap><b><?php xl('Medical Type','e'); ?>:</b></td>
545 <td>
546 <?php
547 echo generate_select_list('form_medical_type', 'medical_type', $irow['injury_type'], '');
549 </td>
550 </tr>
552 <!-- End For Athletic Teams -->
554 <tr>
555 <td valign='top' nowrap><b><?php xl('Begin Date','e'); ?>:</b></td>
556 <td>
558 <input type='text' size='10' name='form_begin' id='form_begin'
559 value='<?php echo $irow['begdate'] ?>'
560 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
561 title='<?php xl('yyyy-mm-dd date of onset, surgery or start of medication','e'); ?>' />
562 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
563 id='img_begin' border='0' alt='[?]' style='cursor:pointer'
564 title='<?php xl('Click here to choose a date','e'); ?>' />
565 </td>
566 </tr>
568 <tr id='row_enddate'>
569 <td valign='top' nowrap><b><?php xl('End Date','e'); ?>:</b></td>
570 <td>
571 <input type='text' size='10' name='form_end' id='form_end'
572 value='<?php echo $irow['enddate'] ?>'
573 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
574 title='<?php xl('yyyy-mm-dd date of recovery or end of medication','e'); ?>' />
575 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
576 id='img_end' border='0' alt='[?]' style='cursor:pointer'
577 title='<?php xl('Click here to choose a date','e'); ?>' />
578 &nbsp;(<?php xl('leave blank if still active','e'); ?>)
579 </td>
580 </tr>
582 <tr id='row_active'>
583 <td valign='top' nowrap><b><?php xl('Active','e'); ?>:</b></td>
584 <td>
585 <input type='checkbox' name='form_active' value='1' <?php echo $irow['enddate'] ? "" : "checked"; ?>
586 onclick='activeClicked(this);'
587 title='<?php xl('Indicates if this issue is currently active','e'); ?>' />
588 </td>
589 </tr>
591 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_returndate'>
592 <td valign='top' nowrap><b><?php xl('Returned to Play','e'); ?>:</b></td>
593 <td>
594 <input type='text' size='10' name='form_return' id='form_return'
595 value='<?php echo $irow['returndate'] ?>'
596 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
597 title='<?php xl('yyyy-mm-dd date returned to play','e'); ?>' />
598 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
599 id='img_return' border='0' alt='[?]' style='cursor:pointer'
600 title='<?php xl('Click here to choose a date','e'); ?>' />
601 &nbsp;(<?php xl('leave blank if still active','e'); ?>)
602 </td>
603 </tr>
605 <tr id='row_occurrence'>
606 <td valign='top' nowrap><b><?php xl('Occurrence','e'); ?>:</b></td>
607 <td>
608 <?php
609 // Modified 6/2009 by BM to incorporate the occurrence items into the list_options listings
610 generate_form_field(array('data_type'=>1,'field_id'=>'occur','list_id'=>'occurrence','empty_title'=>'SKIP'), $irow['occurrence']);
612 </td>
613 </tr>
615 <tr id='row_classification'>
616 <td valign='top' nowrap><b><?php xl('Classification','e'); ?>:</b></td>
617 <td>
618 <select name='form_classification'>
619 <?php
620 foreach ($ISSUE_CLASSIFICATIONS as $key => $value) {
621 echo " <option value='$key'";
622 if ($key == $irow['classification']) echo " selected";
623 echo ">$value\n";
626 </select>
627 </td>
628 </tr>
630 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_reinjury_id'>
631 <td valign='top' nowrap><b><?php xl('Re-Injury?','e'); ?>:</b></td>
632 <td>
633 <select name='form_reinjury_id'>
634 <option value='0'><?php echo xl('No'); ?></option>
635 <?php
636 $pres = sqlStatement(
637 "SELECT id, begdate, title " .
638 "FROM lists WHERE " .
639 "pid = '$thispid' AND " .
640 "type = 'football_injury' AND " .
641 "activity = 1 " .
642 "ORDER BY begdate DESC"
644 while ($prow = sqlFetchArray($pres)) {
645 echo " <option value='" . $prow['id'] . "'";
646 if ($prow['id'] == $irow['reinjury_id']) echo " selected";
647 echo ">" . $prow['begdate'] . " " . $prow['title'] . "\n";
650 </select>
651 </td>
652 </tr>
653 <!--Reaction For Medication Allergy--!>
654 <tr id='row_reaction'>
655 <td valign='top' nowrap><b><?php echo htmlspecialchars( xl('Reaction') ,ENT_NOQUOTES); ?>:</b></td>
656 <td>
657 <input type='text' size='40' name='form_reaction' value='<?php echo $irow['reaction'] ?>'
658 style='width:100%' title='<?php echo htmlspecialchars(xl('Allergy Reaction'),ENT_QUOTES); ?>' />
659 </td>
660 </tr>
661 <!--End of reaction--!>
662 <tr<?php if ($GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_referredby'>
663 <td valign='top' nowrap><b><?php xl('Referred by','e'); ?>:</b></td>
664 <td>
665 <input type='text' size='40' name='form_referredby' value='<?php echo $irow['referredby'] ?>'
666 style='width:100%' title='<?php xl('Referring physician and practice','e'); ?>' />
667 </td>
668 </tr>
670 <tr id='row_comments'>
671 <td valign='top' nowrap><b><?php xl('Comments','e'); ?>:</b></td>
672 <td>
673 <textarea name='form_comments' rows='4' cols='40' wrap='virtual' style='width:100%'><?php echo $irow['comments'] ?></textarea>
674 </td>
675 </tr>
677 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
678 <td valign='top' nowrap><b><?php xl('Outcome','e'); ?>:</b></td>
679 <td>
680 <?php
681 echo generate_select_list('form_outcome', 'outcome', $irow['outcome'], '', '', '', 'outcomeClicked(this);');
683 </td>
684 </tr>
686 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
687 <td valign='top' nowrap><b><?php xl('Destination','e'); ?>:</b></td>
688 <td>
689 <?php if (true) { ?>
690 <input type='text' size='40' name='form_destination' value='<?php echo $irow['destination'] ?>'
691 style='width:100%' title='GP, Secondary care specialist, etc.' />
692 <?php } else { // leave this here for now, please -- Rod ?>
693 <?php echo rbinput('form_destination', '1', 'GP' , 'destination') ?>&nbsp;
694 <?php echo rbinput('form_destination', '2', 'Secondary care spec', 'destination') ?>&nbsp;
695 <?php echo rbinput('form_destination', '3', 'GP via physio' , 'destination') ?>&nbsp;
696 <?php echo rbinput('form_destination', '4', 'GP via podiatry' , 'destination') ?>
697 <?php } ?>
698 </td>
699 </tr>
701 </table>
703 <?php
704 if ($ISSUE_TYPES['football_injury']) {
705 issue_football_injury_form($issue);
707 if ($ISSUE_TYPES['ippf_gcac']) {
708 if (empty($issue) || $irow['type'] == 'ippf_gcac')
709 issue_ippf_gcac_form($issue, $thispid);
710 if (empty($issue) || $irow['type'] == 'contraceptive')
711 issue_ippf_con_form($issue, $thispid);
715 <center>
718 <input type='submit' name='form_save' value='<?php xl('Save','e'); ?>' />
720 <?php if ($issue && acl_check('admin', 'super')) { ?>
721 &nbsp;
722 <input type='button' value='<?php xl('Delete','e'); ?>' style='color:red' onclick='deleteme()' />
723 <?php } ?>
725 &nbsp;
726 <input type='button' value='<?php xl('Cancel','e'); ?>' onclick='closeme();' />
728 </p>
729 </center>
731 </form>
732 <script language='JavaScript'>
733 newtype(<?php echo $type_index ?>);
734 Calendar.setup({inputField:"form_begin", ifFormat:"%Y-%m-%d", button:"img_begin"});
735 Calendar.setup({inputField:"form_end", ifFormat:"%Y-%m-%d", button:"img_end"});
736 Calendar.setup({inputField:"form_return", ifFormat:"%Y-%m-%d", button:"img_return"});
737 </script>
738 </body>
739 </html>