1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- if (!defined('GNUSOCIAL')) {
- exit(1);
- }
- class PollSettingsAction extends SettingsAction
- {
-
- public function title()
- {
-
- return _m('Poll settings');
- }
-
- public function getInstructions()
- {
-
- return _m('Set your poll preferences');
- }
- protected function getForm()
- {
- $prefs = User_poll_prefs::getKV('user_id', $this->scoped->getID());
- $form = new PollPrefsForm($this, $prefs ? $prefs : null);
- return $form;
- }
- protected function doPost()
- {
- $upp = User_poll_prefs::getKV('user_id', $this->scoped->getID());
- $orig = null;
- if ($upp instanceof User_poll_prefs) {
- $orig = clone($upp);
- } else {
- $upp = new User_poll_prefs();
- $upp->user_id = $this->scoped->getID();
- $upp->created = common_sql_now();
- }
- $upp->hide_responses = $this->boolean('hide_responses');
- $upp->modified = common_sql_now();
- if ($orig instanceof User_poll_prefs) {
- $upp->update($orig);
- } else {
- $upp->insert();
- }
-
- return _('Settings saved.');
- }
- }
|