Navigation.class.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * This class is responsible for instanciating
  5. * the various components of the navigation panel
  6. *
  7. * @package PhpMyAdmin-navigation
  8. */
  9. if (! defined('PHPMYADMIN')) {
  10. exit;
  11. }
  12. require_once 'libraries/navigation/NodeFactory.class.php';
  13. require_once 'libraries/navigation/NavigationHeader.class.php';
  14. require_once 'libraries/navigation/NavigationTree.class.php';
  15. /**
  16. * The navigation panel - displays server, db and table selection tree
  17. *
  18. * @package PhpMyAdmin-Navigation
  19. */
  20. class PMA_Navigation
  21. {
  22. /**
  23. * Initialises the class
  24. *
  25. * @return void
  26. */
  27. public function __construct()
  28. {
  29. if (empty($GLOBALS['token'])) {
  30. $GLOBALS['token'] = $_SESSION[' PMA_token '];
  31. }
  32. }
  33. /**
  34. * Renders the navigation tree, or part of it
  35. *
  36. * @return string The navigation tree
  37. */
  38. public function getDisplay()
  39. {
  40. /* Init */
  41. $retval = '';
  42. if (! PMA_Response::getInstance()->isAjax()) {
  43. $header = new PMA_NavigationHeader();
  44. $retval = $header->getDisplay();
  45. }
  46. $tree = new PMA_NavigationTree();
  47. if (! PMA_Response::getInstance()->isAjax()
  48. || ! empty($_REQUEST['full'])
  49. || ! empty($_REQUEST['reload'])
  50. ) {
  51. $treeRender = $tree->renderState();
  52. } else {
  53. $treeRender = $tree->renderPath();
  54. }
  55. if (! $treeRender) {
  56. $retval .= PMA_Message::error(
  57. __('An error has occured while loading the navigation tree')
  58. )->getDisplay();
  59. } else {
  60. $retval .= $treeRender;
  61. }
  62. if (! PMA_Response::getInstance()->isAjax()) {
  63. // closes the tags that were opened by the navigation header
  64. $retval .= '</div>';
  65. $retval .= '</div>';
  66. $retval .= '</div>';
  67. }
  68. return $retval;
  69. }
  70. }
  71. ?>