pollprefs.php 1.9 KB

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