NodeFunction.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 function node in the navigation tree
  11. */
  12. class NodeFunction extends NodeDatabaseChild
  13. {
  14. /**
  15. * Initialises the class
  16. *
  17. * @param string $name An identifier for the new node
  18. * @param int $type Type of node, may be one of CONTAINER or OBJECT
  19. * @param bool $isGroup Whether this object has been created
  20. * while grouping nodes
  21. */
  22. public function __construct($name, $type = Node::OBJECT, $isGroup = false)
  23. {
  24. parent::__construct($name, $type, $isGroup);
  25. $this->icon = Generator::getImage('b_routines', __('Function'));
  26. $this->links = [
  27. 'text' => Url::getFromRoute('/database/routines', [
  28. 'server' => $GLOBALS['server'],
  29. 'item_type' => 'FUNCTION',
  30. 'edit_item' => 1,
  31. ]) . '&amp;db=%2$s&amp;item_name=%1$s',
  32. 'icon' => Url::getFromRoute('/database/routines', [
  33. 'server' => $GLOBALS['server'],
  34. 'item_type' => 'FUNCTION',
  35. 'execute_dialog' => 1,
  36. ]) . '&amp;db=%2$s&amp;item_name=%1$s',
  37. ];
  38. $this->classes = 'function';
  39. }
  40. /**
  41. * Returns the type of the item represented by the node.
  42. *
  43. * @return string type of the item
  44. */
  45. protected function getItemType()
  46. {
  47. return 'function';
  48. }
  49. }