More session fixes
[openemr.git] / interface / reports / patient_edu_web_lookup.php
blob9bb80b772edad07f441bcb3a70ccbd652531a659
1 <?php
2 /**
3 * Open websearch for patient education materials
5 * Copyright (C) 2011 Tony McCormick <tony@mi-squared.com>
6 * Copyright (C) 2011 Brady Miller <brady@sparmy.com>
8 * LICENSE: This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @package OpenEMR
20 * @author Tony McCormick <tony@mi-squared.com>
21 * @author Brady Miller <brady@sparmy.com>
22 * @link http://www.open-emr.org
26 //SANITIZE ALL ESCAPES
27 $sanitize_all_escapes=true;
30 //STOP FAKE REGISTER GLOBALS
31 $fake_register_globals=false;
34 //Include required scripts/libraries
35 require_once("../globals.php");
38 // Reference website links
39 $websites = array(
40 'Medline' => 'http://vsearch.nlm.nih.gov/vivisimo/cgi-bin/query-meta?v%3Aproject=medlineplus&query=[%]&x=12&y=15',
41 'eMedicine' => 'http://search.medscape.com/reference-search?newSearchHeader=1&queryText=[%]',
42 'WebMD' => 'http://www.webmd.com/search/search_results/default.aspx?query=[%]&sourceType=undefined'
45 // Collect variables
46 $form_lookup_at = (isset($_POST['form_lookup_at'])) ? $_POST['form_lookup_at'] : '';
47 $form_diagnosis = (isset($_POST['form_diagnosis'])) ? $_POST['form_diagnosis'] : '';
50 <html>
51 <head>
52 <?php html_header_show();?>
53 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
54 <script type="text/javascript" src="../../library/js/jquery.1.3.2.js"></script>
56 <script type="text/javascript">
57 function searchResultsPopup(search_term,link) {
58 link_formatted = link.replace("[%]",encodeURIComponent(search_term));
59 top.restoreSession();
60 window.open(link_formatted);
62 </script>
64 <title><?php echo htmlspecialchars( xl('Find Patient Education Materials'), ENT_NOQUOTES); ?></title>
65 </head>
67 <body class="body_top">
69 <span class='title'><?php echo htmlspecialchars( xl('Web Search'), ENT_NOQUOTES); ?> - <?php echo htmlspecialchars( xl('Patient Education Materials'), ENT_NOQUOTES); ?></span>
71 <form method='post' action='patient_edu_web_lookup.php' id='theform' onsubmit='return top.restoreSession()'>
73 <div id="report_parameters">
75 <table>
76 <tr>
77 <td>
78 <div style='float:left'>
79 <table class='text'>
80 <tr>
81 <td>
82 <?php echo htmlspecialchars( xl('Search in'), ENT_NOQUOTES);
83 echo '&nbsp;&nbsp;';
84 echo "<select name='form_lookup_at'>\n";
85 foreach ($websites as $key => $value) {
86 echo " <option value='" . htmlspecialchars($key, ENT_QUOTES) . "'";
87 if ($key == $form_lookup_at) echo ' selected';
88 echo ">" . htmlspecialchars( xl($key), ENT_NOQUOTES) . "</option>\n";
90 echo "</select>"; ?>
91 </td>
92 </tr>
93 <tr>
94 <td>
95 <input type='text' name='form_diagnosis' size='60' value='<?php echo htmlspecialchars($form_diagnosis, ENT_QUOTES); ?>'
96 title='<?php echo htmlspecialchars( xl('Search Text'), ENT_QUOTES); ?>'>
97 </td>
98 </tr>
99 </table>
101 </div>
103 </td>
104 <td align='left' valign='middle' height="100%">
105 <table style='border-left:1px solid; width:100%; height:100%' >
106 <tr>
107 <td>
108 <div style='margin-left:15px'>
109 <a href='#' class='css_button' onclick='top.restoreSession(); $("#theform").submit();'>
110 <span>
111 <?php echo htmlspecialchars( xl('Submit'), ENT_NOQUOTES); ?>
112 </span>
113 </a>
115 </div>
116 </td>
117 </tr>
118 </table>
119 </td>
120 </tr>
121 </table>
123 </div> <!-- end of parameters -->
125 <div class='text'>
126 <?php
127 echo htmlspecialchars( xl('Please input search criteria above, and click Submit to view results. (Results will be displayed in a pop up window)'), ENT_NOQUOTES);
129 </div>
130 <div class='text'>
131 <?php if (!empty($form_diagnosis) && !empty($form_lookup_at)) { ?>
132 <script type="text/javascript">
133 searchResultsPopup('<?php echo addslashes($form_diagnosis); ?>','<?php echo addslashes($websites[$form_lookup_at]) ?>');
134 </script>
135 <?php } ?>
136 </div>
137 </form>
138 </body>
139 </html>