Improve select all checkbox process on designer and fix a bug
[phpmyadmin.git] / navigation.php
blob7b79ac71ee79a28a0e407ccb52603dc1634645c7
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * The navigation panel - displays server, db and table selection tree
6 * @package PhpMyAdmin-Navigation
7 */
9 // Include common functionalities
10 use PhpMyAdmin\Config\PageSettings;
11 use PhpMyAdmin\Navigation\Navigation;
12 use PhpMyAdmin\Relation;
13 use PhpMyAdmin\Response;
14 use PhpMyAdmin\Util;
16 require_once './libraries/common.inc.php';
18 // Also initialises the collapsible tree class
19 $response = Response::getInstance();
20 $navigation = new Navigation();
21 if (! $response->isAjax()) {
22 $response->addHTML(
23 PhpMyAdmin\Message::error(
24 __('Fatal error: The navigation can only be accessed via AJAX')
27 exit;
30 if (isset($_POST['getNaviSettings']) && $_POST['getNaviSettings']) {
31 $response->addJSON('message', PageSettings::getNaviSettings());
32 exit();
35 if (isset($_POST['reload'])) {
36 Util::cacheSet('dbs_to_test', false);// Empty database list cache, see #14252
39 $relation = new Relation();
40 $cfgRelation = $relation->getRelationsParam();
41 if ($cfgRelation['navwork']) {
42 if (isset($_POST['hideNavItem'])) {
43 if (! empty($_POST['itemName'])
44 && ! empty($_POST['itemType'])
45 && ! empty($_POST['dbName'])
46 ) {
47 $navigation->hideNavigationItem(
48 $_POST['itemName'],
49 $_POST['itemType'],
50 $_POST['dbName'],
51 (! empty($_POST['tableName']) ? $_POST['tableName'] : null)
54 exit;
57 if (isset($_POST['unhideNavItem'])) {
58 if (! empty($_POST['itemName'])
59 && ! empty($_POST['itemType'])
60 && ! empty($_POST['dbName'])
61 ) {
62 $navigation->unhideNavigationItem(
63 $_POST['itemName'],
64 $_POST['itemType'],
65 $_POST['dbName'],
66 (! empty($_POST['tableName']) ? $_POST['tableName'] : null)
69 exit;
72 if (isset($_POST['showUnhideDialog'])) {
73 if (! empty($_POST['dbName'])) {
74 $response->addJSON(
75 'message',
76 $navigation->getItemUnhideDialog($_POST['dbName'])
79 exit;
83 // Do the magic
84 $response->addJSON('message', $navigation->getDisplay());