123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <?php
- if (!defined('STATUSNET')) {
-
-
- exit(1);
- }
- class NewpollForm extends Form
- {
- protected $question = null;
- protected $options = array();
-
- function __construct($out=null, $question=null, $options=null)
- {
- parent::__construct($out);
- }
-
- function id()
- {
- return 'newpoll-form';
- }
-
- function formClass()
- {
- return 'form_settings ajax-notice';
- }
-
- function action()
- {
- return common_local_url('newpoll');
- }
-
- function formData()
- {
- $this->out->elementStart('fieldset', array('id' => 'newpoll-data'));
- $this->out->elementStart('ul', 'form_data');
- $this->li();
- $this->out->input('question',
-
- _m('Question'),
- $this->question,
-
- _m('What question are people answering?'),
- 'question',
- true);
- $this->unli();
- $max = 5;
- if (count($this->options) + 1 > $max) {
- $max = count($this->options) + 2;
- }
- for ($i = 0; $i < $max; $i++) {
-
- if (isset($this->options[$i])) {
- $default = $this->options[$i];
- } else {
- $default = '';
- }
- $this->li();
- $this->out->input('poll-option' . ($i + 1),
-
-
- sprintf(_m('Option %d'), $i + 1),
- $default,
- null,
- 'option' . ($i + 1),
- $i<2);
- $this->unli();
- }
- $this->out->elementEnd('ul');
- $toWidget = new ToSelector($this->out,
- common_current_user(),
- null);
- $toWidget->show();
- $this->out->elementEnd('fieldset');
- }
-
- function formActions()
- {
-
- $this->out->submit('poll-submit', _m('BUTTON', 'Save'), 'submit', 'submit');
- }
- }
|