more subscriptions/subscribers changes
Showstream now shows subscriptions in reverse chron order, like the other pages. Added a callback method to figure out who the _other_ guy is in a subscription. Changed gallery page to be a UL of images. darcs-hash:20080618172444-84dde-b886f6f8170370ae1aaf2e7f996aff288a471145.gz
This commit is contained in:
parent
78ac9df2a6
commit
f341780e1f
|
@ -204,6 +204,7 @@ class ShowstreamAction extends StreamAction {
|
|||
|
||||
$subs = DB_DataObject::factory('subscription');
|
||||
$subs->subscriber = $profile->id;
|
||||
$subs->orderBy('created DESC');
|
||||
|
||||
# We ask for an extra one to know if we need to do another page
|
||||
|
||||
|
|
|
@ -43,4 +43,8 @@ class SubscribersAction extends GalleryAction {
|
|||
function div_class() {
|
||||
return 'subscribers';
|
||||
}
|
||||
|
||||
function get_other(&$subs) {
|
||||
return $subs->subscriber;
|
||||
}
|
||||
}
|
|
@ -43,4 +43,8 @@ class SubscriptionsAction extends GalleryAction {
|
|||
function div_class() {
|
||||
return 'subscriptions';
|
||||
}
|
||||
|
||||
function get_other(&$subs) {
|
||||
return $subs->subscribed;
|
||||
}
|
||||
}
|
|
@ -68,15 +68,25 @@ class GalleryAction extends Action {
|
|||
|
||||
$subs_count = $subs->find();
|
||||
|
||||
common_element_start('div', $this->div_class());
|
||||
if ($subs_count == 0) {
|
||||
common_element('p', _t('Nobody to show!'));
|
||||
return;
|
||||
}
|
||||
|
||||
$idx = 0;
|
||||
common_element_start('ul', $this->div_class());
|
||||
|
||||
while ($subs->fetch()) {
|
||||
for ($idx = 0; $idx < min($subs_count, AVATARS_PER_PAGE); $idx++) {
|
||||
|
||||
$idx++;
|
||||
$result = $subs->fetch();
|
||||
|
||||
$other = Profile::staticGet($subs->subscribed);
|
||||
if (!$result) {
|
||||
common_debug('Ran out of subscribers too early.', __FILE__);
|
||||
break;
|
||||
}
|
||||
|
||||
$other = Profile::staticGet($this->get_other($subs));
|
||||
|
||||
common_element_start('li');
|
||||
|
||||
common_element_start('a', array('title' => ($other->fullname) ?
|
||||
$other->fullname :
|
||||
|
@ -98,12 +108,10 @@ class GalleryAction extends Action {
|
|||
|
||||
# XXX: subscribe form here
|
||||
|
||||
if ($idx == AVATARS_PER_PAGE) {
|
||||
break;
|
||||
}
|
||||
common_element_end('li');
|
||||
}
|
||||
|
||||
common_element_end('div');
|
||||
common_element_end('ul');
|
||||
|
||||
common_pagination($page > 1,
|
||||
$subs_count > AVATARS_PER_PAGE,
|
||||
|
@ -124,6 +132,10 @@ class GalleryAction extends Action {
|
|||
return;
|
||||
}
|
||||
|
||||
function get_other(&$subs) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
function div_class() {
|
||||
return '';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user