NodeIndexContainer.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 index nodes in the navigation tree
  12. */
  13. class NodeIndexContainer extends Node
  14. {
  15. /**
  16. * Initialises the class
  17. */
  18. public function __construct()
  19. {
  20. parent::__construct(__('Indexes'), Node::CONTAINER);
  21. $this->icon = Generator::getImage('b_index', __('Indexes'));
  22. $this->links = [
  23. 'text' => Url::getFromRoute('/table/structure', [
  24. 'server' => $GLOBALS['server'],
  25. ]) . '&amp;db=%2$s&amp;table=%1$s',
  26. 'icon' => Url::getFromRoute('/table/structure', [
  27. 'server' => $GLOBALS['server'],
  28. ]) . '&amp;db=%2$s&amp;table=%1$s',
  29. ];
  30. $this->realName = 'indexes';
  31. $newLabel = _pgettext('Create new index', 'New');
  32. $new = NodeFactory::getInstanceForNewNode(
  33. $newLabel,
  34. 'new_index italics'
  35. );
  36. $new->icon = Generator::getImage('b_index_add', $newLabel);
  37. $new->links = [
  38. 'text' => Url::getFromRoute('/table/indexes', [
  39. 'server' => $GLOBALS['server'],
  40. 'create_index' => 1,
  41. 'added_fields' => 2,
  42. ]) . '&amp;db=%3$s&amp;table=%2$s',
  43. 'icon' => Url::getFromRoute('/table/indexes', [
  44. 'server' => $GLOBALS['server'],
  45. 'create_index' => 1,
  46. 'added_fields' => 2,
  47. ]) . '&amp;db=%3$s&amp;table=%2$s',
  48. ];
  49. $this->addChild($new);
  50. }
  51. }