3 * add or edit a medical problem.
5 * Copyright (C) 2005-2011 Rod Roark <rod@sunsetsystems.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
13 * @author Rod Roark <rod@sunsetsystems.com>
14 * @link http://www.open-emr.org
17 //SANITIZE ALL ESCAPES
18 $sanitize_all_escapes=true;
21 //STOP FAKE REGISTER GLOBALS
22 $fake_register_globals=false;
25 require_once('../../globals.php');
26 require_once($GLOBALS['srcdir'].'/lists.inc');
27 require_once($GLOBALS['srcdir'].'/patient.inc');
28 require_once($GLOBALS['srcdir'].'/acl.inc');
29 require_once($GLOBALS['srcdir'].'/options.inc.php');
30 require_once($GLOBALS['fileroot'].'/custom/code_types.inc.php');
31 require_once($GLOBALS['srcdir'].'/csv_like_join.php');
32 require_once($GLOBALS['srcdir'].'/htmlspecialchars.inc.php');
33 require_once($GLOBALS['srcdir'].'/formdata.inc.php');
35 if (isset($ISSUE_TYPES['football_injury'])) {
36 if ($ISSUE_TYPES['football_injury']) {
37 // Most of the logic for the "football injury" issue type comes from this
38 // included script. We might eventually refine this approach to support
39 // a plug-in architecture for custom issue types.
40 require_once($GLOBALS['srcdir'].'/football_injury.inc.php');
43 if (isset($ISSUE_TYPES['ippf_gcac'])) {
44 if ($ISSUE_TYPES['ippf_gcac']) {
45 // Similarly for IPPF issues.
46 require_once($GLOBALS['srcdir'].'/ippf_issues.inc.php');
50 $issue = $_REQUEST['issue'];
51 $thispid = 0 +
(empty($_REQUEST['thispid']) ?
$pid : $_REQUEST['thispid']);
54 // A nonempty thisenc means we are to link the issue to the encounter.
55 $thisenc = 0 +
(empty($_REQUEST['thisenc']) ?
0 : $_REQUEST['thisenc']);
57 // A nonempty thistype is an issue type to be forced for a new issue.
58 $thistype = empty($_REQUEST['thistype']) ?
'' : $_REQUEST['thistype'];
60 if ($issue && !acl_check('patients','med','','write') ) die(xlt("Edit is not authorized!"));
61 if ( !acl_check('patients','med','',array('write','addonly') )) die(xlt("Add is not authorized!"));
63 $tmp = getPatientData($thispid, "squad");
64 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
65 die(xlt("Not authorized for this squad!"));
67 function QuotedOrNull($fld) {
68 if ($fld) return "'".add_escape_custom($fld)."'";
73 // Do not use this function since quotes are added in query escaping mechanism
74 // Only keeping since used in the football injury code football_injury.inc.php that is included.
75 // If start using this function, then incorporate the add_escape_custom() function into it
76 function rbvalue($rbname) {
77 $tmp = $_POST[$rbname];
78 if (! $tmp) $tmp = '0';
82 function cbvalue($cbname) {
83 return $_POST[$cbname] ?
'1' : '0';
86 function invalue($inname) {
87 return (int) trim($_POST[$inname]);
90 // Do not use this function since quotes are added in query escaping mechanism
91 // Only keeping since used in the football injury code football_injury.inc.php that is included.
92 // If start using this function, then incorporate the add_escape_custom() function into it
93 function txvalue($txname) {
94 return "'" . trim($_POST[$txname]) . "'";
97 function rbinput($name, $value, $desc, $colname) {
99 $ret = "<input type='radio' name='".attr($name)."' value='".attr($value)."'";
100 if ($irow[$colname] == $value) $ret .= " checked";
101 $ret .= " />".text($desc);
105 function rbcell($name, $value, $desc, $colname) {
106 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
109 // Given an issue type as a string, compute its index.
110 function issueTypeIndex($tstr) {
113 foreach ($ISSUE_TYPES as $key => $value) {
114 if ($key == $tstr) break;
120 // If we are saving, then save and close the window.
122 if ($_POST['form_save']) {
125 $text_type = "unknown";
126 foreach ($ISSUE_TYPES as $key => $value) {
127 if ($i++
== $_POST['form_type']) $text_type = $key;
130 $form_begin = fixDate($_POST['form_begin'], '');
131 $form_end = fixDate($_POST['form_end'], '');
133 if ($text_type == 'football_injury') {
134 $form_injury_part = $_POST['form_injury_part'];
135 $form_injury_type = $_POST['form_injury_type'];
138 $form_injury_part = $_POST['form_medical_system'];
139 $form_injury_type = $_POST['form_medical_type'];
144 $query = "UPDATE lists SET " .
145 "type = '" . add_escape_custom($text_type) . "', " .
146 "title = '" . add_escape_custom($_POST['form_title']) . "', " .
147 "comments = '" . add_escape_custom($_POST['form_comments']) . "', " .
148 "begdate = " . QuotedOrNull($form_begin) . ", " .
149 "enddate = " . QuotedOrNull($form_end) . ", " .
150 "returndate = " . QuotedOrNull($form_return) . ", " .
151 "diagnosis = '" . add_escape_custom($_POST['form_diagnosis']) . "', " .
152 "occurrence = '" . add_escape_custom($_POST['form_occur']) . "', " .
153 "classification = '" . add_escape_custom($_POST['form_classification']) . "', " .
154 "reinjury_id = '" . add_escape_custom($_POST['form_reinjury_id']) . "', " .
155 "referredby = '" . add_escape_custom($_POST['form_referredby']) . "', " .
156 "injury_grade = '" . add_escape_custom($_POST['form_injury_grade']) . "', " .
157 "injury_part = '" . add_escape_custom($form_injury_part) . "', " .
158 "injury_type = '" . add_escape_custom($form_injury_type) . "', " .
159 "outcome = '" . add_escape_custom($_POST['form_outcome']) . "', " .
160 "destination = '" . add_escape_custom($_POST['form_destination']) . "', " .
161 "reaction ='" . add_escape_custom($_POST['form_reaction']) . "', " .
162 "erx_uploaded = '0', " .
163 "modifydate = NOW() " .
164 "WHERE id = '" . add_escape_custom($issue) . "'";
165 sqlStatement($query);
166 if ($text_type == "medication" && enddate
!= '') {
167 sqlStatement('UPDATE prescriptions SET '
168 . 'medication = 0 where patient_id = ? '
169 . " and upper(trim(drug)) = ? "
170 . ' and medication = 1', array($thispid,strtoupper($_POST['form_title'])) );
175 $issue = sqlInsert("INSERT INTO lists ( " .
176 "date, pid, type, title, activity, comments, begdate, enddate, returndate, " .
177 "diagnosis, occurrence, classification, referredby, user, groupname, " .
178 "outcome, destination, reinjury_id, injury_grade, injury_part, injury_type, " .
182 "'" . add_escape_custom($thispid) . "', " .
183 "'" . add_escape_custom($text_type) . "', " .
184 "'" . add_escape_custom($_POST['form_title']) . "', " .
186 "'" . add_escape_custom($_POST['form_comments']) . "', " .
187 QuotedOrNull($form_begin) . ", " .
188 QuotedOrNull($form_end) . ", " .
189 QuotedOrNull($form_return) . ", " .
190 "'" . add_escape_custom($_POST['form_diagnosis']) . "', " .
191 "'" . add_escape_custom($_POST['form_occur']) . "', " .
192 "'" . add_escape_custom($_POST['form_classification']) . "', " .
193 "'" . add_escape_custom($_POST['form_referredby']) . "', " .
194 "'" . add_escape_custom($
$_SESSION['authUser']) . "', " .
195 "'" . add_escape_custom($
$_SESSION['authProvider']) . "', " .
196 "'" . add_escape_custom($_POST['form_outcome']) . "', " .
197 "'" . add_escape_custom($_POST['form_destination']) . "', " .
198 "'" . add_escape_custom($_POST['form_reinjury_id']) . "', " .
199 "'" . add_escape_custom($_POST['form_injury_grade']) . "', " .
200 "'" . add_escape_custom($form_injury_part) . "', " .
201 "'" . add_escape_custom($form_injury_type) . "', " .
202 "'" . add_escape_custom($_POST['form_reaction']) . "' " .
207 // For record/reporting purposes, place entry in lists_touch table.
208 setListTouch($thispid,$text_type);
210 if ($text_type == 'football_injury') issue_football_injury_save($issue);
211 if ($text_type == 'ippf_gcac' ) issue_ippf_gcac_save($issue);
212 if ($text_type == 'contraceptive' ) issue_ippf_con_save($issue);
214 // If requested, link the issue to a specified encounter.
216 $query = "INSERT INTO issue_encounter ( " .
217 "pid, list_id, encounter " .
218 ") VALUES ( ?,?,? )";
219 sqlStatement($query, array($thispid,$issue,$thisenc));
222 $tmp_title = addslashes($ISSUE_TYPES[$text_type][2] . ": $form_begin " .
223 substr($_POST['form_title'], 0, 40));
225 // Close this window and redisplay the updated list of issues.
227 echo "<html><body><script language='JavaScript'>\n";
228 if ($info_msg) echo " alert('$info_msg');\n";
230 echo " var myboss = opener ? opener : parent;\n";
231 echo " if (myboss.refreshIssue) myboss.refreshIssue($issue,'$tmp_title');\n";
232 echo " else if (myboss.reloadIssues) myboss.reloadIssues();\n";
233 echo " else myboss.location.reload();\n";
234 echo " if (parent.$ && parent.$.fancybox) parent.$.fancybox.close();\n";
235 echo " else window.close();\n";
237 echo "</script></body></html>\n";
243 $irow = sqlQuery("SELECT * FROM lists WHERE id = ?",array($issue));
245 $irow['type'] = $thistype;
249 if (!empty($irow['type'])) {
250 foreach ($ISSUE_TYPES as $key => $value) {
251 if ($key == $irow['type']) break;
258 <?php
html_header_show();?
>
259 <title
><?php
echo $issue ?
xlt('Edit') : xlt('Add New'); ?
><?php
echo " ".xlt('Issue'); ?
></title
>
260 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
264 td
, input
, select
, textarea
{
265 font
-family
: Arial
, Helvetica
, sans
-serif
;
272 border
-color
: #0000ff;
279 <style type
="text/css">@import
url(<?php
echo $GLOBALS['webroot']; ?
>/library
/dynarch_calendar
.css
);</style
>
280 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar.js"></script
>
281 <?php
require_once($GLOBALS['srcdir'].'/dynarch_calendar_en.inc.php'); ?
>
282 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar_setup.js"></script
>
283 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/textformat.js"></script
>
284 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js"></script
>
286 <script language
="JavaScript">
288 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
290 var aitypes
= new Array(); // issue type attributes
291 var aopts
= new Array(); // Option objects
294 foreach ($ISSUE_TYPES as $key => $value) {
295 echo " aitypes[$i] = " . attr($value[3]) . ";\n";
296 echo " aopts[$i] = new Array();\n";
297 $qry = sqlStatement("SELECT * FROM list_options WHERE list_id = ?",array($key."_issue_list"));
298 while($res = sqlFetchArray($qry)){
299 echo " aopts[$i][aopts[$i].length] = new Option('".attr(trim($res['option_id']))."', '".attr(xl_list_label(trim($res['title'])))."', false, false);\n";
305 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
307 // React to selection of an issue type. This loads the associated
308 // shortcuts into the selection list of titles, and determines which
309 // rows are displayed or hidden.
310 function newtype(index
) {
311 var f
= document
.forms
[0];
312 var theopts
= f
.form_titles
.options
;
315 for (i
= 0; i
< aopts
[index
].length
; ++i
) {
316 theopts
[i
] = aopts
[index
][i
];
318 document
.getElementById('row_titles').style
.display
= i ?
'' : 'none';
319 // Show or hide various rows depending on issue type, except do not
320 // hide the comments or referred-by fields if they have data.
321 var comdisp
= (aitypes
[index
] == 1) ?
'none' : '';
322 var revdisp
= (aitypes
[index
] == 1) ?
'' : 'none';
323 var injdisp
= (aitypes
[index
] == 2) ?
'' : 'none';
324 var nordisp
= (aitypes
[index
] == 0) ?
'' : 'none';
325 // reaction row should be displayed only for medication allergy.
326 var alldisp
= (index
== <?php
echo issueTypeIndex('allergy'); ?
>) ?
'' : 'none';
327 document
.getElementById('row_enddate' ).style
.display
= comdisp
;
328 // Note that by default all the issues will not show the active row
329 // (which is desired functionality, since then use the end date
330 // to inactivate the item.)
331 document
.getElementById('row_active' ).style
.display
= revdisp
;
332 document
.getElementById('row_diagnosis' ).style
.display
= comdisp
;
333 document
.getElementById('row_occurrence' ).style
.display
= comdisp
;
334 document
.getElementById('row_classification').style
.display
= injdisp
;
335 document
.getElementById('row_reinjury_id' ).style
.display
= injdisp
;
336 document
.getElementById('row_reaction' ).style
.display
= alldisp
;
337 document
.getElementById('row_referredby' ).style
.display
= (f
.form_referredby
.value
) ?
'' : comdisp
;
338 document
.getElementById('row_comments' ).style
.display
= (f
.form_comments
.value
) ?
'' : revdisp
;
339 <?php
if ($GLOBALS['athletic_team']) { ?
>
340 document
.getElementById('row_returndate' ).style
.display
= comdisp
;
341 document
.getElementById('row_injury_grade' ).style
.display
= injdisp
;
342 document
.getElementById('row_injury_part' ).style
.display
= injdisp
;
343 document
.getElementById('row_injury_type' ).style
.display
= injdisp
;
344 document
.getElementById('row_medical_system').style
.display
= nordisp
;
345 document
.getElementById('row_medical_type' ).style
.display
= nordisp
;
346 // Change label text of 'title' row depending on issue type:
347 document
.getElementById('title_diagnosis').innerHTML
= '<b>' +
348 (index
== <?php
echo issueTypeIndex('allergy'); ?
> ?
349 '<?php echo xla('Allergy
') ?>' :
350 (index
== <?php
echo issueTypeIndex('general'); ?
> ?
351 '<?php echo xla('Title
') ?>' :
352 '<?php echo xla('Text Diagnosis
') ?>')) +
355 document
.getElementById('row_referredby' ).style
.display
= (f
.form_referredby
.value
) ?
'' : comdisp
;
358 if ($ISSUE_TYPES['football_injury']) {
359 // Generate more of these for football injury fields.
360 issue_football_injury_newtype();
362 if ($ISSUE_TYPES['ippf_gcac'] && !$_POST['form_save']) {
363 // Generate more of these for gcac and contraceptive fields.
364 if (empty($issue) ||
$irow['type'] == 'ippf_gcac' ) issue_ippf_gcac_newtype();
365 if (empty($issue) ||
$irow['type'] == 'contraceptive') issue_ippf_con_newtype();
370 // If a clickoption title is selected, copy it to the title field.
371 function set_text() {
372 var f
= document
.forms
[0];
373 f
.form_title
.value
= f
.form_titles
.options
[f
.form_titles
.selectedIndex
].text
;
374 f
.form_titles
.selectedIndex
= -1;
377 // Process click on Delete link.
378 function deleteme() {
379 dlgopen('../deleter.php?issue=<?php echo attr($issue) ?>', '_blank', 500, 450);
383 // Called by the deleteme.php window on a successful delete.
384 function imdeleted() {
389 if (parent
.$
) parent
.$
.fancybox
.close();
393 // Called when the Active checkbox is clicked. For consistency we
394 // use the existence of an end date to indicate inactivity, even
395 // though the simple verion of the form does not show an end date.
396 function activeClicked(cb
) {
397 var f
= document
.forms
[0];
399 f
.form_end
.value
= '';
401 var today
= new Date();
402 f
.form_end
.value
= '' +
(today
.getYear() +
1900) +
'-' +
403 (today
.getMonth() +
1) +
'-' + today
.getDate();
407 // Called when resolved outcome is chosen and the end date is entered.
408 function outcomeClicked(cb
) {
409 var f
= document
.forms
[0];
410 if (cb
.value
== '1'){
411 var today
= new Date();
412 f
.form_end
.value
= '' +
(today
.getYear() +
1900) +
'-' +
413 (today
.getMonth() +
1) +
'-' + today
.getDate();
418 // This is for callback by the find-code popup.
419 // Appends to or erases the current list of diagnoses.
420 function set_related(codetype
, code
, selector
, codedesc
) {
421 var f
= document
.forms
[0];
422 var s
= f
.form_diagnosis
.value
;
423 var title
= f
.form_title
.value
;
425 if (s
.length
> 0) s +
= ';';
426 s +
= codetype +
':' + code
;
430 f
.form_diagnosis
.value
= s
;
431 if(title
== '') f
.form_title
.value
= codedesc
;
434 // This invokes the find-code popup.
435 function sel_diagnosis() {
437 if($irow['type'] == 'medical_problem')
440 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("medical_problem","csv")) ?>', '_blank', 500, 400);
445 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("diagnosis","csv")) ?>', '_blank', 500, 400);
451 // Check for errors when the form is submitted.
452 function validate() {
453 var f
= document
.forms
[0];
454 if (! f
.form_title
.value
) {
455 alert("<?php echo addslashes(xl('Please enter a title!')); ?>");
458 top
.restoreSession();
462 // Supports customizable forms (currently just for IPPF).
463 function divclick(cb
, divid
) {
464 var divstyle
= document
.getElementById(divid
).style
;
466 divstyle
.display
= 'block';
468 divstyle
.display
= 'none';
477 <body
class="body_top" style
="padding-right:0.5em">
479 <form method
='post' name
='theform'
480 action
='add_edit_issue.php?issue=<?php echo attr($issue); ?>&thispid=<?php echo attr($thispid); ?>&thisenc=<?php echo attr($thisenc); ?>'
481 onsubmit
='return validate()'>
483 <table border
='0' width
='100%'>
486 <td valign
='top' width
='1%' nowrap
><b
><?php
echo xlt('Type'); ?
>:</b
></td
>
490 foreach ($ISSUE_TYPES as $value) {
491 if ($issue ||
$thistype) {
492 if ($index == $type_index) {
493 echo text($value[1]);
494 echo "<input type='hidden' name='form_type' value='".attr($index)."'>\n";
497 echo " <input type='radio' name='form_type' value='".attr($index)."' onclick='newtype($index)'";
498 if ($index == $type_index) echo " checked";
499 echo " />" . text($value[1]) . " \n";
508 <td valign
='top' nowrap
> 
;</td
>
510 <select name
='form_titles' size
='<?php echo $GLOBALS['athletic_team
'] ? 10 : 4; ?>' onchange
='set_text()'>
511 </select
> <?php
echo xlt('(Select one of these, or type your own title)'); ?
>
516 <td valign
='top' id
='title_diagnosis' nowrap
><b
><?php
echo $GLOBALS['athletic_team'] ?
xlt('Text Diagnosis') : xlt('Title'); ?
>:</b
></td
>
518 <input type
='text' size
='40' name
='form_title' value
='<?php echo attr($irow['title
']) ?>' style
='width:100%' />
522 <tr id
='row_diagnosis'>
523 <td valign
='top' nowrap
><b
><?php
echo xlt('Diagnosis Code'); ?
>:</b
></td
>
525 <input type
='text' size
='50' name
='form_diagnosis'
526 value
='<?php echo attr($irow['diagnosis
']) ?>' onclick
='sel_diagnosis()'
527 title
='<?php echo xla('Click to select
or change diagnoses
'); ?>'
528 style
='width:100%' readonly
/>
532 <!-- For Athletic Teams
-->
534 <tr
<?php
if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?
> id
='row_injury_grade'>
535 <td valign
='top' nowrap
><b
><?php
echo xlt('Grade of Injury'); ?
>:</b
></td
>
538 echo generate_select_list('form_injury_grade', 'injury_grade', $irow['injury_grade'], '');
543 <tr
<?php
if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?
> id
='row_injury_part'>
544 <td valign
='top' nowrap
><b
><?php
echo xlt('Injured Body Part'); ?
>:</b
></td
>
547 echo generate_select_list('form_injury_part', 'injury_part', $irow['injury_part'], '');
552 <tr
<?php
if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?
> id
='row_injury_type'>
553 <td valign
='top' nowrap
><b
><?php
echo xlt('Injury Type'); ?
>:</b
></td
>
556 echo generate_select_list('form_injury_type', 'injury_type', $irow['injury_type'], '');
561 <tr
<?php
if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?
> id
='row_medical_system'>
562 <td valign
='top' nowrap
><b
><?php
echo xlt('Medical System'); ?
>:</b
></td
>
565 echo generate_select_list('form_medical_system', 'medical_system', $irow['injury_part'], '');
570 <tr
<?php
if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?
> id
='row_medical_type'>
571 <td valign
='top' nowrap
><b
><?php
echo xlt('Medical Type'); ?
>:</b
></td
>
574 echo generate_select_list('form_medical_type', 'medical_type', $irow['injury_type'], '');
579 <!-- End
For Athletic Teams
-->
582 <td valign
='top' nowrap
><b
><?php
echo xlt('Begin Date'); ?
>:</b
></td
>
585 <input type
='text' size
='10' name
='form_begin' id
='form_begin'
586 value
='<?php echo attr($irow['begdate
']) ?>'
587 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
588 title
='<?php echo xla('yyyy
-mm
-dd date of onset
, surgery
or start of medication
'); ?>' />
589 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
590 id
='img_begin' border
='0' alt
='[?]' style
='cursor:pointer'
591 title
='<?php echo xla('Click here to choose a date
'); ?>' />
595 <tr id
='row_enddate'>
596 <td valign
='top' nowrap
><b
><?php
echo xlt('End Date'); ?
>:</b
></td
>
598 <input type
='text' size
='10' name
='form_end' id
='form_end'
599 value
='<?php echo attr($irow['enddate
']) ?>'
600 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
601 title
='<?php echo xla('yyyy
-mm
-dd date of recovery
or end of medication
'); ?>' />
602 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
603 id
='img_end' border
='0' alt
='[?]' style
='cursor:pointer'
604 title
='<?php echo xla('Click here to choose a date
'); ?>' />
605  
;(<?php
echo xlt('leave blank if still active'); ?
>)
610 <td valign
='top' nowrap
><b
><?php
echo xlt('Active'); ?
>:</b
></td
>
612 <input type
='checkbox' name
='form_active' value
='1' <?php
echo attr($irow['enddate']) ?
"" : "checked"; ?
>
613 onclick
='activeClicked(this);'
614 title
='<?php echo xla('Indicates
if this issue is currently active
'); ?>' />
618 <tr
<?php
if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?
> id
='row_returndate'>
619 <td valign
='top' nowrap
><b
><?php
echo xlt('Returned to Play'); ?
>:</b
></td
>
621 <input type
='text' size
='10' name
='form_return' id
='form_return'
622 value
='<?php echo attr($irow['returndate
']) ?>'
623 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
624 title
='<?php echo xla('yyyy
-mm
-dd date returned to play
'); ?>' />
625 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
626 id
='img_return' border
='0' alt
='[?]' style
='cursor:pointer'
627 title
='<?php echo xla('Click here to choose a date
'); ?>' />
628  
;(<?php
echo xlt('leave blank if still active'); ?
>)
632 <tr id
='row_occurrence'>
633 <td valign
='top' nowrap
><b
><?php
echo xlt('Occurrence'); ?
>:</b
></td
>
636 // Modified 6/2009 by BM to incorporate the occurrence items into the list_options listings
637 generate_form_field(array('data_type'=>1,'field_id'=>'occur','list_id'=>'occurrence','empty_title'=>'SKIP'), $irow['occurrence']);
642 <tr id
='row_classification'>
643 <td valign
='top' nowrap
><b
><?php
echo xlt('Classification'); ?
>:</b
></td
>
645 <select name
='form_classification'>
647 foreach ($ISSUE_CLASSIFICATIONS as $key => $value) {
648 echo " <option value='".attr($key)."'";
649 if ($key == $irow['classification']) echo " selected";
650 echo ">".text($value)."\n";
657 <tr
<?php
if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?
> id
='row_reinjury_id'>
658 <td valign
='top' nowrap
><b
><?php
echo xlt('Re-Injury?'); ?
>:</b
></td
>
660 <select name
='form_reinjury_id'>
661 <option value
='0'><?php
echo xlt('No'); ?
></option
>
663 $pres = sqlStatement(
664 "SELECT id, begdate, title " .
665 "FROM lists WHERE " .
667 "type = 'football_injury' AND " .
669 "ORDER BY begdate DESC", array($thispid)
671 while ($prow = sqlFetchArray($pres)) {
672 echo " <option value='" . attr($prow['id']) . "'";
673 if ($prow['id'] == $irow['reinjury_id']) echo " selected";
674 echo ">" . text($prow['begdate']) . " " . text($prow['title']) . "\n";
680 <!-- Reaction
For Medication Allergy
-->
681 <tr id
='row_reaction'>
682 <td valign
='top' nowrap
><b
><?php
echo xlt('Reaction'); ?
>:</b
></td
>
684 <input type
='text' size
='40' name
='form_reaction' value
='<?php echo attr($irow['reaction
']) ?>'
685 style
='width:100%' title
='<?php echo xla('Allergy Reaction
'); ?>' />
688 <!-- End of reaction
-->
690 <tr
<?php
if ($GLOBALS['athletic_team']) echo " style='display:none;'"; ?
> id
='row_referredby'>
691 <td valign
='top' nowrap
><b
><?php
echo xlt('Referred by'); ?
>:</b
></td
>
693 <input type
='text' size
='40' name
='form_referredby' value
='<?php echo attr($irow['referredby
']) ?>'
694 style
='width:100%' title
='<?php echo xla('Referring physician
and practice
'); ?>' />
698 <tr id
='row_comments'>
699 <td valign
='top' nowrap
><b
><?php
echo xlt('Comments'); ?
>:</b
></td
>
701 <textarea name
='form_comments' rows
='4' cols
='40' wrap
='virtual' style
='width:100%'><?php
echo text($irow['comments']) ?
></textarea
>
705 <tr
<?php
if ($GLOBALS['athletic_team'] ||
$GLOBALS['ippf_specific']) echo " style='display:none;'"; ?
>>
706 <td valign
='top' nowrap
><b
><?php
echo xlt('Outcome'); ?
>:</b
></td
>
709 echo generate_select_list('form_outcome', 'outcome', $irow['outcome'], '', '', '', 'outcomeClicked(this);');
714 <tr
<?php
if ($GLOBALS['athletic_team'] ||
$GLOBALS['ippf_specific']) echo " style='display:none;'"; ?
>>
715 <td valign
='top' nowrap
><b
><?php
echo xlt('Destination'); ?
>:</b
></td
>
718 <input type
='text' size
='40' name
='form_destination' value
='<?php echo attr($irow['destination
']) ?>'
719 style
='width:100%' title
='GP, Secondary care specialist, etc.' />
720 <?php
} else { // leave this here for now, please -- Rod ?>
721 <?php
echo rbinput('form_destination', '1', 'GP' , 'destination') ?
> 
;
722 <?php
echo rbinput('form_destination', '2', 'Secondary care spec', 'destination') ?
> 
;
723 <?php
echo rbinput('form_destination', '3', 'GP via physio' , 'destination') ?
> 
;
724 <?php
echo rbinput('form_destination', '4', 'GP via podiatry' , 'destination') ?
>
732 if ($ISSUE_TYPES['football_injury']) {
733 issue_football_injury_form($issue);
735 if ($ISSUE_TYPES['ippf_gcac']) {
736 if (empty($issue) ||
$irow['type'] == 'ippf_gcac')
737 issue_ippf_gcac_form($issue, $thispid);
738 if (empty($issue) ||
$irow['type'] == 'contraceptive')
739 issue_ippf_con_form($issue, $thispid);
746 <input type
='submit' name
='form_save' value
='<?php echo xla('Save
'); ?>' />
748 <?php
if ($issue && acl_check('admin', 'super')) { ?
>
750 <input type
='button' value
='<?php echo xla('Delete
'); ?>' style
='color:red' onclick
='deleteme()' />
754 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='closeme();' />
760 <script language
='JavaScript'>
761 newtype(<?php
echo $type_index ?
>);
762 Calendar
.setup({inputField
:"form_begin", ifFormat
:"%Y-%m-%d", button
:"img_begin"});
763 Calendar
.setup({inputField
:"form_end", ifFormat
:"%Y-%m-%d", button
:"img_end"});
764 Calendar
.setup({inputField
:"form_return", ifFormat
:"%Y-%m-%d", button
:"img_return"});