calendar updates: support for preferred category in IN event, visual improvements...
[openemr.git] / interface / main / calendar / index.php
blobe1e285dd8bd32873e1b2b9a8129c0f7fd9110c88
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 //if (empty($_GET['no_nav'])) {
41 // $_SESSION['last_calendar_page'] = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
42 //}
44 //print_r($_SESSION);
45 // start PN
46 pnInit();
48 // Get variables
49 list($module,
50 $func,
51 $op,
52 $name,
53 $file,
54 $type,) = pnVarCleanFromInput('module',
55 'func',
56 'op',
57 'name',
58 'file',
59 'type');
61 // Defaults for variables
62 if (isset($catid)) {
63 pnVarCleanFromInput('catid');
66 // check requested module and set to start module if not present
67 if (empty($name)) {
68 $name = pnConfigGetVar('startpage');
69 // fixed for the new style of loading modules and set start page for them [class007]
70 if (empty($module)) {
71 $module = $name;
75 // get module information
76 $modinfo = pnModGetInfo(pnModGetIDFromName($module));
78 if ($modinfo['type'] == 2)
80 // New-new style of loading modules
81 if (empty($type)) {
82 $type = 'user';
84 if (empty($func)) {
85 $func="main";
88 // it should be $module not $name [class007]
89 if (pnModAvailable($module)) {
90 if (pnModLoad($module, $type)) {
91 // Run the function
92 $return = pnModFunc($module, $type, $func);
93 } else {
94 $return = false;
96 } else {
97 $return = false;
103 // Sort out return of function. Can be
104 // true - finished
105 // false - display error msg
106 // text - return information
107 if ((empty($return)) || ($return == false)) {
108 // Failed to load the module
109 $output = new pnHTML();
110 $output->StartPage();
111 $output->Text('Failed to load module ' . $module .' ( At function: "'.$func.'" )');
112 $output->EndPage();
113 $output->PrintPage();
114 exit;
115 } elseif (strlen($return) > 1) {
116 // Text
117 $output = new pnHTML();
118 //$output->StartPage();
119 $output->SetInputMode(_PNH_VERBATIMINPUT);
120 $output->Text($return);
121 $output->SetInputMode(_PNH_PARSEINPUT);
122 //$output->EndPage();
123 $output->PrintPage();
125 } else {
129 exit;
130 } else {
131 // Old-old style of loading modules
132 if (empty($op)) {
133 $op = "modload";
135 if (empty($file)) {
136 $file="index";
139 include 'includes/legacy.php';
140 switch ($op) {
141 case 'modload':
143 define("LOADED_AS_MODULE","1");
144 // added for the module/system seperation [class007]
145 if (file_exists('modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php')) {
146 include 'modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php';
147 } else {
148 // Failed to load the module
149 $output = new pnHTML();
150 //$output->StartPage();
151 $output->Text('Failed to load module ' . $module);
152 $output->EndPage();
153 $output->PrintPage();
154 exit;
156 break;
157 default:
158 // Failed to load the module
159 $output = new pnHTML();
160 //$output->StartPage();
161 $output->Text('Sorry, you cannot access this file directly...');
162 $output->EndPage();
163 $output->PrintPage();
164 break;