NodeViewContainer.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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\Navigation\NodeFactory;
  9. use PhpMyAdmin\Url;
  10. /**
  11. * Represents a container for view nodes in the navigation tree
  12. */
  13. class NodeViewContainer extends NodeDatabaseChildContainer
  14. {
  15. /**
  16. * Initialises the class
  17. */
  18. public function __construct()
  19. {
  20. parent::__construct(__('Views'), Node::CONTAINER);
  21. $this->icon = Generator::getImage('b_views', __('Views'));
  22. $this->links = [
  23. 'text' => Url::getFromRoute('/database/structure', [
  24. 'server' => $GLOBALS['server'],
  25. 'tbl_type' => 'view',
  26. ]) . '&amp;db=%1$s',
  27. 'icon' => Url::getFromRoute('/database/structure', [
  28. 'server' => $GLOBALS['server'],
  29. 'tbl_type' => 'view',
  30. ]) . '&amp;db=%1$s',
  31. ];
  32. $this->classes = 'viewContainer subContainer';
  33. $this->realName = 'views';
  34. $newLabel = _pgettext('Create new view', 'New');
  35. $new = NodeFactory::getInstanceForNewNode(
  36. $newLabel,
  37. 'new_view italics'
  38. );
  39. $new->icon = Generator::getImage('b_view_add', $newLabel);
  40. $new->links = [
  41. 'text' => Url::getFromRoute('/view/create', [
  42. 'server' => $GLOBALS['server'],
  43. ]) . '&amp;db=%2$s',
  44. 'icon' => Url::getFromRoute('/view/create', [
  45. 'server' => $GLOBALS['server'],
  46. ]) . '&amp;db=%2$s',
  47. ];
  48. $this->addChild($new);
  49. }
  50. }