/**
  * Test getNaviSettings
  *
  * @return void
  */
 function testGetNaviSettings()
 {
     $html = PMA_PageSettings::getNaviSettings();
     // Test some sample parts
     $this->assertContains('<div id="pma_navigation_settings">', $html);
     $this->assertContains('<input type="hidden" name="submit_save" value="Navi_panel" />', $html);
 }
Ejemplo n.º 2
0
 /**
  * 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'])) {
         if ($GLOBALS['cfg']['ShowDatabasesNavigationAsTree']) {
             // provide database tree in navigation
             $navRender = $tree->renderState();
         } else {
             // provide legacy pre-4.0 navigation
             $navRender = $tree->renderDbSelect();
         }
     } else {
         $navRender = $tree->renderPath();
     }
     if (!$navRender) {
         $retval .= PMA_Message::error(__('An error has occurred while loading the navigation display'))->getDisplay();
     } else {
         $retval .= $navRender;
     }
     if (!PMA_Response::getInstance()->isAjax()) {
         // closes the tags that were opened by the navigation header
         $retval .= '</div>';
         // pma_navigation_tree
         $retval .= '<div id="pma_navi_settings_container">';
         if (!defined('PMA_DISABLE_NAVI_SETTINGS')) {
             $retval .= PMA_PageSettings::getNaviSettings();
         }
         $retval .= '</div>';
         //pma_navi_settings_container
         $retval .= '</div>';
         // pma_navigation_content
         $retval .= $this->_getDropHandler();
         $retval .= '</div>';
         // pma_navigation
     }
     return $retval;
 }
 * The navigation panel - displays server, db and table selection tree
 *
 * @package PhpMyAdmin-Navigation
 */
// Include common functionalities
require_once './libraries/common.inc.php';
// Also initialises the collapsible tree class
require_once './libraries/navigation/Navigation.class.php';
$response = PMA_Response::getInstance();
$navigation = new PMA_Navigation();
if (!$response->isAjax()) {
    $response->addHTML(PMA_Message::error(__('Fatal error: The navigation can only be accessed via AJAX')));
    exit;
}
if (isset($_REQUEST['getNaviSettings']) && $_REQUEST['getNaviSettings']) {
    $response->addJSON('message', PMA_PageSettings::getNaviSettings());
    exit;
}
$cfgRelation = PMA_getRelationsParam();
if ($cfgRelation['navwork']) {
    if (isset($_REQUEST['hideNavItem'])) {
        if (!empty($_REQUEST['itemName']) && !empty($_REQUEST['itemType']) && !empty($_REQUEST['dbName'])) {
            $navigation->hideNavigationItem($_REQUEST['itemName'], $_REQUEST['itemType'], $_REQUEST['dbName'], !empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null);
        }
        exit;
    }
    if (isset($_REQUEST['unhideNavItem'])) {
        if (!empty($_REQUEST['itemName']) && !empty($_REQUEST['itemType']) && !empty($_REQUEST['dbName'])) {
            $navigation->unhideNavigationItem($_REQUEST['itemName'], $_REQUEST['itemType'], $_REQUEST['dbName'], !empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null);
        }
        exit;