NodeDatabaseChild.php 1.5 KB

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