require_once INSTALLDIR.'/lib/personalgroupnav.php';
require_once INSTALLDIR.'/lib/noticelist.php';
+require_once INSTALLDIR.'/lib/profileminilist.php';
require_once INSTALLDIR.'/lib/feedlist.php';
/**
}
$this->elementEnd('div');
-
$this->elementStart('div', array('id' => 'user_actions'));
$this->element('h2', null, _('User actions'));
$this->elementStart('ul');
if ($cur) {
if ($cur->id != $this->profile->id) {
if ($cur->isSubscribed($this->profile)) {
- $sf = new SubscribeForm($this, $this->profile);
- $sf->show();
- } else {
$usf = new UnsubscribeForm($this, $this->profile);
$usf->show();
+ } else {
+ $sf = new SubscribeForm($this, $this->profile);
+ $sf->show();
}
}
} else {
}
}
-
-
if ($cur && $cur->id != $this->profile->id) {
$blocked = $cur->hasBlocked($this->profile);
$this->elementStart('li', array('id' => 'user_block'));
if ($blocked) {
- $bf = new BlockForm($this, $this->profile);
- $bf->show();
- } else {
$ubf = new UnblockForm($this, $this->profile);
$ubf->show();
+ } else {
+ $bf = new BlockForm($this, $this->profile);
+ $bf->show();
}
$this->elementEnd('li');
}
{
$this->showStatistics();
$this->showSubscriptions();
+ $this->showSubscribers();
}
function showSubscriptions()
{
- $subs = new Subscription();
- $subs->subscriber = $this->profile->id;
- $subs->whereAdd('subscribed != ' . $this->profile->id);
-
- $subs->orderBy('created DESC');
-
- // We ask for an extra one to know if we need to do another page
-
- $subs->limit(0, SUBSCRIPTIONS + 1);
-
- $subs_count = $subs->find();
+ $profile = $this->user->getSubscriptions(0, PROFILES_PER_MINILIST + 1);
$this->elementStart('div', array('id' => 'user_subscriptions',
'class' => 'section'));
$this->element('h2', null, _('Subscriptions'));
- if ($subs_count > 0) {
+ if ($profile) {
+ $pml = new ProfileMiniList($profile, $this->user, $this);
+ $cnt = $pml->show();
+ if ($cnt == 0) {
+ $this->element('p', null, _('(None)'));
+ }
+ }
- $this->elementStart('ul', 'users');
+ if ($cnt > PROFILES_PER_MINILIST) {
+ $this->elementStart('p');
+ $this->element('a', array('href' => common_local_url('subscriptions',
+ array('nickname' => $this->profile->nickname)),
+ 'class' => 'mores'),
+ _('All subscriptions'));
+ $this->elementEnd('p');
+ }
- for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
+ $this->elementEnd('div');
+ }
- if (!$subs->fetch()) {
- common_debug('Weirdly, broke out of subscriptions loop early', __FILE__);
- break;
- }
+ function showSubscribers()
+ {
+ $profile = $this->user->getSubscribers(0, PROFILES_PER_MINILIST + 1);
- $other = Profile::staticGet($subs->subscribed);
+ $this->elementStart('div', array('id' => 'user_subscribers',
+ 'class' => 'section'));
- if (!$other) {
- common_log_db_error($subs, 'SELECT', __FILE__);
- continue;
- }
+ $this->element('h2', null, _('Subscribers'));
- $this->elementStart('li', 'vcard');
- $this->elementStart('a', array('title' => ($other->fullname) ?
- $other->fullname :
- $other->nickname,
- 'href' => $other->profileurl,
- 'rel' => 'contact',
- 'class' => 'url'));
- $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
- $this->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
- 'width' => AVATAR_MINI_SIZE,
- 'height' => AVATAR_MINI_SIZE,
- 'class' => 'avatar photo',
- 'alt' => ($other->fullname) ?
- $other->fullname :
- $other->nickname));
- $this->element('span', 'fn nickname', $other->nickname);
- $this->elementEnd('a');
- $this->elementEnd('li');
+ if ($profile) {
+ $pml = new ProfileMiniList($profile, $this->user, $this);
+ $cnt = $pml->show();
+ if ($cnt == 0) {
+ $this->element('p', null, _('(None)'));
}
-
- $this->elementEnd('ul');
}
- if ($subs_count > SUBSCRIPTIONS) {
+ if ($cnt > PROFILES_PER_MINILIST) {
$this->elementStart('p');
-
- $this->element('a', array('href' => common_local_url('subscriptions',
+ $this->element('a', array('href' => common_local_url('subscribers',
array('nickname' => $this->profile->nickname)),
'class' => 'mores'),
- _('All subscriptions'));
+ _('All subscribers'));
$this->elementEnd('p');
}
$this->elementEnd('div');
}
-
}
// We don't show the author for a profile, since we already know who it is!