}
return $profile;
}
+
+ function getLists($offset, $limit)
+ {
+ $ids = array();
+
+ $keypart = sprintf('profile:lists:%d', $this->id);
+
+ $idstr = self::cacheGet($keypart);
+
+ if ($idstr !== false) {
+ $ids = explode(',', $idstr);
+ } else {
+ $list = new Profile_list();
+ $list->selectAdd();
+ $list->selectAdd('id');
+ $list->tagger = $this->id;
+
+ if ($list->find()) {
+ while ($list->fetch()) {
+ $ids[] = $list->id;
+ }
+ }
+
+ self::cacheSet($keypart, implode(',', $ids));
+ }
+
+ $lists = array();
+
+ foreach ($ids as $id) {
+ $lists[] = Profile_list::staticGet('id', $id);
+ }
+
+ return new ArrayWrapper($lists);
+ }
}
$this->showSubscriptions();
$this->showSubscribers();
$this->showGroups();
- $this->showListsFor();
- $this->showListSubscriptions();
+ $this->showLists();
$this->showStatistics();
}
$this->elementEnd('div');
}
- function showListsFor()
- {
- if (Event::handle('StartShowListsForSection', array($this))) {
-
- $section = new PeopletagsForUserSection($this, $this->profile);
- $section->show();
-
- Event::handle('EndShowListsForSection', array($this));
- }
- }
-
- function showListSubscriptions()
- {
- if (Event::handle('StartShowListSubscriptionsSection', array($this))) {
-
- $section = new PeopletagSubscriptionsSection($this, $this->profile);
- $section->show();
-
- Event::handle('EndShowListSubscriptionsSection', array($this));
- }
- }
-
function showStatistics()
{
$notice_count = $this->profile->noticeCount();
}
$this->elementEnd('div');
}
+
+ function showLists()
+ {
+ $lists = $this->profile->getLists();
+
+ if ($lists->N > 0) {
+ $this->elementStart('div', array('id' => 'entity_lists',
+ 'class' => 'section'));
+
+ if (Event::handle('StartShowListsMiniList', array($this))) {
+
+ $this->elementStart('h2');
+ // TRANS: H2 text for user list membership statistics.
+ $this->statsSectionLink('userlists', _('Lists'));
+ $this->text(' ');
+ $this->text($lists->N);
+ $this->elementEnd('h2');
+
+ $this->elementStart('ul');
+
+ $cur = common_current_user();
+
+ while ($lists->fetch()) {
+ if (!$lists->private ||
+ ($lists->private && !empty($cur) && $cur->id == $profile->id)) {
+ if (!empty($lists->mainpage)) {
+ $url = $lists->mainpage;
+ } else {
+ $url = common_local_url('showprofiletag',
+ array('tagger' => $this->profile->nickname,
+ 'tag' => $lists->tag));
+ }
+ $this->elementStart('li');
+ $this->element('a', array('href' => $url),
+ $lists->tag);
+ $this->elementEnd('li');
+ }
+ }
+
+ $this->elementEnd('ul');
+
+ Event::handle('EndShowListsMiniList', array($this));
+ }
+ $this->elementEnd('div');
+ }
+ }
}
class SubscribersMiniList extends ProfileMiniList