groupmembers.php 2.8 KB

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