2 // Copyright (C) 2012, 2016 Rod Roark <rod@sunsetsystems.com>
3 // Sponsored by David Eschelbacher, MD
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // Sanitize escapes and stop fake register globals.
12 $sanitize_all_escapes = true;
13 $fake_register_globals = false;
15 require_once("../../globals.php");
17 $popup = empty($_REQUEST['popup']) ?
0 : 1;
19 // Generate some code based on the list of columns.
25 $res = sqlStatement("SELECT option_id, title FROM list_options WHERE " .
26 "list_id = 'ptlistcols' AND activity = 1 ORDER BY seq, title");
27 while ($row = sqlFetchArray($res)) {
28 $colname = $row['option_id'];
29 $title = xl_list_label($row['title']);
31 $header .= text($title);
33 $header0 .= " <td align='center'><input type='text' size='10' ";
34 $header0 .= "value='' class='search_init' /></td>\n";
35 if ($coljson) $coljson .= ", ";
36 $coljson .= "{\"sName\": \"" . addcslashes($colname, "\t\r\n\"\\") . "\"}";
42 <?php
html_header_show(); ?
>
43 <title
><?php
echo xlt("Patient Finder"); ?
></title
>
44 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
46 <style type
="text/css">
47 @import
"../../../library/js/datatables/media/css/demo_page.css";
48 @import
"../../../library/js/datatables/media/css/demo_table.css";
49 .mytopdiv
{ float: left
; margin
-right
: 1em
; }
52 <script type
="text/javascript" src
="../../../library/js/datatables/media/js/jquery.js"></script
>
53 <script type
="text/javascript" src
="../../../library/js/datatables/media/js/jquery.dataTables.min.js"></script
>
54 <!-- this is a
3rd party script
-->
55 <script type
="text/javascript" src
="../../../library/js/datatables/extras/ColReorder/media/js/ColReorderWithResize.js"></script
>
57 <script language
="JavaScript">
59 $
(document
).ready(function() {
61 // Initializing the DataTable.
63 var oTable
= $
('#pt_table').dataTable( {
65 // next 2 lines invoke server side processing
67 "sAjaxSource": "dynamic_finder_ajax.php",
68 // sDom invokes ColReorderWithResize and allows inclusion of a custom div
69 "sDom" : 'Rlfrt<"mytopdiv">ip',
70 // These column names come over as $_GET['sColumns'], a comma-separated list of the names.
71 // See: http://datatables.net/usage/columns and
72 // http://datatables.net/release-datatables/extras/ColReorder/server_side.html
73 "aoColumns": [ <?php
echo $coljson; ?
> ],
74 "aLengthMenu": [ 10, 25, 50, 100 ],
75 "iDisplayLength": <?php
echo empty($GLOBALS['gbl_pt_list_page_size']) ?
'10' : $GLOBALS['gbl_pt_list_page_size']; ?
>,
76 // language strings are included so we can translate them
78 "sSearch" : "<?php echo xla('Search all columns'); ?>:",
79 "sLengthMenu" : "<?php echo xla('Show') . ' _MENU_ ' . xla('entries'); ?>",
80 "sZeroRecords" : "<?php echo xla('No matching records found'); ?>",
81 "sInfo" : "<?php echo xla('Showing') . ' _START_ ' . xla('to{{range}}') . ' _END_ ' . xla('of') . ' _TOTAL_ ' . xla('entries'); ?>",
82 "sInfoEmpty" : "<?php echo xla('Nothing to show'); ?>",
83 "sInfoFiltered": "(<?php echo xla('filtered from') . ' _MAX_ ' . xla('total entries'); ?>)",
85 "sFirst" : "<?php echo xla('First'); ?>",
86 "sPrevious": "<?php echo xla('Previous'); ?>",
87 "sNext" : "<?php echo xla('Next'); ?>",
88 "sLast" : "<?php echo xla('Last'); ?>"
93 // This puts our custom HTML into the table header.
94 $
("div.mytopdiv").html("<form name='myform'><input type='checkbox' name='form_new_window' value='1'<?php
95 if (!empty($GLOBALS['gbl_pt_list_new_window'])) echo ' checked'; ?> /><?php
96 echo xlt('Open in New Window'); ?></form>");
98 // This is to support column-specific search fields.
99 // Borrowed from the multi_filter.html example.
100 $
("thead input").keyup(function () {
101 // Filter on the column (the index) of this element
102 oTable
.fnFilter( this
.value
, $
("thead input").index(this
) );
105 // OnClick handler for the rows
106 $
('#pt_table tbody tr').live('click', function () {
107 // ID of a row element is pid_{value}
108 var newpid
= this
.id
.substring(4);
109 // If the pid is invalid, then don't attempt to set
110 // The row display for "No matching records found" has no valid ID, but is
111 // otherwise clickable. (Matches this CSS selector). This prevents an invalid
112 // state for the PID to be set.
113 if (newpid
.length
===0)
117 if (document
.myform
.form_new_window
.checked
) {
118 openNewTopWindow(newpid
);
121 top
.restoreSession();
122 top
.RTop
.location
= "../../patient_file/summary/demographics.php?set_pid=" + newpid
;
128 function openNewTopWindow(pid
) {
129 document
.fnew
.patientID
.value
= pid
;
130 top
.restoreSession();
131 document
.fnew
.submit();
137 <body
class="body_top">
139 <div id
="dynamic"><!-- TBD
: id seems unused
, is this div required?
-->
141 <!-- Class "display" is defined in demo_table
.css
-->
142 <table cellpadding
="0" cellspacing
="0" border
="0" class="display" id
="pt_table">
145 <?php
echo $header0; ?
>
148 <?php
echo $header; ?
>
153 <!-- Class "dataTables_empty" is defined in jquery
.dataTables
.css
-->
154 <td colspan
="<?php echo $colcount; ?>" class="dataTables_empty">...</td
>
161 <!-- form used to open a
new top level window when a patient row is clicked
-->
162 <form name
='fnew' method
='post' target
='_blank' action
='../main_screen.php?auth=login&site=<?php echo attr($_SESSION['site_id
']); ?>'>
163 <input type
='hidden' name
='patientID' value
='0' />