982b1322a04b1635ac993ec59348a5127b0d5795
[openemr.git] / interface / main / main_screen.php
blob982b1322a04b1635ac993ec59348a5127b0d5795
1 <?php
2 /**
3 * The outside frame that holds all of the OpenEMR User Interface.
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
16 * @package OpenEMR
17 * @author Brady Miller <brady@sparmy.com>
18 * @link http://www.open-emr.org
21 $fake_register_globals=false;
22 $sanitize_all_escapes=true;
24 /* Include our required headers */
25 require_once('../globals.php');
26 require_once("$srcdir/formdata.inc.php");
28 // Creates a new session id when load this outer frame
29 // (allows creations of separate OpenEMR frames to view patients concurrently
30 // on different browser frame/windows)
31 // This session id is used below in the restoreSession.php include to create a
32 // session cookie for this specific OpenEMR instance that is then maintained
33 // within the OpenEMR instance by calling top.restoreSession() whenever
34 // refreshing or starting a new script.
35 session_regenerate_id();
37 $_SESSION["encounter"] = '';
39 // Fetch the password expiration date
40 $is_expired=false;
41 if($GLOBALS['password_expiration_days'] != 0){
42 $is_expired=false;
43 $q= (isset($_POST['authUser'])) ? $_POST['authUser'] : '';
44 $result = sqlStatement("select pwd_expiration_date from users where username = ?", array($q));
45 $current_date = date('Y-m-d');
46 $pwd_expires_date = $current_date;
47 if($row = sqlFetchArray($result)) {
48 $pwd_expires_date = $row['pwd_expiration_date'];
51 // Display the password expiration message (starting from 7 days before the password gets expired)
52 $pwd_alert_date = date('Y-m-d', strtotime($pwd_expires_date . '-7 days'));
54 if (strtotime($pwd_alert_date) != '' &&
55 strtotime($current_date) >= strtotime($pwd_alert_date) &&
56 (!isset($_SESSION['expiration_msg'])
57 or $_SESSION['expiration_msg'] == 0)) {
58 $is_expired = true;
59 $_SESSION['expiration_msg'] = 1; // only show the expired message once
63 if ($is_expired) {
64 //display the php file containing the password expiration message.
65 $frame1url = "pwd_expires_alert.php";
67 else if (!empty($_POST['patientID'])) {
68 $patientID = 0 + $_POST['patientID'];
69 $frame1url = "../patient_file/summary/demographics.php?set_pid=".attr($patientID);
71 else if ($GLOBALS['athletic_team']) {
72 $frame1url = "../reports/players_report.php?embed=1";
74 else if (isset($_GET['mode']) && $_GET['mode'] == "loadcalendar") {
75 $frame1url = "calendar/index.php?pid=" . attr($_GET['pid']);
76 if (isset($_GET['date'])) $frame1url .= "&date=" . attr($_GET['date']);
78 else if ($GLOBALS['concurrent_layout']) {
79 // new layout
80 if ($GLOBALS['default_top_pane']) {
81 $frame1url=attr($GLOBALS['default_top_pane']);
82 } else {
83 $frame1url = "main_info.php";
86 else {
87 // old layout
88 $frame1url = "main.php?mode=" . attr($_GET['mode']);
91 $nav_area_width = $GLOBALS['athletic_team'] ? '230' : '130';
92 if (!empty($GLOBALS['gbl_nav_area_width'])) $nav_area_width = $GLOBALS['gbl_nav_area_width'];
94 <html>
95 <head>
96 <title>
97 <?php echo text($openemr_name) ?>
98 </title>
99 <script type="text/javascript" src="../../library/topdialog.js"></script>
101 <script language='JavaScript'>
102 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
104 // This counts the number of frames that have reported themselves as loaded.
105 // Currently only left_nav and Title do this, so the maximum will be 2.
106 // This is used to determine when those frames are all loaded.
107 var loadedFrameCount = 0;
109 function allFramesLoaded() {
110 // Change this number if more frames participate in reporting.
111 return loadedFrameCount >= 2;
113 </script>
115 </head>
117 <?php
119 // Please keep in mind that border (mozilla) and framespacing (ie) are the
120 // same thing. use both.
121 // frameborder specifies a 3d look, not whether there are borders.
123 if ($GLOBALS['concurrent_layout']) {
124 // start new layout
125 if (empty($GLOBALS['gbl_tall_nav_area'])) {
126 // not tall nav area ?>
127 <frameset rows='<?php echo attr($GLOBALS['titleBarHeight']) + 5 ?>,*' frameborder='1' border='1' framespacing='1' onunload='imclosing()'>
128 <frame src='main_title.php' name='Title' scrolling='no' frameborder='1' noresize />
129 <frameset cols='<?php echo attr($nav_area_width); ?>,*' id='fsbody' frameborder='1' border='4' framespacing='4'>
130 <frameset rows='*,0' frameborder='0' border='0' framespacing='0'>
131 <frame src='left_nav.php' name='left_nav' />
132 <frame src='daemon_frame.php' name='Daemon' scrolling='no' frameborder='0'
133 border='0' framespacing='0' />
134 </frameset>
135 <?php if (empty($GLOBALS['athletic_team'])) { ?>
136 <frameset rows='60%,*' id='fsright' bordercolor='#999999' frameborder='1'>
137 <?php } else { ?>
138 <frameset rows='100%,*' id='fsright' bordercolor='#999999' frameborder='1'>
139 <?php } ?>
140 <frame src='<?php echo $frame1url ?>' name='RTop' scrolling='auto' />
141 <frame src='messages/messages.php?form_active=1' name='RBot' scrolling='auto' />
142 </frameset>
143 </frameset>
144 </frameset>
146 <?php } else { // use tall nav area ?>
148 <frameset cols='<?php echo attr($nav_area_width); ?>,*' id='fsbody' frameborder='1' border='4' framespacing='4' onunload='imclosing()'>
149 <frameset rows='*,0' frameborder='0' border='0' framespacing='0'>
150 <frame src='left_nav.php' name='left_nav' />
151 <frame src='daemon_frame.php' name='Daemon' scrolling='no' frameborder='0'
152 border='0' framespacing='0' />
153 </frameset>
154 <frameset rows='<?php echo attr($GLOBALS['titleBarHeight']) + 5 ?>,*' frameborder='1' border='1' framespacing='1'>
155 <frame src='main_title.php' name='Title' scrolling='no' frameborder='1' />
156 <?php if (empty($GLOBALS['athletic_team'])) { ?>
157 <frameset rows='60%,*' id='fsright' bordercolor='#999999' frameborder='1' border='4' framespacing='4'>
158 <?php } else { ?>
159 <frameset rows='100%,*' id='fsright' bordercolor='#999999' frameborder='1' border='4' framespacing='4'>
160 <?php } ?>
161 <frame src='<?php echo $frame1url ?>' name='RTop' scrolling='auto' />
162 <frame src='messages/messages.php?form_active=1' name='RBot' scrolling='auto' />
163 </frameset>
164 </frameset>
165 </frameset>
167 <?php } // end tall nav area ?>
169 <?php } else { // start old layout ?>
171 </head>
172 <frameset rows="<?php echo attr($GLOBALS[navBarHeight]).",".attr($GLOBALS[titleBarHeight]) ?>,*"
173 cols="*" frameborder="no" border="0" framespacing="0"
174 onunload="imclosing()">
175 <frame src="main_navigation.php" name="Navigation" scrolling="no" noresize frameborder="no">
176 <frame src="main_title.php" name="Title" scrolling="no" noresize frameborder="no">
177 <frame src='<?php echo $frame1url ?>' name='Main' scrolling='auto' noresize frameborder='no'>
178 </frameset>
179 <noframes><body bgcolor="#FFFFFF">
180 <?php echo xlt('Frame support required'); ?>
181 </body></noframes>
183 <?php } // end old layout ?>
185 </html>