summaryrefslogtreecommitdiff
path: root/actions/subscriptions.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-06-14 14:52:26 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-06-14 14:52:26 -0700
commitc2dae24701a22cd2362ebe1a96828cd7945c6b5a (patch)
treef42f7a9961b131c3311800544ef113cb3c6e220a /actions/subscriptions.php
parent9addfeacfdacf1eb8c6a90a636f468e4aeb0e9fe (diff)
Break profilelist into a recipe
Expanded the ProfileList class so it worked more like a recipe. This helps to get rid of a lot of special cases and simplifies the code. It also makes it possible to do things like group block.
Diffstat (limited to 'actions/subscriptions.php')
-rw-r--r--actions/subscriptions.php34
1 files changed, 29 insertions, 5 deletions
diff --git a/actions/subscriptions.php b/actions/subscriptions.php
index 095b18ad8..4124abea4 100644
--- a/actions/subscriptions.php
+++ b/actions/subscriptions.php
@@ -137,22 +137,46 @@ class SubscriptionsAction extends GalleryAction
}
}
-class SubscriptionsList extends ProfileList
+// XXX SubscriptionsList and SubscriptionList are dangerously close
+
+class SubscriptionsList extends SubscriptionList
{
- function showOwnerControls($profile)
+ function newListItem($profile)
+ {
+ return new SubscriptionsListItem($profile, $this->owner, $this->action);
+ }
+}
+
+class SubscriptionsListItem extends SubscriptionListItem
+{
+ function showProfile()
+ {
+ $this->startProfile();
+ $this->showAvatar();
+ $this->showFullName();
+ $this->showLocation();
+ $this->showHomepage();
+ $this->showBio();
+ $this->showTags();
+ // Relevant portion!
+ $this->showOwnerControls();
+ $this->endProfile();
+ }
+
+ function showOwnerControls()
{
$sub = Subscription::pkeyGet(array('subscriber' => $this->owner->id,
- 'subscribed' => $profile->id));
+ 'subscribed' => $this->profile->id));
if (!$sub) {
return;
}
- $this->out->elementStart('form', array('id' => 'subedit-' . $profile->id,
+ $this->out->elementStart('form', array('id' => 'subedit-' . $this->profile->id,
'method' => 'post',
'class' => 'form_subscription_edit',
'action' => common_local_url('subedit')));
$this->out->hidden('token', common_session_token());
- $this->out->hidden('profile', $profile->id);
+ $this->out->hidden('profile', $this->profile->id);
$this->out->checkbox('jabber', _('Jabber'), $sub->jabber);
$this->out->checkbox('sms', _('SMS'), $sub->sms);
$this->out->submit('save', _('Save'));