Users.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * set of common functions for sub tabs in server level `Users` page
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. namespace PhpMyAdmin\Server;
  9. use PhpMyAdmin\Url;
  10. /**
  11. * PhpMyAdmin\Server\Users class
  12. *
  13. * @package PhpMyAdmin
  14. */
  15. class Users
  16. {
  17. /**
  18. * Get HTML for secondary level menu tabs on 'Users' page
  19. *
  20. * @param string $selfUrl Url of the file
  21. *
  22. * @return string HTML for secondary level menu tabs on 'Users' page
  23. */
  24. public static function getHtmlForSubMenusOnUsersPage($selfUrl)
  25. {
  26. $items = array(
  27. array(
  28. 'name' => __('User accounts overview'),
  29. 'url' => 'server_privileges.php',
  30. 'params' => Url::getCommon(array('viewing_mode' => 'server')),
  31. )
  32. );
  33. if ($GLOBALS['dbi']->isSuperuser()) {
  34. $items[] = array(
  35. 'name' => __('User groups'),
  36. 'url' => 'server_user_groups.php',
  37. 'params' => Url::getCommon(),
  38. );
  39. }
  40. $retval = '<ul id="topmenu2">';
  41. foreach ($items as $item) {
  42. $class = '';
  43. if ($item['url'] === $selfUrl) {
  44. $class = ' class="tabactive"';
  45. }
  46. $retval .= '<li>';
  47. $retval .= '<a' . $class;
  48. $retval .= ' href="' . $item['url'] . $item['params'] . '">';
  49. $retval .= $item['name'];
  50. $retval .= '</a>';
  51. $retval .= '</li>';
  52. }
  53. $retval .= '</ul>';
  54. $retval .= '<div class="clearfloat"></div>';
  55. return $retval;
  56. }
  57. }