".__("No Admin Menu Access")."
";
template_display();
}
if ($action=="cfgform") {
// this is the frontend to the config
// database.
// Add help link for cfgform
$menu_bar[__("Configuration Help")] = help_url("admin.php", "cfgform");
//----- Create notebook widget
$book = CreateObject('PHP.notebook',
array('action'),
NOTEBOOK_TABS_LEFT | NOTEBOOK_COMMON_BAR | NOTEBOOK_STRETCH |
NOTEBOOK_SCROLL
);
$book->set_submit_name(__("Configure"));
$book->set_refresh_name(__("Refresh"));
$book->set_cancel_name(__("Cancel"));
//----- Pull in all configuration variables
if (!$book->been_here()) {
$query = "SELECT * FROM config";
$result = $sql->query($query);
while ($r = $sql->fetch_array($result)) {
extract($r);
${$c_option} = stripslashes($c_value);
}
//----- Push page onto the stack
page_push();
}
$page_title = "Configuration";
// Form static portion of configuration array
$book->add_page(
__("Standard Config"),
array($config_vars),
html_form::form_table(array(
__("Graphics Enhanced") =>
html_form::select_widget("gfx",
array (
__("Disabled") => "0",
__("Enabled") => "1"
)
),
__("Scheduling Start Time") =>
html_form::select_widget("calshr",
array (
__("Default") => "",
"4 am" => "4",
"5 am" => "5",
"6 am" => "6",
"7 am" => "7",
"8 am" => "8",
"9 am" => "9",
"10 am" => "10"
)
),
__("Scheduling End Time") =>
html_form::select_widget("calehr",
array (
__("Default") => "",
"2 pm" => "14",
"3 pm" => "15",
"4 pm" => "16",
"5 pm" => "17",
"6 pm" => "18",
"7 pm" => "19",
"8 pm" => "20",
"9 pm" => "21",
"10 pm" => "22",
"11 pm" => "23"
)
),
__("Calendar Overbooking") =>
html_form::select_widget("cal_ob",
array (
__("Enabled") => "enable",
__("Disabled") => "disable"
)
),
__("Date Format") =>
html_form::select_widget("dtfmt",
array (
"YYYY-MM-DD" => "ymd",
"MM-DD-YYYY" => "mdy",
"DD-MM-YYYY" => "dmy",
"YYYY-DD-MM" => "ydm"
)
),
__("Phone Number Format") =>
html_form::select_widget("phofmt",
array (
__("United States")." (XXX) XXX-XXXX" => "usa",
__("France")." (XX) XX XX XX XX" => "fr",
__("Unformatted")." XXXXXXXXXX" => "unformatted"
)
),
__("Prescription Drug Widget") =>
html_form::select_widget("drug_widget_type",
array (
__("rxlist.com Drug Listing") => 'rxlist',
__("Combo with past drugs") => 'combobox'
)
),
__("Date Widget") =>
html_form::select_widget("date_widget_type",
array (
__("javascript widget") => 'js',
__("split text entry") => 'split'
)
),
__("Fold Multipage Forms?") =>
html_form::select_widget("folded",
array (
__("yes") => "yes",
__("no") => "no"
)
),
__("Fax Cover Page") =>
html_form::select_widget("fax_nocover",
array (
__("Attach Cover Page") => "0",
__("No Cover Page") => "1"
)
),
__("Lock Record Override") =>
freemed::multiple_choice (
"SELECT CONCAT(username, ' (', userdescrip, ')') ".
"AS descrip, id FROM user ORDER BY descrip",
"descrip",
"lock_override",
fm_join_from_array($lock_override)
)
))
);
// Check for dynamic components
if (!is_object($module_list)) {
$module_list = freemed::module_cache();
}
// Loop
foreach ($GLOBALS['__phpwebtools']['GLOBAL_MODULES'] AS $__crap => $v) {
if (is_array($v['META_INFORMATION']['global_config'])) {
$this_one = $v['META_INFORMATION']['global_config'];
foreach ($this_one AS $gc_k => $gc_v) {
// If we find ::'s... (for function)
if (!(strpos($gc_v, '::') === false)) {
$command = '$this_one["'.$gc_k.'"] = '.$gc_v.';';
//print "eval : ".$command."
\n";
eval($command);
} else {
$this_one["$gc_k"] = $gc_v;
}
}
$book->add_page(
__($v['MODULE_NAME']),
$v['META_INFORMATION']['global_config_vars'],
html_form::form_table($this_one)
);
}
}
if ($book->is_done()) {
$page_title = __("System Configuration");
$display_buffer .= "\n";
// Check for dynamic components for config_vars
if (!is_object($module_list)) {
$module_list = CreateObject('PHP.module_list', PACKAGENAME, 'modules/');
}
foreach ($GLOBALS['__phpwebtools']['GLOBAL_MODULES'] AS $__crap => $v) {
if (is_array($v['META_INFORMATION']['global_config_vars'])) {
$config_vars = array_merge (
$config_vars,
$v['META_INFORMATION']['global_config_vars']
);
}
}
//----- Commit all configuration variables
foreach ($config_vars AS $_garbage => $v) {
$_q = "SELECT * FROM config WHERE ".
"c_option='".addslashes($v)."'";
$_r = $sql->query($_q);
if (!$sql->results($_r)) {
$q = $sql->insert_query(
'config',
array (
'c_option' => $v,
'c_value' => ${$v}
)
);
} else {
$q = $sql->update_query(
'config',
array ('c_value' => ${$v}),
array('c_option' => $v)
);
}
$query = $sql->query($q);
if (($debug) AND ($q))
$display_buffer .= "$v = ${$v}
\n";
}
$display_buffer .= "
".__("Configuration Complete")."
";
} elseif ($book->is_cancelled()) {
Header("Location: ".page_name());
die();
} else {
$display_buffer .= $book->display();
}
} elseif ($action=="reinit") {
$page_title = __("Reinitialize Database");
// here, to prevent problems, we ask the user to check that they
// REALLY want to...
$display_buffer .= "\n\n";
$display_buffer .= __("Are you sure you want to reinitialize the database?")."\n";
$display_buffer .= "
".__("This is an IRREVERSIBLE PROCESS!")."
\n";
$display_buffer .= "\n
\n";
$display_buffer .= "
\n";
$display_buffer .= "
";
} elseif ($action=="reinit_sure") {
// here we actually put the reinitialization (read - wiping
// and creating the database structure again) code... so that
// stupids don't accidentally click on it and... oops!
// Notice that all of the possible essential table definitions
// (except for module) have been moved out of admin. This is
// to increase ease of upgrade, etc. They are in hidden
// modules.
$display_buffer .= "".__("Creating tables")."... \n";
$display_buffer .= "$re_load\n";
// generate test table, if debug is on
// Fred Trotter
// Moved to the new class.Debug
if ($debug) {
$this_debug = CreateObject('FreeMED.Debug');
$result=$this_debug->init();
if ($result) { $display_buffer .= "- ".__("test db")."
\n"; }
} // end debug section
// Generate module table
// Fred Trotter
// New reference to BaseModule...
$this_module = CreateObject('FreeMED.BaseModule');
$result = $this_module->init();
if ($result) { $display_buffer .= "- ".__("Modules")."
\n"; }
// Generate user db
// Fred Trotter
// In order to seperate database access from super user access in freemed
// from the database user and password I need to first recover the password
// for the new "admin" user account and reuse it in the new database
$result=$sql->query("SELECT * FROM user".
"WHERE username = 'admin' AND id = 1");
$r = $sql->fetch_array ($result);
$admin_password=$r['userpassword'];
$this_user = CreateObject('FreeMED.User');
$result = $this_user->init($admin_password);
/*
eventually wrapper should handle...
PRIMARY KEY (id),
UNIQUE idx_id (id),
KEY (username),
UNIQUE idx_username (username)
*/
if ($result) $display_buffer .= "- ".__("Users")."
\n";
if ($result) $display_buffer .= "- [[".
__("Added admin")."]]
\n";
/**********************************************************************
// generate physician availability map
$result=$sql->query("DROP TABLE phyavailmap");
$result=$sql->query("CREATE TABLE phyavailmap (
pamdatefrom DATE,
pamdateto DATE,
pamtimefromhour INT UNSIGNED,
pamtimefrommin INT UNSIGNED,
pamtimetohour INT UNSIGNED,
pamtimetomin INT UNSIGNED,
pamphysician INT UNSIGNED,
pamcomment VARCHAR(75),
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
)");
if ($result) $display_buffer .= "- ".__("Physician Availability Map")."
\n";
// generate room equipment inventory db
$result=$sql->query("DROP TABLE roomequip");
$result=$sql->query("CREATE TABLE roomequip (
reqname VARCHAR(100),
reqdescrip TEXT,
reqdateadd DATE,
reqdatemod DATE,
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
)");
if ($result) $display_buffer .= "- ".__("Room Equipment")."
\n";
if ($re_load)
{
if (freemed_import_stock_data("roomequip"))
$display_buffer .= "(".__("Stock Room Equipment Data").") \n ";
}
*/
/**********************************************************************
May need this later, but for now, don't use
**********************************************************************
// generate action log table db
$result=$sql->query("DROP TABLE log");
$result=$sql->query($sql->create_table_query(
'log',
array (
'datestamp' => SQL_DATE,
'user' => SQL_INT_UNSIGNED(0),
'db_name' => SQL_VARCHAR(20),
'rec_num' => SQL_INT_UNSIGNED(0),
'comment' => SQL_TEXT,
'id' => SQL_SERIAL
), array ('id')
));
if ($result) $display_buffer .= "- ".__("Action Log")."
\n";
**********************************************************************/
//----- Initialize configuration
$this_config = CreateObject('FreeMED.GeneralConfig');
$result = $this_config->init();
/********************************************************************
***** Fax tables... need to be reenabled
********************************************************************
// generate incoming faxes table
$result=$sql->query("DROP TABLE infaxes");
$result=$sql->query("CREATE TABLE infaxes (
infcode VARCHAR(5),
infsender VARCHAR(50),
inftotpages INT UNSIGNED,
infthispage INT UNSIGNED,
inftimestamp TIMESTAMP,
infimage VARCHAR(50),
inforward ENUM(\"no\",\"yes\") NOT NULL,
infack ENUM(\"no\",\"yes\") NOT NULL,
infptid VARCHAR(10),
infphysid VARCHAR(10),
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
);");
if ($result) $display_buffer .= "- ".__("Incoming Faxes")."
\n";
// generate fax sender lookup table
$result=$sql->query("DROP TABLE infaxlut");
$result=$sql->query("CREATE TABLE infaxlut (
lutsender VARCHAR(50),
lutname VARCHAR(50),
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
);");
if ($result) $display_buffer .= "- ".__("Fax Sender Lookup")."
\n";
*******************************************************************
Printer table
*******************************************************************
// generate printers table (19991008)
$result = $sql->query ("DROP TABLE printer");
$result = $sql->query ("CREATE TABLE printer (
prntname VARCHAR(50),
prnthost VARCHAR(50),
prntaclvl ENUM(\"9\",\"8\",\"7\",\"6\",\"5\",\"4\",\"3\",\"2\",\"1\",\"0\") NOT NULL,
prntdesc VARCHAR(100),
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
);");
if ($result) $display_buffer .= "- ".__("Printers")."
\n";
********************************************************************
***** Simple reports ... support needs to be added again
********************************************************************
// generate simple reports table
$result=$sql->query("DROP TABLE simplereport");
$result=$sql->query("CREATE TABLE simplereport (
sr_label VARCHAR(50),
sr_type INT UNSIGNED,
sr_text TEXT,
sr_textf TEXT,
sr_textcm TEXT,
sr_textcf TEXT,
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
)");
if ($result) $display_buffer .= "- ".__("Simple Reports")."
\n";
// old reports
$result = $sql->query ("DROP TABLE oldreports");
$result = $sql->query ("CREATE TABLE oldreports (
oldrep_timestamp DATE,
oldrep_label VARCHAR(50),
oldrep_type INT UNSIGNED,
oldrep_sender INT UNSIGNED,
oldrep_delivery VARCHAR(20),
oldrep_author INT UNSIGNED,
oldrep_dateline VARCHAR(100),
oldrep_header1 VARCHAR(100),
oldrep_header2 VARCHAR(100),
oldrep_header3 VARCHAR(100),
oldrep_header4 VARCHAR(100),
oldrep_header5 VARCHAR(100),
oldrep_header6 VARCHAR(100),
oldrep_header7 VARCHAR(100),
oldrep_dest1 VARCHAR(100),
oldrep_dest2 VARCHAR(100),
oldrep_dest3 VARCHAR(100),
oldrep_dest4 VARCHAR(100),
oldrep_signature1 VARCHAR(100),
oldrep_signature2 VARCHAR(100),
oldrep_text TEXT,
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
);");
if ($result) $display_buffer .= "- ".__("Old Reports")."
\n";
********************************************************************/
// Initial module load
$modules = CreateObject('PHP.module_list', PACKAGENAME);
// now generate "return code" so that we can get back to the
// admin menu... or perhaps skip that... ??
$display_buffer .= "
".__("done").".
\n";
$display_buffer .= "
".template::link_button(
__("Return to Administration Menu"),
"admin.php"
)."
";
} else {
// actual menu code for admin menu goes here \/
//----- Set page title
$page_title = __("Administration Menu");
//----- Push page onto the stack
page_push();
$display_buffer .= "
| ".__("Action")." |
"; // begin standard font
$userdata = $_SESSION["authdata"];
$display_buffer .= "
|
".__("Export Databases")."
|
|
".__("Import Databases")."
|
|
".__("Module Information")."
|
";
//----- This is depreciated with the use of the init_wizard
//if ($userdata["user"]==1) // if we are root...
// $display_buffer .= "
//
//
// |
// ".__("Reinitialize Database")."
// |
// ";
$display_buffer .= "
|
".__("System Configuration")."
|
";
if ($userdata["user"] == 1) { // if we are root...
$display_buffer .= "
|
".__("User Maintenance")."
|
";
}
// Load dynamic modules for administration via AdminMenu handler
LoadObjectDependency('PHP.module');
$admin_actions = freemed::module_handler('AdminMenu');
if (is_array($admin_actions)) {
foreach ($admin_actions as $class => $handler) {
GettextXML::textdomain(strtolower($class));
$title = freemed::module_get_value($class, 'MODULE_NAME');
$icon = freemed::module_get_value($class, 'ICON');
$display_buffer .= "
|
".__($title)."
|
";
}
} // end if is array admin_actions
$display_buffer .= "
\n";
}
$display_buffer .= "
"; // return to main menu tab...
//----- Display template
template_display();
?>