Improvements in problem lists for MU2.
[openemr.git] / interface / patient_file / summary / add_edit_issue.php
blob573f0616cd7d6d4236ae6ef07a46fcc02c2f4c09
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 //SANITIZE ALL ESCAPES
10 $sanitize_all_escapes=true;
13 //STOP FAKE REGISTER GLOBALS
14 $fake_register_globals=false;
17 require_once("../../globals.php");
18 require_once("$srcdir/lists.inc");
19 require_once("$srcdir/patient.inc");
20 require_once("$srcdir/acl.inc");
21 require_once("$srcdir/options.inc.php");
22 require_once("$srcdir/../custom/code_types.inc.php");
23 require_once("$srcdir/csv_like_join.php");
24 require_once("$srcdir/htmlspecialchars.inc.php");
25 require_once("$srcdir/formdata.inc.php");
27 if ($ISSUE_TYPES['football_injury']) {
28 // Most of the logic for the "football injury" issue type comes from this
29 // included script. We might eventually refine this approach to support
30 // a plug-in architecture for custom issue types.
31 require_once("$srcdir/football_injury.inc.php");
33 if ($ISSUE_TYPES['ippf_gcac']) {
34 // Similarly for IPPF issues.
35 require_once("$srcdir/ippf_issues.inc.php");
38 $issue = $_REQUEST['issue'];
39 $thispid = 0 + (empty($_REQUEST['thispid']) ? $pid : $_REQUEST['thispid']);
40 $info_msg = "";
42 // A nonempty thisenc means we are to link the issue to the encounter.
43 $thisenc = 0 + (empty($_REQUEST['thisenc']) ? 0 : $_REQUEST['thisenc']);
45 // A nonempty thistype is an issue type to be forced for a new issue.
46 $thistype = empty($_REQUEST['thistype']) ? '' : $_REQUEST['thistype'];
48 if ($issue && !acl_check('patients','med','','write') ) die(xlt("Edit is not authorized!"));
49 if ( !acl_check('patients','med','',array('write','addonly') )) die(xlt("Add is not authorized!"));
51 $tmp = getPatientData($thispid, "squad");
52 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
53 die(xlt("Not authorized for this squad!"));
55 function QuotedOrNull($fld) {
56 if ($fld) return "'".add_escape_custom($fld)."'";
57 return "NULL";
61 // Do not use this function since quotes are added in query escaping mechanism
62 // Only keeping since used in the football injury code football_injury.inc.php that is included.
63 // If start using this function, then incorporate the add_escape_custom() function into it
64 function rbvalue($rbname) {
65 $tmp = $_POST[$rbname];
66 if (! $tmp) $tmp = '0';
67 return "'$tmp'";
70 function cbvalue($cbname) {
71 return $_POST[$cbname] ? '1' : '0';
74 function invalue($inname) {
75 return (int) trim($_POST[$inname]);
78 // Do not use this function since quotes are added in query escaping mechanism
79 // Only keeping since used in the football injury code football_injury.inc.php that is included.
80 // If start using this function, then incorporate the add_escape_custom() function into it
81 function txvalue($txname) {
82 return "'" . trim($_POST[$txname]) . "'";
85 function rbinput($name, $value, $desc, $colname) {
86 global $irow;
87 $ret = "<input type='radio' name='".attr($name)."' value='".attr($value)."'";
88 if ($irow[$colname] == $value) $ret .= " checked";
89 $ret .= " />".text($desc);
90 return $ret;
93 function rbcell($name, $value, $desc, $colname) {
94 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
97 // Given an issue type as a string, compute its index.
98 function issueTypeIndex($tstr) {
99 global $ISSUE_TYPES;
100 $i = 0;
101 foreach ($ISSUE_TYPES as $key => $value) {
102 if ($key == $tstr) break;
103 ++$i;
105 return $i;
108 // If we are saving, then save and close the window.
110 if ($_POST['form_save']) {
112 $i = 0;
113 $text_type = "unknown";
114 foreach ($ISSUE_TYPES as $key => $value) {
115 if ($i++ == $_POST['form_type']) $text_type = $key;
118 $form_begin = fixDate($_POST['form_begin'], '');
119 $form_end = fixDate($_POST['form_end'], '');
121 if ($text_type == 'football_injury') {
122 $form_injury_part = $_POST['form_injury_part'];
123 $form_injury_type = $_POST['form_injury_type'];
125 else {
126 $form_injury_part = $_POST['form_medical_system'];
127 $form_injury_type = $_POST['form_medical_type'];
130 if ($issue) {
132 $query = "UPDATE lists SET " .
133 "type = '" . add_escape_custom($text_type) . "', " .
134 "title = '" . add_escape_custom($_POST['form_title']) . "', " .
135 "comments = '" . add_escape_custom($_POST['form_comments']) . "', " .
136 "begdate = " . QuotedOrNull($form_begin) . ", " .
137 "enddate = " . QuotedOrNull($form_end) . ", " .
138 "returndate = " . QuotedOrNull($form_return) . ", " .
139 "diagnosis = '" . add_escape_custom($_POST['form_diagnosis']) . "', " .
140 "occurrence = '" . add_escape_custom($_POST['form_occur']) . "', " .
141 "classification = '" . add_escape_custom($_POST['form_classification']) . "', " .
142 "reinjury_id = '" . add_escape_custom($_POST['form_reinjury_id']) . "', " .
143 "referredby = '" . add_escape_custom($_POST['form_referredby']) . "', " .
144 "injury_grade = '" . add_escape_custom($_POST['form_injury_grade']) . "', " .
145 "injury_part = '" . add_escape_custom($form_injury_part) . "', " .
146 "injury_type = '" . add_escape_custom($form_injury_type) . "', " .
147 "outcome = '" . add_escape_custom($_POST['form_outcome']) . "', " .
148 "destination = '" . add_escape_custom($_POST['form_destination']) . "', " .
149 "reaction ='" . add_escape_custom($_POST['form_reaction']) . "', " .
150 "erx_uploaded = '0', " .
151 "modifydate = NOW() " .
152 "WHERE id = '" . add_escape_custom($issue) . "'";
153 sqlStatement($query);
154 if ($text_type == "medication" && enddate != '') {
155 sqlStatement('UPDATE prescriptions SET '
156 . 'medication = 0 where patient_id = ? '
157 . " and upper(trim(drug)) = ? "
158 . ' and medication = 1', array($thispid,strtoupper($_POST['form_title'])) );
161 } else {
163 $issue = sqlInsert("INSERT INTO lists ( " .
164 "date, pid, type, title, activity, comments, begdate, enddate, returndate, " .
165 "diagnosis, occurrence, classification, referredby, user, groupname, " .
166 "outcome, destination, reinjury_id, injury_grade, injury_part, injury_type, " .
167 "reaction " .
168 ") VALUES ( " .
169 "NOW(), " .
170 "'" . add_escape_custom($thispid) . "', " .
171 "'" . add_escape_custom($text_type) . "', " .
172 "'" . add_escape_custom($_POST['form_title']) . "', " .
173 "1, " .
174 "'" . add_escape_custom($_POST['form_comments']) . "', " .
175 QuotedOrNull($form_begin) . ", " .
176 QuotedOrNull($form_end) . ", " .
177 QuotedOrNull($form_return) . ", " .
178 "'" . add_escape_custom($_POST['form_diagnosis']) . "', " .
179 "'" . add_escape_custom($_POST['form_occur']) . "', " .
180 "'" . add_escape_custom($_POST['form_classification']) . "', " .
181 "'" . add_escape_custom($_POST['form_referredby']) . "', " .
182 "'" . add_escape_custom($$_SESSION['authUser']) . "', " .
183 "'" . add_escape_custom($$_SESSION['authProvider']) . "', " .
184 "'" . add_escape_custom($_POST['form_outcome']) . "', " .
185 "'" . add_escape_custom($_POST['form_destination']) . "', " .
186 "'" . add_escape_custom($_POST['form_reinjury_id']) . "', " .
187 "'" . add_escape_custom($_POST['form_injury_grade']) . "', " .
188 "'" . add_escape_custom($form_injury_part) . "', " .
189 "'" . add_escape_custom($form_injury_type) . "', " .
190 "'" . add_escape_custom($_POST['form_reaction']) . "' " .
191 ")");
195 // For record/reporting purposes, place entry in lists_touch table.
196 setListTouch($thispid,$text_type);
198 if ($text_type == 'football_injury') issue_football_injury_save($issue);
199 if ($text_type == 'ippf_gcac' ) issue_ippf_gcac_save($issue);
200 if ($text_type == 'contraceptive' ) issue_ippf_con_save($issue);
202 // If requested, link the issue to a specified encounter.
203 if ($thisenc) {
204 $query = "INSERT INTO issue_encounter ( " .
205 "pid, list_id, encounter " .
206 ") VALUES ( ?,?,? )";
207 sqlStatement($query, array($thispid,$issue,$thisenc));
210 $tmp_title = addslashes($ISSUE_TYPES[$text_type][2] . ": $form_begin " .
211 substr($_POST['form_title'], 0, 40));
213 // Close this window and redisplay the updated list of issues.
215 echo "<html><body><script language='JavaScript'>\n";
216 if ($info_msg) echo " alert('$info_msg');\n";
218 echo " var myboss = opener ? opener : parent;\n";
219 echo " if (myboss.refreshIssue) myboss.refreshIssue($issue,'$tmp_title');\n";
220 echo " else if (myboss.reloadIssues) myboss.reloadIssues();\n";
221 echo " else myboss.location.reload();\n";
222 echo " if (parent.$ && parent.$.fancybox) parent.$.fancybox.close();\n";
223 echo " else window.close();\n";
225 echo "</script></body></html>\n";
226 exit();
229 $irow = array();
230 if ($issue)
231 $irow = sqlQuery("SELECT * FROM lists WHERE id = ?",array($issue));
232 else if ($thistype)
233 $irow['type'] = $thistype;
235 $type_index = 0;
237 if (!empty($irow['type'])) {
238 foreach ($ISSUE_TYPES as $key => $value) {
239 if ($key == $irow['type']) break;
240 ++$type_index;
244 <html>
245 <head>
246 <?php html_header_show();?>
247 <title><?php echo $issue ? xlt('Edit') : xlt('Add New'); ?><?php echo " ".xlt('Issue'); ?></title>
248 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
250 <style>
252 td, input, select, textarea {
253 font-family: Arial, Helvetica, sans-serif;
254 font-size: 10pt;
257 div.section {
258 border: solid;
259 border-width: 1px;
260 border-color: #0000ff;
261 margin: 0 0 0 10pt;
262 padding: 5pt;
265 </style>
267 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
268 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
269 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
270 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
271 <script type="text/javascript" src="../../../library/textformat.js"></script>
272 <script type="text/javascript" src="../../../library/dialog.js"></script>
274 <script language="JavaScript">
276 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
278 var aitypes = new Array(); // issue type attributes
279 var aopts = new Array(); // Option objects
280 <?php
281 // "Clickoptions" is a feature by Mark Leeds that provides for one-click
282 // access to preselected lists of issues in each category. Here we get
283 // the issue titles from the user-customizable file and write JavaScript
284 // statements that will build an array of arrays of Option objects.
286 $clickoptions = array();
287 if (is_file($GLOBALS['OE_SITE_DIR'] . "/clickoptions.txt"))
288 $clickoptions = file($GLOBALS['OE_SITE_DIR'] . "/clickoptions.txt");
289 $i = 0;
290 foreach ($ISSUE_TYPES as $key => $value) {
291 echo " aitypes[$i] = " . attr($value[3]) . ";\n";
292 echo " aopts[$i] = new Array();\n";
293 foreach($clickoptions as $line) {
294 $line = trim($line);
295 if (substr($line, 0, 1) != "#") {
296 if (strpos($line, $key) !== false) {
297 $text = addslashes(substr($line, strpos($line, "::") + 2));
298 echo " aopts[$i][aopts[$i].length] = new Option('$text', '$text', false, false);\n";
302 ++$i;
306 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
308 // React to selection of an issue type. This loads the associated
309 // shortcuts into the selection list of titles, and determines which
310 // rows are displayed or hidden.
311 function newtype(index) {
312 var f = document.forms[0];
313 var theopts = f.form_titles.options;
314 theopts.length = 0;
315 var i = 0;
316 for (i = 0; i < aopts[index].length; ++i) {
317 theopts[i] = aopts[index][i];
319 document.getElementById('row_titles').style.display = i ? '' : 'none';
320 // Show or hide various rows depending on issue type, except do not
321 // hide the comments or referred-by fields if they have data.
322 var comdisp = (aitypes[index] == 1) ? 'none' : '';
323 var revdisp = (aitypes[index] == 1) ? '' : 'none';
324 var injdisp = (aitypes[index] == 2) ? '' : 'none';
325 var nordisp = (aitypes[index] == 0) ? '' : 'none';
326 // reaction row should be displayed only for medication allergy.
327 var alldisp = (index == <?php echo issueTypeIndex('allergy'); ?>) ? '' : 'none';
328 document.getElementById('row_enddate' ).style.display = comdisp;
329 // Note that by default all the issues will not show the active row
330 // (which is desired functionality, since then use the end date
331 // to inactivate the item.)
332 document.getElementById('row_active' ).style.display = revdisp;
333 document.getElementById('row_diagnosis' ).style.display = comdisp;
334 document.getElementById('row_occurrence' ).style.display = comdisp;
335 document.getElementById('row_classification').style.display = injdisp;
336 document.getElementById('row_reinjury_id' ).style.display = injdisp;
337 document.getElementById('row_reaction' ).style.display = alldisp;
338 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
339 document.getElementById('row_comments' ).style.display = (f.form_comments.value ) ? '' : revdisp;
340 <?php if ($GLOBALS['athletic_team']) { ?>
341 document.getElementById('row_returndate' ).style.display = comdisp;
342 document.getElementById('row_injury_grade' ).style.display = injdisp;
343 document.getElementById('row_injury_part' ).style.display = injdisp;
344 document.getElementById('row_injury_type' ).style.display = injdisp;
345 document.getElementById('row_medical_system').style.display = nordisp;
346 document.getElementById('row_medical_type' ).style.display = nordisp;
347 // Change label text of 'title' row depending on issue type:
348 document.getElementById('title_diagnosis').innerHTML = '<b>' +
349 (index == <?php echo issueTypeIndex('allergy'); ?> ?
350 '<?php echo xla('Allergy') ?>' :
351 (index == <?php echo issueTypeIndex('general'); ?> ?
352 '<?php echo xla('Title') ?>' :
353 '<?php echo xla('Text Diagnosis') ?>')) +
354 ':</b>';
355 <?php } else { ?>
356 document.getElementById('row_referredby' ).style.display = (f.form_referredby.value) ? '' : comdisp;
357 <?php } ?>
358 <?php
359 if ($ISSUE_TYPES['football_injury']) {
360 // Generate more of these for football injury fields.
361 issue_football_injury_newtype();
363 if ($ISSUE_TYPES['ippf_gcac'] && !$_POST['form_save']) {
364 // Generate more of these for gcac and contraceptive fields.
365 if (empty($issue) || $irow['type'] == 'ippf_gcac' ) issue_ippf_gcac_newtype();
366 if (empty($issue) || $irow['type'] == 'contraceptive') issue_ippf_con_newtype();
371 // If a clickoption title is selected, copy it to the title field.
372 function set_text() {
373 var f = document.forms[0];
374 f.form_title.value = f.form_titles.options[f.form_titles.selectedIndex].text;
375 f.form_titles.selectedIndex = -1;
378 // Process click on Delete link.
379 function deleteme() {
380 dlgopen('../deleter.php?issue=<?php echo attr($issue) ?>', '_blank', 500, 450);
381 return false;
384 // Called by the deleteme.php window on a successful delete.
385 function imdeleted() {
386 closeme();
389 function closeme() {
390 if (parent.$) parent.$.fancybox.close();
391 window.close();
394 // Called when the Active checkbox is clicked. For consistency we
395 // use the existence of an end date to indicate inactivity, even
396 // though the simple verion of the form does not show an end date.
397 function activeClicked(cb) {
398 var f = document.forms[0];
399 if (cb.checked) {
400 f.form_end.value = '';
401 } else {
402 var today = new Date();
403 f.form_end.value = '' + (today.getYear() + 1900) + '-' +
404 (today.getMonth() + 1) + '-' + today.getDate();
408 // Called when resolved outcome is chosen and the end date is entered.
409 function outcomeClicked(cb) {
410 var f = document.forms[0];
411 if (cb.value == '1'){
412 var today = new Date();
413 f.form_end.value = '' + (today.getYear() + 1900) + '-' +
414 (today.getMonth() + 1) + '-' + today.getDate();
415 f.form_end.focus();
419 // This is for callback by the find-code popup.
420 // Appends to or erases the current list of diagnoses.
421 function set_related(codetype, code, selector, codedesc) {
422 var f = document.forms[0];
423 var s = f.form_diagnosis.value;
424 var title = f.form_title.value;
425 if (code) {
426 if (s.length > 0) s += ';';
427 s += codetype + ':' + code;
428 } else {
429 s = '';
431 f.form_diagnosis.value = s;
432 if(title == '') f.form_title.value = codedesc;
435 // This invokes the find-code popup.
436 function sel_diagnosis() {
437 <?php
438 if($irow['type'] == 'medical_problem')
441 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("medical_problem","csv")) ?>', '_blank', 500, 400);
442 <?php
444 else{
446 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("diagnosis","csv")) ?>', '_blank', 500, 400);
447 <?php
452 // Check for errors when the form is submitted.
453 function validate() {
454 var f = document.forms[0];
455 if (! f.form_title.value) {
456 alert("<?php echo addslashes(xl('Please enter a title!')); ?>");
457 return false;
459 top.restoreSession();
460 return true;
463 // Supports customizable forms (currently just for IPPF).
464 function divclick(cb, divid) {
465 var divstyle = document.getElementById(divid).style;
466 if (cb.checked) {
467 divstyle.display = 'block';
468 } else {
469 divstyle.display = 'none';
471 return true;
474 </script>
476 </head>
478 <body class="body_top" style="padding-right:0.5em">
480 <form method='post' name='theform'
481 action='add_edit_issue.php?issue=<?php echo attr($issue); ?>&thispid=<?php echo attr($thispid); ?>&thisenc=<?php echo attr($thisenc); ?>'
482 onsubmit='return validate()'>
484 <table border='0' width='100%'>
486 <tr>
487 <td valign='top' width='1%' nowrap><b><?php echo xlt('Type'); ?>:</b></td>
488 <td>
489 <?php
490 $index = 0;
491 foreach ($ISSUE_TYPES as $value) {
492 if ($issue || $thistype) {
493 if ($index == $type_index) {
494 echo text($value[1]);
495 echo "<input type='hidden' name='form_type' value='".attr($index)."'>\n";
497 } else {
498 echo " <input type='radio' name='form_type' value='".attr($index)."' onclick='newtype($index)'";
499 if ($index == $type_index) echo " checked";
500 echo " />" . text($value[1]) . "&nbsp;\n";
502 ++$index;
505 </td>
506 </tr>
508 <tr id='row_titles'>
509 <td valign='top' nowrap>&nbsp;</td>
510 <td valign='top'>
511 <select name='form_titles' size='<?php echo $GLOBALS['athletic_team'] ? 10 : 4; ?>' onchange='set_text()'>
512 </select> <?php echo xlt('(Select one of these, or type your own title)'); ?>
513 </td>
514 </tr>
516 <tr>
517 <td valign='top' id='title_diagnosis' nowrap><b><?php echo $GLOBALS['athletic_team'] ? xlt('Text Diagnosis') : xlt('Title'); ?>:</b></td>
518 <td>
519 <input type='text' size='40' name='form_title' value='<?php echo attr($irow['title']) ?>' style='width:100%' />
520 </td>
521 </tr>
523 <tr id='row_diagnosis'>
524 <td valign='top' nowrap><b><?php echo xlt('Diagnosis Code'); ?>:</b></td>
525 <td>
526 <input type='text' size='50' name='form_diagnosis'
527 value='<?php echo attr($irow['diagnosis']) ?>' onclick='sel_diagnosis()'
528 title='<?php echo xla('Click to select or change diagnoses'); ?>'
529 style='width:100%' readonly />
530 </td>
531 </tr>
533 <!-- For Athletic Teams -->
535 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_grade'>
536 <td valign='top' nowrap><b><?php echo xlt('Grade of Injury'); ?>:</b></td>
537 <td>
538 <?php
539 echo generate_select_list('form_injury_grade', 'injury_grade', $irow['injury_grade'], '');
541 </td>
542 </tr>
544 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_part'>
545 <td valign='top' nowrap><b><?php echo xlt('Injured Body Part'); ?>:</b></td>
546 <td>
547 <?php
548 echo generate_select_list('form_injury_part', 'injury_part', $irow['injury_part'], '');
550 </td>
551 </tr>
553 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_type'>
554 <td valign='top' nowrap><b><?php echo xlt('Injury Type'); ?>:</b></td>
555 <td>
556 <?php
557 echo generate_select_list('form_injury_type', 'injury_type', $irow['injury_type'], '');
559 </td>
560 </tr>
562 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_system'>
563 <td valign='top' nowrap><b><?php echo xlt('Medical System'); ?>:</b></td>
564 <td>
565 <?php
566 echo generate_select_list('form_medical_system', 'medical_system', $irow['injury_part'], '');
568 </td>
569 </tr>
571 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_type'>
572 <td valign='top' nowrap><b><?php echo xlt('Medical Type'); ?>:</b></td>
573 <td>
574 <?php
575 echo generate_select_list('form_medical_type', 'medical_type', $irow['injury_type'], '');
577 </td>
578 </tr>
580 <!-- End For Athletic Teams -->
582 <tr>
583 <td valign='top' nowrap><b><?php echo xlt('Begin Date'); ?>:</b></td>
584 <td>
586 <input type='text' size='10' name='form_begin' id='form_begin'
587 value='<?php echo attr($irow['begdate']) ?>'
588 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
589 title='<?php echo xla('yyyy-mm-dd date of onset, surgery or start of medication'); ?>' />
590 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
591 id='img_begin' border='0' alt='[?]' style='cursor:pointer'
592 title='<?php echo xla('Click here to choose a date'); ?>' />
593 </td>
594 </tr>
596 <tr id='row_enddate'>
597 <td valign='top' nowrap><b><?php echo xlt('End Date'); ?>:</b></td>
598 <td>
599 <input type='text' size='10' name='form_end' id='form_end'
600 value='<?php echo attr($irow['enddate']) ?>'
601 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
602 title='<?php echo xla('yyyy-mm-dd date of recovery or end of medication'); ?>' />
603 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
604 id='img_end' border='0' alt='[?]' style='cursor:pointer'
605 title='<?php echo xla('Click here to choose a date'); ?>' />
606 &nbsp;(<?php echo xlt('leave blank if still active'); ?>)
607 </td>
608 </tr>
610 <tr id='row_active'>
611 <td valign='top' nowrap><b><?php echo xlt('Active'); ?>:</b></td>
612 <td>
613 <input type='checkbox' name='form_active' value='1' <?php echo attr($irow['enddate']) ? "" : "checked"; ?>
614 onclick='activeClicked(this);'
615 title='<?php echo xla('Indicates if this issue is currently active'); ?>' />
616 </td>
617 </tr>
619 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_returndate'>
620 <td valign='top' nowrap><b><?php echo xlt('Returned to Play'); ?>:</b></td>
621 <td>
622 <input type='text' size='10' name='form_return' id='form_return'
623 value='<?php echo attr($irow['returndate']) ?>'
624 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
625 title='<?php echo xla('yyyy-mm-dd date returned to play'); ?>' />
626 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
627 id='img_return' border='0' alt='[?]' style='cursor:pointer'
628 title='<?php echo xla('Click here to choose a date'); ?>' />
629 &nbsp;(<?php echo xlt('leave blank if still active'); ?>)
630 </td>
631 </tr>
633 <tr id='row_occurrence'>
634 <td valign='top' nowrap><b><?php echo xlt('Occurrence'); ?>:</b></td>
635 <td>
636 <?php
637 // Modified 6/2009 by BM to incorporate the occurrence items into the list_options listings
638 generate_form_field(array('data_type'=>1,'field_id'=>'occur','list_id'=>'occurrence','empty_title'=>'SKIP'), $irow['occurrence']);
640 </td>
641 </tr>
643 <tr id='row_classification'>
644 <td valign='top' nowrap><b><?php echo xlt('Classification'); ?>:</b></td>
645 <td>
646 <select name='form_classification'>
647 <?php
648 foreach ($ISSUE_CLASSIFICATIONS as $key => $value) {
649 echo " <option value='".attr($key)."'";
650 if ($key == $irow['classification']) echo " selected";
651 echo ">".text($value)."\n";
654 </select>
655 </td>
656 </tr>
658 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_reinjury_id'>
659 <td valign='top' nowrap><b><?php echo xlt('Re-Injury?'); ?>:</b></td>
660 <td>
661 <select name='form_reinjury_id'>
662 <option value='0'><?php echo xlt('No'); ?></option>
663 <?php
664 $pres = sqlStatement(
665 "SELECT id, begdate, title " .
666 "FROM lists WHERE " .
667 "pid = ? AND " .
668 "type = 'football_injury' AND " .
669 "activity = 1 " .
670 "ORDER BY begdate DESC", array($thispid)
672 while ($prow = sqlFetchArray($pres)) {
673 echo " <option value='" . attr($prow['id']) . "'";
674 if ($prow['id'] == $irow['reinjury_id']) echo " selected";
675 echo ">" . text($prow['begdate']) . " " . text($prow['title']) . "\n";
678 </select>
679 </td>
680 </tr>
681 <!-- Reaction For Medication Allergy -->
682 <tr id='row_reaction'>
683 <td valign='top' nowrap><b><?php echo xlt('Reaction'); ?>:</b></td>
684 <td>
685 <input type='text' size='40' name='form_reaction' value='<?php echo attr($irow['reaction']) ?>'
686 style='width:100%' title='<?php echo xla('Allergy Reaction'); ?>' />
687 </td>
688 </tr>
689 <!-- End of reaction -->
691 <tr<?php if ($GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_referredby'>
692 <td valign='top' nowrap><b><?php echo xlt('Referred by'); ?>:</b></td>
693 <td>
694 <input type='text' size='40' name='form_referredby' value='<?php echo attr($irow['referredby']) ?>'
695 style='width:100%' title='<?php echo xla('Referring physician and practice'); ?>' />
696 </td>
697 </tr>
699 <tr id='row_comments'>
700 <td valign='top' nowrap><b><?php echo xlt('Comments'); ?>:</b></td>
701 <td>
702 <textarea name='form_comments' rows='4' cols='40' wrap='virtual' style='width:100%'><?php echo text($irow['comments']) ?></textarea>
703 </td>
704 </tr>
706 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
707 <td valign='top' nowrap><b><?php echo xlt('Outcome'); ?>:</b></td>
708 <td>
709 <?php
710 echo generate_select_list('form_outcome', 'outcome', $irow['outcome'], '', '', '', 'outcomeClicked(this);');
712 </td>
713 </tr>
715 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
716 <td valign='top' nowrap><b><?php echo xlt('Destination'); ?>:</b></td>
717 <td>
718 <?php if (true) { ?>
719 <input type='text' size='40' name='form_destination' value='<?php echo attr($irow['destination']) ?>'
720 style='width:100%' title='GP, Secondary care specialist, etc.' />
721 <?php } else { // leave this here for now, please -- Rod ?>
722 <?php echo rbinput('form_destination', '1', 'GP' , 'destination') ?>&nbsp;
723 <?php echo rbinput('form_destination', '2', 'Secondary care spec', 'destination') ?>&nbsp;
724 <?php echo rbinput('form_destination', '3', 'GP via physio' , 'destination') ?>&nbsp;
725 <?php echo rbinput('form_destination', '4', 'GP via podiatry' , 'destination') ?>
726 <?php } ?>
727 </td>
728 </tr>
730 </table>
732 <?php
733 if ($ISSUE_TYPES['football_injury']) {
734 issue_football_injury_form($issue);
736 if ($ISSUE_TYPES['ippf_gcac']) {
737 if (empty($issue) || $irow['type'] == 'ippf_gcac')
738 issue_ippf_gcac_form($issue, $thispid);
739 if (empty($issue) || $irow['type'] == 'contraceptive')
740 issue_ippf_con_form($issue, $thispid);
744 <center>
747 <input type='submit' name='form_save' value='<?php echo xla('Save'); ?>' />
749 <?php if ($issue && acl_check('admin', 'super')) { ?>
750 &nbsp;
751 <input type='button' value='<?php echo xla('Delete'); ?>' style='color:red' onclick='deleteme()' />
752 <?php } ?>
754 &nbsp;
755 <input type='button' value='<?php echo xla('Cancel'); ?>' onclick='closeme();' />
757 </p>
758 </center>
760 </form>
761 <script language='JavaScript'>
762 newtype(<?php echo $type_index ?>);
763 Calendar.setup({inputField:"form_begin", ifFormat:"%Y-%m-%d", button:"img_begin"});
764 Calendar.setup({inputField:"form_end", ifFormat:"%Y-%m-%d", button:"img_end"});
765 Calendar.setup({inputField:"form_return", ifFormat:"%Y-%m-%d", button:"img_return"});
766 </script>
767 </body>
768 </html>