adminpanelnav.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. /**
  3. * StatusNet - the distributed open-source microblogging tool
  4. * Copyright (C) 2011, StatusNet, Inc.
  5. *
  6. * Menu for admin panels
  7. *
  8. * PHP version 5
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. * @category Menu
  24. * @package StatusNet
  25. * @author Evan Prodromou <evan@status.net>
  26. * @copyright 2011 StatusNet, Inc.
  27. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  28. * @link http://status.net/
  29. */
  30. if (!defined('STATUSNET')) {
  31. // This check helps protect against security problems;
  32. // your code file can't be executed directly from the web.
  33. exit(1);
  34. }
  35. /**
  36. * Menu for admin panels
  37. *
  38. * @category Output
  39. * @package StatusNet
  40. * @author Evan Prodromou <evan@status.net>
  41. * @author Sarven Capadisli <csarven@status.net>
  42. * @copyright 2011 StatusNet, Inc.
  43. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  44. * @link http://status.net/
  45. */
  46. class AdminPanelNav extends Menu
  47. {
  48. /**
  49. * Show the menu
  50. *
  51. * @return void
  52. */
  53. function show()
  54. {
  55. $action_name = $this->action->trimmed('action');
  56. $user = common_current_user();
  57. $nickname = $user->nickname;
  58. $name = $user->getProfile()->getBestName();
  59. $stub = new HomeStubNav($this->action);
  60. $this->submenu(_m('MENU','Home'), $stub);
  61. $this->action->elementStart('ul');
  62. $this->action->elementStart('li');
  63. // TRANS: Header in administrator navigation panel.
  64. $this->action->element('h3', null, _m('HEADER','Admin'));
  65. $this->action->elementStart('ul', array('class' => 'nav'));
  66. if (Event::handle('StartAdminPanelNav', array($this))) {
  67. if (AdminPanelAction::canAdmin('site')) {
  68. // TRANS: Menu item title in administrator navigation panel.
  69. $menu_title = _('Basic site configuration');
  70. // TRANS: Menu item in administrator navigation panel.
  71. $this->out->menuItem(common_local_url('siteadminpanel'), _m('MENU', 'Site'),
  72. $menu_title, $action_name == 'siteadminpanel', 'nav_site_admin_panel');
  73. }
  74. if (AdminPanelAction::canAdmin('user')) {
  75. // TRANS: Menu item title in administrator navigation panel.
  76. $menu_title = _('User configuration');
  77. // TRANS: Menu item in administrator navigation panel.
  78. $this->out->menuItem(common_local_url('useradminpanel'), _m('MENU','User'),
  79. $menu_title, $action_name == 'useradminpanel', 'nav_user_admin_panel');
  80. }
  81. if (AdminPanelAction::canAdmin('access')) {
  82. // TRANS: Menu item title in administrator navigation panel.
  83. $menu_title = _('Access configuration');
  84. // TRANS: Menu item in administrator navigation panel.
  85. $this->out->menuItem(common_local_url('accessadminpanel'), _m('MENU','Access'),
  86. $menu_title, $action_name == 'accessadminpanel', 'nav_access_admin_panel');
  87. }
  88. if (AdminPanelAction::canAdmin('paths')) {
  89. // TRANS: Menu item title in administrator navigation panel.
  90. $menu_title = _('Paths configuration');
  91. // TRANS: Menu item in administrator navigation panel.
  92. $this->out->menuItem(common_local_url('pathsadminpanel'), _m('MENU','Paths'),
  93. $menu_title, $action_name == 'pathsadminpanel', 'nav_paths_admin_panel');
  94. }
  95. if (AdminPanelAction::canAdmin('sessions')) {
  96. // TRANS: Menu item title in administrator navigation panel.
  97. $menu_title = _('Sessions configuration');
  98. // TRANS: Menu item in administrator navigation panel.
  99. $this->out->menuItem(common_local_url('sessionsadminpanel'), _m('MENU','Sessions'),
  100. $menu_title, $action_name == 'sessionsadminpanel', 'nav_sessions_admin_panel');
  101. }
  102. if (AdminPanelAction::canAdmin('sitenotice')) {
  103. // TRANS: Menu item title in administrator navigation panel.
  104. $menu_title = _('Edit site notice');
  105. // TRANS: Menu item in administrator navigation panel.
  106. $this->out->menuItem(common_local_url('sitenoticeadminpanel'), _m('MENU','Site notice'),
  107. $menu_title, $action_name == 'sitenoticeadminpanel', 'nav_sitenotice_admin_panel');
  108. }
  109. if (AdminPanelAction::canAdmin('license')) {
  110. // TRANS: Menu item title in administrator navigation panel.
  111. $menu_title = _('Set site license');
  112. // TRANS: Menu item in administrator navigation panel.
  113. $this->out->menuItem(common_local_url('licenseadminpanel'), _m('MENU','License'),
  114. $menu_title, $action_name == 'licenseadminpanel', 'nav_license_admin_panel');
  115. }
  116. if (AdminPanelAction::canAdmin('plugins')) {
  117. // TRANS: Menu item title in administrator navigation panel.
  118. $menu_title = _('Plugins configuration');
  119. // TRANS: Menu item in administrator navigation panel.
  120. $this->out->menuItem(common_local_url('pluginsadminpanel'), _m('MENU','Plugins'),
  121. $menu_title, $action_name == 'pluginsadminpanel', 'nav_plugin_admin_panel');
  122. }
  123. Event::handle('EndAdminPanelNav', array($this));
  124. }
  125. $this->action->elementEnd('ul');
  126. $this->action->elementEnd('li');
  127. $this->action->elementEnd('ul');
  128. }
  129. }