NodeDatabaseChild.php 1.6 KB

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