3 * Form to set your personal poll settings
5 * StatusNet, the distributed open-source microblogging tool
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Brion Vibber <brion@status.net>
25 * @copyright 2012 StatusNet, Inc.
26 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
27 * @link http://status.net/
30 if (!defined('GNUSOCIAL')) { exit(1); }
32 class PollSettingsAction extends SettingsAction
37 * @return string Page title
42 return _m('Poll settings');
46 * Instructions for use
48 * @return string Instructions for use
51 function getInstructions()
53 // TRANS: Page instructions.
54 return _m('Set your poll preferences');
57 protected function getForm()
59 $prefs = User_poll_prefs::getKV('user_id', $this->scoped->getID());
60 $form = new PollPrefsForm($this, $prefs);
64 protected function doPost()
66 $upp = User_poll_prefs::getKV('user_id', $this->scoped->getID());
69 if ($upp instanceof User_poll_prefs) {
72 $upp = new User_poll_prefs();
73 $upp->user_id = $this->scoped->getID();
74 $upp->created = common_sql_now();
77 $upp->hide_responses = $this->boolean('hide_responses');
78 $upp->modified = common_sql_now();
80 if ($orig instanceof User_poll_prefs) {
86 // TRANS: Confirmation shown when user profile settings are saved.
87 return _('Settings saved.');