/** * @param {String} $key valid key as specified in validTabs * @return {HtmlForm} */ public function getPreferencesForm($key) { $prefs = array(); $user = $this->getUser(); $ctx = $this->getContext(); switch ($key) { case 'personal': Preferences::profilePreferences($user, $ctx, $prefs); break; case 'skin': Preferences::skinPreferences($user, $ctx, $prefs); break; case 'dateformat': Preferences::datetimePreferences($user, $ctx, $prefs); break; case 'files': Preferences::filesPreferences($user, $ctx, $prefs); break; case 'rc': Preferences::rcPreferences($user, $ctx, $prefs); break; } Preferences::loadPreferenceValues($user, $ctx, $prefs); $htmlForm = new PreferencesForm($prefs, $ctx, 'prefs'); $htmlForm->suppressReset(); $htmlForm->setModifiedUser($user); $htmlForm->setId('mw-prefs-form'); $htmlForm->setSubmitText($ctx->msg('saveprefs')->text()); $htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit')); $htmlForm->setAction(SpecialPage::getTitleFor($this->getName(), $key)->getLocalUrl()); return $htmlForm; }
/** Helper */ function prefsFor($user_key) { $preferences = array(); Preferences::profilePreferences($this->prefUsers[$user_key], $this->context, $preferences); return $preferences; }