Fourth merge from Julia Longtin repository with conflict fix in interface/patient_fil...
[openemr.git] / interface / patient_file / summary / add_edit_issue.php
blobe29f4841d80b715eb3dabbf49f24208607b4b80a
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 // "Clickoptions" is a feature by Mark Leeds that provides for one-click
294 // access to preselected lists of issues in each category. Here we get
295 // the issue titles from the user-customizable file and write JavaScript
296 // statements that will build an array of arrays of Option objects.
298 $clickoptions = array();
299 if (is_file($GLOBALS['OE_SITE_DIR'] . "/clickoptions.txt"))
300 $clickoptions = file($GLOBALS['OE_SITE_DIR'] . "/clickoptions.txt");
301 $i = 0;
302 foreach ($ISSUE_TYPES as $key => $value) {
303 echo " aitypes[$i] = " . attr($value[3]) . ";\n";
304 echo " aopts[$i] = new Array();\n";
305 foreach($clickoptions as $line) {
306 $line = trim($line);
307 if (substr($line, 0, 1) != "#") {
308 if (strpos($line, $key) !== false) {
309 $text = addslashes(substr($line, strpos($line, "::") + 2));
310 echo " aopts[$i][aopts[$i].length] = new Option('$text', '$text', false, false);\n";
314 ++$i;
318 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
320 // React to selection of an issue type. This loads the associated
321 // shortcuts into the selection list of titles, and determines which
322 // rows are displayed or hidden.
323 function newtype(index) {
324 var f = document.forms[0];
325 var theopts = f.form_titles.options;
326 theopts.length = 0;
327 var i = 0;
328 for (i = 0; i < aopts[index].length; ++i) {
329 theopts[i] = aopts[index][i];
331 document.getElementById('row_titles').style.display = i ? '' : 'none';
332 // Show or hide various rows depending on issue type, except do not
333 // hide the comments or referred-by fields if they have data.
334 var comdisp = (aitypes[index] == 1) ? 'none' : '';
335 var revdisp = (aitypes[index] == 1) ? '' : 'none';
336 var injdisp = (aitypes[index] == 2) ? '' : 'none';
337 var nordisp = (aitypes[index] == 0) ? '' : 'none';
338 // reaction row should be displayed only for medication allergy.
339 var alldisp = (index == <?php echo issueTypeIndex('allergy'); ?>) ? '' : 'none';
340 document.getElementById('row_enddate' ).style.display = comdisp;
341 // Note that by default all the issues will not show the active row
342 // (which is desired functionality, since then use the end date
343 // to inactivate the item.)
344 document.getElementById('row_active' ).style.display = revdisp;
345 document.getElementById('row_diagnosis' ).style.display = comdisp;
346 document.getElementById('row_occurrence' ).style.display = comdisp;
347 document.getElementById('row_classification').style.display = injdisp;
348 document.getElementById('row_reinjury_id' ).style.display = injdisp;
349 document.getElementById('row_reaction' ).style.display = alldisp;
350 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
351 document.getElementById('row_comments' ).style.display = (f.form_comments.value ) ? '' : revdisp;
352 <?php if ($GLOBALS['athletic_team']) { ?>
353 document.getElementById('row_returndate' ).style.display = comdisp;
354 document.getElementById('row_injury_grade' ).style.display = injdisp;
355 document.getElementById('row_injury_part' ).style.display = injdisp;
356 document.getElementById('row_injury_type' ).style.display = injdisp;
357 document.getElementById('row_medical_system').style.display = nordisp;
358 document.getElementById('row_medical_type' ).style.display = nordisp;
359 // Change label text of 'title' row depending on issue type:
360 document.getElementById('title_diagnosis').innerHTML = '<b>' +
361 (index == <?php echo issueTypeIndex('allergy'); ?> ?
362 '<?php echo xla('Allergy') ?>' :
363 (index == <?php echo issueTypeIndex('general'); ?> ?
364 '<?php echo xla('Title') ?>' :
365 '<?php echo xla('Text Diagnosis') ?>')) +
366 ':</b>';
367 <?php } else { ?>
368 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
369 <?php } ?>
370 <?php
371 if ($ISSUE_TYPES['football_injury']) {
372 // Generate more of these for football injury fields.
373 issue_football_injury_newtype();
375 if ($ISSUE_TYPES['ippf_gcac'] && !$_POST['form_save']) {
376 // Generate more of these for gcac and contraceptive fields.
377 if (empty($issue) || $irow['type'] == 'ippf_gcac' ) issue_ippf_gcac_newtype();
378 if (empty($issue) || $irow['type'] == 'contraceptive') issue_ippf_con_newtype();
383 // If a clickoption title is selected, copy it to the title field.
384 function set_text() {
385 var f = document.forms[0];
386 f.form_title.value = f.form_titles.options[f.form_titles.selectedIndex].text;
387 f.form_titles.selectedIndex = -1;
390 // Process click on Delete link.
391 function deleteme() {
392 dlgopen('../deleter.php?issue=<?php echo attr($issue) ?>', '_blank', 500, 450);
393 return false;
396 // Called by the deleteme.php window on a successful delete.
397 function imdeleted() {
398 closeme();
401 function closeme() {
402 if (parent.$) parent.$.fancybox.close();
403 window.close();
406 // Called when the Active checkbox is clicked. For consistency we
407 // use the existence of an end date to indicate inactivity, even
408 // though the simple verion of the form does not show an end date.
409 function activeClicked(cb) {
410 var f = document.forms[0];
411 if (cb.checked) {
412 f.form_end.value = '';
413 } else {
414 var today = new Date();
415 f.form_end.value = '' + (today.getYear() + 1900) + '-' +
416 (today.getMonth() + 1) + '-' + today.getDate();
420 // Called when resolved outcome is chosen and the end date is entered.
421 function outcomeClicked(cb) {
422 var f = document.forms[0];
423 if (cb.value == '1'){
424 var today = new Date();
425 f.form_end.value = '' + (today.getYear() + 1900) + '-' +
426 (today.getMonth() + 1) + '-' + today.getDate();
427 f.form_end.focus();
431 // This is for callback by the find-code popup.
432 // Appends to or erases the current list of diagnoses.
433 function set_related(codetype, code, selector, codedesc) {
434 var f = document.forms[0];
435 var s = f.form_diagnosis.value;
436 var title = f.form_title.value;
437 if (code) {
438 if (s.length > 0) s += ';';
439 s += codetype + ':' + code;
440 } else {
441 s = '';
443 f.form_diagnosis.value = s;
444 if(title == '') f.form_title.value = codedesc;
447 // This invokes the find-code popup.
448 function sel_diagnosis() {
449 <?php
450 if($irow['type'] == 'medical_problem')
453 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("medical_problem","csv")) ?>', '_blank', 500, 400);
454 <?php
456 else{
458 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("diagnosis","csv")) ?>', '_blank', 500, 400);
459 <?php
464 // Check for errors when the form is submitted.
465 function validate() {
466 var f = document.forms[0];
467 if (! f.form_title.value) {
468 alert("<?php echo addslashes(xl('Please enter a title!')); ?>");
469 return false;
471 top.restoreSession();
472 return true;
475 // Supports customizable forms (currently just for IPPF).
476 function divclick(cb, divid) {
477 var divstyle = document.getElementById(divid).style;
478 if (cb.checked) {
479 divstyle.display = 'block';
480 } else {
481 divstyle.display = 'none';
483 return true;
486 </script>
488 </head>
490 <body class="body_top" style="padding-right:0.5em">
492 <form method='post' name='theform'
493 action='add_edit_issue.php?issue=<?php echo attr($issue); ?>&thispid=<?php echo attr($thispid); ?>&thisenc=<?php echo attr($thisenc); ?>'
494 onsubmit='return validate()'>
496 <table border='0' width='100%'>
498 <tr>
499 <td valign='top' width='1%' nowrap><b><?php echo xlt('Type'); ?>:</b></td>
500 <td>
501 <?php
502 $index = 0;
503 foreach ($ISSUE_TYPES as $value) {
504 if ($issue || $thistype) {
505 if ($index == $type_index) {
506 echo text($value[1]);
507 echo "<input type='hidden' name='form_type' value='".attr($index)."'>\n";
509 } else {
510 echo " <input type='radio' name='form_type' value='".attr($index)."' onclick='newtype($index)'";
511 if ($index == $type_index) echo " checked";
512 echo " />" . text($value[1]) . "&nbsp;\n";
514 ++$index;
517 </td>
518 </tr>
520 <tr id='row_titles'>
521 <td valign='top' nowrap>&nbsp;</td>
522 <td valign='top'>
523 <select name='form_titles' size='<?php echo $GLOBALS['athletic_team'] ? 10 : 4; ?>' onchange='set_text()'>
524 </select> <?php echo xlt('(Select one of these, or type your own title)'); ?>
525 </td>
526 </tr>
528 <tr>
529 <td valign='top' id='title_diagnosis' nowrap><b><?php echo $GLOBALS['athletic_team'] ? xlt('Text Diagnosis') : xlt('Title'); ?>:</b></td>
530 <td>
531 <input type='text' size='40' name='form_title' value='<?php echo attr($irow['title']) ?>' style='width:100%' />
532 </td>
533 </tr>
535 <tr id='row_diagnosis'>
536 <td valign='top' nowrap><b><?php echo xlt('Diagnosis Code'); ?>:</b></td>
537 <td>
538 <input type='text' size='50' name='form_diagnosis'
539 value='<?php echo attr($irow['diagnosis']) ?>' onclick='sel_diagnosis()'
540 title='<?php echo xla('Click to select or change diagnoses'); ?>'
541 style='width:100%' readonly />
542 </td>
543 </tr>
545 <!-- For Athletic Teams -->
547 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_grade'>
548 <td valign='top' nowrap><b><?php echo xlt('Grade of Injury'); ?>:</b></td>
549 <td>
550 <?php
551 echo generate_select_list('form_injury_grade', 'injury_grade', $irow['injury_grade'], '');
553 </td>
554 </tr>
556 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_part'>
557 <td valign='top' nowrap><b><?php echo xlt('Injured Body Part'); ?>:</b></td>
558 <td>
559 <?php
560 echo generate_select_list('form_injury_part', 'injury_part', $irow['injury_part'], '');
562 </td>
563 </tr>
565 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_type'>
566 <td valign='top' nowrap><b><?php echo xlt('Injury Type'); ?>:</b></td>
567 <td>
568 <?php
569 echo generate_select_list('form_injury_type', 'injury_type', $irow['injury_type'], '');
571 </td>
572 </tr>
574 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_system'>
575 <td valign='top' nowrap><b><?php echo xlt('Medical System'); ?>:</b></td>
576 <td>
577 <?php
578 echo generate_select_list('form_medical_system', 'medical_system', $irow['injury_part'], '');
580 </td>
581 </tr>
583 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_type'>
584 <td valign='top' nowrap><b><?php echo xlt('Medical Type'); ?>:</b></td>
585 <td>
586 <?php
587 echo generate_select_list('form_medical_type', 'medical_type', $irow['injury_type'], '');
589 </td>
590 </tr>
592 <!-- End For Athletic Teams -->
594 <tr>
595 <td valign='top' nowrap><b><?php echo xlt('Begin Date'); ?>:</b></td>
596 <td>
598 <input type='text' size='10' name='form_begin' id='form_begin'
599 value='<?php echo attr($irow['begdate']) ?>'
600 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
601 title='<?php echo xla('yyyy-mm-dd date of onset, surgery or start of medication'); ?>' />
602 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
603 id='img_begin' border='0' alt='[?]' style='cursor:pointer'
604 title='<?php echo xla('Click here to choose a date'); ?>' />
605 </td>
606 </tr>
608 <tr id='row_enddate'>
609 <td valign='top' nowrap><b><?php echo xlt('End Date'); ?>:</b></td>
610 <td>
611 <input type='text' size='10' name='form_end' id='form_end'
612 value='<?php echo attr($irow['enddate']) ?>'
613 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
614 title='<?php echo xla('yyyy-mm-dd date of recovery or end of medication'); ?>' />
615 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
616 id='img_end' border='0' alt='[?]' style='cursor:pointer'
617 title='<?php echo xla('Click here to choose a date'); ?>' />
618 &nbsp;(<?php echo xlt('leave blank if still active'); ?>)
619 </td>
620 </tr>
622 <tr id='row_active'>
623 <td valign='top' nowrap><b><?php echo xlt('Active'); ?>:</b></td>
624 <td>
625 <input type='checkbox' name='form_active' value='1' <?php echo attr($irow['enddate']) ? "" : "checked"; ?>
626 onclick='activeClicked(this);'
627 title='<?php echo xla('Indicates if this issue is currently active'); ?>' />
628 </td>
629 </tr>
631 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_returndate'>
632 <td valign='top' nowrap><b><?php echo xlt('Returned to Play'); ?>:</b></td>
633 <td>
634 <input type='text' size='10' name='form_return' id='form_return'
635 value='<?php echo attr($irow['returndate']) ?>'
636 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
637 title='<?php echo xla('yyyy-mm-dd date returned to play'); ?>' />
638 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
639 id='img_return' border='0' alt='[?]' style='cursor:pointer'
640 title='<?php echo xla('Click here to choose a date'); ?>' />
641 &nbsp;(<?php echo xlt('leave blank if still active'); ?>)
642 </td>
643 </tr>
645 <tr id='row_occurrence'>
646 <td valign='top' nowrap><b><?php echo xlt('Occurrence'); ?>:</b></td>
647 <td>
648 <?php
649 // Modified 6/2009 by BM to incorporate the occurrence items into the list_options listings
650 generate_form_field(array('data_type'=>1,'field_id'=>'occur','list_id'=>'occurrence','empty_title'=>'SKIP'), $irow['occurrence']);
652 </td>
653 </tr>
655 <tr id='row_classification'>
656 <td valign='top' nowrap><b><?php echo xlt('Classification'); ?>:</b></td>
657 <td>
658 <select name='form_classification'>
659 <?php
660 foreach ($ISSUE_CLASSIFICATIONS as $key => $value) {
661 echo " <option value='".attr($key)."'";
662 if ($key == $irow['classification']) echo " selected";
663 echo ">".text($value)."\n";
666 </select>
667 </td>
668 </tr>
670 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_reinjury_id'>
671 <td valign='top' nowrap><b><?php echo xlt('Re-Injury?'); ?>:</b></td>
672 <td>
673 <select name='form_reinjury_id'>
674 <option value='0'><?php echo xlt('No'); ?></option>
675 <?php
676 $pres = sqlStatement(
677 "SELECT id, begdate, title " .
678 "FROM lists WHERE " .
679 "pid = ? AND " .
680 "type = 'football_injury' AND " .
681 "activity = 1 " .
682 "ORDER BY begdate DESC", array($thispid)
684 while ($prow = sqlFetchArray($pres)) {
685 echo " <option value='" . attr($prow['id']) . "'";
686 if ($prow['id'] == $irow['reinjury_id']) echo " selected";
687 echo ">" . text($prow['begdate']) . " " . text($prow['title']) . "\n";
690 </select>
691 </td>
692 </tr>
693 <!-- Reaction For Medication Allergy -->
694 <tr id='row_reaction'>
695 <td valign='top' nowrap><b><?php echo xlt('Reaction'); ?>:</b></td>
696 <td>
697 <input type='text' size='40' name='form_reaction' value='<?php echo attr($irow['reaction']) ?>'
698 style='width:100%' title='<?php echo xla('Allergy Reaction'); ?>' />
699 </td>
700 </tr>
701 <!-- End of reaction -->
703 <tr<?php if ($GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_referredby'>
704 <td valign='top' nowrap><b><?php echo xlt('Referred by'); ?>:</b></td>
705 <td>
706 <input type='text' size='40' name='form_referredby' value='<?php echo attr($irow['referredby']) ?>'
707 style='width:100%' title='<?php echo xla('Referring physician and practice'); ?>' />
708 </td>
709 </tr>
711 <tr id='row_comments'>
712 <td valign='top' nowrap><b><?php echo xlt('Comments'); ?>:</b></td>
713 <td>
714 <textarea name='form_comments' rows='4' cols='40' wrap='virtual' style='width:100%'><?php echo text($irow['comments']) ?></textarea>
715 </td>
716 </tr>
718 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
719 <td valign='top' nowrap><b><?php echo xlt('Outcome'); ?>:</b></td>
720 <td>
721 <?php
722 echo generate_select_list('form_outcome', 'outcome', $irow['outcome'], '', '', '', 'outcomeClicked(this);');
724 </td>
725 </tr>
727 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
728 <td valign='top' nowrap><b><?php echo xlt('Destination'); ?>:</b></td>
729 <td>
730 <?php if (true) { ?>
731 <input type='text' size='40' name='form_destination' value='<?php echo attr($irow['destination']) ?>'
732 style='width:100%' title='GP, Secondary care specialist, etc.' />
733 <?php } else { // leave this here for now, please -- Rod ?>
734 <?php echo rbinput('form_destination', '1', 'GP' , 'destination') ?>&nbsp;
735 <?php echo rbinput('form_destination', '2', 'Secondary care spec', 'destination') ?>&nbsp;
736 <?php echo rbinput('form_destination', '3', 'GP via physio' , 'destination') ?>&nbsp;
737 <?php echo rbinput('form_destination', '4', 'GP via podiatry' , 'destination') ?>
738 <?php } ?>
739 </td>
740 </tr>
742 </table>
744 <?php
745 if ($ISSUE_TYPES['football_injury']) {
746 issue_football_injury_form($issue);
748 if ($ISSUE_TYPES['ippf_gcac']) {
749 if (empty($issue) || $irow['type'] == 'ippf_gcac')
750 issue_ippf_gcac_form($issue, $thispid);
751 if (empty($issue) || $irow['type'] == 'contraceptive')
752 issue_ippf_con_form($issue, $thispid);
756 <center>
759 <input type='submit' name='form_save' value='<?php echo xla('Save'); ?>' />
761 <?php if ($issue && acl_check('admin', 'super')) { ?>
762 &nbsp;
763 <input type='button' value='<?php echo xla('Delete'); ?>' style='color:red' onclick='deleteme()' />
764 <?php } ?>
766 &nbsp;
767 <input type='button' value='<?php echo xla('Cancel'); ?>' onclick='closeme();' />
769 </p>
770 </center>
772 </form>
773 <script language='JavaScript'>
774 newtype(<?php echo $type_index ?>);
775 Calendar.setup({inputField:"form_begin", ifFormat:"%Y-%m-%d", button:"img_begin"});
776 Calendar.setup({inputField:"form_end", ifFormat:"%Y-%m-%d", button:"img_end"});
777 Calendar.setup({inputField:"form_return", ifFormat:"%Y-%m-%d", button:"img_return"});
778 </script>
779 </body>
780 </html>