<?php
/**
* SENAYAN admin application bootstrap files
*
* Copyright (C) 2007,2008 Arie Nugraha (hide@address.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
// start the session
session_start();
// required file
require '../sysconfig.inc.php';
// session checking
require './default/session_check.inc.php';
require SIMBIO_BASE_DIR.'simbio_GUI/template_parser/simbio_template_parser.inc.php';
require LIB_DIR.'module.inc.php';
// https connection (if enabled)
if ($sysconf['https_enable']) {
simbio_security::doCheckHttps($sysconf['https_port']);
}
// create the template object
$template = new simbio_template_parser($sysconf['admin_template']['dir'].'/'.$sysconf['admin_template']['theme'].'/index_template.html');
// page title
$page_title = $sysconf['library_name'].' :: Library Automation System';
// main menu
$module = new module();
$module->setModulesDir(MODULES_BASE_DIR);
$main_menu = $module->generateModuleMenu($dbs);
$module = '';
// get module from URL
if (isset($_GET['mod']) AND !empty($_GET['mod'])) {
$module = trim($_GET['mod']);
}
// start the output buffering for sub menu
ob_start();
if ($module) {
// get parsed content of module submenu
echo '<script type="text/javascript">setContent(\'sidepan\', \''.MODULES_WEB_ROOT_DIR.$module.'/submenu.inc.php\', \'post\');</script>';
} else {
// this is homepage
include 'default/home_submenu.inc.php';
}
// page content
$sub_menu = ob_get_clean();
// start the output buffering for main content
ob_start();
// info
$info = lang_sys_common_welcome.' <strong>'.$_SESSION['realname'].'</strong>';
// set some javascript vars
echo '<script type="text/javascript">'."\n";
echo 'lastStr = \''.addslashes($info).'\';'."\n";
echo 'loadingImage = \''.SENAYAN_WEB_ROOT_DIR.'admin/'.$sysconf['admin_template']['dir'].'/'.$sysconf['admin_template']['theme'].'/loader.gif\';'."\n";
if ($module) {
echo 'defaultAJAXurl = \''.MODULES_WEB_ROOT_DIR.$module.'/index.php\';'."\n";
} else {
echo 'defaultAJAXurl = \''.SENAYAN_WEB_ROOT_DIR.'admin/default/home.inc.php\';'."\n";
}
echo '</script>';
if ($module) {
// get parsed content of module default content
echo '<script type="text/javascript">setContent(\'mainContent\', \''.MODULES_WEB_ROOT_DIR.$module.'/index.php\', \'post\');</script>';
} else {
include 'default/home.inc.php';
}
// page content
$main_content = ob_get_clean();
// assign content to markers
$template->assign('<!--PAGE_TITLE-->', $page_title);
$template->assign('<!--CSS-->', $sysconf['admin_template']['css']);
$template->assign('<!--MAIN_MENU-->', $main_menu);
$template->assign('<!--SUB_MENU-->', $sub_menu);
$template->assign('<!--INFO-->', $info);
$template->assign('<!--LIBRARY_NAME-->', $sysconf['library_name']);
$template->assign('<!--MAIN_CONTENT-->', $main_content);
$template->assign('<!--FOOTER-->', $sysconf['page_footer']);
// print out the template
$template->printOut();
?>