Proposed fix for clikoptions in upgrade for windows
[openemr.git] / interface / patient_file / summary / add_edit_issue.php
blobfae251703276d44b8d54b611a32f6650596f9ff7
1 <?php
2 /**
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.
12 * @package OpenEMR
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']);
52 $info_msg = "";
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)."'";
69 return "NULL";
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';
79 return "'$tmp'";
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) {
98 global $irow;
99 $ret = "<input type='radio' name='".attr($name)."' value='".attr($value)."'";
100 if ($irow[$colname] == $value) $ret .= " checked";
101 $ret .= " />".text($desc);
102 return $ret;
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) {
111 global $ISSUE_TYPES;
112 $i = 0;
113 foreach ($ISSUE_TYPES as $key => $value) {
114 if ($key == $tstr) break;
115 ++$i;
117 return $i;
120 // If we are saving, then save and close the window.
122 if ($_POST['form_save']) {
124 $i = 0;
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'];
137 else {
138 $form_injury_part = $_POST['form_medical_system'];
139 $form_injury_type = $_POST['form_medical_type'];
142 if ($issue) {
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'])) );
173 } else {
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, " .
179 "reaction " .
180 ") VALUES ( " .
181 "NOW(), " .
182 "'" . add_escape_custom($thispid) . "', " .
183 "'" . add_escape_custom($text_type) . "', " .
184 "'" . add_escape_custom($_POST['form_title']) . "', " .
185 "1, " .
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']) . "' " .
203 ")");
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.
215 if ($thisenc) {
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";
238 exit();
241 $irow = array();
242 if ($issue)
243 $irow = sqlQuery("SELECT * FROM lists WHERE id = ?",array($issue));
244 else if ($thistype)
245 $irow['type'] = $thistype;
247 $type_index = 0;
249 if (!empty($irow['type'])) {
250 foreach ($ISSUE_TYPES as $key => $value) {
251 if ($key == $irow['type']) break;
252 ++$type_index;
256 <html>
257 <head>
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'>
262 <style>
264 td, input, select, textarea {
265 font-family: Arial, Helvetica, sans-serif;
266 font-size: 10pt;
269 div.section {
270 border: solid;
271 border-width: 1px;
272 border-color: #0000ff;
273 margin: 0 0 0 10pt;
274 padding: 5pt;
277 </style>
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
292 <?php
293 $i = 0;
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";
301 ++$i;
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;
313 theopts.length = 0;
314 var i = 0;
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') ?>')) +
353 ':</b>';
354 <?php } else { ?>
355 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
356 <?php } ?>
357 <?php
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);
380 return false;
383 // Called by the deleteme.php window on a successful delete.
384 function imdeleted() {
385 closeme();
388 function closeme() {
389 if (parent.$) parent.$.fancybox.close();
390 window.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];
398 if (cb.checked) {
399 f.form_end.value = '';
400 } else {
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();
414 f.form_end.focus();
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;
424 if (code) {
425 if (s.length > 0) s += ';';
426 s += codetype + ':' + code;
427 } else {
428 s = '';
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() {
436 <?php
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);
441 <?php
443 else{
445 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("diagnosis","csv")) ?>', '_blank', 500, 400);
446 <?php
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!')); ?>");
456 return false;
458 top.restoreSession();
459 return true;
462 // Supports customizable forms (currently just for IPPF).
463 function divclick(cb, divid) {
464 var divstyle = document.getElementById(divid).style;
465 if (cb.checked) {
466 divstyle.display = 'block';
467 } else {
468 divstyle.display = 'none';
470 return true;
473 </script>
475 </head>
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%'>
485 <tr>
486 <td valign='top' width='1%' nowrap><b><?php echo xlt('Type'); ?>:</b></td>
487 <td>
488 <?php
489 $index = 0;
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";
496 } else {
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]) . "&nbsp;\n";
501 ++$index;
504 </td>
505 </tr>
507 <tr id='row_titles'>
508 <td valign='top' nowrap>&nbsp;</td>
509 <td valign='top'>
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)'); ?>
512 </td>
513 </tr>
515 <tr>
516 <td valign='top' id='title_diagnosis' nowrap><b><?php echo $GLOBALS['athletic_team'] ? xlt('Text Diagnosis') : xlt('Title'); ?>:</b></td>
517 <td>
518 <input type='text' size='40' name='form_title' value='<?php echo attr($irow['title']) ?>' style='width:100%' />
519 </td>
520 </tr>
522 <tr id='row_diagnosis'>
523 <td valign='top' nowrap><b><?php echo xlt('Diagnosis Code'); ?>:</b></td>
524 <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 />
529 </td>
530 </tr>
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>
536 <td>
537 <?php
538 echo generate_select_list('form_injury_grade', 'injury_grade', $irow['injury_grade'], '');
540 </td>
541 </tr>
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>
545 <td>
546 <?php
547 echo generate_select_list('form_injury_part', 'injury_part', $irow['injury_part'], '');
549 </td>
550 </tr>
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>
554 <td>
555 <?php
556 echo generate_select_list('form_injury_type', 'injury_type', $irow['injury_type'], '');
558 </td>
559 </tr>
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>
563 <td>
564 <?php
565 echo generate_select_list('form_medical_system', 'medical_system', $irow['injury_part'], '');
567 </td>
568 </tr>
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>
572 <td>
573 <?php
574 echo generate_select_list('form_medical_type', 'medical_type', $irow['injury_type'], '');
576 </td>
577 </tr>
579 <!-- End For Athletic Teams -->
581 <tr>
582 <td valign='top' nowrap><b><?php echo xlt('Begin Date'); ?>:</b></td>
583 <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'); ?>' />
592 </td>
593 </tr>
595 <tr id='row_enddate'>
596 <td valign='top' nowrap><b><?php echo xlt('End Date'); ?>:</b></td>
597 <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 &nbsp;(<?php echo xlt('leave blank if still active'); ?>)
606 </td>
607 </tr>
609 <tr id='row_active'>
610 <td valign='top' nowrap><b><?php echo xlt('Active'); ?>:</b></td>
611 <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'); ?>' />
615 </td>
616 </tr>
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>
620 <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 &nbsp;(<?php echo xlt('leave blank if still active'); ?>)
629 </td>
630 </tr>
632 <tr id='row_occurrence'>
633 <td valign='top' nowrap><b><?php echo xlt('Occurrence'); ?>:</b></td>
634 <td>
635 <?php
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']);
639 </td>
640 </tr>
642 <tr id='row_classification'>
643 <td valign='top' nowrap><b><?php echo xlt('Classification'); ?>:</b></td>
644 <td>
645 <select name='form_classification'>
646 <?php
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";
653 </select>
654 </td>
655 </tr>
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>
659 <td>
660 <select name='form_reinjury_id'>
661 <option value='0'><?php echo xlt('No'); ?></option>
662 <?php
663 $pres = sqlStatement(
664 "SELECT id, begdate, title " .
665 "FROM lists WHERE " .
666 "pid = ? AND " .
667 "type = 'football_injury' AND " .
668 "activity = 1 " .
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";
677 </select>
678 </td>
679 </tr>
680 <!-- Reaction For Medication Allergy -->
681 <tr id='row_reaction'>
682 <td valign='top' nowrap><b><?php echo xlt('Reaction'); ?>:</b></td>
683 <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'); ?>' />
686 </td>
687 </tr>
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>
692 <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'); ?>' />
695 </td>
696 </tr>
698 <tr id='row_comments'>
699 <td valign='top' nowrap><b><?php echo xlt('Comments'); ?>:</b></td>
700 <td>
701 <textarea name='form_comments' rows='4' cols='40' wrap='virtual' style='width:100%'><?php echo text($irow['comments']) ?></textarea>
702 </td>
703 </tr>
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>
707 <td>
708 <?php
709 echo generate_select_list('form_outcome', 'outcome', $irow['outcome'], '', '', '', 'outcomeClicked(this);');
711 </td>
712 </tr>
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>
716 <td>
717 <?php if (true) { ?>
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') ?>&nbsp;
722 <?php echo rbinput('form_destination', '2', 'Secondary care spec', 'destination') ?>&nbsp;
723 <?php echo rbinput('form_destination', '3', 'GP via physio' , 'destination') ?>&nbsp;
724 <?php echo rbinput('form_destination', '4', 'GP via podiatry' , 'destination') ?>
725 <?php } ?>
726 </td>
727 </tr>
729 </table>
731 <?php
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);
743 <center>
746 <input type='submit' name='form_save' value='<?php echo xla('Save'); ?>' />
748 <?php if ($issue && acl_check('admin', 'super')) { ?>
749 &nbsp;
750 <input type='button' value='<?php echo xla('Delete'); ?>' style='color:red' onclick='deleteme()' />
751 <?php } ?>
753 &nbsp;
754 <input type='button' value='<?php echo xla('Cancel'); ?>' onclick='closeme();' />
756 </p>
757 </center>
759 </form>
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"});
765 </script>
766 </body>
767 </html>