123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- require_once INSTALLDIR . '/lib/groups/grouplist.php';
- class UsergroupsAction extends GalleryAction
- {
- function title()
- {
- if ($this->page == 1) {
-
-
- return sprintf(_('%s groups'), $this->getTarget()->getNickname());
- } else {
-
-
- return sprintf(_('%1$s groups, page %2$d'),
- $this->getTarget()->getNickname(),
- $this->page);
- }
- }
- function showPageNotice()
- {
- if ($this->scoped instanceof Profile && $this->scoped->sameAs($this->getTarget())) {
- $this->element('p', 'instructions',
-
-
- _('These are the groups whose notices '.
- 'you listen to.'));
- } else {
- $this->element('p', 'instructions',
-
-
- sprintf(_('These are the groups whose '.
- 'notices %s listens to.'),
- $this->target->getNickname()));
- }
- }
- function showContent()
- {
- if ($this->scoped instanceof Profile && $this->scoped->sameAs($this->getTarget())) {
- $notice =
-
-
-
- sprintf(_('Groups let you find and talk with ' .
- 'people of similar interests. ' .
- 'You can [search for groups](%%%%action.groups%%%%) in your instance or ' .
- '[create a new group](%%%%action.newgroup%%%%). ' .
- 'You can also follow groups ' .
- 'from other GNU social instances: click on the remote button below ' .
- 'and copy the group\'s link. ' .
- 'You can find a list of GNU social groups [here](http://skilledtests.com/wiki/List_of_federated_GNU_social_groups)' .
- ''));
- $this->elementStart('div', 'instructions');
- $this->raw(common_markup_to_html($notice));
- $this->elementEnd('div');
- }
- if (Event::handle('StartShowUserGroupsContent', array($this))) {
- $offset = ($this->page-1) * GROUPS_PER_PAGE;
- $limit = GROUPS_PER_PAGE + 1;
- $groups = $this->getTarget()->getGroups($offset, $limit);
- if ($groups instanceof User_group) {
- $gl = new GroupList($groups, $this->getTarget(), $this);
- $cnt = $gl->show();
- if (0 == $cnt) {
- $this->showEmptyListMessage();
- } else {
- $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE,
- $this->page, 'usergroups',
- array('nickname' => $this->getTarget()->getNickname()));
- }
- }
- Event::handle('EndShowUserGroupsContent', array($this));
- }
- }
- function showEmptyListMessage()
- {
-
-
- $message = sprintf(_('%s is not a member of any group.'), $this->getTarget()->getNickname()) . ' ';
- if (common_logged_in()) {
- if ($this->scoped->sameAs($this->getTarget())) {
-
-
- $message = _('You are not member of any group yet. After you join a group ' .
- 'you can send messages to its members using the ' .
- 'syntax "!groupname".');
- }
- }
- $this->elementStart('div', 'guide');
- $this->raw(common_markup_to_html($message));
- $this->elementEnd('div');
- }
- function showProfileBlock()
- {
- $block = new AccountProfileBlock($this, $this->getTarget());
- $block->show();
- }
- }
|