Do not show table header it there were no user groups

This commit is contained in:
Kasun Chathuranga 2013-07-31 10:09:27 +05:30
parent 25e9672f37
commit 36217b01ee

View File

@ -3234,24 +3234,26 @@ function PMA_getHtmlForUserGroupsTable()
$tabs = PMA_Util::getMenuTabList();
$html_output = '<h2>' . __('User groups') . '</h2>';
$html_output .= '<form name="userGroupsForm" id="userGroupsForm"'
. ' action="server_privileges.php" method="post">';
$html_output .= PMA_generate_common_hidden_inputs();
$html_output .= '<table id="userGroupsTable">';
$html_output .= '<thead><tr>';
$html_output .= '<th style="white-space: nowrap">' . __('User group') . '</th>';
$html_output .= '<th>' . __('Server level tabs') . '</th>';
$html_output .= '<th>' . __('Database level tabs') . '</th>';
$html_output .= '<th>' . __('Table level tabs') . '</th>';
$html_output .= '<th>' . __('Action') . '</th>';
$html_output .= '</tr></thead>';
$html_output .= '<tbody>';
$groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
$sql_query = "SELECT * FROM " . $groupTable;
$result = PMA_queryAsControlUser($sql_query, false);
if ($result) {
if ($result && $GLOBALS['dbi']->numRows($result)) {
$html_output .= '<form name="userGroupsForm" id="userGroupsForm"'
. ' action="server_privileges.php" method="post">';
$html_output .= PMA_generate_common_hidden_inputs();
$html_output .= '<table id="userGroupsTable">';
$html_output .= '<thead><tr>';
$html_output .= '<th style="white-space: nowrap">'
. __('User group') . '</th>';
$html_output .= '<th>' . __('Server level tabs') . '</th>';
$html_output .= '<th>' . __('Database level tabs') . '</th>';
$html_output .= '<th>' . __('Table level tabs') . '</th>';
$html_output .= '<th>' . __('Action') . '</th>';
$html_output .= '</tr></thead>';
$html_output .= '<tbody>';
$odd = true;
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
$html_output .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
@ -3282,13 +3284,13 @@ function PMA_getHtmlForUserGroupsTable()
$odd = ! $odd;
}
$html_output .= '</tbody>';
$html_output .= '</table>';
$html_output .= '</form>';
}
$GLOBALS['dbi']->freeResult($result);
$html_output .= '</tbody>';
$html_output .= '</table>';
$html_output .= '</form>';
$html_output .= '<fieldset id="fieldset_add_user_group">';
$html_output .= '<a href="server_user_groups.php?'
. PMA_generate_common_url() . '&addUserGroup=1">'