PMA\libraries\Util::getHtmlTabs PHP Method

getHtmlTabs() public static method

returns html-code for a tab navigation
public static getHtmlTabs ( array $tabs, array $url_params, string $menu_id, boolean $resizable = false ) : string
$tabs array one element per tab
$url_params array additional URL parameters
$menu_id string HTML id attribute for the menu container
$resizable boolean whether to add a "resizable" class
return string html-code for tab-navigation
    public static function getHtmlTabs($tabs, $url_params, $menu_id, $resizable = false)
    {
        $class = '';
        if ($resizable) {
            $class = ' class="resizable-menu"';
        }
        $tab_navigation = '<div id="' . htmlentities($menu_id) . 'container" class="menucontainer">' . '<ul id="' . htmlentities($menu_id) . '" ' . $class . '>';
        foreach ($tabs as $tab) {
            $tab_navigation .= self::getHtmlTab($tab, $url_params);
        }
        $tab_navigation .= '<div class="clearfloat"></div>' . '</ul>' . "\n" . '</div>' . "\n";
        return $tab_navigation;
    }

Usage Example

Example #1
0
 /**
  * Returns the menu as HTML
  *
  * @return string HTML formatted menubar
  */
 private function _getMenu()
 {
     $url_params = array('db' => $this->_db);
     if (strlen($this->_table) > 0) {
         $tabs = $this->_getTableTabs();
         $url_params['table'] = $this->_table;
         $level = 'table';
     } else {
         if (strlen($this->_db) > 0) {
             $tabs = $this->_getDbTabs();
             $level = 'db';
         } else {
             $tabs = $this->_getServerTabs();
             $level = 'server';
         }
     }
     $allowedTabs = $this->_getAllowedTabs($level);
     foreach ($tabs as $key => $value) {
         if (!array_key_exists($key, $allowedTabs)) {
             unset($tabs[$key]);
         }
     }
     return Util::getHtmlTabs($tabs, $url_params, 'topmenu', true);
 }
Util