The Third Reminders email bug fix - contributed by arnabnaha
[openemr.git] / interface / patient_file / summary / add_edit_issue.php
blob6b50a74896bd94f8215827678ead7d140bb32241
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 "WHERE id = '" . add_escape_custom($issue) . "'";
152 sqlStatement($query);
153 if ($text_type == "medication" && enddate != '') {
154 sqlStatement('UPDATE prescriptions SET '
155 . 'medication = 0 where patient_id = ? '
156 . " and upper(trim(drug)) = ? "
157 . ' and medication = 1', array($thispid,strtoupper($_POST['form_title'])) );
160 } else {
162 $issue = sqlInsert("INSERT INTO lists ( " .
163 "date, pid, type, title, activity, comments, begdate, enddate, returndate, " .
164 "diagnosis, occurrence, classification, referredby, user, groupname, " .
165 "outcome, destination, reinjury_id, injury_grade, injury_part, injury_type, " .
166 "reaction " .
167 ") VALUES ( " .
168 "NOW(), " .
169 "'" . add_escape_custom($thispid) . "', " .
170 "'" . add_escape_custom($text_type) . "', " .
171 "'" . add_escape_custom($_POST['form_title']) . "', " .
172 "1, " .
173 "'" . add_escape_custom($_POST['form_comments']) . "', " .
174 QuotedOrNull($form_begin) . ", " .
175 QuotedOrNull($form_end) . ", " .
176 QuotedOrNull($form_return) . ", " .
177 "'" . add_escape_custom($_POST['form_diagnosis']) . "', " .
178 "'" . add_escape_custom($_POST['form_occur']) . "', " .
179 "'" . add_escape_custom($_POST['form_classification']) . "', " .
180 "'" . add_escape_custom($_POST['form_referredby']) . "', " .
181 "'" . add_escape_custom($$_SESSION['authUser']) . "', " .
182 "'" . add_escape_custom($$_SESSION['authProvider']) . "', " .
183 "'" . add_escape_custom($_POST['form_outcome']) . "', " .
184 "'" . add_escape_custom($_POST['form_destination']) . "', " .
185 "'" . add_escape_custom($_POST['form_reinjury_id']) . "', " .
186 "'" . add_escape_custom($_POST['form_injury_grade']) . "', " .
187 "'" . add_escape_custom($form_injury_part) . "', " .
188 "'" . add_escape_custom($form_injury_type) . "', " .
189 "'" . add_escape_custom($_POST['form_reaction']) . "' " .
190 ")");
194 // For record/reporting purposes, place entry in lists_touch table.
195 setListTouch($thispid,$text_type);
197 if ($text_type == 'football_injury') issue_football_injury_save($issue);
198 if ($text_type == 'ippf_gcac' ) issue_ippf_gcac_save($issue);
199 if ($text_type == 'contraceptive' ) issue_ippf_con_save($issue);
201 // If requested, link the issue to a specified encounter.
202 if ($thisenc) {
203 $query = "INSERT INTO issue_encounter ( " .
204 "pid, list_id, encounter " .
205 ") VALUES ( ?,?,? )";
206 sqlStatement($query, array($thispid,$issue,$thisenc));
209 $tmp_title = addslashes($ISSUE_TYPES[$text_type][2] . ": $form_begin " .
210 substr($_POST['form_title'], 0, 40));
212 // Close this window and redisplay the updated list of issues.
214 echo "<html><body><script language='JavaScript'>\n";
215 if ($info_msg) echo " alert('$info_msg');\n";
217 echo " var myboss = opener ? opener : parent;\n";
218 echo " if (myboss.refreshIssue) myboss.refreshIssue($issue,'$tmp_title');\n";
219 echo " else if (myboss.reloadIssues) myboss.reloadIssues();\n";
220 echo " else myboss.location.reload();\n";
221 echo " if (parent.$ && parent.$.fancybox) parent.$.fancybox.close();\n";
222 echo " else window.close();\n";
224 echo "</script></body></html>\n";
225 exit();
228 $irow = array();
229 if ($issue)
230 $irow = sqlQuery("SELECT * FROM lists WHERE id = ?",array($issue));
231 else if ($thistype)
232 $irow['type'] = $thistype;
234 $type_index = 0;
236 if (!empty($irow['type'])) {
237 foreach ($ISSUE_TYPES as $key => $value) {
238 if ($key == $irow['type']) break;
239 ++$type_index;
243 <html>
244 <head>
245 <?php html_header_show();?>
246 <title><?php echo $issue ? xlt('Edit') : xlt('Add New'); ?><?php echo " ".xlt('Issue'); ?></title>
247 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
249 <style>
251 td, input, select, textarea {
252 font-family: Arial, Helvetica, sans-serif;
253 font-size: 10pt;
256 div.section {
257 border: solid;
258 border-width: 1px;
259 border-color: #0000ff;
260 margin: 0 0 0 10pt;
261 padding: 5pt;
264 </style>
266 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
267 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
268 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
269 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
270 <script type="text/javascript" src="../../../library/textformat.js"></script>
271 <script type="text/javascript" src="../../../library/dialog.js"></script>
273 <script language="JavaScript">
275 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
277 var aitypes = new Array(); // issue type attributes
278 var aopts = new Array(); // Option objects
279 <?php
280 // "Clickoptions" is a feature by Mark Leeds that provides for one-click
281 // access to preselected lists of issues in each category. Here we get
282 // the issue titles from the user-customizable file and write JavaScript
283 // statements that will build an array of arrays of Option objects.
285 $clickoptions = array();
286 if (is_file($GLOBALS['OE_SITE_DIR'] . "/clickoptions.txt"))
287 $clickoptions = file($GLOBALS['OE_SITE_DIR'] . "/clickoptions.txt");
288 $i = 0;
289 foreach ($ISSUE_TYPES as $key => $value) {
290 echo " aitypes[$i] = " . attr($value[3]) . ";\n";
291 echo " aopts[$i] = new Array();\n";
292 foreach($clickoptions as $line) {
293 $line = trim($line);
294 if (substr($line, 0, 1) != "#") {
295 if (strpos($line, $key) !== false) {
296 $text = addslashes(substr($line, strpos($line, "::") + 2));
297 echo " aopts[$i][aopts[$i].length] = new Option('$text', '$text', 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 if (code) {
424 if (s.length > 0) s += ';';
425 s += codetype + ':' + code;
426 } else {
427 s = '';
429 f.form_diagnosis.value = s;
432 // This invokes the find-code popup.
433 function sel_diagnosis() {
434 dlgopen('../encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("diagnosis","csv")) ?>', '_blank', 500, 400);
437 // Check for errors when the form is submitted.
438 function validate() {
439 var f = document.forms[0];
440 if (! f.form_title.value) {
441 alert("<?php echo addslashes(xl('Please enter a title!')); ?>");
442 return false;
444 top.restoreSession();
445 return true;
448 // Supports customizable forms (currently just for IPPF).
449 function divclick(cb, divid) {
450 var divstyle = document.getElementById(divid).style;
451 if (cb.checked) {
452 divstyle.display = 'block';
453 } else {
454 divstyle.display = 'none';
456 return true;
459 </script>
461 </head>
463 <body class="body_top" style="padding-right:0.5em">
465 <form method='post' name='theform'
466 action='add_edit_issue.php?issue=<?php echo attr($issue); ?>&thispid=<?php echo attr($thispid); ?>&thisenc=<?php echo attr($thisenc); ?>'
467 onsubmit='return validate()'>
469 <table border='0' width='100%'>
471 <tr>
472 <td valign='top' width='1%' nowrap><b><?php echo xlt('Type'); ?>:</b></td>
473 <td>
474 <?php
475 $index = 0;
476 foreach ($ISSUE_TYPES as $value) {
477 if ($issue || $thistype) {
478 if ($index == $type_index) {
479 echo text($value[1]);
480 echo "<input type='hidden' name='form_type' value='".attr($index)."'>\n";
482 } else {
483 echo " <input type='radio' name='form_type' value='".attr($index)."' onclick='newtype($index)'";
484 if ($index == $type_index) echo " checked";
485 echo " />" . text($value[1]) . "&nbsp;\n";
487 ++$index;
490 </td>
491 </tr>
493 <tr id='row_titles'>
494 <td valign='top' nowrap>&nbsp;</td>
495 <td valign='top'>
496 <select name='form_titles' size='<?php echo $GLOBALS['athletic_team'] ? 10 : 4; ?>' onchange='set_text()'>
497 </select> <?php echo xlt('(Select one of these, or type your own title)'); ?>
498 </td>
499 </tr>
501 <tr>
502 <td valign='top' id='title_diagnosis' nowrap><b><?php echo $GLOBALS['athletic_team'] ? xlt('Text Diagnosis') : xlt('Title'); ?>:</b></td>
503 <td>
504 <input type='text' size='40' name='form_title' value='<?php echo attr($irow['title']) ?>' style='width:100%' />
505 </td>
506 </tr>
508 <tr id='row_diagnosis'>
509 <td valign='top' nowrap><b><?php echo xlt('Diagnosis Code'); ?>:</b></td>
510 <td>
511 <input type='text' size='50' name='form_diagnosis'
512 value='<?php echo attr($irow['diagnosis']) ?>' onclick='sel_diagnosis()'
513 title='<?php echo xla('Click to select or change diagnoses'); ?>'
514 style='width:100%' readonly />
515 </td>
516 </tr>
518 <!-- For Athletic Teams -->
520 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_grade'>
521 <td valign='top' nowrap><b><?php echo xlt('Grade of Injury'); ?>:</b></td>
522 <td>
523 <?php
524 echo generate_select_list('form_injury_grade', 'injury_grade', $irow['injury_grade'], '');
526 </td>
527 </tr>
529 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_part'>
530 <td valign='top' nowrap><b><?php echo xlt('Injured Body Part'); ?>:</b></td>
531 <td>
532 <?php
533 echo generate_select_list('form_injury_part', 'injury_part', $irow['injury_part'], '');
535 </td>
536 </tr>
538 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_injury_type'>
539 <td valign='top' nowrap><b><?php echo xlt('Injury Type'); ?>:</b></td>
540 <td>
541 <?php
542 echo generate_select_list('form_injury_type', 'injury_type', $irow['injury_type'], '');
544 </td>
545 </tr>
547 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_system'>
548 <td valign='top' nowrap><b><?php echo xlt('Medical System'); ?>:</b></td>
549 <td>
550 <?php
551 echo generate_select_list('form_medical_system', 'medical_system', $irow['injury_part'], '');
553 </td>
554 </tr>
556 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_medical_type'>
557 <td valign='top' nowrap><b><?php echo xlt('Medical Type'); ?>:</b></td>
558 <td>
559 <?php
560 echo generate_select_list('form_medical_type', 'medical_type', $irow['injury_type'], '');
562 </td>
563 </tr>
565 <!-- End For Athletic Teams -->
567 <tr>
568 <td valign='top' nowrap><b><?php echo xlt('Begin Date'); ?>:</b></td>
569 <td>
571 <input type='text' size='10' name='form_begin' id='form_begin'
572 value='<?php echo attr($irow['begdate']) ?>'
573 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
574 title='<?php echo xla('yyyy-mm-dd date of onset, surgery or start of medication'); ?>' />
575 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
576 id='img_begin' border='0' alt='[?]' style='cursor:pointer'
577 title='<?php echo xla('Click here to choose a date'); ?>' />
578 </td>
579 </tr>
581 <tr id='row_enddate'>
582 <td valign='top' nowrap><b><?php echo xlt('End Date'); ?>:</b></td>
583 <td>
584 <input type='text' size='10' name='form_end' id='form_end'
585 value='<?php echo attr($irow['enddate']) ?>'
586 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
587 title='<?php echo xla('yyyy-mm-dd date of recovery or end of medication'); ?>' />
588 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
589 id='img_end' border='0' alt='[?]' style='cursor:pointer'
590 title='<?php echo xla('Click here to choose a date'); ?>' />
591 &nbsp;(<?php echo xlt('leave blank if still active'); ?>)
592 </td>
593 </tr>
595 <tr id='row_active'>
596 <td valign='top' nowrap><b><?php echo xlt('Active'); ?>:</b></td>
597 <td>
598 <input type='checkbox' name='form_active' value='1' <?php echo attr($irow['enddate']) ? "" : "checked"; ?>
599 onclick='activeClicked(this);'
600 title='<?php echo xla('Indicates if this issue is currently active'); ?>' />
601 </td>
602 </tr>
604 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_returndate'>
605 <td valign='top' nowrap><b><?php echo xlt('Returned to Play'); ?>:</b></td>
606 <td>
607 <input type='text' size='10' name='form_return' id='form_return'
608 value='<?php echo attr($irow['returndate']) ?>'
609 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
610 title='<?php echo xla('yyyy-mm-dd date returned to play'); ?>' />
611 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
612 id='img_return' border='0' alt='[?]' style='cursor:pointer'
613 title='<?php echo xla('Click here to choose a date'); ?>' />
614 &nbsp;(<?php echo xlt('leave blank if still active'); ?>)
615 </td>
616 </tr>
618 <tr id='row_occurrence'>
619 <td valign='top' nowrap><b><?php echo xlt('Occurrence'); ?>:</b></td>
620 <td>
621 <?php
622 // Modified 6/2009 by BM to incorporate the occurrence items into the list_options listings
623 generate_form_field(array('data_type'=>1,'field_id'=>'occur','list_id'=>'occurrence','empty_title'=>'SKIP'), $irow['occurrence']);
625 </td>
626 </tr>
628 <tr id='row_classification'>
629 <td valign='top' nowrap><b><?php echo xlt('Classification'); ?>:</b></td>
630 <td>
631 <select name='form_classification'>
632 <?php
633 foreach ($ISSUE_CLASSIFICATIONS as $key => $value) {
634 echo " <option value='".attr($key)."'";
635 if ($key == $irow['classification']) echo " selected";
636 echo ">".text($value)."\n";
639 </select>
640 </td>
641 </tr>
643 <tr<?php if (! $GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_reinjury_id'>
644 <td valign='top' nowrap><b><?php echo xlt('Re-Injury?'); ?>:</b></td>
645 <td>
646 <select name='form_reinjury_id'>
647 <option value='0'><?php echo xlt('No'); ?></option>
648 <?php
649 $pres = sqlStatement(
650 "SELECT id, begdate, title " .
651 "FROM lists WHERE " .
652 "pid = ? AND " .
653 "type = 'football_injury' AND " .
654 "activity = 1 " .
655 "ORDER BY begdate DESC", array($thispid)
657 while ($prow = sqlFetchArray($pres)) {
658 echo " <option value='" . attr($prow['id']) . "'";
659 if ($prow['id'] == $irow['reinjury_id']) echo " selected";
660 echo ">" . text($prow['begdate']) . " " . text($prow['title']) . "\n";
663 </select>
664 </td>
665 </tr>
666 <!-- Reaction For Medication Allergy -->
667 <tr id='row_reaction'>
668 <td valign='top' nowrap><b><?php echo xlt('Reaction'); ?>:</b></td>
669 <td>
670 <input type='text' size='40' name='form_reaction' value='<?php echo attr($irow['reaction']) ?>'
671 style='width:100%' title='<?php echo xla('Allergy Reaction'); ?>' />
672 </td>
673 </tr>
674 <!-- End of reaction -->
676 <tr<?php if ($GLOBALS['athletic_team']) echo " style='display:none;'"; ?> id='row_referredby'>
677 <td valign='top' nowrap><b><?php echo xlt('Referred by'); ?>:</b></td>
678 <td>
679 <input type='text' size='40' name='form_referredby' value='<?php echo attr($irow['referredby']) ?>'
680 style='width:100%' title='<?php echo xla('Referring physician and practice'); ?>' />
681 </td>
682 </tr>
684 <tr id='row_comments'>
685 <td valign='top' nowrap><b><?php echo xlt('Comments'); ?>:</b></td>
686 <td>
687 <textarea name='form_comments' rows='4' cols='40' wrap='virtual' style='width:100%'><?php echo text($irow['comments']) ?></textarea>
688 </td>
689 </tr>
691 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
692 <td valign='top' nowrap><b><?php echo xlt('Outcome'); ?>:</b></td>
693 <td>
694 <?php
695 echo generate_select_list('form_outcome', 'outcome', $irow['outcome'], '', '', '', 'outcomeClicked(this);');
697 </td>
698 </tr>
700 <tr<?php if ($GLOBALS['athletic_team'] || $GLOBALS['ippf_specific']) echo " style='display:none;'"; ?>>
701 <td valign='top' nowrap><b><?php echo xlt('Destination'); ?>:</b></td>
702 <td>
703 <?php if (true) { ?>
704 <input type='text' size='40' name='form_destination' value='<?php echo attr($irow['destination']) ?>'
705 style='width:100%' title='GP, Secondary care specialist, etc.' />
706 <?php } else { // leave this here for now, please -- Rod ?>
707 <?php echo rbinput('form_destination', '1', 'GP' , 'destination') ?>&nbsp;
708 <?php echo rbinput('form_destination', '2', 'Secondary care spec', 'destination') ?>&nbsp;
709 <?php echo rbinput('form_destination', '3', 'GP via physio' , 'destination') ?>&nbsp;
710 <?php echo rbinput('form_destination', '4', 'GP via podiatry' , 'destination') ?>
711 <?php } ?>
712 </td>
713 </tr>
715 </table>
717 <?php
718 if ($ISSUE_TYPES['football_injury']) {
719 issue_football_injury_form($issue);
721 if ($ISSUE_TYPES['ippf_gcac']) {
722 if (empty($issue) || $irow['type'] == 'ippf_gcac')
723 issue_ippf_gcac_form($issue, $thispid);
724 if (empty($issue) || $irow['type'] == 'contraceptive')
725 issue_ippf_con_form($issue, $thispid);
729 <center>
732 <input type='submit' name='form_save' value='<?php echo xla('Save'); ?>' />
734 <?php if ($issue && acl_check('admin', 'super')) { ?>
735 &nbsp;
736 <input type='button' value='<?php echo xla('Delete'); ?>' style='color:red' onclick='deleteme()' />
737 <?php } ?>
739 &nbsp;
740 <input type='button' value='<?php echo xla('Cancel'); ?>' onclick='closeme();' />
742 </p>
743 </center>
745 </form>
746 <script language='JavaScript'>
747 newtype(<?php echo $type_index ?>);
748 Calendar.setup({inputField:"form_begin", ifFormat:"%Y-%m-%d", button:"img_begin"});
749 Calendar.setup({inputField:"form_end", ifFormat:"%Y-%m-%d", button:"img_end"});
750 Calendar.setup({inputField:"form_return", ifFormat:"%Y-%m-%d", button:"img_return"});
751 </script>
752 </body>
753 </html>