public static function getNavigation($callerBadgerRoot) { global $badgerDb; NavigationFromDB::$callerBadgerRoot = $callerBadgerRoot; $settings = new UserSettings($badgerDb); $itemTypes = array('i' => 'item', 'm' => 'menu', 's' => 'separator'); $sql = 'SELECT navi_id, parent_id, menu_order, item_type, item_name, tooltip, icon_url, command FROM navi ORDER BY parent_id, menu_order'; $res =& $badgerDb->query($sql); $menus = array(); $row = array(); while ($res->fetchInto($row, DB_FETCHMODE_ASSOC)) { $menuId = $row['parent_id']; //create containing menu if it does not exist if (!isset($menus[$menuId])) { $menus[$menuId] = array(); } //fill most of the fields $menus[$menuId][] = array('type' => $itemTypes[$row['item_type']], 'name' => getBadgerTranslation2("Navigation", $row['item_name']), 'tooltip' => $row['tooltip'], 'icon' => BADGER_ROOT . "/tpl/" . $settings->getProperty("badgerTemplate") . "/Navigation/" . $row['icon_url'], 'command' => NavigationFromDB::replaceBadgerRoot($row['command'])); //if current row is a menu if ($row['item_type'] == 'm') { //create sub-menu if it does not exist if (!isset($menus[$row['navi_id']])) { $menus[$row['navi_id']] = array(); } //add menu field to the previously created item and assign a reference to the proper //sub-menu to it $menus[$menuId][count($menus[$menuId]) - 1]['menu'] =& $menus[$row['navi_id']]; } } //All sub-menus are within element 0 as references return $menus[0]; }
**/ /** * This file is called by StandardNavigation. It externalizes the CSS and JS code of * StandardNavigation, assuming it does not change for each side. This saves some * bandwith, as this file should be cached. * * @author Eni Kao */ define('BADGER_ROOT', '../..'); require_once BADGER_ROOT . '/includes/fileHeaderBackEnd.inc.php'; require_once BADGER_ROOT . '/core/navi/StandardNavigation.class.php'; require_once BADGER_ROOT . '/core/navi/NavigationFromDB.class.php'; //require_once(BADGER_ROOT . '/core/UserSettings.class.php'); // sollte das nicht auch in die Includes?? if (isset($_GET['part'])) { $callerBadgerRoot = isset($_GET['badger_root']) ? getGPC($_GET, 'badger_root') : ""; $navi = NavigationFromDB::getNavigation($callerBadgerRoot); $naviObj = new StandardNavigation(); $naviObj->setStructure($navi); //We do our best to get this cached //header('Cache-Control: public'); //header('Expires: ' . date('r', time() + 24 * 60 * 60)); switch (getGPC($_GET, 'part')) { case 'css': header('Content-Type: text/css'); echo $naviObj->getCSS(); break; case 'js': header('Content-Type: text/javascript'); echo "function loadNavigation() {\n" . $naviObj->getJS() . "\n}"; break; }
* Open Source Financial Management * Visit http://www.badger-finance.org * **/ /* * Due to internal changes in StandardNavigation, this example is more ore less the same as * StandardNavigationTest.php. * * This example requires the table navi in the database. * See http://svn.berlios.de/viewcvs/badger/techdoc/navi/ */ define('BADGER_ROOT', '../..'); require_once BADGER_ROOT . '/includes/fileHeaderFrontEnd.inc.php'; require_once BADGER_ROOT . '/core/navi/NavigationFromDB.class.php'; require_once BADGER_ROOT . '/core/navi/StandardNavigation.class.php'; $navi1 = NavigationFromDB::getNavigation("../.."); $naviObj = new StandardNavigation(); $naviObj->setStructure($navi1); ?> <html> <head> <?php echo $naviObj->getHeader(); ?> <body> <?php echo $naviObj->getHTML(); ?> <p>Erste Zeile</p> <br />