}
}
}
+
+/**
+ * Adds user preferences elements to user edit form.
+ *
+ * @deprecated since Moodle 2.9 MDL-45774 - Please do not use this function any more.
+ * @todo MDL-49784 Remove this function in Moodle 3.1
+ * @param stdClass $user
+ * @param moodleform $mform
+ * @param array|null $editoroptions
+ * @param array|null $filemanageroptions
+ */
+function useredit_shared_definition_preferences($user, &$mform, $editoroptions = null, $filemanageroptions = null) {
+ global $CFG;
+
+ debugging('useredit_shared_definition_preferences() is deprecated.', DEBUG_DEVELOPER, backtrace);
+
+ $choices = array();
+ $choices['0'] = get_string('emaildisplayno');
+ $choices['1'] = get_string('emaildisplayyes');
+ $choices['2'] = get_string('emaildisplaycourse');
+ $mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices);
+ $mform->setDefault('maildisplay', $CFG->defaultpreference_maildisplay);
+
+ $choices = array();
+ $choices['0'] = get_string('textformat');
+ $choices['1'] = get_string('htmlformat');
+ $mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
+ $mform->setDefault('mailformat', $CFG->defaultpreference_mailformat);
+
+ if (!empty($CFG->allowusermailcharset)) {
+ $choices = array();
+ $charsets = get_list_of_charsets();
+ if (!empty($CFG->sitemailcharset)) {
+ $choices['0'] = get_string('site').' ('.$CFG->sitemailcharset.')';
+ } else {
+ $choices['0'] = get_string('site').' (UTF-8)';
+ }
+ $choices = array_merge($choices, $charsets);
+ $mform->addElement('select', 'preference_mailcharset', get_string('emailcharset'), $choices);
+ }
+
+ $choices = array();
+ $choices['0'] = get_string('emaildigestoff');
+ $choices['1'] = get_string('emaildigestcomplete');
+ $choices['2'] = get_string('emaildigestsubjects');
+ $mform->addElement('select', 'maildigest', get_string('emaildigest'), $choices);
+ $mform->setDefault('maildigest', $CFG->defaultpreference_maildigest);
+ $mform->addHelpButton('maildigest', 'emaildigest');
+
+ $choices = array();
+ $choices['1'] = get_string('autosubscribeyes');
+ $choices['0'] = get_string('autosubscribeno');
+ $mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
+ $mform->setDefault('autosubscribe', $CFG->defaultpreference_autosubscribe);
+
+ if (!empty($CFG->forum_trackreadposts)) {
+ $choices = array();
+ $choices['0'] = get_string('trackforumsno');
+ $choices['1'] = get_string('trackforumsyes');
+ $mform->addElement('select', 'trackforums', get_string('trackforums'), $choices);
+ $mform->setDefault('trackforums', $CFG->defaultpreference_trackforums);
+ }
+
+ $editors = editors_get_enabled();
+ if (count($editors) > 1) {
+ $choices = array('' => get_string('defaulteditor'));
+ $firsteditor = '';
+ foreach (array_keys($editors) as $editor) {
+ if (!$firsteditor) {
+ $firsteditor = $editor;
+ }
+ $choices[$editor] = get_string('pluginname', 'editor_' . $editor);
+ }
+ $mform->addElement('select', 'preference_htmleditor', get_string('textediting'), $choices);
+ $mform->setDefault('preference_htmleditor', '');
+ } else {
+ // Empty string means use the first chosen text editor.
+ $mform->addElement('hidden', 'preference_htmleditor');
+ $mform->setDefault('preference_htmleditor', '');
+ $mform->setType('preference_htmleditor', PARAM_PLUGIN);
+ }
+
+ $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
+ $mform->setDefault('lang', $CFG->lang);
+
+}
$mform->setType('address', PARAM_TEXT);
}
-/**
- * Adds user preferences elements to user edit form.
- *
- * @param stdClass $user
- * @param moodleform $mform
- * @param array|null $editoroptions
- * @param array|null $filemanageroptions
- */
-function useredit_shared_definition_preferences($user, &$mform, $editoroptions = null, $filemanageroptions = null) {
- global $CFG;
-
- $choices = array();
- $choices['0'] = get_string('emaildisplayno');
- $choices['1'] = get_string('emaildisplayyes');
- $choices['2'] = get_string('emaildisplaycourse');
- $mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices);
- $mform->setDefault('maildisplay', $CFG->defaultpreference_maildisplay);
-
- $choices = array();
- $choices['0'] = get_string('textformat');
- $choices['1'] = get_string('htmlformat');
- $mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
- $mform->setDefault('mailformat', $CFG->defaultpreference_mailformat);
-
- if (!empty($CFG->allowusermailcharset)) {
- $choices = array();
- $charsets = get_list_of_charsets();
- if (!empty($CFG->sitemailcharset)) {
- $choices['0'] = get_string('site').' ('.$CFG->sitemailcharset.')';
- } else {
- $choices['0'] = get_string('site').' (UTF-8)';
- }
- $choices = array_merge($choices, $charsets);
- $mform->addElement('select', 'preference_mailcharset', get_string('emailcharset'), $choices);
- }
-
- $choices = array();
- $choices['0'] = get_string('emaildigestoff');
- $choices['1'] = get_string('emaildigestcomplete');
- $choices['2'] = get_string('emaildigestsubjects');
- $mform->addElement('select', 'maildigest', get_string('emaildigest'), $choices);
- $mform->setDefault('maildigest', $CFG->defaultpreference_maildigest);
- $mform->addHelpButton('maildigest', 'emaildigest');
-
- $choices = array();
- $choices['1'] = get_string('autosubscribeyes');
- $choices['0'] = get_string('autosubscribeno');
- $mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
- $mform->setDefault('autosubscribe', $CFG->defaultpreference_autosubscribe);
-
- if (!empty($CFG->forum_trackreadposts)) {
- $choices = array();
- $choices['0'] = get_string('trackforumsno');
- $choices['1'] = get_string('trackforumsyes');
- $mform->addElement('select', 'trackforums', get_string('trackforums'), $choices);
- $mform->setDefault('trackforums', $CFG->defaultpreference_trackforums);
- }
-
- $editors = editors_get_enabled();
- if (count($editors) > 1) {
- $choices = array('' => get_string('defaulteditor'));
- $firsteditor = '';
- foreach (array_keys($editors) as $editor) {
- if (!$firsteditor) {
- $firsteditor = $editor;
- }
- $choices[$editor] = get_string('pluginname', 'editor_' . $editor);
- }
- $mform->addElement('select', 'preference_htmleditor', get_string('textediting'), $choices);
- $mform->setDefault('preference_htmleditor', '');
- } else {
- // Empty string means use the first chosen text editor.
- $mform->addElement('hidden', 'preference_htmleditor');
- $mform->setDefault('preference_htmleditor', '');
- $mform->setType('preference_htmleditor', PARAM_PLUGIN);
- }
-
- $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
- $mform->setDefault('lang', $CFG->lang);
-
-}
-
/**
* Return required user name fields for forms.
*