/**
* Display navigation tabs
- * @param $tabs An associative array of tabs definitions, see printNav() for an example.
+ * @param $tabs The name of current section (Ex: intro, server, ...), or an array with tabs (Ex: sqledit.php doFind function)
* @param $activetab The name of the tab to be highlighted.
*/
function printTabs($tabs, $activetab) {
* @param $section The name of the tab bar.
*/
function getNavTabs($section) {
- global $data, $lang, $conf;
+ global $data, $lang, $conf, $plugin_manager;
$hide_advanced = ($conf['show_advanced'] === false);
+ $tabs = array();
switch ($section) {
case 'root':
- return array (
+ $tabs = array (
'intro' => array (
'title' => $lang['strintroduction'],
'url' => "intro.php",
'icon' => 'Servers',
),
);
+ break;
case 'server':
case 'report':
$hide_users = !$data->isSuperUser();
- $tmp = array (
+ $tabs = array (
'databases' => array (
'title' => $lang['strdatabases'],
'url' => 'all_db.php',
)
);
if ($data->hasRoles()) {
- $tmp = array_merge($tmp, array(
+ $tabs = array_merge($tabs, array(
'roles' => array (
'title' => $lang['strroles'],
'url' => 'roles.php',
));
}
else {
- $tmp = array_merge($tmp, array(
+ $tabs = array_merge($tabs, array(
'users' => array (
'title' => $lang['strusers'],
'url' => 'users.php',
));
}
- $tmp = array_merge($tmp, array(
+ $tabs = array_merge($tabs, array(
'account' => array (
'title' => $lang['straccount'],
'url' => $data->hasRoles() ? 'roles.php' : 'users.php',
'icon' => 'Reports',
),
));
- return $tmp;
break;
case 'database':
$tabs = array (
'icon' => 'Export',
),
);
- return $tabs;
+ break;
case 'schema':
$tabs = array (
),
);
if (!$data->hasFTS()) unset($tabs['fulltext']);
- return $tabs;
+ break;
case 'table':
- return array (
+ $tabs = array (
'columns' => array (
'title' => $lang['strcolumns'],
'url' => 'tblproperties.php',
'hide' => false,
),
);
+ break;
case 'view':
- return array (
+ $tabs = array (
'columns' => array (
'title' => $lang['strcolumns'],
'url' => 'viewproperties.php',
'hide' => false,
),
);
+ break;
case 'function':
- return array (
+ $tabs = array (
'definition' => array (
'title' => $lang['strdefinition'],
'url' => 'functions.php',
'icon' => 'Privileges',
),
);
+ break;
case 'aggregate':
- return array (
+ $tabs = array (
'definition' => array (
'title' => $lang['strdefinition'],
'url' => 'aggregates.php',
'icon' => 'Definition',
),
);
+ break;
case 'role':
- return array (
+ $tabs = array (
'definition' => array (
'title' => $lang['strdefinition'],
'url' => 'roles.php',
'icon' => 'Definition',
),
);
+ break;
case 'popup':
- return array (
+ $tabs = array (
'sql' => array (
'title' => $lang['strsql'],
'url' => 'sqledit.php',
'icon' => 'Search',
),
);
+ break;
case 'column':
- return array(
+ $tabs = array(
'properties' => array (
'title' => $lang['strcolprop'],
'url' => 'colproperties.php',
'icon' => 'Privileges',
)
);
+ break;
case 'fulltext':
- return array (
+ $tabs = array (
'ftsconfigs' => array (
'title' => $lang['strftstabconfigs'],
'url' => 'fulltext.php',
'icon' => 'FtsParser',
),
);
-
- default:
- return array();
+ break;
}
+
+ // Tabs hook's place
+ $plugin_functions_parameters = array(
+ 'tabs' => &$tabs,
+ 'section' => $section
+ );
+ $plugin_manager->do_hook('tabs', $plugin_functions_parameters);
+
+ return $tabs;
}
/**
}
function icon($icon) {
- global $conf;
- $path = "images/themes/{$conf['theme']}/{$icon}";
- if (file_exists($path.'.png')) return $path.'.png';
- if (file_exists($path.'.gif')) return $path.'.gif';
- $path = "images/themes/default/{$icon}";
- if (file_exists($path.'.png')) return $path.'.png';
- if (file_exists($path.'.gif')) return $path.'.gif';
+ if (is_string($icon)) {
+ global $conf;
+ $path = "images/themes/{$conf['theme']}/{$icon}";
+ if (file_exists($path.'.png')) return $path.'.png';
+ if (file_exists($path.'.gif')) return $path.'.gif';
+ $path = "images/themes/default/{$icon}";
+ if (file_exists($path.'.png')) return $path.'.png';
+ if (file_exists($path.'.gif')) return $path.'.gif';
+ }
+ else {
+ // Icon from plugins
+ $path = "plugins/{$icon[0]}/images/{$icon[1]}";
+ if (file_exists($path.'.png')) return $path.'.png';
+ if (file_exists($path.'.gif')) return $path.'.gif';
+ }
return '';
}