123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class SubscriptionsAction extends GalleryAction
- {
- function title()
- {
- if ($this->page == 1) {
-
-
- return sprintf(_('%s subscriptions'), $this->target->getNickname());
- } else {
-
-
- return sprintf(_('%1$s subscriptions, page %2$d'),
- $this->target->getNickname(),
- $this->page);
- }
- }
- function showPageNotice()
- {
- if ($this->scoped instanceof Profile && $this->scoped->sameAs($this->getTarget())) {
- $this->element('p', null,
-
-
- _('These are the people whose notices '.
- 'you listen to.'));
- } else {
- $this->element('p', null,
-
-
- sprintf(_('These are the people whose '.
- 'notices %s listens to.'),
- $this->target->getNickname()));
- }
- }
- function getAllTags()
- {
- return $this->getTags('subscribed', 'subscriber');
- }
- function showContent()
- {
- if (Event::handle('StartShowSubscriptionsContent', array($this))) {
- parent::showContent();
- $offset = ($this->page-1) * PROFILES_PER_PAGE;
- $limit = PROFILES_PER_PAGE + 1;
- $cnt = 0;
- if ($this->tag) {
- $subscriptions = $this->target->getTaggedSubscriptions($this->tag, $offset, $limit);
- } else {
- $subscriptions = $this->target->getSubscribed($offset, $limit);
- }
- if ($subscriptions) {
- $subscriptions_list = new SubscriptionsList($subscriptions, $this->target->getUser(), $this);
- $cnt = $subscriptions_list->show();
- if (0 == $cnt) {
- $this->showEmptyListMessage();
- }
- }
- $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
- $this->page, 'subscriptions',
- array('nickname' => $this->target->getNickname()));
- Event::handle('EndShowSubscriptionsContent', array($this));
- }
- }
- function showScripts()
- {
- parent::showScripts();
- $this->autofocus('tag');
- }
- function showEmptyListMessage()
- {
- if ($this->scoped instanceof Profile && $this->target->id === $this->scoped->id) {
-
-
-
-
- $message = _('You\'re not listening to anyone\'s notices right now, try subscribing to people you know. '.
- 'Try [people search](%%action.peoplesearch%%), look for members in groups you\'re interested '.
- 'in and in our [featured users](%%action.featured%%).');
- } else {
-
-
- $message = sprintf(_('%s is not listening to anyone.'), $this->target->getNickname());
- }
- $this->elementStart('div', 'guide');
- $this->raw(common_markup_to_html($message));
- $this->elementEnd('div');
- }
-
- function getFeeds()
- {
- return array(new Feed(Feed::ATOM,
- common_local_url('AtomPubSubscriptionFeed',
- array('subscriber' => $this->target->id)),
-
- sprintf(_('Subscription feed for %s (Atom)'),
- $this->target->getNickname())));
- }
- }
|