4cb1b3a4c35edf26413976d379c23467fdeee921
[openemr.git] / interface / main / main_screen.php
blob4cb1b3a4c35edf26413976d379c23467fdeee921
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 $_SESSION["encounter"] = '';
30 // Fetch the password expiration date
31 $is_expired=false;
32 if($GLOBALS['password_expiration_days'] != 0){
33 $is_expired=false;
34 $q= (isset($_POST['authUser'])) ? $_POST['authUser'] : '';
35 $result = sqlStatement("select pwd_expiration_date from users where username = ?", array($q));
36 $current_date = date('Y-m-d');
37 $pwd_expires_date = $current_date;
38 if($row = sqlFetchArray($result)) {
39 $pwd_expires_date = $row['pwd_expiration_date'];
42 // Display the password expiration message (starting from 7 days before the password gets expired)
43 $pwd_alert_date = date('Y-m-d', strtotime($pwd_expires_date . '-7 days'));
45 if (strtotime($pwd_alert_date) != '' &&
46 strtotime($current_date) >= strtotime($pwd_alert_date) &&
47 (!isset($_SESSION['expiration_msg'])
48 or $_SESSION['expiration_msg'] == 0)) {
49 $is_expired = true;
50 $_SESSION['expiration_msg'] = 1; // only show the expired message once
54 if ($is_expired) {
55 //display the php file containing the password expiration message.
56 $frame1url = "pwd_expires_alert.php";
58 else if (!empty($_POST['patientID'])) {
59 $patientID = 0 + $_POST['patientID'];
60 $frame1url = "../patient_file/summary/demographics.php?set_pid=".attr($patientID);
62 else if ($GLOBALS['athletic_team']) {
63 $frame1url = "../reports/players_report.php?embed=1";
65 else if (isset($_GET['mode']) && $_GET['mode'] == "loadcalendar") {
66 $frame1url = "calendar/index.php?pid=" . attr($_GET['pid']);
67 if (isset($_GET['date'])) $frame1url .= "&date=" . attr($_GET['date']);
69 else if ($GLOBALS['concurrent_layout']) {
70 // new layout
71 if ($GLOBALS['default_top_pane']) {
72 $frame1url=attr($GLOBALS['default_top_pane']);
73 } else {
74 $frame1url = "main_info.php";
77 else {
78 // old layout
79 $frame1url = "main.php?mode=" . attr($_GET['mode']);
82 $nav_area_width = $GLOBALS['athletic_team'] ? '230' : '130';
83 if (!empty($GLOBALS['gbl_nav_area_width'])) $nav_area_width = $GLOBALS['gbl_nav_area_width'];
85 <html>
86 <head>
87 <title>
88 <?php echo text($openemr_name) ?>
89 </title>
90 <script type="text/javascript" src="../../library/topdialog.js"></script>
92 <script language='JavaScript'>
93 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
95 // This counts the number of frames that have reported themselves as loaded.
96 // Currently only left_nav and Title do this, so the maximum will be 2.
97 // This is used to determine when those frames are all loaded.
98 var loadedFrameCount = 0;
100 function allFramesLoaded() {
101 // Change this number if more frames participate in reporting.
102 return loadedFrameCount >= 2;
104 </script>
106 </head>
108 <?php
110 // Please keep in mind that border (mozilla) and framespacing (ie) are the
111 // same thing. use both.
112 // frameborder specifies a 3d look, not whether there are borders.
114 if ($GLOBALS['concurrent_layout']) {
115 // start new layout
116 if (empty($GLOBALS['gbl_tall_nav_area'])) {
117 // not tall nav area ?>
118 <frameset rows='<?php echo attr($GLOBALS['titleBarHeight']) + 5 ?>,*' frameborder='1' border='1' framespacing='1' onunload='imclosing()'>
119 <frame src='main_title.php' name='Title' scrolling='no' frameborder='1' noresize />
120 <frameset cols='<?php echo attr($nav_area_width); ?>,*' id='fsbody' frameborder='1' border='4' framespacing='4'>
121 <frameset rows='*,0' frameborder='0' border='0' framespacing='0'>
122 <frame src='left_nav.php' name='left_nav' />
123 <frame src='daemon_frame.php' name='Daemon' scrolling='no' frameborder='0'
124 border='0' framespacing='0' />
125 </frameset>
126 <?php if (empty($GLOBALS['athletic_team'])) { ?>
127 <frameset rows='60%,*' id='fsright' bordercolor='#999999' frameborder='1'>
128 <?php } else { ?>
129 <frameset rows='100%,*' id='fsright' bordercolor='#999999' frameborder='1'>
130 <?php } ?>
131 <frame src='<?php echo $frame1url ?>' name='RTop' scrolling='auto' />
132 <frame src='messages/messages.php?form_active=1' name='RBot' scrolling='auto' />
133 </frameset>
134 </frameset>
135 </frameset>
137 <?php } else { // use tall nav area ?>
139 <frameset cols='<?php echo attr($nav_area_width); ?>,*' id='fsbody' frameborder='1' border='4' framespacing='4' onunload='imclosing()'>
140 <frameset rows='*,0' frameborder='0' border='0' framespacing='0'>
141 <frame src='left_nav.php' name='left_nav' />
142 <frame src='daemon_frame.php' name='Daemon' scrolling='no' frameborder='0'
143 border='0' framespacing='0' />
144 </frameset>
145 <frameset rows='<?php echo attr($GLOBALS['titleBarHeight']) + 5 ?>,*' frameborder='1' border='1' framespacing='1'>
146 <frame src='main_title.php' name='Title' scrolling='no' frameborder='1' />
147 <?php if (empty($GLOBALS['athletic_team'])) { ?>
148 <frameset rows='60%,*' id='fsright' bordercolor='#999999' frameborder='1' border='4' framespacing='4'>
149 <?php } else { ?>
150 <frameset rows='100%,*' id='fsright' bordercolor='#999999' frameborder='1' border='4' framespacing='4'>
151 <?php } ?>
152 <frame src='<?php echo $frame1url ?>' name='RTop' scrolling='auto' />
153 <frame src='messages/messages.php?form_active=1' name='RBot' scrolling='auto' />
154 </frameset>
155 </frameset>
156 </frameset>
158 <?php } // end tall nav area ?>
160 <?php } else { // start old layout ?>
162 </head>
163 <frameset rows="<?php echo attr($GLOBALS[navBarHeight]).",".attr($GLOBALS[titleBarHeight]) ?>,*"
164 cols="*" frameborder="no" border="0" framespacing="0"
165 onunload="imclosing()">
166 <frame src="main_navigation.php" name="Navigation" scrolling="no" noresize frameborder="no">
167 <frame src="main_title.php" name="Title" scrolling="no" noresize frameborder="no">
168 <frame src='<?php echo $frame1url ?>' name='Main' scrolling='auto' noresize frameborder='no'>
169 </frameset>
170 <noframes><body bgcolor="#FFFFFF">
171 <?php echo xlt('Frame support required'); ?>
172 </body></noframes>
174 <?php } // end old layout ?>
176 </html>