Merge branch 'master' of git://github.com/openemr/openemr
[openemr.git] / custom / search.php
blob8c9f9a4d44e6aacc82772c203ab32282035009bd
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 include_once("../interface/globals.php");
18 require_once("../library/sql.inc");
22 <head>
23 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
24 <style type="text/css">
25 body {
26 font-size:8pt;
27 font-weight:normal;
28 padding: 5px 3px 5px 3px;
29 background: #94D6E7;
31 </style>
32 <script language="javascript">
33 function doSelectorButton() {
34 var selector = document.getElementById('selectorButton');
35 var value;
36 if ( selector.value == "<?php echo htmlspecialchars( xl('Select All'), ENT_QUOTES); ?>" ) {
37 selector.value = "<?php echo htmlspecialchars( xl('Unselect All'), ENT_QUOTES); ?>";
38 value = true;
39 } else {
40 selector.value = "<?php echo htmlspecialchars( xl('Select All'), ENT_QUOTES); ?>";
41 value = false;
43 var checkBoxes = document.getElementsByName( "searchFields" );
44 setAll( checkBoxes, value );
47 function setAll(field, value) {
48 for (i = 0; i < field.length; i++) {
49 field[i].checked = value ;
53 function doSubmit() {
54 // buildup fieldstring
55 var checkBoxes = document.getElementsByName( "searchFields" );
56 var fieldString = '';
57 for (i = 0; i < checkBoxes.length; i++) {
58 if ( checkBoxes[i].checked ) {
59 if ( fieldString != '' ) {
60 fieldString += "~";
62 fieldString += checkBoxes[i].value;
65 if ( opener != null ) {
66 if ( fieldString == '' || fieldString == undefined ) {
67 alert("<?php echo htmlspecialchars( xl('You must select some fields to continue.'), ENT_QUOTES); ?>");
68 return false;
70 opener.processFilter( fieldString );
74 </script>
75 </head>
77 <body>
78 <table>
79 <tr>
80 <td>
81 <b><?php xl('Select Fields', 'e'); ?>:</b>
82 </td>
83 <td>
84 <input type="button" value="<?php echo htmlspecialchars( xl('Submit'), ENT_QUOTES); ?>" id="submit" onclick="javascript:doSubmit();"></input>
85 </td>
86 <td>
87 <input type="button" value="<?php echo htmlspecialchars( xl('Select All'), ENT_QUOTES); ?>" id="selectorButton" onclick="javascript:doSelectorButton();"></input>
88 </td>
89 </tr>
90 </table>
92 <?php
93 function echoFilterItem($iter, $fieldId, $fieldTitle) {
94 if ( $iter == 0 || ($iter % 3 == 0) ) {
95 if ( $iter > 0 ) {
96 echo "</tr>";
98 echo "<tr>";
100 echo "<td>";
101 echo "<input type='checkbox' value='".htmlspecialchars( ${fieldId}, ENT_QUOTES)."' name='searchFields'/> <b>".htmlspecialchars( $fieldTitle, ENT_NOQUOTES)."</b>";
102 echo "</td>";
105 $layoutCols = sqlStatement( "SELECT field_id, title, description, group_name "
106 . "FROM layout_options "
107 . "WHERE form_id='DEM' "
108 . "AND group_name not like ('%Employer%' ) AND uor !=0 "
109 . "ORDER BY group_name,seq"
112 echo "<table>";
114 for($iter=0; $row=sqlFetchArray($layoutCols); $iter++) {
115 $label = $row['title'] ? $row['title'] : $row['description'];
116 if ( !$label ) {
117 $label = $row['field_id'];
119 echoFilterItem(
120 $iter,
121 $row['field_id'],
122 xl_layout_label($label)
125 echoFilterItem($iter, 'pid', xl('Internal Identifier (pid)'));
127 echo "</table>";
130 </body>