groupmembers.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * StatusNet, the distributed open-source microblogging tool
  4. *
  5. * List of group members
  6. *
  7. * PHP version 5
  8. *
  9. * LICENCE: This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. * @category Group
  23. * @package StatusNet
  24. * @author Evan Prodromou <evan@status.net>
  25. * @copyright 2008-2009 StatusNet, Inc.
  26. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  27. * @link http://status.net/
  28. */
  29. if (!defined('GNUSOCIAL')) { exit(1); }
  30. /**
  31. * List of group members
  32. *
  33. * @category Group
  34. * @package StatusNet
  35. * @author Evan Prodromou <evan@status.net>
  36. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  37. * @link http://status.net/
  38. */
  39. class GroupmembersAction extends GroupAction
  40. {
  41. var $page = null;
  42. function isReadOnly($args)
  43. {
  44. return true;
  45. }
  46. function title()
  47. {
  48. if ($this->page == 1) {
  49. // TRANS: Title of the page showing group members.
  50. // TRANS: %s is the name of the group.
  51. return sprintf(_('%s group members'),
  52. $this->group->nickname);
  53. } else {
  54. // TRANS: Title of the page showing group members.
  55. // TRANS: %1$s is the name of the group, %2$d is the page number of the members list.
  56. return sprintf(_('%1$s group members, page %2$d'),
  57. $this->group->nickname,
  58. $this->page);
  59. }
  60. }
  61. protected function handle()
  62. {
  63. parent::handle();
  64. $this->showPage();
  65. }
  66. function showPageNotice()
  67. {
  68. $this->element('p', 'instructions',
  69. // TRANS: Page notice for group members page.
  70. _('A list of the users in this group.'));
  71. }
  72. function showContent()
  73. {
  74. $offset = ($this->page-1) * PROFILES_PER_PAGE;
  75. $limit = PROFILES_PER_PAGE + 1;
  76. $cnt = 0;
  77. $members = $this->group->getMembers($offset, $limit);
  78. if ($members) {
  79. $member_list = new GroupMemberList($members, $this->group, $this);
  80. $cnt = $member_list->show();
  81. }
  82. $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
  83. $this->page, 'groupmembers',
  84. array('nickname' => $this->group->nickname));
  85. }
  86. }