diff options
| author | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
|---|---|---|
| committer | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
| commit | b62676ca5d3d6f6ba3f019ea3f99722e165a98d8 (patch) | |
| tree | 86722cb80f07d4569f90088eeaea2fc2f6e2ef94 /hugo/libraries/navigation/Navigation.class.php | |
Diffstat (limited to '')
| -rw-r--r-- | hugo/libraries/navigation/Navigation.class.php | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/hugo/libraries/navigation/Navigation.class.php b/hugo/libraries/navigation/Navigation.class.php new file mode 100644 index 0000000..d140bbc --- /dev/null +++ b/hugo/libraries/navigation/Navigation.class.php @@ -0,0 +1,77 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * This class is responsible for instanciating + * the various components of the navigation panel + * + * @package PhpMyAdmin-navigation + */ +if (! defined('PHPMYADMIN')) { + exit; +} + +require_once 'libraries/navigation/NodeFactory.class.php'; +require_once 'libraries/navigation/NavigationHeader.class.php'; +require_once 'libraries/navigation/NavigationTree.class.php'; + +/** + * The navigation panel - displays server, db and table selection tree + * + * @package PhpMyAdmin-Navigation + */ +class PMA_Navigation +{ + /** + * Initialises the class + * + * @return void + */ + public function __construct() + { + if (empty($GLOBALS['token'])) { + $GLOBALS['token'] = $_SESSION[' PMA_token ']; + } + } + + /** + * Renders the navigation tree, or part of it + * + * @return string The navigation tree + */ + public function getDisplay() + { + /* Init */ + $retval = ''; + if (! PMA_Response::getInstance()->isAjax()) { + $header = new PMA_NavigationHeader(); + $retval = $header->getDisplay(); + } + $tree = new PMA_NavigationTree(); + if (! PMA_Response::getInstance()->isAjax() + || ! empty($_REQUEST['full']) + || ! empty($_REQUEST['reload']) + ) { + $treeRender = $tree->renderState(); + } else { + $treeRender = $tree->renderPath(); + } + + if (! $treeRender) { + $retval .= PMA_Message::error( + __('An error has occured while loading the navigation tree') + )->getDisplay(); + } else { + $retval .= $treeRender; + } + + if (! PMA_Response::getInstance()->isAjax()) { + // closes the tags that were opened by the navigation header + $retval .= '</div>'; + $retval .= '</div>'; + $retval .= '</div>'; + } + + return $retval; + } +} +?> |
