2 // Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
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 include_once("../../globals.php");
10 include_once("$srcdir/lists.inc");
11 include_once("$srcdir/patient.inc");
12 // include_once("$srcdir/overlib_mini.js");
13 // include_once("$srcdir/calendar.js");
15 $issue = $_REQUEST['issue'];
19 'medical_problem' => 'Problem',
20 'allergy' => 'Allergy',
21 'medication' => 'Medication',
22 'surgery' => 'Surgery'
26 0 => 'Unknown or N/A',
30 4 => 'Chronic/Recurrent',
31 5 => 'Acute on Chronic'
34 function QuotedOrNull($fld) {
35 if ($fld) return "'$fld'";
42 <title
><?
echo $issue ?
"Edit" : "Add New" ?
> Issue
</title
>
43 <link rel
=stylesheet href
='<? echo $css_header ?>' type
='text/css'>
46 td
{ font
-size
:10pt
; }
49 <script type
="text/javascript" src
="../../../library/overlib_mini.js"></script
>
50 <script type
="text/javascript" src
="../../../library/calendar.js"></script
>
52 <script language
="JavaScript">
54 var aopts
= new Array();
56 // "Clickoptions" is a feature by Mark Leeds that provides for one-click
57 // access to preselected lists of issues in each category. Here we get
58 // the issue titles from the user-customizable file and write JavaScript
59 // statements that will build an array of arrays of Option objects.
61 $clickoptions = array();
62 if (is_file("../../../custom/clickoptions.txt"))
63 $clickoptions = file("../../../custom/clickoptions.txt");
65 foreach ($arrtype as $key => $value) {
66 echo " aopts[$i] = new Array();\n";
67 foreach($clickoptions as $line) {
69 if (substr($line, 0, 1) != "#") {
70 if (strpos($line, $key) !== false) {
71 $text = addslashes(substr($line, strpos($line, "::") +
2));
72 echo " aopts[$i][aopts[$i].length] = new Option('$text', '$text', false, false);\n";
80 // React to selection of an issue type. This loads the associated
81 // shortcuts into the selection list of titles.
82 function newtype(index
) {
83 var theopts
= document
.forms
[0].form_titles
.options
;
85 for (i
= 0; i
< aopts
[index
].length
; ++i
) {
86 theopts
[i
] = aopts
[index
][i
];
90 // If a clickoption title is selected, copy it to the title field.
92 var f
= document
.forms
[0];
93 f
.form_title
.value
= f
.form_titles
.options
[f
.form_titles
.selectedIndex
].text
;
94 f
.form_titles
.selectedIndex
= -1;
101 <body
<?
echo $top_bg_line;?
>>
103 // If we are saving, then save and close the window.
105 if ($_POST['form_save']) {
108 $text_type = "unknown";
109 foreach ($arrtype as $key => $value) {
110 if ($i++
== $_POST['form_type']) $text_type = $key;
114 sqlStatement("UPDATE lists SET " .
115 "type = '" . $text_type . "', " .
116 "title = '" . $_POST['form_title'] . "', " .
117 "comments = '" . $_POST['form_comments'] . "', " .
118 "begdate = " . QuotedOrNull(fixDate($_POST['form_begin'], '')) . ", " .
119 "enddate = " . QuotedOrNull(fixDate($_POST['form_end'], '')) . ", " .
120 "occurrence = '" . $_POST['form_occur'] . "', " .
121 "referredby = '" . $_POST['form_referredby'] . "', " .
122 "extrainfo = '" . $_POST['form_missed'] . "' " .
123 "WHERE id = '$issue'");
125 sqlInsert("INSERT INTO lists ( " .
126 "date, pid, type, title, activity, comments, begdate, enddate, " .
127 "occurrence, referredby, extrainfo, user, groupname " .
131 "'" . $text_type . "', " .
132 "'" . $_POST['form_title'] . "', " .
134 "'" . $_POST['form_comments'] . "', " .
135 QuotedOrNull(fixDate($_POST['form_begin'], '')) . ", " .
136 QuotedOrNull(fixDate($_POST['form_end'], '')) . ", " .
137 "'" . $_POST['form_occur'] . "', " .
138 "'" . $_POST['form_referredby'] . "', " .
139 "'" . $_POST['form_missed'] . "', " .
140 "'" . $
$_SESSION['authUser'] . "', " .
141 "'" . $
$_SESSION['authProvider'] . "' )");
144 // Close this window and redisplay the updated list of issues.
146 echo "<script language='JavaScript'>\n";
147 if ($info_msg) echo " alert('$info_msg');\n";
148 echo " window.close();\n";
149 echo " opener.location.reload();\n";
150 echo "</script></body></html>\n";
157 $irow = sqlQuery("SELECT * FROM lists WHERE id = $issue");
158 foreach ($arrtype as $key => $value) {
159 if ($key == $irow['type']) break;
164 <!-- Required
for the popup date selectors
-->
165 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
167 <form method
='post' name
='theform' action
='add_edit_issue.php?issue=<? echo $issue ?>'>
170 <table border
='0' width
='100%'>
173 <td valign
='top' width
='1%' nowrap
><b
>Type
:</b
></td
>
177 foreach ($arrtype as $value) {
178 echo " <input type='radio' name='form_type' value='$index' onclick='newtype($index)'";
179 if ($index == $type_index) echo " checked";
180 echo " />$value \n";
188 <td valign
='top' nowrap
><b
>Title
:</b
></td
>
190 <select name
='form_titles' size
='4' onchange
='set_text()' style
='width:100%'>
192 <input type
='text' size
='40' name
='form_title' value
='<? echo $irow['title
'] ?>' style
='width:100%' />
197 <td valign
='top' nowrap
><b
>Begin Date
:</b
></td
>
199 <input type
='text' size
='10' name
='form_begin' value
='<? echo $irow['begdate
'] ?>'
200 title
='yyyy-mm-dd date of onset, surgery or start of medication' />
201 <a href
="javascript:show_calendar('theform.form_begin')"
202 title
="Click here to choose a date"
203 ><img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22' border
='0'></a
>
208 <td valign
='top' nowrap
><b
>End Date
:</b
></td
>
210 <input type
='text' size
='10' name
='form_end' value
='<? echo $irow['enddate
'] ?>'
211 title
='yyyy-mm-dd date of recovery or end of medication' />
212 <a href
="javascript:show_calendar('theform.form_end')"
213 title
="Click here to choose a date"
214 ><img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22' border
='0'></a
>
215  
;(leave blank
if still active
)
220 <td valign
='top' nowrap
><b
>Occurrence
:</b
></td
>
222 <select name
='form_occur'>
224 foreach ($arroccur as $key => $value) {
225 echo " <option value='$key'";
226 if ($key == $irow['occurrence']) echo " selected";
234 <?
if ($GLOBALS['athletic_team']) { ?
>
236 <td valign
='top' nowrap
><b
>Missed
:</b
></td
>
238 <input type
='text' size
='3' name
='form_missed' value
='<? echo $irow['extrainfo
'] ?>'
239 title
='Number of games or events missed, if any' />
245 <td valign
='top' nowrap
><b
>Referred by
:</b
></td
>
247 <input type
='text' size
='40' name
='form_referredby' value
='<? echo $irow['referredby
'] ?>'
248 style
='width:100%' title
='Referring physician and practice' />
254 <td valign
='top' nowrap
><b
>Comments
:</b
></td
>
256 <textarea name
='form_comments' rows
='4' cols
='40' wrap
='virtual' style
='width:100%'><?
echo $irow['comments'] ?
></textarea
>
263 <input type
='submit' name
='form_save' value
='Save' />
265 <input type
='button' value
='Cancel' onclick
='window.close()' />
270 <script language
='JavaScript'>
271 newtype(<?
echo $type_index ?
>);