NodeDatabaseContainer.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\CheckUserPrivileges;
  11. use PhpMyAdmin\Navigation\NodeFactory;
  12. use PhpMyAdmin\Util;
  13. /**
  14. * Represents a container for database nodes in the navigation tree
  15. *
  16. * @package PhpMyAdmin-Navigation
  17. */
  18. class NodeDatabaseContainer extends Node
  19. {
  20. /**
  21. * Initialises the class
  22. *
  23. * @param string $name An identifier for the new node
  24. */
  25. public function __construct($name)
  26. {
  27. $checkUserPrivileges = new CheckUserPrivileges($GLOBALS['dbi']);
  28. $checkUserPrivileges->getPrivileges();
  29. parent::__construct($name, Node::CONTAINER);
  30. if ($GLOBALS['is_create_db_priv']
  31. && $GLOBALS['cfg']['ShowCreateDb'] !== false
  32. ) {
  33. $newLabel = _pgettext('Create new database', 'New');
  34. $new = NodeFactory::getInstance(
  35. 'Node',
  36. $newLabel
  37. );
  38. $new->isNew = true;
  39. $new->icon = Util::getImage('b_newdb', '');
  40. $new->title = $newLabel;
  41. $new->links = [
  42. 'text' => 'server_databases.php?server=' . $GLOBALS['server'],
  43. 'icon' => 'server_databases.php?server=' . $GLOBALS['server'],
  44. ];
  45. $new->classes = 'new_database italics';
  46. $this->addChild($new);
  47. }
  48. }
  49. }