3 * This is called as a pop-up to display patient education materials.
5 * Copyright (C) 2014 Rod Roark <rod@sunsetsystems.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>.
19 * @author Rod Roark <rod@sunsetsystems.com>
22 $sanitize_all_escapes = true;
23 $fake_register_globals = false;
25 require_once("../globals.php");
26 require_once("$srcdir/options.inc.php");
28 $educationdir = "$OE_SITE_DIR/documents/education";
30 $codetype = empty($_REQUEST['type' ]) ?
'' : $_REQUEST['type' ];
31 $codevalue = empty($_REQUEST['code' ]) ?
'' : $_REQUEST['code' ];
32 $language = empty($_REQUEST['language']) ?
'' : strtolower($_REQUEST['language']);
33 $source = empty($_REQUEST['source' ]) ?
'' : $_REQUEST['source' ];
37 if ($_POST['bn_submit']) {
38 if ($source == 'MLP') {
39 // MedlinePlus Connect Web Application. See:
40 // http://www.nlm.nih.gov/medlineplus/connect/application.html
41 $url = 'http://apps.nlm.nih.gov/medlineplus/services/mpconnect.cfm';
42 // Set code type in URL.
43 $url .= '?mainSearchCriteria.v.cs=';
44 if ('ICD9' == $codetype) $url .= '2.16.840.1.113883.6.103'; else
45 if ('ICD10' == $codetype) $url .= '2.16.840.1.113883.6.90' ; else
46 if ('SNOMED' == $codetype) $url .= '2.16.840.1.113883.6.96' ; else
47 if ('RXCUI' == $codetype) $url .= '2.16.840.1.113883.6.88' ; else
48 if ('NDC' == $codetype) $url .= '2.16.840.1.113883.6.69' ; else
49 if ('LOINC' == $codetype) $url .= '2.16.840.1.113883.6.1' ; else
50 die(xlt('Code type not recognized') . ': ' . text($codetype));
51 // Set code value in URL.
52 $url .= '&mainSearchCriteria.v.c=' . urlencode($codevalue);
53 // Set language in URL if relevant. MedlinePlus supports only English or Spanish.
54 if ($language == 'es' ||
$language == 'spanish') {
55 $url .= '&informationRecipient.languageCode.c=es';
57 // There are 2 different ways to get the data: have the server do it, or
58 // have the browser do it.
60 $data = file_get_contents($url);
65 ."<script type=\"text/javascript\" src=\"". $webroot ."/interface/main/tabs/js/include_opener.js\"></script>"
66 . "<script language='JavaScript'>\n";
67 echo "document.location.href = '$url';\n";
68 echo "</script></body></html>\n";
74 if ($language == 'es' ||
$language == 'spanish') $lang = 'es';
75 $filename = strtolower("{$codetype}_{$codevalue}_{$lang}.pdf");
76 $filepath = "$educationdir/$filename";
77 if (is_file($filepath)) {
78 header('Content-Description: File Transfer');
79 header('Content-Transfer-Encoding: binary');
81 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
82 header('Pragma: public');
83 // attachment, not inline
84 header("Content-Disposition: attachment; filename=\"$filename\"");
85 header("Content-Type: application/pdf");
86 header("Content-Length: " . filesize($filepath));
93 $errmsg = xl('There is no local content for this topic.');
100 <?php
html_header_show(); ?
>
101 <!-- There is a problem with cross site scripting with iframes
-->
102 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script
>
103 <link rel
=stylesheet href
="<?php echo $css_header; ?>" type
="text/css">
105 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
108 tr
.head
{ font
-size
:10pt
; background
-color
:#cccccc; text-align:center; }
109 tr
.detail
{ font
-size
:10pt
; background
-color
:#ddddff; }
110 td input
{ background
-color
:transparent
; }
114 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
115 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script
>
117 <script language
="JavaScript">
119 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
124 <body
class="body_top">
129 echo xlt('Educational materials for');
130 echo ' ' . text($codetype) . ' ';
132 echo ' "' . text($codevalue) . '"';
134 echo ' ' . xlt('with preferred language') . ' ' .
135 text(getListItemTitle('language', $_REQUEST['language']));
141 if ($errmsg) echo "<p style='color:red'>" . text($errmsg) . "</p>\n";
144 <form method
='post' action
='education.php'>
146 <input type
='hidden' name
='type' value
='<?php echo attr($codetype ); ?>' />
147 <input type
='hidden' name
='code' value
='<?php echo attr($codevalue); ?>' />
148 <input type
='hidden' name
='language' value
='<?php echo attr($language ); ?>' />
151 <?php
echo xlt('Select source'); ?
>:
152 <select name
='source'>
153 <option value
='MLP' ><?php
echo xlt('MedlinePlus Connect'); ?
></option
>
154 <option value
='Local'><?php
echo xlt('Local Content' ); ?
></option
>
159 <input type
='submit' name
='bn_submit' value
='<?php echo xla('Submit
'); ?>' />
161 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
="window.close()" />