adminpanelnav.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. public $widgetOpts;
  49. public $scoped;
  50. /**
  51. * Show the menu
  52. *
  53. * @return void
  54. */
  55. function show()
  56. {
  57. $action_name = $this->action->trimmed('action');
  58. $user = common_current_user();
  59. $nickname = $user->nickname;
  60. $name = $user->getProfile()->getBestName();
  61. $stub = new HomeStubNav($this->action);
  62. $this->submenu(_m('MENU','Home'), $stub);
  63. $this->action->elementStart('ul');
  64. $this->action->elementStart('li');
  65. // TRANS: Header in administrator navigation panel.
  66. $this->action->element('h3', null, _m('HEADER','Admin'));
  67. $this->action->elementStart('ul', array('class' => 'nav'));
  68. if (Event::handle('StartAdminPanelNav', array($this))) {
  69. if (AdminPanelAction::canAdmin('site')) {
  70. // TRANS: Menu item title in administrator navigation panel.
  71. $menu_title = _('Basic site configuration');
  72. // TRANS: Menu item in administrator navigation panel.
  73. $this->out->menuItem(common_local_url('siteadminpanel'), _m('MENU', 'Site'),
  74. $menu_title, $action_name == 'siteadminpanel', 'nav_site_admin_panel');
  75. }
  76. if (AdminPanelAction::canAdmin('user')) {
  77. // TRANS: Menu item title in administrator navigation panel.
  78. $menu_title = _('User configuration');
  79. // TRANS: Menu item in administrator navigation panel.
  80. $this->out->menuItem(common_local_url('useradminpanel'), _m('MENU','User'),
  81. $menu_title, $action_name == 'useradminpanel', 'nav_user_admin_panel');
  82. }
  83. if (AdminPanelAction::canAdmin('access')) {
  84. // TRANS: Menu item title in administrator navigation panel.
  85. $menu_title = _('Access configuration');
  86. // TRANS: Menu item in administrator navigation panel.
  87. $this->out->menuItem(common_local_url('accessadminpanel'), _m('MENU','Access'),
  88. $menu_title, $action_name == 'accessadminpanel', 'nav_access_admin_panel');
  89. }
  90. if (AdminPanelAction::canAdmin('paths')) {
  91. // TRANS: Menu item title in administrator navigation panel.
  92. $menu_title = _('Paths configuration');
  93. // TRANS: Menu item in administrator navigation panel.
  94. $this->out->menuItem(common_local_url('pathsadminpanel'), _m('MENU','Paths'),
  95. $menu_title, $action_name == 'pathsadminpanel', 'nav_paths_admin_panel');
  96. }
  97. if (AdminPanelAction::canAdmin('sessions')) {
  98. // TRANS: Menu item title in administrator navigation panel.
  99. $menu_title = _('Sessions configuration');
  100. // TRANS: Menu item in administrator navigation panel.
  101. $this->out->menuItem(common_local_url('sessionsadminpanel'), _m('MENU','Sessions'),
  102. $menu_title, $action_name == 'sessionsadminpanel', 'nav_sessions_admin_panel');
  103. }
  104. if (AdminPanelAction::canAdmin('sitenotice')) {
  105. // TRANS: Menu item title in administrator navigation panel.
  106. $menu_title = _('Edit site notice');
  107. // TRANS: Menu item in administrator navigation panel.
  108. $this->out->menuItem(common_local_url('sitenoticeadminpanel'), _m('MENU','Site notice'),
  109. $menu_title, $action_name == 'sitenoticeadminpanel', 'nav_sitenotice_admin_panel');
  110. }
  111. if (AdminPanelAction::canAdmin('license')) {
  112. // TRANS: Menu item title in administrator navigation panel.
  113. $menu_title = _('Set site license');
  114. // TRANS: Menu item in administrator navigation panel.
  115. $this->out->menuItem(common_local_url('licenseadminpanel'), _m('MENU','License'),
  116. $menu_title, $action_name == 'licenseadminpanel', 'nav_license_admin_panel');
  117. }
  118. if (AdminPanelAction::canAdmin('plugins')) {
  119. // TRANS: Menu item title in administrator navigation panel.
  120. $menu_title = _('Plugins configuration');
  121. // TRANS: Menu item in administrator navigation panel.
  122. $this->out->menuItem(common_local_url('pluginsadminpanel'), _m('MENU','Plugins'),
  123. $menu_title, $action_name == 'pluginsadminpanel', 'nav_plugin_admin_panel');
  124. }
  125. Event::handle('EndAdminPanelNav', array($this));
  126. }
  127. $this->action->elementEnd('ul');
  128. $this->action->elementEnd('li');
  129. $this->action->elementEnd('ul');
  130. }
  131. }