3 * This is called as a pop-up to display patient education materials.
6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2014 Rod Roark <rod@sunsetsystems.com>
10 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/options.inc.php");
18 use OpenEMR\Common\Csrf\CsrfUtils
;
19 use OpenEMR\Core\Header
;
21 $educationdir = "$OE_SITE_DIR/documents/education";
23 $codetype = empty($_REQUEST['type' ]) ?
'' : $_REQUEST['type' ];
24 $codevalue = empty($_REQUEST['code' ]) ?
'' : $_REQUEST['code' ];
25 $language = empty($_REQUEST['language']) ?
'' : strtolower($_REQUEST['language']);
26 $source = empty($_REQUEST['source' ]) ?
'' : $_REQUEST['source' ];
30 if ($_POST['bn_submit']) {
31 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
32 CsrfUtils
::csrfNotVerified();
35 if ($source == 'MLP') {
36 // MedlinePlus Connect Web Application. See:
37 // http://www.nlm.nih.gov/medlineplus/connect/application.html
38 $url = 'http://apps.nlm.nih.gov/medlineplus/services/mpconnect.cfm';
39 // Set code type in URL.
40 $url .= '?mainSearchCriteria.v.cs=';
41 if ('ICD9' == $codetype) {
42 $url .= '2.16.840.1.113883.6.103';
43 } else if ('ICD10' == $codetype) {
44 $url .= '2.16.840.1.113883.6.90' ;
45 } else if ('SNOMED' == $codetype) {
46 $url .= '2.16.840.1.113883.6.96' ;
47 } else if ('RXCUI' == $codetype) {
48 $url .= '2.16.840.1.113883.6.88' ;
49 } else if ('NDC' == $codetype) {
50 $url .= '2.16.840.1.113883.6.69' ;
51 } else if ('LOINC' == $codetype) {
52 $url .= '2.16.840.1.113883.6.1' ;
54 die(xlt('Code type not recognized') . ': ' . text($codetype));
57 // Set code value in URL.
58 $url .= '&mainSearchCriteria.v.c=' . urlencode($codevalue);
59 // Set language in URL if relevant. MedlinePlus supports only English or Spanish.
60 if ($language == 'es' ||
$language == 'spanish') {
61 $url .= '&informationRecipient.languageCode.c=es';
64 // There are 2 different ways to get the data: have the server do it, or
65 // have the browser do it.
67 $data = file_get_contents($url);
69 } else { // Removed opener because this is not a dialog. sjp 12/14/17
71 //."<script type=\"text/javascript\" src=\"". $webroot ."/interface/main/tabs/js/include_opener.js\"></script>"
72 . "<script language='JavaScript'>\n";
73 echo "document.location.href = " . js_escape($url) . ";\n";
74 echo "</script></body></html>\n";
80 if ($language == 'es' ||
$language == 'spanish') {
84 $filename = strtolower("{$codetype}_{$codevalue}_{$lang}.pdf");
85 $filepath = "$educationdir/$filename";
86 if (is_file($filepath)) {
87 header('Content-Description: File Transfer');
88 header('Content-Transfer-Encoding: binary');
90 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
91 header('Pragma: public');
92 // attachment, not inline
93 header("Content-Disposition: attachment; filename=\"$filename\"");
94 header("Content-Type: application/pdf");
95 header("Content-Length: " . filesize($filepath));
101 $errmsg = xl('There is no local content for this topic.');
109 <title
><?php
echo xlt('Education'); ?
></title
>
111 <?php Header
::setupHeader(); ?
>
114 <body
class="body_top">
115 <div
class="container">
118 <div
class="page-header">
121 echo xlt('Educational materials for');
122 echo ' ' . text($codetype) . ' ';
124 echo ' "' . text($codevalue) . '"';
126 echo ' ' . xlt('with preferred language') . ' ' .
127 text(getListItemTitle('language', $_REQUEST['language']));
133 echo "<p style='color:red'>" . text($errmsg) . "</p>\n";
141 <form method
='post' action
='education.php' onsubmit
='return top.restoreSession()'>
142 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
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); ?>' />
146 <div
class='form-group'>
147 <label
for="source"><?php
echo xlt('Select source'); ?
></label
>
148 <select name
='source' id
='source' class='form-control'>
149 <option value
='MLP' ><?php
echo xlt('MedlinePlus Connect'); ?
></option
>
150 <option value
='Local'><?php
echo xlt('Local Content'); ?
></option
>
153 <div
class='form-group'>
154 <div
class='btn-group' role
='group'>
155 <button type
='submit' class='btn btn-secondary btn-search' name
='bn_submit' value
='bn_submit'>
156 <?php
echo xlt('Submit'); ?
>
158 <button type
='button' class='btn btn-link btn-cancel' onclick
='window.close()'>
159 <?php
echo xlt('Cancel'); ?
>