3 use OpenEMR\Core\Header
;
6 * Copyright (C) 2016 Kevin Yeh <kevin.y@integralemr.com>
7 * Copyright (C) 2016 Brady Miller <brady.g.miller@gmail.com>
9 * LICENSE: This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 3
12 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
21 * @author Kevin Yeh <kevin.y@integralemr.com>
22 * @author Brady Miller <brady.g.miller@gmail.com>
23 * @link http://www.open-emr.org
29 /* Include our required headers */
30 require_once('../../globals.php');
31 require_once $GLOBALS['srcdir'].'/ESign/Api.php';
33 $esignApi = new Api();
35 ?
><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
38 <title
><?php
echo text($openemr_name); ?
></title
>
40 <script type
="text/javascript">
41 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
43 // Since this should be the parent window, this is to prevent calls to the
44 // window that opened this window. For example when a new window is opened
45 // from the Patient Flow Board or the Patient Finder.
48 // This flag indicates if another window or frame is trying to reload the login
49 // page to this top-level window. It is set by javascript returned by auth.inc
50 // and is checked by handlers of beforeunload events.
51 var timed_out
= false;
53 // Include this variable for backward compatibility
54 var loadedFrameCount
= 0;
56 function allFramesLoaded() {
57 // Stub function for backward compatibility with frame race condition mechanism
61 function goRepeaterServices(){
63 // Ensure send the skip_timeout_reset parameter to not count this as a manual entry in the
64 // timing out mechanism in OpenEMR.
66 // Send the skip_timeout_reset parameter to not count this as a manual entry in the
67 // timing out mechanism in OpenEMR.
68 $
.post("<?php echo $GLOBALS['webroot']; ?>/library/ajax/dated_reminders_counter.php",
69 { skip_timeout_reset
: "1" },
72 app_view_model
.application_data
.user().messages(data
);
76 // run background-services
77 $
.post("<?php echo $GLOBALS['webroot']; ?>/library/ajax/execute_background_services.php",
78 { skip_timeout_reset
: "1", ajax
: "1" }
81 // auto run this function every 60 seconds
82 var repeater
= setTimeout("goRepeaterServices()", 60000);
85 function isEncounterLocked( encounterId
) {
86 <?php
if ($esignApi->lockEncounters()) { ?
>
87 // If encounter locking is enabled, make a syncronous call (async=false) to check the
88 // DB to see if the encounter is locked.
89 // Call restore session, just in case
93 url
: '<?php echo $GLOBALS['webroot
']?>/interface/esign/index.php?module=encounter&method=esign_is_encounter_locked',
94 data
: { encounterId
: encounterId
},
95 success
: function( data
) {
96 encounter_locked
= data
;
101 return encounter_locked
;
103 // If encounter locking isn't enabled then always return false
107 var webroot_url
="<?php echo $web_root; ?>";
110 <?php Header
::setupHeader(["knockout","tabs-theme",'jquery-ui']); ?
>
113 <link rel
="shortcut icon" href
="<?php echo $GLOBALS['images_static_relative']; ?>/favicon.ico" />
115 <script type
="text/javascript" src
="js/custom_bindings.js?v=<?php echo $v_js_includes; ?>"></script
>
116 <script type
="text/javascript" src
="js/user_data_view_model.js?v=<?php echo $v_js_includes; ?>"></script
>
117 <script type
="text/javascript" src
="js/patient_data_view_model.js?v=<?php echo $v_js_includes; ?>"></script
>
118 <script type
="text/javascript" src
="js/therapy_group_data_view_model.js?v=<?php echo $v_js_includes; ?>"></script
>
120 <script type
="text/javascript">
121 // Create translations to be used in the menuActionClick() function in below js/tabs_view_model.js script
122 var xl_strings_tabs_view_model
= <?php
echo json_encode(array(
123 'encounter_locked' => xla('This encounter is locked. No new forms can be added.'),
124 'must_select_patient' => $GLOBALS['enable_group_therapy'] ?
xla('You must first select or add a patient or therapy group.') : xla('You must first select or add a patient.'),
125 'must_select_encounter' => xla('You must first select or create an encounter.')
129 <script type
="text/javascript" src
="js/tabs_view_model.js?v=<?php echo $v_js_includes; ?>"></script
>
131 <script type
="text/javascript" src
="js/application_view_model.js?v=<?php echo $v_js_includes; ?>"></script
>
132 <script type
="text/javascript" src
="js/frame_proxies.js?v=<?php echo $v_js_includes; ?>"></script
>
133 <script type
="text/javascript" src
="js/dialog_utils.js?v=<?php echo $v_js_includes; ?>"></script
>
136 // Below code block is to prepare certain elements for deciding what links to show on the menu
138 // prepare newcrop globals that are used in creating the menu
139 if ($GLOBALS['erx_enable']) {
140 $newcrop_user_role_sql = sqlQuery("SELECT `newcrop_user_role` FROM `users` WHERE `username` = ?", array($_SESSION['authUser']));
141 $GLOBALS['newcrop_user_role'] = $newcrop_user_role_sql['newcrop_user_role'];
142 if ($GLOBALS['newcrop_user_role'] === 'erxadmin') {
143 $GLOBALS['newcrop_user_role_erxadmin'] = 1;
147 // prepare track anything to be used in creating the menu
148 $track_anything_sql = sqlQuery("SELECT `state` FROM `registry` WHERE `directory` = 'track_anything'");
149 $GLOBALS['track_anything_state'] = $track_anything_sql['state'];
150 // prepare Issues popup link global that is used in creating the menu
151 $GLOBALS['allow_issue_menu_link'] = ((acl_check('encounters', 'notes', '', 'write') ||
acl_check('encounters', 'notes_a', '', 'write')) &&
152 acl_check('patients', 'med', '', 'write'));
155 <?php
require_once("templates/tabs_template.php"); ?
>
156 <?php
require_once("templates/menu_template.php"); ?
>
157 <?php
require_once("templates/patient_data_template.php"); ?
>
158 <?php
require_once("templates/therapy_group_template.php"); ?
>
159 <?php
require_once("templates/user_data_template.php"); ?
>
160 <?php
require_once("menu/menu_json.php"); ?
>
161 <?php
$userQuery = sqlQuery("select * from users where username = ?", array($_SESSION['authUser'])); ?
>
162 <script type
="text/javascript">
163 <?php
if (!empty($_SESSION['frame1url']) && !empty($_SESSION['frame1target'])) { ?
>
164 app_view_model
.application_data
.tabs
.tabsList()[0].url(<?php
echo json_encode("../".$_SESSION['frame1url']); ?
>);
165 app_view_model
.application_data
.tabs
.tabsList()[0].name(<?php
echo json_encode($_SESSION['frame1target']); ?
>);
167 <?php
unset($_SESSION['frame1url']); ?
>
168 <?php
unset($_SESSION['frame1target']); ?
>
169 <?php
if (!empty($_SESSION['frame2url']) && !empty($_SESSION['frame2target'])) { ?
>
170 app_view_model
.application_data
.tabs
.tabsList()[1].url(<?php
echo json_encode("../".$_SESSION['frame2url']); ?
>);
171 app_view_model
.application_data
.tabs
.tabsList()[1].name(<?php
echo json_encode($_SESSION['frame2target']); ?
>);
173 <?php
unset($_SESSION['frame2url']); ?
>
174 <?php
unset($_SESSION['frame2target']); ?
>
176 app_view_model
.application_data
.user(new user_data_view_model(<?php
echo json_encode($_SESSION{"authUser"})
177 .',' . json_encode($userQuery['fname'])
178 .',' . json_encode($userQuery['lname'])
179 .',' . json_encode($_SESSION['authGroup']); ?
>));
185 <!-- Below iframe is to support auto logout when timeout is reached
-->
186 <iframe name
="timeout" style
="visibility:hidden; position:absolute; left:0; top:0; height:0; width:0; border:none;" src
="timeout_iframe.php"></iframe
>
187 <?php
// mdsupport - app settings
189 if (isset($_SESSION['app1'])) {
191 "SELECT title app_url FROM list_options WHERE activity=1 AND list_id=? AND option_id=?",
192 array('apps', $_SESSION['app1'])
194 if ($rs['app_url'] != "main/main_screen.php") {
195 echo '<iframe name="app1" src="../../'.attr($rs['app_url']).'"
196 style="position:absolute; left:0; top:0; height:100%; width:100%; border:none;" />';
197 $disp_mainBox = 'style="display: none;"';
201 <div id
="mainBox" <?php
echo $disp_mainBox ?
>>
202 <div id
="dialogDiv"></div
>
203 <div
class="body_top">
204 <a href
="http://www.open-emr.org" title
="OpenEMR <?php echo xla("Website
"); ?>" target
="_blank"><img
class="logo" alt
="openEMR small logo" style
="float: left; margin:3px 4px 0px 10px;width:20px;z-index:10000;" border
="0" src
="<?php echo $GLOBALS['images_static_relative']; ?>/menu-logo.png"></a
>
205 <span id
="menu logo" data
-bind
="template: {name: 'menu-template', data: application_data} "></span
>
206 <span id
="userData" data
-bind
="template: {name: 'user-data-template', data:application_data} "></span
>
208 <div id
="attendantData" class="body_title acck" data
-bind
="template: {name: app_view_model.attendant_template_type, data: application_data} ">
210 <div
class="body_title" data
-bind
="template: {name: 'tabs-controls', data: application_data} "> </div
>
212 <div
class="mainFrames">
213 <div id
="framesDisplay" data
-bind
="template: {name: 'tabs-frames', data: application_data}"> </div
>
217 $
("#dialogDiv").hide();
218 ko
.applyBindings(app_view_model
);
220 $
(document
).ready(function() {
221 $
('.dropdown-toggle').dropdown();
222 goRepeaterServices();
223 $
('#patient_caret').click(function() {
224 $
('#attendantData').slideToggle();
225 $
('#patient_caret').toggleClass('fa-caret-down').toggleClass('fa-caret-up');