gnu-social/plugins/Poll/forms/pollprefs.php

92 lines
2.0 KiB
PHP
Raw Normal View History

2015-07-17 23:19:02 +09:00
<?php
2019-06-23 08:55:40 +09:00
if (!defined('GNUSOCIAL')) {
exit(1);
}
2015-07-17 23:19:02 +09:00
class PollPrefsForm extends Form
{
2019-06-23 08:55:40 +09:00
public function __construct(Action $out, User_poll_prefs $prefs = null)
2015-07-17 23:19:02 +09:00
{
parent::__construct($out);
$this->prefs = $prefs;
}
/**
* Visible or invisible data elements
*
* Display the form fields that make up the data of the form.
* Sub-classes should overload this to show their data.
*
* @return void
*/
2019-06-23 08:55:40 +09:00
public function formData()
2015-07-17 23:19:02 +09:00
{
$this->elementStart('fieldset');
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
2019-06-23 08:55:40 +09:00
$this->checkbox(
'hide_responses',
_('Do not deliver poll responses to my home timeline'),
($this->prefs instanceof User_poll_prefs && $this->prefs->hide_responses)
);
2015-07-17 23:19:02 +09:00
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('fieldset');
}
/**
* Buttons for form actions
*
* Submit and cancel buttons (or whatever)
* Sub-classes should overload this to show their own buttons.
*
* @return void
*/
2019-06-23 08:55:40 +09:00
public function formActions()
2015-07-17 23:19:02 +09:00
{
$this->submit('submit', _('Save'));
}
/**
* ID of the form
*
* Should be unique on the page. Sub-classes should overload this
* to show their own IDs.
*
* @return int ID of the form
*/
2019-06-23 08:55:40 +09:00
public function id()
2015-07-17 23:19:02 +09:00
{
return 'form_poll_prefs';
}
/**
* Action of the form.
*
* URL to post to. Should be overloaded by subclasses to give
* somewhere to post to.
*
* @return string URL to post to
*/
2019-06-23 08:55:40 +09:00
public function action()
2015-07-17 23:19:02 +09:00
{
return common_local_url('pollsettings');
}
/**
* Class of the form. May include space-separated list of multiple classes.
*
* @return string the form's class
*/
2019-06-23 08:55:40 +09:00
public function formClass()
2015-07-17 23:19:02 +09:00
{
return 'form_settings';
}
}