]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/subscriptionslistitem.php
Introduced common_location_shared() to check if location sharing is always,
[quix0rs-gnu-social.git] / lib / subscriptionslistitem.php
1 <?php
2
3 if (!defined('GNUSOCIAL')) { exit(1); }
4
5 class SubscriptionsListItem extends SubscriptionListItem
6 {
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
15         $transports = array();
16         Event::handle('GetImTransports', array(&$transports));
17         if (!$transports && !common_config('sms', 'enabled')) {
18             return;
19         }
20
21         $this->out->elementStart('form', array('id' => 'subedit-' . $this->profile->id,
22                                           'method' => 'post',
23                                           'class' => 'form_subscription_edit',
24                                           'action' => common_local_url('subedit')));
25         $this->out->hidden('token', common_session_token());
26         $this->out->hidden('profile', $this->profile->id);
27         if ($transports) {
28             $attrs = array('name' => 'jabber',
29                            'type' => 'checkbox',
30                            'class' => 'checkbox',
31                            'id' => 'jabber-'.$this->profile->id);
32             if ($sub->jabber) {
33                 $attrs['checked'] = 'checked';
34             }
35
36             $this->out->element('input', $attrs);
37             // TRANS: Checkbox label for enabling IM messages for a profile in a subscriptions list.
38             $this->out->element('label', array('for' => 'jabber-'.$this->profile->id), _m('LABEL','IM'));
39         } else {
40             $this->out->hidden('jabber', $sub->jabber);
41         }
42         if (common_config('sms', 'enabled')) {
43             $attrs = array('name' => 'sms',
44                            'type' => 'checkbox',
45                            'class' => 'checkbox',
46                            'id' => 'sms-'.$this->profile->id);
47             if ($sub->sms) {
48                 $attrs['checked'] = 'checked';
49             }
50
51             $this->out->element('input', $attrs);
52             // TRANS: Checkbox label for enabling SMS messages for a profile in a subscriptions list.
53             $this->out->element('label', array('for' => 'sms-'.$this->profile->id), _('SMS'));
54         } else {
55             $this->out->hidden('sms', $sub->sms);
56         }
57         // TRANS: Save button for settings for a profile in a subscriptions list.
58         $this->out->submit('save', _m('BUTTON','Save'));
59         $this->out->elementEnd('form');
60     }
61 }