NodeDatabaseChild.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Functionality for the navigation tree
  5. *
  6. * @package PhpMyAdmin-Navigation
  7. */
  8. namespace PhpMyAdmin\Navigation\Nodes;
  9. use PhpMyAdmin\Relation;
  10. use PhpMyAdmin\Url;
  11. use PhpMyAdmin\Util;
  12. /**
  13. * Represents a node that is a child of a database node
  14. * This may either be a concrete child such as table or a container
  15. * such as table container
  16. *
  17. * @package PhpMyAdmin-Navigation
  18. */
  19. abstract class NodeDatabaseChild extends Node
  20. {
  21. /**
  22. * Returns the type of the item represented by the node.
  23. *
  24. * @return string type of the item
  25. */
  26. protected abstract function getItemType();
  27. /**
  28. * Returns HTML for control buttons displayed infront of a node
  29. *
  30. * @return String HTML for control buttons
  31. */
  32. public function getHtmlForControlButtons()
  33. {
  34. $ret = '';
  35. $cfgRelation = $this->relation->getRelationsParam();
  36. if ($cfgRelation['navwork']) {
  37. $db = $this->realParent()->real_name;
  38. $item = $this->real_name;
  39. $params = array(
  40. 'hideNavItem' => true,
  41. 'itemType' => $this->getItemType(),
  42. 'itemName' => $item,
  43. 'dbName' => $db
  44. );
  45. $ret = '<span class="navItemControls">'
  46. . '<a href="navigation.php" data-post="'
  47. . Url::getCommon($params, '', false) . '"'
  48. . ' class="hideNavItem ajax">'
  49. . Util::getImage('hide', __('Hide'))
  50. . '</a></span>';
  51. }
  52. return $ret;
  53. }
  54. }