Fix for issue add/edit when the patient is not the one currently selected.
[openemr.git] / interface / patient_file / summary / add_edit_issue.php
blobe2f497c749b7c81287b58b9511dc0430ec70c79d
1 <?php
2 // Copyright (C) 2005-2011 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 " var myboss = opener ? opener : parent;\n";
212 echo " if (myboss.refreshIssue) myboss.refreshIssue($issue,'$tmp_title');\n";
213 echo " else myboss.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_reinjury_id' ).style.display = injdisp;
329 document.getElementById('row_reaction' ).style.display = alldisp;
330 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
331 document.getElementById('row_comments' ).style.display = (f.form_comments.value ) ? '' : revdisp;
332 <?php if ($GLOBALS['athletic_team']) { ?>
333 document.getElementById('row_returndate' ).style.display = comdisp;
334 document.getElementById('row_injury_grade' ).style.display = injdisp;
335 document.getElementById('row_injury_part' ).style.display = injdisp;
336 document.getElementById('row_injury_type' ).style.display = injdisp;
337 document.getElementById('row_medical_system').style.display = nordisp;
338 document.getElementById('row_medical_type' ).style.display = nordisp;
339 // Change label text of 'title' row depending on issue type:
340 document.getElementById('title_diagnosis').innerHTML = '<b>' +
341 (index == <?php echo issueTypeIndex('allergy'); ?> ?
342 '<?php echo xl('Allergy') ?>' :
343 (index == <?php echo issueTypeIndex('general'); ?> ?
344 '<?php echo xl('Title') ?>' :
345 '<?php echo xl('Text Diagnosis') ?>')) +
346 ':</b>';
347 <?php } else { ?>
348 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
349 <?php } ?>
350 <?php
351 if ($ISSUE_TYPES['football_injury']) {
352 // Generate more of these for football injury fields.
353 issue_football_injury_newtype();
355 if ($ISSUE_TYPES['ippf_gcac'] && !$_POST['form_save']) {
356 // Generate more of these for gcac and contraceptive fields.
357 if (empty($issue) || $irow['type'] == 'ippf_gcac' ) issue_ippf_gcac_newtype();
358 if (empty($issue) || $irow['type'] == 'contraceptive') issue_ippf_con_newtype();
363 // If a clickoption title is selected, copy it to the title field.
364 function set_text() {
365 var f = document.forms[0];
366 f.form_title.value = f.form_titles.options[f.form_titles.selectedIndex].text;
367 f.form_titles.selectedIndex = -1;
370 // Process click on Delete link.
371 function deleteme() {
372 dlgopen('../deleter.php?issue=<?php echo $issue ?>', '_blank', 500, 450);
373 return false;
376 // Called by the deleteme.php window on a successful delete.
377 function imdeleted() {
378 closeme();
381 function closeme() {
382 if (parent.$) parent.$.fancybox.close();
383 window.close();
386 // Called when the Active checkbox is clicked. For consistency we
387 // use the existence of an end date to indicate inactivity, even
388 // though the simple verion of the form does not show an end date.
389 function activeClicked(cb) {
390 var f = document.forms[0];
391 if (cb.checked) {
392 f.form_end.value = '';
393 } else {
394 var today = new Date();
395 f.form_end.value = '' + (today.getYear() + 1900) + '-' +
396 (today.getMonth() + 1) + '-' + today.getDate();
400 // Called when resolved outcome is chosen and the end date is entered.
401 function outcomeClicked(cb) {
402 var f = document.forms[0];
403 if (cb.value == '1'){
404 var today = new Date();
405 f.form_end.value = '' + (today.getYear() + 1900) + '-' +
406 (today.getMonth() + 1) + '-' + today.getDate();
407 f.form_end.focus();
411 // This is for callback by the find-code popup.
412 // Appends to or erases the current list of diagnoses.
413 function set_related(codetype, code, selector, codedesc) {
414 var f = document.forms[0];
415 var s = f.form_diagnosis.value;
416 if (code) {
417 if (s.length > 0) s += ';';
418 s += codetype + ':' + code;
419 } else {
420 s = '';
422 f.form_diagnosis.value = s;
425 // This invokes the find-code popup.
426 function sel_diagnosis() {
427 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo $diagnosis_type ?>', '_blank', 500, 400);
430 // Check for errors when the form is submitted.
431 function validate() {
432 var f = document.forms[0];
433 if (! f.form_title.value) {
434 alert("<?php xl('Please enter a title!','e'); ?>");
435 return false;
437 top.restoreSession();
438 return true;
441 // Supports customizable forms (currently just for IPPF).
442 function divclick(cb, divid) {
443 var divstyle = document.getElementById(divid).style;
444 if (cb.checked) {
445 divstyle.display = 'block';
446 } else {
447 divstyle.display = 'none';
449 return true;
452 </script>
454 </head>
456 <body class="body_top" style="padding-right:0.5em">
458 <form method='post' name='theform'
459 action='add_edit_issue.php?issue=<?php echo $issue; ?>&thispid=<?php echo $thispid; ?>&thisenc=<?php echo $thisenc; ?>'
460 onsubmit='return validate()'>
462 <table border='0' width='100%'>
464 <tr>
465 <td valign='top' width='1%' nowrap><b><?php xl('Type','e'); ?>:</b></td>
466 <td>
467 <?php
468 $index = 0;
469 foreach ($ISSUE_TYPES as $value) {
470 if ($issue || $thistype) {
471 if ($index == $type_index) {
472 echo $value[1];
473 echo "<input type='hidden' name='form_type' value='$index'>\n";
475 } else {
476 echo " <input type='radio' name='form_type' value='$index' onclick='newtype($index)'";
477 if ($index == $type_index) echo " checked";
478 echo " />" . $value[1] . "&nbsp;\n";
480 ++$index;
483 </td>
484 </tr>
486 <tr id='row_titles'>
487 <td valign='top' nowrap>&nbsp;</td>
488 <td valign='top'>
489 <select name='form_titles' size='<?php echo $GLOBALS['athletic_team'] ? 10 : 4; ?>' onchange='set_text()'>
490 </select> <?php xl('(Select one of these, or type your own title)','e'); ?>
491 </td>
492 </tr>
494 <tr>
495 <td valign='top' id='title_diagnosis' nowrap><b><?php echo $GLOBALS['athletic_team'] ? xl('Text Diagnosis') : xl('Title'); ?>:</b></td>
496 <td>
497 <input type='text' size='40' name='form_title' value='<?php echo $irow['title'] ?>' style='width:100%' />
498 </td>
499 </tr>
501 <tr id='row_diagnosis'>
502 <td valign='top' nowrap><b><?php xl('Diagnosis Code','e'); ?>:</b></td>
503 <td>
504 <input type='text' size='50' name='form_diagnosis'
505 value='<?php echo $irow['diagnosis'] ?>' onclick='sel_diagnosis()'
506 title='<?php xl('Click to select or change diagnoses','e'); ?>'
507 style='width:100%' readonly />
508 </td>
509 </tr>
511 <!-- For Athletic Teams -->
513 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_grade'>
514 <td valign='top' nowrap><b><?php xl('Grade of Injury','e'); ?>:</b></td>
515 <td>
516 <?php
517 echo generate_select_list('form_injury_grade', 'injury_grade', $irow['injury_grade'], '');
519 </td>
520 </tr>
522 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_part'>
523 <td valign='top' nowrap><b><?php xl('Injured Body Part','e'); ?>:</b></td>
524 <td>
525 <?php
526 echo generate_select_list('form_injury_part', 'injury_part', $irow['injury_part'], '');
528 </td>
529 </tr>
531 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_type'>
532 <td valign='top' nowrap><b><?php xl('Injury Type','e'); ?>:</b></td>
533 <td>
534 <?php
535 echo generate_select_list('form_injury_type', 'injury_type', $irow['injury_type'], '');
537 </td>
538 </tr>
540 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_system'>
541 <td valign='top' nowrap><b><?php xl('Medical System','e'); ?>:</b></td>
542 <td>
543 <?php
544 echo generate_select_list('form_medical_system', 'medical_system', $irow['injury_part'], '');
546 </td>
547 </tr>
549 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_type'>
550 <td valign='top' nowrap><b><?php xl('Medical Type','e'); ?>:</b></td>
551 <td>
552 <?php
553 echo generate_select_list('form_medical_type', 'medical_type', $irow['injury_type'], '');
555 </td>
556 </tr>
558 <!-- End For Athletic Teams -->
560 <tr>
561 <td valign='top' nowrap><b><?php xl('Begin Date','e'); ?>:</b></td>
562 <td>
564 <input type='text' size='10' name='form_begin' id='form_begin'
565 value='<?php echo $irow['begdate'] ?>'
566 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
567 title='<?php xl('yyyy-mm-dd date of onset, surgery or start of medication','e'); ?>' />
568 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
569 id='img_begin' border='0' alt='[?]' style='cursor:pointer'
570 title='<?php xl('Click here to choose a date','e'); ?>' />
571 </td>
572 </tr>
574 <tr id='row_enddate'>
575 <td valign='top' nowrap><b><?php xl('End Date','e'); ?>:</b></td>
576 <td>
577 <input type='text' size='10' name='form_end' id='form_end'
578 value='<?php echo $irow['enddate'] ?>'
579 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
580 title='<?php xl('yyyy-mm-dd date of recovery or end of medication','e'); ?>' />
581 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
582 id='img_end' border='0' alt='[?]' style='cursor:pointer'
583 title='<?php xl('Click here to choose a date','e'); ?>' />
584 &nbsp;(<?php xl('leave blank if still active','e'); ?>)
585 </td>
586 </tr>
588 <tr id='row_active'>
589 <td valign='top' nowrap><b><?php xl('Active','e'); ?>:</b></td>
590 <td>
591 <input type='checkbox' name='form_active' value='1' <?php echo $irow['enddate'] ? "" : "checked"; ?>
592 onclick='activeClicked(this);'
593 title='<?php xl('Indicates if this issue is currently active','e'); ?>' />
594 </td>
595 </tr>
597 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_returndate'>
598 <td valign='top' nowrap><b><?php xl('Returned to Play','e'); ?>:</b></td>
599 <td>
600 <input type='text' size='10' name='form_return' id='form_return'
601 value='<?php echo $irow['returndate'] ?>'
602 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
603 title='<?php xl('yyyy-mm-dd date returned to play','e'); ?>' />
604 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
605 id='img_return' border='0' alt='[?]' style='cursor:pointer'
606 title='<?php xl('Click here to choose a date','e'); ?>' />
607 &nbsp;(<?php xl('leave blank if still active','e'); ?>)
608 </td>
609 </tr>
611 <tr id='row_occurrence'>
612 <td valign='top' nowrap><b><?php xl('Occurrence','e'); ?>:</b></td>
613 <td>
614 <?php
615 // Modified 6/2009 by BM to incorporate the occurrence items into the list_options listings
616 generate_form_field(array('data_type'=>1,'field_id'=>'occur','list_id'=>'occurrence','empty_title'=>'SKIP'), $irow['occurrence']);
618 </td>
619 </tr>
621 <tr id='row_classification'>
622 <td valign='top' nowrap><b><?php xl('Classification','e'); ?>:</b></td>
623 <td>
624 <select name='form_classification'>
625 <?php
626 foreach ($ISSUE_CLASSIFICATIONS as $key => $value) {
627 echo " <option value='$key'";
628 if ($key == $irow['classification']) echo " selected";
629 echo ">$value\n";
632 </select>
633 </td>
634 </tr>
636 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_reinjury_id'>
637 <td valign='top' nowrap><b><?php xl('Re-Injury?','e'); ?>:</b></td>
638 <td>
639 <select name='form_reinjury_id'>
640 <option value='0'><?php echo xl('No'); ?></option>
641 <?php
642 $pres = sqlStatement(
643 "SELECT id, begdate, title " .
644 "FROM lists WHERE " .
645 "pid = '$thispid' AND " .
646 "type = 'football_injury' AND " .
647 "activity = 1 " .
648 "ORDER BY begdate DESC"
650 while ($prow = sqlFetchArray($pres)) {
651 echo " <option value='" . $prow['id'] . "'";
652 if ($prow['id'] == $irow['reinjury_id']) echo " selected";
653 echo ">" . $prow['begdate'] . " " . $prow['title'] . "\n";
656 </select>
657 </td>
658 </tr>
659 <!-- Reaction For Medication Allergy -->
660 <tr id='row_reaction'>
661 <td valign='top' nowrap><b><?php echo htmlspecialchars( xl('Reaction') ,ENT_NOQUOTES); ?>:</b></td>
662 <td>
663 <input type='text' size='40' name='form_reaction' value='<?php echo $irow['reaction'] ?>'
664 style='width:100%' title='<?php echo htmlspecialchars(xl('Allergy Reaction'),ENT_QUOTES); ?>' />
665 </td>
666 </tr>
667 <!-- End of reaction -->
669 <tr<?php if ($GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_referredby'>
670 <td valign='top' nowrap><b><?php xl('Referred by','e'); ?>:</b></td>
671 <td>
672 <input type='text' size='40' name='form_referredby' value='<?php echo $irow['referredby'] ?>'
673 style='width:100%' title='<?php xl('Referring physician and practice','e'); ?>' />
674 </td>
675 </tr>
677 <tr id='row_comments'>
678 <td valign='top' nowrap><b><?php xl('Comments','e'); ?>:</b></td>
679 <td>
680 <textarea name='form_comments' rows='4' cols='40' wrap='virtual' style='width:100%'><?php echo $irow['comments'] ?></textarea>
681 </td>
682 </tr>
684 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
685 <td valign='top' nowrap><b><?php xl('Outcome','e'); ?>:</b></td>
686 <td>
687 <?php
688 echo generate_select_list('form_outcome', 'outcome', $irow['outcome'], '', '', '', 'outcomeClicked(this);');
690 </td>
691 </tr>
693 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
694 <td valign='top' nowrap><b><?php xl('Destination','e'); ?>:</b></td>
695 <td>
696 <?php if (true) { ?>
697 <input type='text' size='40' name='form_destination' value='<?php echo $irow['destination'] ?>'
698 style='width:100%' title='GP, Secondary care specialist, etc.' />
699 <?php } else { // leave this here for now, please -- Rod ?>
700 <?php echo rbinput('form_destination', '1', 'GP' , 'destination') ?>&nbsp;
701 <?php echo rbinput('form_destination', '2', 'Secondary care spec', 'destination') ?>&nbsp;
702 <?php echo rbinput('form_destination', '3', 'GP via physio' , 'destination') ?>&nbsp;
703 <?php echo rbinput('form_destination', '4', 'GP via podiatry' , 'destination') ?>
704 <?php } ?>
705 </td>
706 </tr>
708 </table>
710 <?php
711 if ($ISSUE_TYPES['football_injury']) {
712 issue_football_injury_form($issue);
714 if ($ISSUE_TYPES['ippf_gcac']) {
715 if (empty($issue) || $irow['type'] == 'ippf_gcac')
716 issue_ippf_gcac_form($issue, $thispid);
717 if (empty($issue) || $irow['type'] == 'contraceptive')
718 issue_ippf_con_form($issue, $thispid);
722 <center>
725 <input type='submit' name='form_save' value='<?php xl('Save','e'); ?>' />
727 <?php if ($issue && acl_check('admin', 'super')) { ?>
728 &nbsp;
729 <input type='button' value='<?php xl('Delete','e'); ?>' style='color:red' onclick='deleteme()' />
730 <?php } ?>
732 &nbsp;
733 <input type='button' value='<?php xl('Cancel','e'); ?>' onclick='closeme();' />
735 </p>
736 </center>
738 </form>
739 <script language='JavaScript'>
740 newtype(<?php echo $type_index ?>);
741 Calendar.setup({inputField:"form_begin", ifFormat:"%Y-%m-%d", button:"img_begin"});
742 Calendar.setup({inputField:"form_end", ifFormat:"%Y-%m-%d", button:"img_end"});
743 Calendar.setup({inputField:"form_return", ifFormat:"%Y-%m-%d", button:"img_return"});
744 </script>
745 </body>
746 </html>