more organization of autoloaded files (#424)
[openemr.git] / custom / search.php
blob4d402a2fa8d13957dde20cbcda45b82d37bd3bf7
1 <?php
2 //// Copyright (C) 2009 Aron Racho <aron@mi-squared.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 //SANITIZE ALL ESCAPES
10 $sanitize_all_escapes=true;
13 //STOP FAKE REGISTER GLOBALS
14 $fake_register_globals=false;
17 require_once("../interface/globals.php");
19 <html>
20 <head>
21 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
22 <style type="text/css">
23 body {
24 font-size:8pt;
25 font-weight:normal;
26 padding: 5px 3px 5px 3px;
27 background: #94D6E7;
29 </style>
30 <script language="javascript">
31 function doSelectorButton() {
32 var selector = document.getElementById('selectorButton');
33 var value;
34 if ( selector.value == "<?php echo htmlspecialchars( xl('Select All'), ENT_QUOTES); ?>" ) {
35 selector.value = "<?php echo htmlspecialchars( xl('Unselect All'), ENT_QUOTES); ?>";
36 value = true;
37 } else {
38 selector.value = "<?php echo htmlspecialchars( xl('Select All'), ENT_QUOTES); ?>";
39 value = false;
41 var checkBoxes = document.getElementsByName( "searchFields" );
42 setAll( checkBoxes, value );
45 function setAll(field, value) {
46 for (i = 0; i < field.length; i++) {
47 field[i].checked = value ;
51 function doSubmit() {
52 // buildup fieldstring
53 var checkBoxes = document.getElementsByName( "searchFields" );
54 var fieldString = '';
55 var ssc = document.forms[0].search_service_code.value;
56 for (i = 0; i < checkBoxes.length; i++) {
57 if ( checkBoxes[i].checked ) {
58 if ( fieldString != '' ) {
59 fieldString += "~";
61 fieldString += checkBoxes[i].value;
64 if ( opener != null ) {
65 if (fieldString == undefined || (fieldString == '' && ssc.length == '')) {
66 alert("<?php echo htmlspecialchars( xl('You must select some fields to continue.'), ENT_QUOTES); ?>");
67 return false;
69 opener.processFilter(fieldString, ssc);
73 </script>
74 </head>
76 <body>
77 <form>
79 <table>
80 <tr>
81 <td>
82 <b><?php echo htmlspecialchars(xl('Select Fields')); ?>:</b>
83 </td>
84 <td>
85 <input type="button" value="<?php echo htmlspecialchars( xl('Submit'), ENT_QUOTES); ?>" id="submit" onclick="javascript:doSubmit();"></input>
86 </td>
87 <td>
88 <input type="button" value="<?php echo htmlspecialchars( xl('Select All'), ENT_QUOTES); ?>" id="selectorButton" onclick="javascript:doSelectorButton();"></input>
89 </td>
90 </tr>
91 </table>
93 <?php
94 function echoFilterItem($iter, $fieldId, $fieldTitle) {
95 if ($iter % 3 == 0) {
96 if ( $iter > 0 ) {
97 echo "</tr>\n";
99 echo "<tr>\n";
101 echo "<td>";
102 echo "<input type='checkbox' value='".htmlspecialchars( ${fieldId}, ENT_QUOTES)."' name='searchFields'/> <b>".htmlspecialchars( $fieldTitle, ENT_NOQUOTES)."</b>";
103 echo "</td>\n";
106 $layoutCols = sqlStatement( "SELECT field_id, title, description, group_name "
107 . "FROM layout_options "
108 . "WHERE form_id='DEM' "
109 . "AND group_name not like ('%Employer%' ) AND uor != 0 "
110 . "ORDER BY group_name,seq"
113 echo "<table>";
115 for($iter=0; $row=sqlFetchArray($layoutCols); $iter++) {
116 $label = $row['title'] ? $row['title'] : $row['description'];
117 if ( !$label ) {
118 $label = $row['field_id'];
120 echoFilterItem(
121 $iter,
122 $row['field_id'],
123 xl_layout_label($label)
126 echoFilterItem($iter++, 'pid', xl('Internal Identifier (pid)'));
128 // Finish the row gracefully.
129 while ($iter++ % 3) echo "<td>&nbsp;</td>\n";
130 echo "</tr>\n";
132 // Write a final line to solicit an optional service code.
133 echo "<tr>\n";
134 echo "<td colspan='3'>";
135 echo "<input type='text' value='' name='search_service_code' size='8' /> " .
136 "<b>" . htmlspecialchars(xl('Service Code')) . "</b> (" .
137 htmlspecialchars(xl('if entered, select only those who have had this service')) . ")";
138 echo "</td>\n";
139 echo "</tr>\n";
141 echo "</table>";
144 </form>
145 </body>
146 </html>