subscriptionslistitem.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. if (!defined('GNUSOCIAL')) { exit(1); }
  3. class SubscriptionsListItem extends SubscriptionListItem
  4. {
  5. function showOwnerControls()
  6. {
  7. $sub = Subscription::pkeyGet(array('subscriber' => $this->owner->id,
  8. 'subscribed' => $this->profile->id));
  9. if (!$sub) {
  10. return;
  11. }
  12. $transports = array();
  13. Event::handle('GetImTransports', array(&$transports));
  14. if (!$transports && !common_config('sms', 'enabled')) {
  15. return;
  16. }
  17. $this->out->elementStart('form', array('id' => 'subedit-' . $this->profile->id,
  18. 'method' => 'post',
  19. 'class' => 'form_subscription_edit',
  20. 'action' => common_local_url('subedit')));
  21. $this->out->hidden('token', common_session_token());
  22. $this->out->hidden('profile', $this->profile->id);
  23. if ($transports) {
  24. $attrs = array('name' => 'jabber',
  25. 'type' => 'checkbox',
  26. 'class' => 'checkbox',
  27. 'id' => 'jabber-'.$this->profile->id);
  28. if ($sub->jabber) {
  29. $attrs['checked'] = 'checked';
  30. }
  31. $this->out->element('input', $attrs);
  32. // TRANS: Checkbox label for enabling IM messages for a profile in a subscriptions list.
  33. $this->out->element('label', array('for' => 'jabber-'.$this->profile->id), _m('LABEL','IM'));
  34. } else {
  35. $this->out->hidden('jabber', $sub->jabber);
  36. }
  37. if (common_config('sms', 'enabled')) {
  38. $attrs = array('name' => 'sms',
  39. 'type' => 'checkbox',
  40. 'class' => 'checkbox',
  41. 'id' => 'sms-'.$this->profile->id);
  42. if ($sub->sms) {
  43. $attrs['checked'] = 'checked';
  44. }
  45. $this->out->element('input', $attrs);
  46. // TRANS: Checkbox label for enabling SMS messages for a profile in a subscriptions list.
  47. $this->out->element('label', array('for' => 'sms-'.$this->profile->id), _('SMS'));
  48. } else {
  49. $this->out->hidden('sms', $sub->sms);
  50. }
  51. // TRANS: Save button for settings for a profile in a subscriptions list.
  52. $this->out->submit('save', _m('BUTTON','Save'));
  53. $this->out->elementEnd('form');
  54. }
  55. }