4 * This is called as a pop-up to display patient education materials.
7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2014 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
12 * @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\Crypto\CryptoGen
;
19 use OpenEMR\Common\Csrf\CsrfUtils
;
20 use OpenEMR\Core\Header
;
22 $educationdir = "$OE_SITE_DIR/documents/education";
24 $codetype = empty($_REQUEST['type' ]) ?
'' : $_REQUEST['type' ];
25 $codevalue = empty($_REQUEST['code' ]) ?
'' : $_REQUEST['code' ];
26 $language = empty($_REQUEST['language']) ?
'' : strtolower($_REQUEST['language']);
27 $source = empty($_REQUEST['source' ]) ?
'' : $_REQUEST['source' ];
31 if (!empty($_POST['bn_submit'])) {
32 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
33 CsrfUtils
::csrfNotVerified();
36 if ($source == 'MLP') {
37 // MedlinePlus Connect Web Application. See:
38 // https://www.nlm.nih.gov/medlineplus/connect/application.html
39 $url = 'https://connect.medlineplus.gov/application';
40 // Set code type in URL.
41 $url .= '?mainSearchCriteria.v.cs=';
42 if ('ICD9' == $codetype) {
43 $url .= '2.16.840.1.113883.6.103';
44 } elseif ('ICD10' == $codetype) {
45 $url .= '2.16.840.1.113883.6.90' ;
46 } elseif ('SNOMED' == $codetype) {
47 $url .= '2.16.840.1.113883.6.96' ;
48 } elseif ('RXCUI' == $codetype) {
49 $url .= '2.16.840.1.113883.6.88' ;
50 } elseif ('NDC' == $codetype) {
51 $url .= '2.16.840.1.113883.6.69' ;
52 } elseif ('LOINC' == $codetype) {
53 $url .= '2.16.840.1.113883.6.1' ;
55 die(xlt('Code type not recognized') . ': ' . text($codetype));
58 // Set code value in URL.
59 $url .= '&mainSearchCriteria.v.c=' . urlencode($codevalue);
60 // Set language in URL if relevant. MedlinePlus supports only English or Spanish.
61 if ($language == 'es' ||
$language == 'spanish') {
62 $url .= '&informationRecipient.languageCode.c=es';
66 //."<script type=\"text/javascript\" src=\"". $webroot ."/interface/main/tabs/js/include_opener.js\"></script>"
68 echo "document.location.href = " . js_escape($url) . ";\n";
69 echo "</script></body></html>\n";
74 if ($language == 'es' ||
$language == 'spanish') {
77 $filename = strtolower("{$codetype}_{$codevalue}_{$lang}.pdf");
78 check_file_dir_name($filename);
79 $filepath = "$educationdir/$filename";
81 if (is_file($filepath)) {
82 $fileData = file_get_contents($filepath);
84 // Decrypt file, if applicable.
85 $cryptoGen = new CryptoGen();
86 if ($cryptoGen->cryptCheckStandard($fileData)) {
87 $fileData = $cryptoGen->decryptStandard($fileData, null, 'database');
90 header('Content-Description: File Transfer');
91 header('Content-Transfer-Encoding: binary');
93 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
94 header('Pragma: public');
95 // attachment, not inline
96 header("Content-Disposition: attachment; filename=\"$filename\"");
97 header("Content-Type: application/pdf");
98 header("Content-Length: " . strlen($fileData));
104 $errmsg = xl('There is no local content for this topic.');
112 <title
><?php
echo xlt('Education'); ?
></title
>
114 <?php Header
::setupHeader(); ?
>
118 <div
class="container mt-3">
123 echo xlt('Educational materials for');
124 echo ' ' . text($codetype) . ' ';
126 echo ' "' . text($codevalue) . '"';
128 echo ' ' . xlt('with preferred language') . ' ' .
129 text(getListItemTitle('language', $_REQUEST['language']));
135 echo "<p class='text-danger'>" . text($errmsg) . "</p>\n";
142 <form method
='post' action
='education.php' onsubmit
='return top.restoreSession()'>
143 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
144 <input type
='hidden' name
='type' value
='<?php echo attr($codetype); ?>' />
145 <input type
='hidden' name
='code' value
='<?php echo attr($codevalue); ?>' />
146 <input type
='hidden' name
='language' value
='<?php echo attr($language); ?>' />
147 <div
class='form-group'>
148 <label
for="source"><?php
echo xlt('Select source'); ?
></label
>
149 <select name
='source' id
='source' class='form-control'>
150 <option value
='MLP'><?php
echo xlt('MedlinePlus Connect'); ?
></option
>
151 <option value
='Local'><?php
echo xlt('Local Content'); ?
></option
>
154 <div
class='form-group'>
155 <div
class='btn-group' role
='group'>
156 <button type
='submit' class='btn btn-primary btn-search' name
='bn_submit' value
='bn_submit'>
157 <?php
echo xlt('Submit'); ?
>
159 <button type
='button' class='btn btn-secondary btn-cancel' onclick
='window.close()'>
160 <?php
echo xlt('Cancel'); ?
>