<?php
-
/**
* StatusNet, the distributed open-source microblogging tool
*
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class SortableSubscriptionList extends SubscriptionList
{
/** Owner of this list */
$this->out->elementStart('tr');
$tableHeaders = array(
+ // TRANS: Column header in table for user nickname.
'nickname' => _m('Nickname'),
+ // TRANS: Column header in table for timestamp when user was created.
'created' => _m('Created')
);
$this->out->elementEnd('th');
}
- $this->out->element('th', array('id' => 'subscriptions'), 'Subscriptions');
- $this->out->element('th', array('id' => 'notices'), 'Notices');
+ // TRANS: Column header for number of subscriptions.
+ $this->out->element('th', array('id' => 'subscriptions'), _m('Subscriptions'));
+ // TRANS: Column header for number of notices.
+ $this->out->element('th', array('id' => 'notices'), _m('Notices'));
$this->out->element('th', array('id' => 'controls'), null);
$this->out->elementEnd('tr');
function showProfiles()
{
- $cnt = 0;
+ // Note: we don't use fetchAll() because it's borked with query()
+
+ $profiles = array();
while ($this->profile->fetch()) {
- $cnt++;
- if($cnt > PROFILES_PER_PAGE) {
- break;
- }
+ $profiles[] = clone($this->profile);
+ }
+
+ $cnt = count($profiles);
- $odd = ($cnt % 2 == 0); // for zebra striping
+ $max = min($cnt, $this->maxProfiles());
- $pli = $this->newListItem($this->profile, $odd);
+ for ($i = 0; $i < $max; $i++) {
+ $odd = ($i % 2 == 0); // for zebra striping
+ $pli = $this->newListItem($profiles[$i], $odd);
$pli->show();
}
return $cnt;
}
- function newListItem($profile, $odd)
+ function newListItem(Profile $profile, $odd)
{
return new SortableSubscriptionListItem($profile, $this->owner, $this->action, $odd);
}
function startProfile()
{
- $this->out->elementStart('td', 'entity_profile vcard entry-content');
+ $this->out->elementStart('td', 'entity_profile h-card');
}
function endProfile()
function endActions()
{
+
+ // delete button
+ $cur = common_current_user();
+ list($action, $r2args) = $this->out->returnToArgs();
+ $r2args['action'] = $action;
+ if ($cur instanceof User && $cur->hasRight(Right::DELETEUSER)) {
+ $this->out->elementStart('li', 'entity_delete');
+ $df = new DeleteUserForm($this->out, $this->profile, $r2args);
+ $df->show();
+ $this->out->elementEnd('li');
+ }
+
$this->out->elementEnd('ul');
$this->out->elementEnd('td');
}
$this->out->elementEnd('td');
}
+ /**
+ * Overrided to truncate the bio if it's real long, because it
+ * looks better that way in the SortableSubscriptionList's table
+ */
+ function showBio()
+ {
+ if (!empty($this->profile->bio)) {
+ $cutoff = 140; // XXX Should this be configurable?
+ $bio = htmlspecialchars($this->profile->bio);
+
+ if (mb_strlen($bio) > $cutoff) {
+ $bio = mb_substr($bio, 0, $cutoff - 1)
+ .'<a href="' . $this->profile->profileurl .'">…</a>';
+ }
+
+ $this->out->elementStart('p', 'note');
+ $this->out->raw($bio);
+ $this->out->elementEnd('p');
+ }
+ }
+
/**
* Only show the tags if we're logged in
*/
}
}
-
}