Example #1
0
 /**
  * Prints the menu and the breadcrumbs
  *
  * @return void
  */
 public static function getInstance()
 {
     if (empty(self::$_instance)) {
         self::$_instance = new PMA_Menu($GLOBALS['server'], $GLOBALS['db'], $GLOBALS['table']);
     }
     return self::$_instance;
 }
Example #2
0
 /**
  * Generates the header
  *
  * @return string The header
  */
 public function getDisplay()
 {
     $retval = '';
     if (!$this->_headerIsSent) {
         if (!$this->_isAjax && $this->_isEnabled) {
             $this->sendHttpHeaders();
             $retval .= $this->_getHtmlStart();
             $retval .= $this->_getMetaTags();
             $retval .= $this->_getLinkTags();
             $retval .= $this->getTitleTag();
             // The user preferences have been merged at this point
             // so we can conditionally add CodeMirror
             if ($GLOBALS['cfg']['CodemirrorEnable']) {
                 $this->_scripts->addFile('codemirror/lib/codemirror.js');
                 $this->_scripts->addFile('codemirror/mode/sql/sql.js');
                 $this->_scripts->addFile('codemirror/addon/runmode/runmode.js');
             }
             if ($this->_userprefsOfferImport) {
                 $this->_scripts->addFile('config.js');
             }
             $retval .= $this->_scripts->getDisplay();
             $retval .= $this->_getBodyStart();
             if ($this->_menuEnabled && $GLOBALS['server'] > 0) {
                 $nav = new PMA_Navigation();
                 $retval .= $nav->getDisplay();
             }
             // Include possible custom headers
             if (file_exists(CUSTOM_HEADER_FILE)) {
                 $retval .= '<div id="pma_header">';
                 ob_start();
                 include CUSTOM_HEADER_FILE;
                 $retval .= ob_get_contents();
                 ob_end_clean();
                 $retval .= '</div>';
             }
             // offer to load user preferences from localStorage
             if ($this->_userprefsOfferImport) {
                 include_once './libraries/user_preferences.lib.php';
                 $retval .= PMA_userprefsAutoloadGetHeader();
             }
             // pass configuration for hint tooltip display
             // (to be used by PMA_tooltip() in js/functions.js)
             if (!$GLOBALS['cfg']['ShowHint']) {
                 $retval .= '<span id="no_hint" class="hide"></span>';
             }
             $retval .= $this->_getWarnings();
             if ($this->_menuEnabled && $GLOBALS['server'] > 0) {
                 $retval .= $this->_menu->getDisplay();
                 $retval .= sprintf('<a id="goto_pagetop" href="#" title="%s">%s</a>', __('Click on the bar to scroll to top of page'), PMA_Util::getImage('s_top.png'));
             }
             $retval .= '<div id="page_content">';
             $retval .= $this->getMessage();
         }
         if ($this->_isEnabled && empty($_REQUEST['recent_table'])) {
             $retval .= $this->_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
         }
     }
     return $retval;
 }
 /**
  * Table menu setTable test
  *
  * @return void
  */
 function testSetTable()
 {
     $menu = new PMA_Menu('server', 'pma_test', '');
     $menu->setTable('table1');
     $this->assertContains('table1', $menu->getDisplay());
 }
Example #4
0
 /**
  * Table menu display test
  *
  * @return void
  */
 function testTableDisplay()
 {
     $menu = new PMA_Menu('server', 'pma_test', '');
     $this->expectOutputString($menu->getDisplay());
     $menu->display();
 }
Example #5
0
        }
        // add recently used table and reload the navigation
        if (strlen($GLOBALS['table']) && $GLOBALS['cfg']['LeftRecentTable'] > 0) {
            PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
        }
        if (!defined('PMA_DISPLAY_HEADING')) {
            define('PMA_DISPLAY_HEADING', 1);
        }
        // pass configuration for hint tooltip display
        // (to be used by PMA_createqTip in js/functions.js)
        if (!$GLOBALS['cfg']['ShowHint']) {
            echo '<span id="no_hint" class="hide"></span>';
        }
        /**
         * Display heading if needed. Design can be set in css file.
         */
        if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
            PMA_Menu::getInstance()->display();
        }
    }
    /**
     * Sets a variable to remember headers have been sent
     */
    $GLOBALS['is_header_sent'] = true;
    //end if (!$GLOBALS['is_ajax_request'])
} else {
    if (empty($GLOBALS['is_header_sent'])) {
        include_once './libraries/header_http.inc.php';
        $GLOBALS['is_header_sent'] = true;
    }
}
Example #6
0
 /**
  * Table menu test
  *
  * @return void
  */
 function testTable()
 {
     $menu = new PMA_Menu('server', 'pma_test', 'table1');
     $this->assertContains(
         'floating_menubar',
         $menu->getDisplay()
     );
 }