NodeView.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 view node in the navigation tree
  11. */
  12. class NodeView 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_props', __('View'));
  26. $this->links = [
  27. 'text' => Url::getFromRoute('/sql')
  28. . '&amp;server=' . $GLOBALS['server']
  29. . '&amp;db=%2$s&amp;table=%1$s&amp;pos=0',
  30. 'icon' => Url::getFromRoute('/table/structure')
  31. . '&amp;server=' . $GLOBALS['server']
  32. . '&amp;db=%2$s&amp;table=%1$s',
  33. ];
  34. $this->classes = 'view';
  35. }
  36. /**
  37. * Returns the type of the item represented by the node.
  38. *
  39. * @return string type of the item
  40. */
  41. protected function getItemType()
  42. {
  43. return 'view';
  44. }
  45. }