Slimmed down version of class OemrUI - Take 4 (#2044)
[openemr.git] / interface / patient_file / summary / dashboard_header.php
blob2121049e47b2ced7a8f110e77d66b696878aa8ea
1 <?php
2 /**
3 * Dash Board Header.
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Ranganath Pathak <pathak@scrs1.org>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2018 Ranganath Pathak <pathak@scrs1.org>
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("$srcdir/display_help_icon_inc.php");
15 $url_webroot = $GLOBALS['webroot'];
16 $portal_login_href = $url_webroot ."/interface/patient_file/summary/create_portallogin.php";
19 <div class="page-header clearfix">
20 <?php echo $oemr_ui->pageHeading() . "\r\n"; ?>
21 <?php
22 // If patient is deceased, then show this (along with the number of days patient has been deceased for)
23 $days_deceased = is_patient_deceased($pid);
24 if ($days_deceased) { ?>
25 <p class="deceased" style="font-weight:bold;color:red">
27 <?php
28 $deceased_days = intval($days_deceased['days_deceased']);
29 if ($deceased_days == 0) {
30 $num_of_days = xl("Today");
31 } elseif ($deceased_days == 1) {
32 $num_of_days = $deceased_days . " " . xl("day ago");
33 } elseif ($deceased_days > 1 && $deceased_days < 90) {
34 $num_of_days = $deceased_days . " " . xl("days ago");
35 } elseif ($deceased_days >= 90 && $deceased_days < 731) {
36 $num_of_days = "~". round($deceased_days/30) . " " . xl("months ago"); // function intdiv available only in php7
37 } elseif ($deceased_days >= 731) {
38 $num_of_days = xl("More than") . " " . round($deceased_days/365) . " " . xl("years ago");
41 if (strlen($days_deceased['date_deceased']) > 10 && $GLOBALS['date_display_format'] < 1) {
42 $deceased_date = substr($days_deceased['date_deceased'], 0, 10);
43 } else {
44 $deceased_date = oeFormatShortDate($days_deceased['date_deceased']);
47 //echo xlt("Deceased") . " - " . text(oeFormatShortDate($days_deceased['date_deceased'])) . " (" . text($num_of_days) . ")" ;
48 echo xlt("Deceased") . " - " . text($deceased_date) . " (" . text($num_of_days) . ")" ;
50 </p>
51 <?php
52 } ?>
53 <div class="form-group">
55 <div class="btn-group oe-opt-btn-group-pinch" role="group">
57 <?php
58 if (acl_check('admin', 'super') && $GLOBALS['allow_pat_delete']) { ?>
60 <a class='btn btn-default btn-sm btn-delete deleter delete'
61 href='<?php echo attr($url_webroot)?>/interface/patient_file/deleter.php?patient=<?php echo attr_url($pid);?>&csrf_token_form=<?php echo attr_url(collectCsrfToken()); ?>'
62 onclick='return top.restoreSession()'>
63 <span><?php echo xlt('Delete');?></span>
64 </a>
65 <?php
66 } // Allow PT delete
67 if ($GLOBALS['erx_enable']) { ?>
68 <a class="btn btn-default btn-sm btn-add erx" href="<?php echo attr($url_webroot)?>/interface/eRx.php?page=medentry" onclick="top.restoreSession()">
69 <span><?php echo xlt('NewCrop MedEntry');?></span>
70 </a>
71 <a class="btn btn-default btn-sm btn-save iframe1"
72 href="<?php echo attr($url_webroot)?>/interface/soap_functions/soap_accountStatusDetails.php"
73 onclick="top.restoreSession()">
74 <span><?php echo xlt('NewCrop Account Status');?></span>
75 </a>
76 <!--<div id='accountstatus'></div>RP_MOVED-->
77 <?php
78 } // eRX Enabled
79 //Patient Portal
80 $portalUserSetting = true; //flag to see if patient has authorized access to portal
81 if (($GLOBALS['portal_onsite_enable'] && $GLOBALS['portal_onsite_address']) || ($GLOBALS['portal_onsite_two_enable'] && $GLOBALS['portal_onsite_two_address'])) {
82 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?", array($pid));
83 if ($portalStatus['allow_patient_portal']=='YES') {
84 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_onsite` WHERE `pid`=?", array($pid));?>
85 <?php $display_class = (empty($portalLogin)) ? "btn-save" : "btn-undo"; ?>
86 <a class='small_modal btn btn-default btn-sm <?php echo attr($display_class); ?>'
87 href='<?php echo attr($portal_login_href); ?>?portalsite=on&patient=<?php echo attr_url($pid);?>'
88 onclick='top.restoreSession()'>
89 <?php $display = (empty($portalLogin)) ? xl('Create Onsite Portal Credentials') : xl('Reset Onsite Portal Credentials'); ?>
90 <span><?php echo text($display); ?></span>
91 </a>
93 <?php
94 } else {
95 $portalUserSetting = false;
96 } // allow patient portal
97 } // Onsite Patient Portal
98 if ($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address']) {
99 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?", array($pid));
100 if ($portalStatus['allow_patient_portal']=='YES') {
101 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_offsite` WHERE `pid`=?", array($pid));
103 <?php $display_class = (empty($portalLogin)) ? "btn-save" : "btn-undo"; ?>
104 <a class='small_modal btn btn-default btn-sm <?php echo attr($display_class); ?>'
105 href='<?php echo attr($portal_login_href); ?>?portalsite=off&patient=<?php echo attr_url($pid);?>'
106 onclick='top.restoreSession()'>
107 <span>
108 <?php $text = (empty($portalLogin)) ? xl('Create Offsite Portal Credentials') : xl('Reset Offsite Portal Credentials'); ?>
109 <?php echo text($text); ?>
110 </span>
111 </a>
112 <?php
113 } else {
114 $portalUserSetting = false;
115 } // allow_patient_portal
116 } // portal_offsite_enable
117 if (!($portalUserSetting)) { // Show that the patient has not authorized portal access ?>
119 <i class="fa fa-exclamation-circle oe-text-orange" aria-hidden="true"></i> <?php echo xlt('Patient has not authorized the Patient Portal.');?>
120 </p>
121 <?php
123 //Patient Portal
124 if ($GLOBALS['erx_enable']) { ?>
125 <div id='accountstatus'></div>
126 <?php
127 } ?>
128 </div>
130 </div>
131 </div>