Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
| <?php | <?php | ||||
| final class PhabricatorAccountSettingsPanel extends PhabricatorSettingsPanel { | final class PhabricatorAccountSettingsPanel extends PhabricatorSettingsPanel { | ||||
| public function getPanelKey() { | public function getPanelKey() { | ||||
| return 'account'; | return 'account'; | ||||
| } | } | ||||
| public function getPanelName() { | public function getPanelName() { | ||||
| return pht('Account'); | return pht('Account'); | ||||
| } | } | ||||
| public function getPanelGroup() { | public function getPanelGroup() { | ||||
| return pht('Account Information'); | return pht('Account Information'); | ||||
| } | } | ||||
| public function isEditableByAdministrators() { | |||||
| return true; | |||||
| } | |||||
| public function processRequest(AphrontRequest $request) { | public function processRequest(AphrontRequest $request) { | ||||
| $user = $request->getUser(); | $viewer = $this->getViewer(); | ||||
| $user = $this->getUser(); | |||||
| $username = $user->getUsername(); | $username = $user->getUsername(); | ||||
| $errors = array(); | $errors = array(); | ||||
| if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
| $sex = $request->getStr('sex'); | $sex = $request->getStr('sex'); | ||||
| $sexes = array(PhutilPerson::SEX_MALE, PhutilPerson::SEX_FEMALE); | $sexes = array(PhutilPerson::SEX_MALE, PhutilPerson::SEX_FEMALE); | ||||
| if (in_array($sex, $sexes)) { | if (in_array($sex, $sexes)) { | ||||
| $user->setSex($sex); | $user->setSex($sex); | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | public function processRequest(AphrontRequest $request) { | ||||
| // TODO: Implement "locale.default" and use it here. | // TODO: Implement "locale.default" and use it here. | ||||
| $default = 'en_US'; | $default = 'en_US'; | ||||
| $translations = array( | $translations = array( | ||||
| '' => pht('Server Default: %s', $locales[$default]->getLocaleName()), | '' => pht('Server Default: %s', $locales[$default]->getLocaleName()), | ||||
| ) + $translations; | ) + $translations; | ||||
| $form = new AphrontFormView(); | $form = new AphrontFormView(); | ||||
| $form | $form | ||||
| ->setUser($user) | ->setUser($viewer) | ||||
| ->appendChild( | ->appendChild( | ||||
| id(new AphrontFormSelectControl()) | id(new AphrontFormSelectControl()) | ||||
| ->setOptions($translations) | ->setOptions($translations) | ||||
| ->setLabel(pht('Translation')) | ->setLabel(pht('Translation')) | ||||
| ->setName('translation') | ->setName('translation') | ||||
| ->setValue($user->getTranslation())) | ->setValue($user->getTranslation())) | ||||
| ->appendRemarkupInstructions(pht('**Choose the pronoun you prefer:**')) | ->appendRemarkupInstructions(pht('**Choose the pronoun you prefer:**')) | ||||
| ->appendChild( | ->appendChild( | ||||
| Show All 20 Lines | |||||