ad6226fb |
1 | <?php //$Id$ |
2 | |
3 | $mform->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"'); |
4 | $mform->addRule('firstname', $strrequired, 'required', null, 'client'); |
5 | $mform->setType('firstname', PARAM_NOTAGS); |
6 | |
7 | $mform->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"'); |
8 | $mform->addRule('lastname', $strrequired, 'required', null, 'client'); |
9 | $mform->setType('lastname', PARAM_NOTAGS); |
10 | |
11 | $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"'); |
12 | $mform->addRule('email', $strrequired, 'required', null, 'client'); |
13 | |
14 | $choices = array(); |
15 | $choices['0'] = get_string('emaildisplayno'); |
16 | $choices['1'] = get_string('emaildisplayyes'); |
17 | $choices['2'] = get_string('emaildisplaycourse'); |
18 | $mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices); |
19 | $mform->setDefault('emaildisplay', 2); |
20 | |
21 | $choices = array(); |
22 | $choices['0'] = get_string('emailenable'); |
23 | $choices['1'] = get_string('emaildisable'); |
24 | $mform->addElement('select', 'emailstop', get_string('emailactive'), $choices); |
25 | $mform->setDefault('emailenable', 1); |
26 | |
27 | $choices = array(); |
28 | $choices['0'] = get_string('textformat'); |
29 | $choices['1'] = get_string('htmlformat'); |
30 | $mform->addElement('select', 'mailformat', get_string('emailformat'), $choices); |
31 | $mform->setDefault('mailformat', 1); |
32 | $mform->setAdvanced('mailformat'); |
33 | |
34 | if (!empty($CFG->allowusermailcharset)) { |
35 | $choices = array(); |
36 | $charsets = get_list_of_charsets(); |
37 | if (!empty($CFG->sitemailcharset)) { |
38 | $choices['0'] = get_string('site').' ('.$CFG->sitemailcharset.')'; |
39 | } else { |
40 | $choices['0'] = get_string('site').' ('.current_charset().')'; |
41 | } |
42 | $choices = array_merge($choices, $charsets); |
43 | $mform->addElement('select', 'preference_mailcharset', get_string('emailcharset'), $choices); |
44 | $mform->setAdvanced('preference_mailcharset'); |
45 | } |
46 | |
47 | $choices = array(); |
48 | $choices['0'] = get_string('emaildigestoff'); |
49 | $choices['1'] = get_string('emaildigestcomplete'); |
50 | $choices['2'] = get_string('emaildigestsubjects'); |
51 | $mform->addElement('select', 'maildigest', get_string('emaildigest'), $choices); |
52 | $mform->setDefault('maildigest', 0); |
53 | $mform->setAdvanced('maildigest'); |
54 | |
55 | $choices = array(); |
56 | $choices['1'] = get_string('autosubscribeyes'); |
57 | $choices['0'] = get_string('autosubscribeno'); |
58 | $mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices); |
59 | $mform->setDefault('autosubscribe', 0); |
60 | $mform->setAdvanced('autosubscribe'); |
61 | |
62 | if (!empty($CFG->forum_trackreadposts)) { |
63 | $choices = array(); |
64 | $choices['0'] = get_string('trackforumsno'); |
65 | $choices['1'] = get_string('trackforumsyes'); |
66 | $mform->addElement('select', 'trackforums', get_string('trackforums'), $choices); |
67 | $mform->setDefault('trackforums', 0); |
68 | $mform->setAdvanced('trackforums'); |
69 | } |
70 | |
71 | if ($CFG->htmleditor) { |
72 | $choices = array(); |
73 | $choices['0'] = get_string('texteditor'); |
74 | $choices['1'] = get_string('htmleditor'); |
75 | $mform->addElement('select', 'htmleditor', get_string('textediting'), $choices); |
76 | $mform->setDefault('htmleditor', 1); |
77 | $mform->setAdvanced('htmleditor'); |
78 | } |
79 | |
80 | if (empty($CFG->enableajax)) { |
81 | $mform->addElement('static', 'ajaxdisabled', get_string('ajaxuse'), get_string('ajaxno')); |
82 | $mform->setAdvanced('ajaxdisabled'); |
83 | } else { |
84 | $choices = array(); |
85 | $choices['0'] = get_string('ajaxno'); |
86 | $choices['1'] = get_string('ajaxyes'); |
87 | $mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices); |
88 | $mform->setDefault('ajax', 0); |
89 | $mform->setAdvanced('ajax'); |
90 | } |
91 | |
92 | $choices = array(); |
93 | $choices['0'] = get_string('screenreaderno'); |
94 | $choices['1'] = get_string('screenreaderyes'); |
95 | $mform->addElement('select', 'screenreader', get_string('screenreaderuse'), $choices); |
96 | $mform->setDefault('screenreader', 0); |
97 | $mform->setAdvanced('screenreader'); |
98 | |
99 | $mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"'); |
100 | $mform->setType('city', PARAM_MULTILANG); |
101 | $mform->addRule('city', $strrequired, 'required', null, 'client'); |
102 | |
103 | |
104 | $choices = get_list_of_countries(); |
105 | $choices= array(''=>get_string('selectacountry').'...') + $choices; |
106 | $mform->addElement('select', 'country', get_string('selectacountry'), $choices); |
107 | $mform->addRule('country', $strrequired, 'required', null, 'client'); |
108 | if (!empty($CFG->country)) { |
109 | $mform->setDefault('country', $CFG->country); |
110 | } |
111 | |
112 | $choices = get_list_of_timezones(); |
113 | $choices['99'] = get_string('serverlocaltime'); |
114 | if ($CFG->forcetimezone != 99) { |
115 | $mform->addElement('static', 'forcedtimezone', get_string('timezone'), $choices[$CFG->forcetimezone]); |
116 | } else { |
117 | $mform->addElement('select', 'timezone', get_string('timezone'), $choices); |
118 | $mform->setDefault('timezone', '99'); |
119 | } |
120 | |
121 | $choices = array(); |
122 | if ($choices = get_list_of_languages()) { |
123 | $mform->addElement('select', 'lang', get_string('preferredlanguage'), $choices); |
124 | $mform->setDefault('lang', $CFG->lang); |
125 | } |
126 | |
127 | if (!empty($CFG->allowuserthemes)) { |
128 | $choices = array(); |
129 | $choices[''] = get_string('default'); |
130 | $choices += get_list_of_themes(); |
131 | $mform->addElement('select', 'theme', get_string('preferredtheme'), $choices); |
132 | $mform->setAdvanced('theme'); |
133 | } |
134 | |
135 | $mform->addElement('htmleditor', 'description', get_string('userdescription')); |
136 | $mform->setType('description', PARAM_CLEAN); |
137 | $mform->setHelpButton('description', array('text', get_string('helptext'))); |
138 | //TODO: set as 'required' in normal edit form |
139 | |
140 | if (!empty($CFG->gdversion)) { |
141 | $mform->addElement('header', 'moodle_picture', get_string('pictureof'));//TODO: Accessibility fix fieldset legend |
142 | |
143 | $mform->addElement('static', 'currentpicture', get_string('currentpicture')); |
144 | //TODO: set current picture as default value |
145 | |
146 | $mform->addElement('checkbox', 'deletepicture', get_string('delete')); |
147 | $mform->setDefault('deletepicture',false); |
148 | //TODO: remove when picture not present or user->id==0 |
149 | |
150 | $mform->addElement('file', 'imagefile', get_string('newpicture')); |
151 | $mform->setHelpButton('imagefile', array('picture', get_string('helppicture'))); |
152 | |
153 | $mform->addElement('text', 'imagealt', get_string('imagealt'), 'maxlength="100" size="30"'); |
154 | $mform->setType('imagealt', PARAM_MULTILANG); |
155 | |
156 | } |
157 | //TODO: remove if empty($CFG->disableuserimages) in normal edit form |
158 | |
159 | /// Moodle optional fields |
160 | /// TODO: freeze what's needed |
161 | $mform->addElement('header', 'moodle_optional', get_string('optional', 'form')); |
162 | $mform->setAdvanced('moodle_optional'); |
163 | |
164 | $mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"'); |
165 | $mform->setType('url', PARAM_URL); |
166 | |
167 | $mform->addElement('text', 'icq', get_string('icqnumber'), 'maxlength="15" size="25"'); |
168 | $mform->setType('icq', PARAM_CLEAN); |
169 | |
170 | $mform->addElement('text', 'skype', get_string('skypeid'), 'maxlength="50" size="25"'); |
171 | $mform->setType('skype', PARAM_CLEAN); |
172 | |
173 | $mform->addElement('text', 'aim', get_string('aimid'), 'maxlength="50" size="25"'); |
174 | $mform->setType('aim', PARAM_CLEAN); |
175 | |
176 | $mform->addElement('text', 'yahoo', get_string('yahooid'), 'maxlength="50" size="25"'); |
177 | $mform->setType('yahoo', PARAM_CLEAN); |
178 | |
179 | $mform->addElement('text', 'msn', get_string('msnid'), 'maxlength="50" size="25"'); |
180 | $mform->setType('msn', PARAM_CLEAN); |
181 | |
182 | $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="64" size="25"'); |
183 | $mform->setType('idnumber', PARAM_RAW); |
184 | |
185 | $mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"'); |
186 | $mform->setType('institution', PARAM_MULTILANG); |
187 | |
188 | $mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"'); |
189 | $mform->setType('department', PARAM_MULTILANG); |
190 | |
191 | $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"'); |
192 | $mform->setType('phone1', PARAM_CLEAN); |
193 | |
194 | $mform->addElement('text', 'phone2', get_string('phone'), 'maxlength="20" size="25"'); |
195 | $mform->setType('phone2', PARAM_CLEAN); |
196 | |
197 | $mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"'); |
198 | $mform->setType('address', PARAM_MULTILANG); |
199 | |
200 | |
201 | ?> |