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/formdata.inc.php");
27 require_once("$srcdir/options.inc.php");
29 $educationdir = "$OE_SITE_DIR/documents/education";
31 $codetype = empty($_REQUEST['type' ]) ?
'' : $_REQUEST['type' ];
32 $codevalue = empty($_REQUEST['code' ]) ?
'' : $_REQUEST['code' ];
33 $language = empty($_REQUEST['language']) ?
'' : strtolower($_REQUEST['language']);
34 $source = empty($_REQUEST['source' ]) ?
'' : $_REQUEST['source' ];
38 if ($_POST['bn_submit']) {
39 if ($source == 'MLP') {
40 // MedlinePlus Connect Web Application. See:
41 // http://www.nlm.nih.gov/medlineplus/connect/application.html
42 $url = 'http://apps.nlm.nih.gov/medlineplus/services/mpconnect.cfm';
43 // Set code type in URL.
44 $url .= '?mainSearchCriteria.v.cs=';
45 if ('ICD9' == $codetype) $url .= '2.16.840.1.113883.6.103'; else
46 if ('ICD10' == $codetype) $url .= '2.16.840.1.113883.6.90' ; else
47 if ('SNOMED' == $codetype) $url .= '2.16.840.1.113883.6.96' ; else
48 if ('RXCUI' == $codetype) $url .= '2.16.840.1.113883.6.88' ; else
49 if ('NDC' == $codetype) $url .= '2.16.840.1.113883.6.69' ; else
50 if ('LOINC' == $codetype) $url .= '2.16.840.1.113883.6.1' ; else
51 die(xlt('Code type not recognized') . ': ' . text($codetype));
52 // Set code value in URL.
53 $url .= '&mainSearchCriteria.v.c=' . urlencode($codevalue);
54 // Set language in URL if relevant. MedlinePlus supports only English or Spanish.
55 if ($language == 'es' ||
$language == 'spanish') {
56 $url .= '&informationRecipient.languageCode.c=es';
58 // There are 2 different ways to get the data: have the server do it, or
59 // have the browser do it.
61 $data = file_get_contents($url);
65 echo "<html><body><script language='JavaScript'>\n";
66 echo "document.location.href = '$url';\n";
67 echo "</script></body></html>\n";
73 if ($language == 'es' ||
$language == 'spanish') $lang = 'es';
74 $filename = strtolower("{$codetype}_{$codevalue}_{$lang}.pdf");
75 $filepath = "$educationdir/$filename";
76 if (is_file($filepath)) {
77 header('Content-Description: File Transfer');
78 header('Content-Transfer-Encoding: binary');
80 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
81 header('Pragma: public');
82 // attachment, not inline
83 header("Content-Disposition: attachment; filename=\"$filename\"");
84 header("Content-Type: application/pdf");
85 header("Content-Length: " . filesize($filepath));
92 $errmsg = xl('There is no local content for this topic.');
99 <?php
html_header_show(); ?
>
100 <link rel
=stylesheet href
="<?php echo $css_header; ?>" type
="text/css">
102 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
105 tr
.head
{ font
-size
:10pt
; background
-color
:#cccccc; text-align:center; }
106 tr
.detail
{ font
-size
:10pt
; background
-color
:#ddddff; }
107 td input
{ background
-color
:transparent
; }
111 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
112 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-1.2.2.min.js"></script
>
114 <script language
="JavaScript">
116 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
121 <body
class="body_top">
126 echo xlt('Educational materials for');
127 echo ' ' . text($codetype) . ' ';
129 echo ' "' . text($codevalue) . '"';
131 echo ' ' . xlt('with preferred language') . ' ' .
132 text(getListItemTitle('language', $_REQUEST['language']));
138 if ($errmsg) echo "<p style='color:red'>" . text($errmsg) . "</p>\n";
141 <form method
='post' action
='education.php'>
143 <input type
='hidden' name
='type' value
='<?php echo attr($codetype ); ?>' />
144 <input type
='hidden' name
='code' value
='<?php echo attr($codevalue); ?>' />
145 <input type
='hidden' name
='language' value
='<?php echo attr($language ); ?>' />
148 <?php
echo xlt('Select source'); ?
>:
149 <select name
='source'>
150 <option value
='MLP' ><?php
echo xlt('MedlinePlus Connect'); ?
></option
>
151 <option value
='Local'><?php
echo xlt('Local Content' ); ?
></option
>
156 <input type
='submit' name
='bn_submit' value
='<?php echo xla('Submit
'); ?>' />
158 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
="window.close()" />