bug fix to allow default selection of only a single provider
[openemr.git] / interface / main / calendar / index.php
blob44a1b20edc0793b11d7c89352d173d56b8257cd7
1 <?php
2 // File: $Id$ $Name$
3 // ----------------------------------------------------------------------
4 // POST-NUKE Content Management System
5 // Copyright (C) 2001 by the Post-Nuke Development Team.
6 // http://www.postnuke.com/
7 // ----------------------------------------------------------------------
8 // Based on:
9 // PHP-NUKE Web Portal System - http://phpnuke.org/
10 // Thatware - http://thatware.org/
11 // ----------------------------------------------------------------------
12 // LICENSE
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License (GPL)
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
24 // To read the license please visit http://www.gnu.org/copyleft/gpl.html
25 // ----------------------------------------------------------------------
26 // Original Author of this file: Francisco Burzi
27 // Purpose of this file: Directs to the start page as defined in config.php
28 // ----------------------------------------------------------------------
30 // include base api
33 //$ignoreAuth = true;
34 include_once("../../globals.php");
35 include_once("$srcdir/calendar.inc");
36 include_once("$srcdir/patient.inc");
37 include "includes/pnre.inc.php";
38 include 'includes/pnAPI.php';
40 // From Michael Brinson 2006-09-19:
41 if ($_POST['pc_username']) $_SESSION['pc_username'] = $_POST['pc_username'];
43 // bug fix to allow default selection of a provider
44 if ($_GET['pc_username']) $_SESSION['pc_username'] = $_GET['pc_username'];
46 // FACILITY FILTERING (lemonsoftware)
47 $_SESSION['pc_facility'] = ( $_POST['pc_facility'] ) ? $_POST['pc_facility'] : '0';
49 //if (empty($_GET['no_nav'])) {
50 // $_SESSION['last_calendar_page'] = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
51 //}
53 //print_r($_SESSION);
54 // start PN
55 pnInit();
57 // Get variables
58 list($module,
59 $func,
60 $op,
61 $name,
62 $file,
63 $type,) = pnVarCleanFromInput('module',
64 'func',
65 'op',
66 'name',
67 'file',
68 'type');
70 // Defaults for variables
71 if (isset($catid)) {
72 pnVarCleanFromInput('catid');
75 // check requested module and set to start module if not present
76 if (empty($name)) {
77 $name = pnConfigGetVar('startpage');
78 // fixed for the new style of loading modules and set start page for them [class007]
79 if (empty($module)) {
80 $module = $name;
84 // get module information
85 $modinfo = pnModGetInfo(pnModGetIDFromName($module));
87 if ($modinfo['type'] == 2)
89 // New-new style of loading modules
90 if (empty($type)) {
91 $type = 'user';
93 if (empty($func)) {
94 $func="main";
97 // it should be $module not $name [class007]
98 if (pnModAvailable($module)) {
99 if (pnModLoad($module, $type)) {
100 // Run the function
101 $return = pnModFunc($module, $type, $func);
102 } else {
103 $return = false;
105 } else {
106 $return = false;
112 // Sort out return of function. Can be
113 // true - finished
114 // false - display error msg
115 // text - return information
116 if ((empty($return)) || ($return == false)) {
117 // Failed to load the module
118 $output = new pnHTML();
119 $output->StartPage();
120 $output->Text('Failed to load module ' . $module .' ( At function: "'.$func.'" )');
121 $output->EndPage();
122 $output->PrintPage();
123 exit;
124 } elseif (strlen($return) > 1) {
125 // Text
126 $output = new pnHTML();
127 //$output->StartPage();
128 $output->SetInputMode(_PNH_VERBATIMINPUT);
129 $output->Text($return);
130 $output->SetInputMode(_PNH_PARSEINPUT);
131 //$output->EndPage();
132 $output->PrintPage();
134 } else {
138 exit;
139 } else {
140 // Old-old style of loading modules
141 if (empty($op)) {
142 $op = "modload";
144 if (empty($file)) {
145 $file="index";
148 include 'includes/legacy.php';
149 switch ($op) {
150 case 'modload':
152 define("LOADED_AS_MODULE","1");
153 // added for the module/system seperation [class007]
154 if (file_exists('modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php')) {
155 include 'modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php';
156 } else {
157 // Failed to load the module
158 $output = new pnHTML();
159 //$output->StartPage();
160 $output->Text('Failed to load module ' . $module);
161 $output->EndPage();
162 $output->PrintPage();
163 exit;
165 break;
166 default:
167 // Failed to load the module
168 $output = new pnHTML();
169 //$output->StartPage();
170 $output->Text('Sorry, you cannot access this file directly...');
171 $output->EndPage();
172 $output->PrintPage();
173 break;