subscriptionslistitem.php 2.5 KB

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