groupmembers.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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('STATUSNET') && !defined('LACONICA')) {
  30. exit(1);
  31. }
  32. require_once(INSTALLDIR.'/lib/profilelist.php');
  33. require_once INSTALLDIR.'/lib/publicgroupnav.php';
  34. /**
  35. * List of group members
  36. *
  37. * @category Group
  38. * @package StatusNet
  39. * @author Evan Prodromou <evan@status.net>
  40. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  41. * @link http://status.net/
  42. */
  43. class GroupmembersAction extends GroupAction
  44. {
  45. var $page = null;
  46. function isReadOnly($args)
  47. {
  48. return true;
  49. }
  50. protected function prepare(array $args=array())
  51. {
  52. parent::prepare($args);
  53. $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
  54. return true;
  55. }
  56. function title()
  57. {
  58. if ($this->page == 1) {
  59. // TRANS: Title of the page showing group members.
  60. // TRANS: %s is the name of the group.
  61. return sprintf(_('%s group members'),
  62. $this->group->nickname);
  63. } else {
  64. // TRANS: Title of the page showing group members.
  65. // TRANS: %1$s is the name of the group, %2$d is the page number of the members list.
  66. return sprintf(_('%1$s group members, page %2$d'),
  67. $this->group->nickname,
  68. $this->page);
  69. }
  70. }
  71. protected function handle()
  72. {
  73. parent::handle();
  74. $this->showPage();
  75. }
  76. function showPageNotice()
  77. {
  78. $this->element('p', 'instructions',
  79. // TRANS: Page notice for group members page.
  80. _('A list of the users in this group.'));
  81. }
  82. function showContent()
  83. {
  84. $offset = ($this->page-1) * PROFILES_PER_PAGE;
  85. $limit = PROFILES_PER_PAGE + 1;
  86. $cnt = 0;
  87. $members = $this->group->getMembers($offset, $limit);
  88. if ($members) {
  89. $member_list = new GroupMemberList($members, $this->group, $this);
  90. $cnt = $member_list->show();
  91. }
  92. $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
  93. $this->page, 'groupmembers',
  94. array('nickname' => $this->group->nickname));
  95. }
  96. }