123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?php
- if (!defined('STATUSNET')) {
-
-
- exit(1);
- }
- class PollResponseForm extends Form
- {
- protected $poll;
-
- public function __construct(Poll $poll, HTMLOutputter $out)
- {
- parent::__construct($out);
- $this->poll = $poll;
- }
-
- public function id()
- {
- return 'pollresponse-form';
- }
-
- public function formClass()
- {
- return 'form_settings ajax';
- }
-
- public function action()
- {
- return common_local_url('respondpoll', array('id' => $this->poll->id));
- }
-
- public function formData()
- {
- $poll = $this->poll;
- $out = $this->out;
- $out->element('p', 'poll-question', $poll->question);
- $out->elementStart('ul', 'poll-options');
- foreach ($poll->getOptions() as $i => $opt) {
- $out->elementStart('li');
- $out->elementStart('label');
- $out->element('input', ['type' => 'radio', 'name' => 'pollselection', 'value' => $i + 1], '');
- $out->text(' ' . $opt);
- $out->elementEnd('label');
- $out->elementEnd('li');
- }
- $out->elementEnd('ul');
- }
-
- public function formActions()
- {
-
- $this->out->submit('poll-response-submit', _m('BUTTON', 'Submit'), 'submit', 'submit');
- }
- }
|