123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class ShowprofiletagAction extends ShowstreamAction
- {
- var $notice, $peopletag;
- protected function doStreamPreparation()
- {
- $tag = common_canonical_tag($this->arg('tag'));
- try {
- $this->peopletag = Profile_list::getByPK(array('tagger' => $this->target->getID(), 'tag' => $tag));
- } catch (NoResultException $e) {
-
- throw new ClientException('No such list.');
- }
- if ($this->peopletag->private && !$this->peopletag->getTagger()->sameAs($this->scoped)) {
-
- throw new AuthorizationException('You do not have permission to see this list.');
- }
- }
- public function getStream()
- {
- return new PeopletagNoticeStream($this->peopletag, $this->scoped);
- }
- function title()
- {
- if ($this->page > 1) {
- if($this->peopletag->private) {
-
-
- return sprintf(_('Private timeline for %1$s list by you, page %2$d'),
- $this->peopletag->tag, $this->page);
- }
- $current = common_current_user();
- if (!empty($current) && $current->id == $this->peopletag->tagger) {
-
-
- return sprintf(_('Timeline for %1$s list by you, page %2$d'),
- $this->peopletag->tag, $this->page);
- }
-
-
- return sprintf(_('Timeline for %1$s list by %2$s, page %3$d'),
- $this->peopletag->tag,
- $this->target->getNickname(),
- $this->page
- );
- } else {
- if($this->peopletag->private) {
-
-
- return sprintf(_('Private timeline of %s list by you'),
- $this->peopletag->tag);
- }
- $current = common_current_user();
- if (!empty($current) && $current->id == $this->peopletag->tagger) {
-
-
- return sprintf(_('Timeline for %s list by you'),
- $this->peopletag->tag);
- }
-
-
- return sprintf(_('Timeline for %1$s list by %2$s'),
- $this->peopletag->tag,
- $this->target->getNickname()
- );
- }
- }
- function getFeeds()
- {
-
- return array(new Feed(Feed::JSON,
- common_local_url(
- 'ApiTimelineList', array(
- 'user' => $this->target->id,
- 'id' => $this->peopletag->id,
- 'format' => 'as'
- )
- ),
-
-
- sprintf(_('Feed for friends of %s (Activity Streams JSON)'), $this->target->getNickname())),
- new Feed(Feed::RSS2,
- common_local_url(
- 'ApiTimelineList', array(
- 'user' => $this->target->id,
- 'id' => $this->peopletag->id,
- 'format' => 'rss'
- )
- ),
-
-
- sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->target->getNickname())),
- new Feed(Feed::ATOM,
- common_local_url(
- 'ApiTimelineList', array(
- 'user' => $this->target->id,
- 'id' => $this->peopletag->id,
- 'format' => 'atom'
- )
- ),
-
-
- sprintf(_('Feed for %1$s list by %2$s (Atom)'),
- $this->peopletag->tag, $this->target->getNickname()
- )
- )
- );
- }
- function showObjectNav()
- {
- $nav = new PeopletagGroupNav($this);
- $nav->show();
- }
- function showEmptyListMessage()
- {
-
-
- $message = sprintf(_('This is the timeline for %1$s list by %2$s but no one has posted anything yet.'),
- $this->peopletag->tag,
- $this->target->getNickname()) . ' ';
- if (common_logged_in()) {
- if ($this->target->sameAs($this->scoped)) {
-
- $message .= _('Try tagging more people.');
- }
- } else {
-
-
- $message .= _('Why not [register an account](%%%%action.register%%%%) and start following this timeline!');
- }
- $this->elementStart('div', 'guide');
- $this->raw(common_markup_to_html($message));
- $this->elementEnd('div');
- }
- protected function showContent()
- {
- $this->showPeopletag();
- parent::showContent();
- }
- function showPeopletag()
- {
- $tag = new Peopletag($this->peopletag, $this->scoped, $this);
- $tag->show();
- }
- function showNotices()
- {
- if (Event::handle('StartShowProfileTagContent', array($this))) {
- $nl = new PrimaryNoticeList($this->notice, $this, array('show_n'=>NOTICES_PER_PAGE));
- $cnt = $nl->show();
- if (0 == $cnt) {
- $this->showEmptyListMessage();
- }
- $this->pagination($this->page > 1,
- $cnt > NOTICES_PER_PAGE,
- $this->page,
- 'showprofiletag',
- array('tag' => $this->peopletag->tag,
- 'nickname' => $this->target->getNickname())
- );
- Event::handle('EndShowProfileTagContent', array($this));
- }
- }
- function showSections()
- {
- $this->showTagged();
- if (!$this->peopletag->private) {
- $this->showSubscribers();
- }
-
- }
- function showTagged()
- {
- $profile = $this->peopletag->getTagged(0, PROFILES_PER_MINILIST + 1);
- $this->elementStart('div', array('id' => 'entity_tagged',
- 'class' => 'section'));
- if (Event::handle('StartShowTaggedProfilesMiniList', array($this))) {
- $title = '';
-
- $this->element('h2', null, _('Listed'));
- $cnt = 0;
- if (!empty($profile)) {
- $pml = new ProfileMiniList($profile, $this);
- $cnt = $pml->show();
- if ($cnt == 0) {
-
- $this->element('p', null, _('(None)'));
- }
- }
- if ($cnt > PROFILES_PER_MINILIST) {
- $this->elementStart('p');
- $this->element('a', array('href' => common_local_url('taggedprofiles',
- array('nickname' => $this->target->getNickname(),
- 'profiletag' => $this->peopletag->tag)),
- 'class' => 'more'),
-
-
- _('Show all'));
- $this->elementEnd('p');
- }
- Event::handle('EndShowTaggedProfilesMiniList', array($this));
- }
- $this->elementEnd('div');
- }
- function showSubscribers()
- {
- $profile = $this->peopletag->getSubscribers(0, PROFILES_PER_MINILIST + 1);
- $this->elementStart('div', array('id' => 'entity_subscribers',
- 'class' => 'section'));
- if (Event::handle('StartShowProfileTagSubscribersMiniList', array($this))) {
-
- $this->element('h2', null, _('Subscribers'));
- $cnt = 0;
- if (!empty($profile)) {
- $pml = new ProfileMiniList($profile, $this);
- $cnt = $pml->show();
- if ($cnt == 0) {
-
- $this->element('p', null, _('(None)'));
- }
- }
-
- Event::handle('EndShowProfileTagSubscribersMiniList', array($this));
- }
- $this->elementEnd('div');
- }
- }
|