diff options
author | Rouslan Placella <rouslan@placella.com> | 2012-05-03 02:52:20 +0400 |
---|---|---|
committer | Rouslan Placella <rouslan@placella.com> | 2012-05-05 20:35:27 +0400 |
commit | ff01dc25b5512f33603da5dd1c21cc26ab75357b (patch) | |
tree | 18ab29d146706be65e41f1e153a6009b94829954 /libraries/Menu.class.php | |
parent | ffde8d135fba0ce69f268a032b15c26db6a0e77a (diff) |
Moved the render of breadcrumbs to the Menu class
Diffstat (limited to 'libraries/Menu.class.php')
-rw-r--r-- | libraries/Menu.class.php | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/libraries/Menu.class.php b/libraries/Menu.class.php index 6a1d75e3bb..c668d82e82 100644 --- a/libraries/Menu.class.php +++ b/libraries/Menu.class.php @@ -11,6 +11,7 @@ class Menu { $this->table = $table; if (! $GLOBALS['is_ajax_request']) { + echo $this->getBreadcrumbs(); echo $this->getMenu(); if (! empty($GLOBALS['message'])) { PMA_showMessage($GLOBALS['message']); @@ -36,6 +37,129 @@ class Menu { return PMA_generate_html_tabs($tabs, $url_params); } + private function getBreadcrumbs() + { + $retval = ''; + $tbl_is_view = PMA_Table::isView($this->db, $this->table); + $server_info = ! empty($GLOBALS['cfg']['Server']['verbose']) + ? $GLOBALS['cfg']['Server']['verbose'] + : $GLOBALS['cfg']['Server']['host']; + $server_info .= empty($GLOBALS['cfg']['Server']['port']) + ? '' + : ':' . $GLOBALS['cfg']['Server']['port']; + + $separator = "<span class='separator item'> ยป</span>\n"; + $item = '<a href="%1$s?%2$s" class="item">'; + + if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) { + $item .= '%4$s: '; + } + $item .= '%3$s</a>' . "\n"; + $retval .= "<div id='floating_menubar'></div>\n"; + $retval .= "<div id='serverinfo'>\n"; + if ($GLOBALS['cfg']['NavigationBarIconic']) { + $retval .= PMA_getImage( + 's_host.png', + '', + array('class' => 'item') + ); + } + $retval .= sprintf( + $item, + $GLOBALS['cfg']['DefaultTabServer'], + PMA_generate_common_url(), + htmlspecialchars($server_info), + __('Server') + ); + + if (strlen($this->db)) { + $retval .= $separator; + if ($GLOBALS['cfg']['NavigationBarIconic']) { + $retval .= PMA_getImage( + 's_db.png', + '', + array('class' => 'item') + ); + } + $retval .= sprintf( + $item, + $GLOBALS['cfg']['DefaultTabDatabase'], + PMA_generate_common_url($this->db), + htmlspecialchars($this->db), + __('Database') + ); + // if the table is being dropped, $_REQUEST['purge'] is set to '1' + // so do not display the table name in upper div + if ( + strlen($this->table) + && + ! (isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1') + ) { + include_once './libraries/tbl_info.inc.php'; + + $retval .= $separator; + if ($GLOBALS['cfg']['NavigationBarIconic']) { + $icon = $tbl_is_view ? 'b_views.png' : 's_tbl.png'; + $retval .= PMA_getImage( + $icon, + '', + array('class' => 'item') + ); + } + $retval .= sprintf( + $item, + $GLOBALS['cfg']['DefaultTabTable'], + PMA_generate_common_url($this->db, $this->table), + str_replace(' ', ' ', htmlspecialchars($this->table)), + $tbl_is_view ? __('View') : __('Table') + ); + + /** + * Displays table comment + */ + if (! empty($show_comment) + && ! isset($GLOBALS['avoid_show_comment']) + ) { + if (strstr($show_comment, '; InnoDB free')) { + $show_comment = preg_replace( + '@; InnoDB free:.*?$@', + '', + $show_comment + ); + } + $retval .= '<span class="table_comment" id="span_table_comment">'; + $retval .= '"' . htmlspecialchars($show_comment); + $retval .= '"</span>' . "\n"; + } // end if + } else { + // no table selected, display database comment if present + /** + * Settings for relations stuff + */ + include_once './libraries/relation.lib.php'; + $cfgRelation = PMA_getRelationsParam(); + + // Get additional information about tables for tooltip is done + // in libraries/db_info.inc.php only once + if ($cfgRelation['commwork']) { + $comment = PMA_getDbComment($this->db); + /** + * Displays table comment + */ + if (! empty($comment)) { + $retval .= '<span class="table_comment"' + . ' id="span_table_comment">"' + . htmlspecialchars($comment) + . '"</span>' . "\n"; + } // end if + } + } + } + $retval .= '<div class="clearfloat"></div>'; + $retval .= '</div>'; + return $retval; + } + private function getTableTabs() { $db_is_information_schema = PMA_is_system_schema($this->db); |