require_once $root_path . 'include/inc_front_chain_lang.php';
$breakfile = 'edv-system-admi-welcome.php' . URL_APPEND;
if ($from == 'add') {
    $returnfile = 'edv_system_format_menu_item_add.php' . URL_APPEND . '&from=set';
} else {
    $returnfile = $breakfile;
}
$thisfile = basename($_SERVER['PHP_SELF']);
$editfile = 'edv_system_format_menu_item_add.php' . URL_REDIRECT_APPEND . '&mode=edit&from=set&item_no=';
if (!isset($GCONFIG)) {
    $GCONFIG = array();
}
require_once $root_path . 'include/care_api_classes/class_globalconfig.php';
$gc = new GlobalConfig($GCONFIG);
if (isset($mode) && $mode == 'save' && !empty($max_items)) {
    $gc->saveConfigItem('theme_control_buttons', $_POST['theme_control_buttons']);
    header('location:' . $thisfile . URL_REDIRECT_APPEND . '&mode=0');
    exit;
}
# Start Smarty templating here
/**
 * LOAD Smarty
 */
# Note: it is advisable to load this after the inc_front_chain_lang.php so
# that the smarty script can use the user configured template theme
require_once $root_path . 'gui/smarty_template/smarty_care.class.php';
$smarty = new smarty_care('system_admin');
# Title in toolbar
$smarty->assign('sToolbarTitle', $LDTheme);
# href for return button
$smarty->assign('pbBack', $returnfile);
}
if (!isset($date_format)) {
    $date_format = '';
}
if (!isset($validator)) {
    $validator = '';
}
$dbtable = 'care_config_global';
// Table name for global configurations
$GLOBAL_CONFIG = array();
$new_date_ok = 0;
# Create global config object
require_once $root_path . 'include/care_api_classes/class_globalconfig.php';
$glob_obj = new GlobalConfig($GLOBAL_CONFIG);
if ($mode == 'save' && $date_format != '' && eregi($date_format, $validator)) {
    $new_date_ok = $glob_obj->saveConfigItem('date_format', $date_format);
} else {
    if ($glob_obj->getConfig('date_format')) {
        $date_format = $GLOBAL_CONFIG['date_format'];
    }
}
# Start Smarty templating here
/**
 * LOAD Smarty
 */
# Note: it is advisable to load this after the inc_front_chain_lang.php so
# that the smarty script can use the user configured template theme
require_once $root_path . 'gui/smarty_template/smarty_care.class.php';
$smarty = new smarty_care('system_admin');
# Title in toolbar
$smarty->assign('sToolbarTitle', $LDDate);
$editfile = 'edv_system_format_menu_item_add.php' . URL_REDIRECT_APPEND . '&mode=edit&from=set&item_no=';
/**
* Load the db routine
*/
if (!isset($GCONFIG)) {
    $GCONFIG = array();
}
include_once $root_path . 'include/care_api_classes/class_globalconfig.php';
$gc = new GlobalConfig($GCONFIG);
if (isset($mode) && $mode == 'save' && !empty($max_items)) {
    for ($i = 1; $i <= $max_items; $i++) {
        if (empty($_POST["value{$i}"])) {
            $_POST["value{$i}"] = '0';
        }
        //echo $_POST["index$i"].'==>'.$_POST["value$i"].'<br>';
        $gc->saveConfigItem($_POST["index{$i}"], $_POST["value{$i}"]);
    }
    header('location:' . $thisfile . URL_REDIRECT_APPEND . '&mode=0');
    exit;
} else {
    $gc->getConfig('person_%_hide');
    $gc->getConfig('patient_%_hide');
    $gc->getConfig('patient_%_show');
}
# Start Smarty templating here
/**
 * LOAD Smarty
 */
# Note: it is advisable to load this after the inc_front_chain_lang.php so
# that the smarty script can use the user configured template theme
require_once $root_path . 'gui/smarty_template/smarty_care.class.php';
*/
$GLOBALCONFIG = array();
require_once $root_path . 'include/care_api_classes/class_globalconfig.php';
$gc = new GlobalConfig($GLOBALCONFIG);
if (isset($mode) && $mode == 'save') {
    /*	$db->Execute("REPLACE INTO care_config_global (type,value) VALUES ('gui_frame_left_nav_resize','$bg_resize')";
    
    	if(!empty($bg_width)){
    		$db->Execute("REPLACE INTO care_config_global (type,value) VALUES ('gui_frame_left_nav_width','$bg_width')";
    	}
    	if(!empty($bg_color)){
    		$db->Execute("REPLACE INTO care_config_global (type,value) VALUES ('gui_frame_left_nav_border','$bg_border')";
    	}
    */
    //echo $bg_resize; exit;
    $gc->saveConfigItem('gui_frame_left_nav_border', $bg_border);
    $gc->saveConfigItem('gui_frame_left_nav_width', $bg_width);
    $gc->saveConfigItem('gui_frame_left_nav_bdcolor', $bg_bdcolor);
    $gc->saveConfigItem('language_single', $multilang);
    $gc->saveConfigItem('language_default', $deflang);
    header('location:' . $thisfile . URL_REDIRECT_APPEND . '&mode=0');
    exit;
}
$gc->getConfig('gui_frame_left_nav_%');
$gc->getConfig('language_%');
# Start Smarty templating here
/**
 * LOAD Smarty
 */
# Note: it is advisable to load this after the inc_front_chain_lang.php so
# that the smarty script can use the user configured template theme