NodeIndexContainer.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Functionality for the navigation tree
  5. *
  6. * @package PhpMyAdmin-Navigation
  7. */
  8. declare(strict_types=1);
  9. namespace PhpMyAdmin\Navigation\Nodes;
  10. use PhpMyAdmin\Navigation\NodeFactory;
  11. use PhpMyAdmin\Util;
  12. /**
  13. * Represents a container for index nodes in the navigation tree
  14. *
  15. * @package PhpMyAdmin-Navigation
  16. */
  17. class NodeIndexContainer extends Node
  18. {
  19. /**
  20. * Initialises the class
  21. */
  22. public function __construct()
  23. {
  24. parent::__construct(__('Indexes'), Node::CONTAINER);
  25. $this->icon = Util::getImage('b_index', __('Indexes'));
  26. $this->links = [
  27. 'text' => 'tbl_structure.php?server=' . $GLOBALS['server']
  28. . '&amp;db=%2$s&amp;table=%1$s',
  29. 'icon' => 'tbl_structure.php?server=' . $GLOBALS['server']
  30. . '&amp;db=%2$s&amp;table=%1$s',
  31. ];
  32. $this->realName = 'indexes';
  33. $newLabel = _pgettext('Create new index', 'New');
  34. $new = NodeFactory::getInstance(
  35. 'Node',
  36. $newLabel
  37. );
  38. $new->isNew = true;
  39. $new->icon = Util::getImage('b_index_add', $newLabel);
  40. $new->title = $newLabel;
  41. $new->links = [
  42. 'text' => 'tbl_indexes.php?server=' . $GLOBALS['server']
  43. . '&amp;create_index=1&amp;added_fields=2'
  44. . '&amp;db=%3$s&amp;table=%2$s',
  45. 'icon' => 'tbl_indexes.php?server=' . $GLOBALS['server']
  46. . '&amp;create_index=1&amp;added_fields=2'
  47. . '&amp;db=%3$s&amp;table=%2$s',
  48. ];
  49. $new->classes = 'new_index italics';
  50. $this->addChild($new);
  51. }
  52. }