]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Poll/forms/pollprefs.php
Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly
[quix0rs-gnu-social.git] / plugins / Poll / forms / pollprefs.php
1 <?php
2
3 if (!defined('GNUSOCIAL')) { exit(1); }
4
5 class PollPrefsForm extends Form
6 {
7     function __construct(Action $out, User_poll_prefs $prefs=null)
8     {
9         parent::__construct($out);
10         $this->prefs = $prefs;
11     }
12
13     /**
14      * Visible or invisible data elements
15      *
16      * Display the form fields that make up the data of the form.
17      * Sub-classes should overload this to show their data.
18      *
19      * @return void
20      */
21
22     function formData()
23     {
24         $this->elementStart('fieldset');
25         $this->elementStart('ul', 'form_data');
26         $this->elementStart('li');
27         $this->checkbox('hide_responses',
28                         _('Do not deliver poll responses to my home timeline'),
29                         ($this->prefs instanceof User_poll_prefs && $this->prefs->hide_responses));
30         $this->elementEnd('li');
31         $this->elementEnd('ul');
32         $this->elementEnd('fieldset');
33     }
34
35     /**
36      * Buttons for form actions
37      *
38      * Submit and cancel buttons (or whatever)
39      * Sub-classes should overload this to show their own buttons.
40      *
41      * @return void
42      */
43
44     function formActions()
45     {
46         $this->submit('submit', _('Save'));
47     }
48
49     /**
50      * ID of the form
51      *
52      * Should be unique on the page. Sub-classes should overload this
53      * to show their own IDs.
54      *
55      * @return int ID of the form
56      */
57
58     function id()
59     {
60         return 'form_poll_prefs';
61     }
62
63     /**
64      * Action of the form.
65      *
66      * URL to post to. Should be overloaded by subclasses to give
67      * somewhere to post to.
68      *
69      * @return string URL to post to
70      */
71
72     function action()
73     {
74         return common_local_url('pollsettings');
75     }
76
77     /**
78      * Class of the form. May include space-separated list of multiple classes.
79      *
80      * @return string the form's class
81      */
82
83     function formClass()
84     {
85         return 'form_settings';
86     }
87 }