robots.txt (#2077)
[openemr.git] / interface / orders / types.php
blob0b29d5bc9422f85b706af9be55e79b4052e5823a
1 <?php
2 /**
3 * types.php
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @author Jerry Padgett <sjpadgett@gmail.com>
10 * @copyright Copyright (c) 2010-2012 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../globals.php");
15 require_once("$srcdir/acl.inc");
17 use OpenEMR\Core\Header;
19 // This script can be run either inside the OpenEMR frameset for order catalog
20 // maintenance, or as a popup window for selecting an item to order. In the
21 // popup case the GET variables 'popup' (a boolean) and 'order' (an optional
22 // item ID to select) will be provided, and maintenance may also be permitted.
24 $popup = empty($_GET['popup']) ? 0 : 1;
25 $order = isset($_GET['order']) ? $_GET['order'] + 0 : 0;
26 $labid = isset($_GET['labid']) ? $_GET['labid'] + 0 : 0;
28 // If Save was clicked, set the result, close the window and exit.
30 if ($popup && $_POST['form_save']) {
31 $form_order = isset($_GET['form_order']) ? $_GET['form_order'] + 0 : 0;
32 $ptrow = sqlQuery("SELECT name FROM procedure_type WHERE " . "procedure_type_id = '$form_order'");
33 $name = addslashes($ptrow['name']);
35 <script type="text/javascript"
36 src="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js">
37 </script>
38 <script language="JavaScript">
39 if (opener.closed || ! opener.set_proc_type) {
40 alert('<?php echo xlt('The destination form was closed; I cannot act on your selection.'); ?>');
41 } else {
42 opener.set_proc_type(<?php echo "$form_order, '$name'" ?>);
43 <?php
44 // This is to generate the "Questions at Order Entry" for the Procedure Order form.
45 // GET parms needed for this are: formid, formseq.
46 if (isset($_GET['formid'])) {
47 require_once("qoe.inc.php");
48 $qoe_init_javascript = '';
49 echo ' opener.set_proc_html("';
50 echo generate_qoe_html($form_order, intval($_GET['formid']), 0, intval($_GET['formseq']));
51 echo '", "' . $qoe_init_javascript . '");' . "\n";
55 window.close(); // comment out for debugging
56 </script>
57 <?php
58 exit();
60 // end Save logic
63 <!DOCTYPE html>
64 <html>
66 <head>
67 <?php Header::setupHeader(['opener', 'datetime-picker', 'jquery-ui', 'jquery-ui-base']);?>
69 <title><?php echo xlt('Configure Orders and Results'); ?></title>
71 <style type="text/css">
72 #con0 table {
73 margin: 0;
74 padding: 0;
75 width: 100%;
77 #con0 td {
78 /*padding: 0;*/
79 font-family: sans-serif;
80 font-size: 11px;
81 line-height: 25px;
83 .plusminus {
84 font-family: monospace;
85 /*font-size: 11px;*/
87 .haskids {
88 color: #0000dd;
89 cursor: pointer;
90 cursor: hand;
92 tr.head {
93 font-size: 14px;
94 background-color: #cccccc;
95 font-weight: bold;
97 tr.evenrow {
98 background-color: #ddddff;
100 tr.oddrow {
101 background-color: #ffffff;
103 tr.outertr {
104 padding: 0px 0px 0px 10px;
106 td {
107 line-height: 25px;
109 .col1 {
110 width: 33%
112 .col2 {
113 width: 12%
115 .col3 {
116 width: 8%
118 .col4 {
119 width: 28%
121 .col5 {
122 width: 5%
124 .col6 {
125 width: 8%
128 @media only screen and (max-width: 768px) {
129 [class*="col-"] {
130 width: 100%;
134 </style>
137 <?php
138 if ($popup) { ?>
139 <script type="text/javascript" src="../../library/topdialog.js"></script>
140 <?php } ?>
143 <script language="JavaScript">
145 <?php
146 if ($popup) {
147 require($GLOBALS['srcdir'] . "/restoreSession.php");
151 <?php
152 // Create array of IDs to pre-select, leaf to top.
153 echo "preopen = [";
154 echo $order > 0 ? $order : 0;
155 for ($parentid = $order; $parentid > 0;) {
156 $row = sqlQuery("SELECT parent FROM procedure_type WHERE procedure_type_id = '$parentid'");
157 $parentid = $row['parent'] + 0;
158 echo ", $parentid";
161 echo "];\n";
165 // initiate by loading the top-level nodes
166 $(document).ready(function(){
167 nextOpen();
170 // This is called repeatedly at initialization until all desired nodes
171 // have been opened.
172 function nextOpen() {
173 if (preopen.length) {
174 var thisid = preopen.pop();
176 if (thisid == 0 || preopen.length > 0) {
177 if (thisid > 0)
178 toggle(thisid);
179 else
180 $.getScript('types_ajax.php?id=' + thisid + '&order=<?php echo $order; ?>' + '&labid=<?php echo $labid; ?>');
182 else {
183 recolor();
186 else {
187 recolor();
191 // toggle expansion indicator from + to - or vice versa
192 function swapsign(td1, from, to) {
193 var s = td1.html();
194 var i = s.indexOf('>' + from + ' <');
195 if (i >= 0) td1.html(s.substring(0,i+1) + to + s.substring(i+2));
198 // onclick handler to expand or collapse a node
199 function toggle(id) {
200 var td1 = $('#td' + id);
201 if (!td1.hasClass('haskids')) return;
202 if (td1.hasClass('isExpanded')) {
203 $('#con' + id).remove();
204 td1.removeClass('isExpanded');
205 swapsign(td1, '-', '+');
206 recolor();
208 else {
209 td1.parent().after('<tr class="outertr"><td colspan="7" id="con' + id + '" style="padding:0">Loading...</td></tr>');
210 td1.addClass('isExpanded');
211 swapsign(td1, '+', '-');
212 $.getScript('types_ajax.php?id=' + id + '&order=<?php echo $order; ?>' + '&labid=<?php echo $labid; ?>');
216 // Called by the edit window to refresh a given node's children
217 function refreshFamily(id, haskids) {
218 if (id) { // id == 0 means top level
219 var td1 = $('#td' + id);
220 if (td1.hasClass('isExpanded')) {
221 $('#con' + id).remove();
222 td1.removeClass('isExpanded');
223 swapsign(td1, '-', '+');
225 if (td1.hasClass('haskids') && !haskids) {
226 td1.removeClass('haskids');
227 // swapsign(td1, '+', '.');
228 swapsign(td1, '+', '|');
229 return;
231 if (!td1.hasClass('haskids') && haskids) {
232 td1.addClass('haskids');
233 // swapsign(td1, '.', '+');
234 swapsign(td1, '|', '+');
236 if (haskids) {
237 td1.parent().after('<tr class="outertr"><td colspan="7" id="con' + id + '" style="padding:0">Loading...</td></tr>');
238 td1.addClass('isExpanded');
239 swapsign(td1, '+', '-');
242 if (haskids)
243 $.getScript('types_ajax.php?id=' + id + '&order=<?php echo $order; ?>' + '&labid=<?php echo $labid; ?>');
244 else
245 recolor();
248 // edit/add a node
249 function handleNode(id, type, add, lab) {
250 var editTitle = '<i class="fa fa-pencil" style="width:20px;" aria-hidden="true"></i> ' + '<?php echo xlt("Edit Mode"); ?> ';
251 var addTitle = '<i class="fa fa-plus" style="width:20px;" aria-hidden="true"></i> ' + '<?php echo xlt("Add Mode"); ?>';
252 if (type > 0) {
253 type = (type === 1 && !add) ? 'fgp' : 'for';
255 let url = 'types_edit.php?addfav=' + type + '&labid=' + lab + '&parent=0&typeid=' + id;
257 if (add) {
258 url = 'types_edit.php?addfav=' + type + '&labid=' + lab + '&typeid=0&parent=' + id;
259 dlgopen(url, '_blank', 800, 750, false, addTitle);
260 } else {
261 dlgopen(url, '_blank', 800, 750, false, editTitle);
265 // call this to alternate row colors when anything changes the number of rows
266 function recolor() {
267 var i = 0;
268 $('#con0 tr').each(function(index) {
269 // skip any row that contains other rows
270 if ($(this).hasClass('outertr')) return;
271 this.className = (i++ & 1) ? "evenrow" : "oddrow";
275 // Callback from popups to refresh this display.
276 function refreshme() {
277 // location.reload();
278 document.forms[0].submit();
280 </script>
282 </head>
284 <body class="body_nav">
285 <?php
286 if ($GLOBALS['enable_help'] == 1) {
287 $help_icon = '<a class="oe-pull-away oe-help-redirect" data-target="#myModal" data-toggle="modal" href="#" id="help-href" name="help-href" style="color:#676666" title="' . xla("Click to view Help") . '"><i class="fa fa-question-circle" aria-hidden="true"></i></a>';
288 } elseif ($GLOBALS['enable_help'] == 2) {
289 $help_icon = '<a class="oe-pull-away oe-help-redirect" data-target="#myModal" data-toggle="modal" href="#" id="help-href" name="help-href" style="color:#DCD6D0 !Important" title="' . xla("To enable help - Go to Administration > Globals > Features > Enable Help Modal") . '"><i class="fa fa-question-circle" aria-hidden="true"></i></a>';
290 } elseif ($GLOBALS['enable_help'] == 0) {
291 $help_icon = '';
294 <div class="container">
295 <div class="row">
296 <div class="col-sm-12">
297 <div class="page-header clearfix">
298 <h2 id="header_title" class="clearfix"><span id='header_text'><?php echo xlt('Configure Orders and Results');?></span><?php echo $help_icon; ?></h2>
299 </div>
300 </div>
301 </div>
302 <div class="row">
303 <div class="col-sm-12">
304 <form method='post' name='theform'
305 action='types.php?popup=<?php echo $popup ?>&order=<?php
306 echo $order;
307 if (isset($_GET['formid'])) {
308 echo '&formid=' . $_GET['formid'];
311 if (isset($_GET['formseq'])) {
312 echo '&formseq=' . $_GET['formseq'];
314 ?>'>
315 <div class="btn-group">
316 <button type="button" name="form_search" class="btn btn-default btn-refresh" onclick="refreshme()"><?php echo xlt('Refresh');?></button>
317 <button type="button" class="btn btn-default btn-add" name='add_node_btn' id='add_node_button' onclick='handleNode(0,"","")'><?php echo xlt('Add Top Level');?></button>
318 </div>
319 <br>
320 <br>
321 <div class = "table-responsive">
322 <table class="table" style="margin-bottom:0">
323 <thead>
324 <tr class='head'>
325 <td class='col1' align='left'>&nbsp;&nbsp;<?php echo xlt('Name') ?> <i id="name-tooltip" class="fa fa-info-circle oe-text-black" aria-hidden="true"></i></td>
326 <td class='col2 oe-pl0' align='left'><?php echo xlt('Category') ?> <i id="order-tooltip" class="fa fa-info-circle oe-text-black" aria-hidden="true"></i></td>
327 <td class='col3 oe-pl0' align='left'><?php echo xlt('Code') ?> <i id="code-tooltip" class="fa fa-info-circle oe-text-black" aria-hidden="true"></i></td>
328 <td class='col6 oe-pl0' align='left'><?php echo xlt('Tier') ?> <i id="tier-tooltip" class="fa fa-info-circle oe-text-black" aria-hidden="true"></i></td>
329 <td class='col4 oe-pl0' align='left'><?php echo xlt('Description') ?></td>
330 <td class='col5 oe-pl0' align='left'><?php echo xlt('Edit') ?></td>
331 <td class='col5 oe-pl0' align='center'><?php echo xlt('Add') ?></td>
332 </tr>
333 </thead>
334 </table>
335 </div>
336 <div id="con0"></div>
337 <?php //can change position of buttons by creating a class 'position-override' and adding rule text-align:center or right as the case may be in individual stylesheets ?>
338 <div class="form-group clearfix">
339 <div class="col-sm-12 text-left position-override">
340 <div class="btn-group btn-group-pinch" role="group">
341 <?php if ($popup) { ?>
342 <button type="submit" class="btn btn-default btn-save" name='form_save' value='<?php echo xla('Save'); ?>'><?php echo xlt('Save');?></button>
343 <button class="btn btn-link btn-cancel btn-separate-left" onclick="CancelDistribute()"><?php echo xlt('Cancel');?></button>
344 <?php } ?>
345 </div>
346 </div>
347 </div>
348 </form>
349 </div>
350 </div>
351 </div><!--End of Container div-->
352 <br>
353 <?php
354 //home of the help modal ;)
355 //$GLOBALS['enable_help'] = 0; // Please comment out line if you want help modal to function on this page
356 if ($GLOBALS['enable_help'] == 1) {
357 echo "<script>var helpFile = 'configure_orders_help.php'</script>";
358 //help_modal.php lives in interface, set path accordingly
359 require "../help_modal.php";
362 <script>
363 //jqury-ui tooltip
364 $(document).ready(function(){
365 //for jquery tooltip to function if jquery 1.12.1.js is called via jquery-ui in the Header::setupHeader
366 // the relevant css file needs to be called i.e. jquery-ui-darkness - to get a black tooltip
367 $('#name-tooltip').attr( "title", "<?php echo xla('The actual tests or procedures that can be searched for and ordered are highlighted in yellow'); ?>" + ". " + "<?php echo xla('Click on the blue plus sign under Name to reveal test names'); ?>").tooltip();
368 $('#order-tooltip').attr( "title", "<?php echo xla('The entries highlighted in yellow can be ordered as a test or procedure those highlighted in pink can be ordered as a Custom Group'); ?>" + ". " + "<?php echo xla('Click on the blue plus sign under Name to reveal test names'); ?>" ).tooltip();
369 $('#code-tooltip').attr( "title", "<?php echo xla('Category - Order, Result and Recommendation need an identifying code');?>" + ". " + "<?php echo xla('Red Triangle indicates a required code that is missing')?>.").
370 tooltip();
371 $('#tier-tooltip').attr( "title", "<?php echo xla('Shows the hierarchal level of this line');?>" + ". " + "<?php echo xla('Tier 1 entries should be of Category Top Group')?>.").
372 tooltip();
373 $('table td .required-tooltip').attr( "title", "<?php echo xla('For proper tabulated display of tests and results an identifying code is required'); ?>").tooltip();
374 $("table td .required-tooltip").fadeIn(500);
375 $("table td .required-tooltip3").fadeOut(1000);
376 $("table td .required-tooltip").fadeIn(500);
377 $(".plusminus").click(function(){
378 $(".required-tooltip").effect("pulsate", {times:1}, 4000);
381 </script>
383 </body>
384 </html>