Automatic installer.php lang files by installer_builder (20080623)
[moodle.git] / user / edit.html
blob6bf6efa9406d56168144e3478d78e48dbe501e24
1 <?php
2 if (!isset($user->htmleditor)) {
3 $user->htmleditor = 1;
5 if (!isset($user->ajax)) {
6 $user->ajax = 1;
8 if (!isset($user->picture)) {
9 $user->picture = NULL;
11 if (empty($user->lang)) {
12 $user->lang = $CFG->lang;
14 if (!isset($user->theme)) {
15 $user->theme = '';
17 if (!isset($user->trackforums)) {
18 $user->trackforums = 0;
23 <form method="post" name="form" enctype="multipart/form-data" action="edit.php">
24 <table class="formtable">
25 <?php
26 if (has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
27 $theadmin = get_admin(); // returns false during install
28 $adminself = (!empty($theadmin) and ($theadmin->id == $USER->id) and ($USER->id == $user->id));
29 echo '<tr>';
30 echo '<th>'.get_string('username').':</th>';
31 if ($adminself || is_internal_auth($user->auth) ){
32 echo "<td><input type=\"text\" name=\"username\" size=\"20\" alt=\"".get_string("username")."\" value=\"";
33 p($user->username);
34 echo "\" />";
35 if (isset($err["username"])) formerr($err["username"]);
36 } else {
37 echo "<td>";
38 p($user->username);
39 echo "<input type=\"hidden\" name=\"username\" value=\"";
40 p($user->username);
41 echo "\" />";
43 echo "</td>";
44 echo "</tr>\n";
46 $modules = get_list_of_plugins("auth");
47 $auth_options = array();
48 foreach ($modules as $module) {
49 $auth_options[$module] = get_string("auth_$module"."title", "auth");
51 if (!$adminself) { /// Main admin is ALWAYS default manual
52 echo '<tr>';
53 echo '<th>'.get_string("chooseauthmethod","auth").':</th>' . "\n<td>";
54 choose_from_menu ($auth_options, 'auth', $user->auth);
55 helpbutton('authchange', get_string('chooseauthmethod', 'auth'));
56 echo "</td></tr>\n";
59 if ($adminself || is_internal_auth($user->auth) || (!empty($CFG->{'auth_'.$user->auth.'_stdchangepassword'}))) {
60 echo '<tr>';
61 echo '<th>'.get_string('newpassword').':</th>';
62 echo "<td><input type=\"text\" name=\"newpassword\" size=\"20\" alt=\"".get_string("newpassword")."\" value=\"";
63 if (isset($user->newpassword)) {
64 p($user->newpassword);
66 echo "\" />";
67 if (isset($err["newpassword"])) {
68 formerr($err["newpassword"]);
69 } else if (empty($user->newpassword)) {
70 echo " (".get_string("leavetokeep").")";
72 echo "</td>";
73 echo "</tr>\n";
74 if (!$adminself && (!empty($CFG->{'auth_'.$user->auth.'_stdchangepassword'}) || is_internal_auth())){
75 if (get_user_preferences('auth_forcepasswordchange', NULL, $user->id)) {
76 $checked = ' checked="checked" ';
77 } else {
78 $checked = '';
80 echo '<tr>';
81 echo '<th>'.get_string('forcepasswordchange').':</th>';
82 echo '<td><input type="checkbox" name="forcepasswordchange" alt="'.get_string('forcepasswordchange').'" '.$checked.' /> '.get_string('forcepasswordchangehelp').'</td>';
83 echo '</tr>';
86 echo '<tr><td colspan="2"><hr /></td></tr>';
91 <tr>
92 <th><?php print_string("firstname") ?>:</th>
93 <td>
94 <input type="text" name="firstname" size="30" alt="<?php print_string("firstname") ?>" maxlength="100" value="<?php p($user->firstname) ?>" />
95 <?php if (isset($err["firstname"])) formerr($err["firstname"]); ?>
96 </td>
97 </tr>
98 <tr>
99 <th><?php print_string("lastname") ?>:</th>
100 <td>
101 <input type="text" name="lastname" size="30" alt="<?php print_string("lastname") ?>" maxlength="100" value="<?php p($user->lastname) ?>" />
102 <?php if (isset($err["lastname"])) formerr($err["lastname"]); ?>
103 </td>
104 </tr>
105 <tr>
106 <th><?php print_string("email") ?>:</th>
107 <td>
108 <input type="text" name="email" size="30" alt="<?php print_string("email") ?>" maxlength="100" value="<?php p($user->email) ?>" />
109 <?php if (isset($err["email"])) formerr($err["email"]); ?>
110 </td>
111 </tr>
112 <tr>
113 <th><?php print_string("emaildisplay") ?>:</th>
114 <td><?php
115 unset($choices);
116 $choices["0"] = get_string("emaildisplayno");
117 $choices["1"] = get_string("emaildisplayyes");
118 $choices["2"] = get_string("emaildisplaycourse");
119 choose_from_menu ($choices, "maildisplay", $user->maildisplay, "") ?>
120 </td>
121 </tr>
122 <tr>
123 <th><?php print_string("emailactive") ?>:</th>
124 <td><?php
125 unset($choices);
126 $choices["0"] = get_string("emailenable");
127 $choices["1"] = get_string("emaildisable");
128 choose_from_menu ($choices, "emailstop", $user->emailstop, "") ?>
129 </td>
130 </tr>
131 <tr>
132 <th><?php print_string("emailformat") ?>:</th>
133 <td><?php
134 unset($choices);
135 $choices["0"] = get_string("textformat");
136 $choices["1"] = get_string("htmlformat");
137 choose_from_menu ($choices, "mailformat", $user->mailformat, "") ?>
138 </td>
139 </tr>
140 <?php if (!empty($CFG->unicodedb) && !empty($CFG->allowusermailcharset)) { ?>
141 <tr>
142 <th><?php print_string("emailcharset") ?>:</th>
143 <td><?php
144 $mailcharset = get_user_preferences('mailcharset', '0', $user->id);
145 unset($choices);
146 unset($charsets);
147 $charsets = get_list_of_charsets();
148 if (!empty($CFG->sitemailcharset)) {
149 $choices['0'] = get_string('site').' ('.$CFG->sitemailcharset.')';
150 } else {
151 $choices['0'] = get_string('default').' ('.current_charset().')';
153 $choices = array_merge($choices, $charsets);
154 choose_from_menu($choices, 'mailcharset', $mailcharset, ''); ?>
155 </td>
156 </tr>
157 <?php } ?>
158 <tr>
159 <th><?php print_string('emaildigest') ?>:</th>
160 <td><?php
161 unset($choices);
162 $choices['0'] = get_string('emaildigestoff');
163 $choices['1'] = get_string('emaildigestcomplete');
164 $choices['2'] = get_string('emaildigestsubjects');
165 choose_from_menu ($choices, 'maildigest', $user->maildigest, "") ?>
166 </td>
167 </tr>
168 <tr>
169 <th><?php print_string("autosubscribe") ?>:</th>
170 <td><?php
171 unset($choices);
172 $choices["1"] = get_string("autosubscribeyes");
173 $choices["0"] = get_string("autosubscribeno");
174 choose_from_menu ($choices, "autosubscribe", $user->autosubscribe, "") ?>
175 </td>
176 </tr>
177 <?php if (!empty($CFG->forum_trackreadposts)) { ?>
178 <tr>
179 <th><?php print_string("trackforums") ?>:</th>
180 <td><?php
181 unset($choices);
182 $choices["0"] = get_string("trackforumsno");
183 $choices["1"] = get_string("trackforumsyes");
184 choose_from_menu ($choices, "trackforums", $user->trackforums, "") ?>
185 </td>
186 </tr>
187 <?php } ?>
188 <?php if ($CFG->htmleditor) { ?>
189 <tr>
190 <th><?php print_string("textediting") ?>:</th>
191 <td><?php
192 unset($choices);
193 $choices["0"] = get_string("texteditor");
194 $choices["1"] = get_string("htmleditor");
195 choose_from_menu ($choices, "htmleditor", $user->htmleditor, "") ?>
196 </td>
197 </tr>
198 <?php } ?>
199 <tr>
200 <th><?php print_string("ajaxuse") ?>:</th>
201 <td><?php
202 unset($choices);
203 $choices["0"] = get_string("ajaxno");
204 $choices["1"] = get_string("ajaxyes");
205 if (empty($CFG->enableajax)) {
206 $user->ajax = 0;
208 choose_from_menu ($choices, 'ajax', $user->ajax, '', '', 0, false, empty($CFG->enableajax)) ?>
209 </td>
210 </tr>
211 <tr>
212 <th><?php print_string("city") ?>:</th>
213 <td>
214 <input type="text" name="city" size="25" alt="<?php print_string("city") ?>" maxlength="20" value="<?php p($user->city) ?>" />
215 <?php if (isset($err["city"])) formerr($err["city"]); ?>
216 </td>
217 </tr>
218 <tr>
219 <th><?php print_string("country") ?>:</th>
220 <td>
221 <?php
223 if (!$user->country and $CFG->country) {
224 $user->country = $CFG->country;
227 choose_from_menu(get_list_of_countries(), "country", $user->country, get_string("selectacountry")."...", "", "");
229 <?php if (isset($err["country"])) formerr($err["country"]); ?>
230 </td>
231 </tr>
232 <tr>
233 <th><?php print_string('timezone')?>:</th>
234 <td>
235 <?php
236 $timezones = get_list_of_timezones();
237 if ($CFG->forcetimezone != 99) {
238 choose_from_menu($timezones, 'timezone', $CFG->forcetimezone, get_string('serverlocaltime'), '', '99', false, true);
239 } else {
240 choose_from_menu($timezones, 'timezone', $user->timezone, get_string('serverlocaltime'), '', '99');
243 </td>
244 </tr>
245 <tr>
246 <th><?php print_string("preferredlanguage") ?>:</th>
247 <td><?php if ($languages = get_list_of_languages()) {
248 if (!$user->lang) {
249 $user->lang = $CFG->lang;
251 choose_from_menu ($languages, "lang", $user->lang, "", "", "");
253 if (isset($err["lang"])) formerr($err["lang"]);
255 </td>
256 </tr>
257 <?php if (!empty($CFG->allowuserthemes)) { ?>
258 <tr>
259 <th><?php print_string("preferredtheme") ?>:</th>
260 <td><?php
261 $themes[''] = get_string('default');
262 $themes += get_list_of_themes();
263 choose_from_menu($themes, 'theme', $user->theme, "", "", "");
264 if (isset($err["theme"])) formerr($err["theme"]);
266 </td>
267 </tr>
268 <?php } ?>
269 <tr>
270 <th><?php print_string("userdescription") ?>:</th>
271 <td><?php
272 if (isset($err["description"])) {
273 formerr($err["description"]);
274 echo "<br />";
276 print_textarea($usehtmleditor, 10, 50, 50, 10, 'description', "$user->description");
277 helpbutton("text", get_string("helptext"));
279 </td>
280 </tr>
281 <tr>
282 <td colspan="2" style="text-align: center;"><input type="submit" value="<?php print_string("updatemyprofile") ?>" /></td>
283 </tr>
286 <tr>
287 <td colspan="2" align="center"> <br /><b><?php print_string("followingoptional") ?>:</b></td>
288 </tr>
291 <?php
292 $maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes);
293 if (!empty($CFG->gdversion) and $maxbytes and (empty($CFG->disableuserimages) or has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SITEID)))) {
295 <tr>
296 <th><?php print_string("currentpicture") ?>:</th>
297 <td>
298 <?php print_user_picture($user->id, $course->id, $user->picture, false, false, false);
299 if ($user->picture) {
300 echo '&nbsp;&nbsp;<input type="checkbox" name="deletepicture" alt="'.get_string("delete").'" value="1" />';
301 print_string("delete");
304 </td>
305 </tr>
306 <tr>
307 <th><?php print_string("newpicture") ?>:</th>
308 <td>
309 <?php
310 require_once($CFG->dirroot.'/lib/uploadlib.php');
311 upload_print_form_fragment(1,array('imagefile'),null,false,null,0,0,false);
312 helpbutton("picture", get_string("helppicture"));
313 print_string("maxsize", "", display_size($maxbytes));
314 if (isset($err["imagefile"])) formerr($err["imagefile"]);
316 </td>
317 </tr>
318 <?php } else if (empty($CFG->gdversion) and has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) { ?>
319 <tr>
320 <th><?php print_string("newpicture") ?>:</th>
321 <td>
322 <?php
323 echo "<a href=\"$CFG->wwwroot/$CFG->admin/config.php\">";
324 print_string('gdnot');
325 echo "</a>";
327 </td>
328 </tr>
329 <?php } ?>
331 <tr>
332 <th><?php print_string("webpage") ?>:</th>
333 <td><input type="text" name="url" size="50" alt="<?php print_string("webpage") ?>" maxlength="255" value="<?php p($user->url) ?>" />
334 <?php if (isset($err["url"])) formerr($err["url"]); ?>
335 </td>
336 </tr>
337 <tr>
338 <th><?php print_string("icqnumber") ?>:</th>
339 <td><input type="text" name="icq" size="25" alt="<?php print_string("icqnumber") ?>" maxlength="15" value="<?php p($user->icq) ?>" />
340 <?php if (isset($err["icq"])) formerr($err["icq"]); ?>
341 </td>
342 </tr>
343 <tr>
344 <th><?php print_string("skypeid") ?>:</th>
345 <td><input type="text" name="skype" size="25" alt="<?php print_string("skypeid") ?>" maxlength="50" value="<?php p($user->skype) ?>" />
346 <?php if (isset($err["skype"])) formerr($err["skype"]); ?>
347 </td>
348 </tr>
349 <tr>
350 <th><?php print_string("aimid") ?>:</th>
351 <td><input type="text" name="aim" size="25" alt="<?php print_string("aimid") ?>" maxlength="50" value="<?php p($user->aim) ?>" />
352 <?php if (isset($err["aim"])) formerr($err["aim"]); ?>
353 </td>
354 </tr>
355 <tr>
356 <th><?php print_string("yahooid") ?>:</th>
357 <td><input type="text" name="yahoo" size="25" alt="<?php print_string("yahooid") ?>" maxlength="50" value="<?php p($user->yahoo) ?>" />
358 <?php if (isset($err["yahoo"])) formerr($err["yahoo"]); ?>
359 </td>
360 </tr>
361 <tr>
362 <th><?php print_string("msnid") ?>:</th>
363 <td><input type="text" name="msn" size="25" alt="<?php print_string("msnid") ?>" maxlength="50" value="<?php p($user->msn) ?>" />
364 <?php if (isset($err["msn"])) formerr($err["msn"]); ?>
365 </td>
366 </tr>
367 <tr>
368 <th><?php print_string("idnumber") ?>:</th>
369 <td>
370 <input type="text" name="idnumber" size="25" alt="<?php print_string("idnumber") ?>" maxlength="64" value="<?php p($user->idnumber) ?>" /> <?php p($teacheronly) ?>
371 <?php if (isset($err["idnumber"])) formerr($err["idnumber"]); ?>
372 </td>
373 </tr>
374 <?php if (has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) { ?>
375 <tr>
376 <th><?php print_string("institution") ?>:</th>
377 <td><input type="text" name="institution" size="25" alt="<?php print_string("institution") ?>" maxlength="40" value="<?php p($user->institution) ?>" /> <?php p($teacheronly) ?>
378 </td>
379 </tr>
380 <tr>
381 <th><?php print_string("department") ?>:</th>
382 <td>
383 <input type="text" name="department" size="25" alt="<?php print_string("department") ?>" maxlength="30" value="<?php p($user->department) ?>" /> <?php p($teacheronly) ?>
384 </td>
385 </tr>
386 <?php } ?>
387 <tr>
388 <th><?php print_string("phone") ?> 1:</th>
389 <td>
390 <input type="text" name="phone1" size="25" alt="<?php print_string("phone") ?>" maxlength="20" value="<?php p($user->phone1) ?>" /> <?php p($teacheronly) ?>
391 <?php if (isset($err["phone1"])) formerr($err["phone1"]); ?>
392 </td>
393 </tr>
394 <tr>
395 <th><?php print_string("phone") ?> 2:</th>
396 <td>
397 <input type="text" name="phone2" size="25" alt="<?php print_string("phone") ?>" maxlength="20" value="<?php p($user->phone2) ?>" /> <?php p($teacheronly) ?>
398 <?php if (isset($err["phone2"])) formerr($err["phone2"]); ?>
399 </td>
400 </tr>
401 <tr>
402 <th><?php print_string("address") ?>:</th>
403 <td>
404 <input type="text" name="address" size="25" alt="<?php print_string("address") ?>" maxlength="70" value="<?php p($user->address) ?>" /> <?php p($teacheronly) ?>
405 <?php if (isset($err["address"])) formerr($err["address"]); ?>
406 </td>
407 </tr>
408 <tr>
409 <td colspan="2" style="text-align: center;"><input type="submit" value="<?php print_string("updatemyprofile") ?>" /></td>
410 </tr>
411 </table>
412 <input type="hidden" name="course" value="<?php p($course->id) ?>" />
413 <input type="hidden" name="id" value="<?php p($user->id) ?>" />
414 </form>