Export now saves file in correct course file area (ie, the current one).
[moodle-linuxchix.git] / user / edit.html
blobab732a176bd5dc38d1bd032e3e134945569ed597
1 <?php
2 if (!isset($user->htmleditor)) {
3 $user->htmleditor = 1;
5 if (!isset($user->picture)) {
6 $user->picture = NULL;
8 if (empty($user->lang)) {
9 $user->lang = $CFG->lang;
11 if (!isset($user->theme)) {
12 $user->theme = '';
14 if (!isset($user->trackforums)) {
15 $user->trackforums = 0;
20 <form method="post" name="form" enctype="multipart/form-data" action="edit.php">
21 <table class="formtable">
22 <?php
23 if (isadmin()) {
24 $theadmin = get_admin();
25 $adminself = (($theadmin->id == $USER->id) and ($USER->id == $user->id));
26 echo '<tr>';
27 echo '<th>'.get_string('username').':</th>';
28 if ($adminself || is_internal_auth($user->auth) ){
29 echo "<td><input type=\"text\" name=\"username\" size=\"20\" alt=\"".get_string("username")."\" value=\"";
30 p($user->username);
31 echo "\" />";
32 if (isset($err["username"])) formerr($err["username"]);
33 } else {
34 echo "<td>";
35 p($user->username);
36 echo "<input type=\"hidden\" name=\"username\" value=\"";
37 p($user->username);
38 echo "\" />";
40 echo "</td>";
41 echo "</tr>\n";
43 $modules = get_list_of_plugins("auth");
44 $auth_options = array();
45 foreach ($modules as $module) {
46 $auth_options[$module] = get_string("auth_$module"."title", "auth");
48 if (!$adminself) { /// Main admin is ALWAYS default manual
49 echo '<tr>';
50 echo '<th>'.get_string("chooseauthmethod","auth").':</th>' . "\n<td>";
51 choose_from_menu ($auth_options, 'auth', $user->auth);
52 helpbutton('authchange', get_string('chooseauthmethod', 'auth'));
53 echo "</td></tr>\n";
56 if ($adminself || is_internal_auth($user->auth) || (!empty($CFG->{'auth_'.$user->auth.'_stdchangepassword'}))) {
57 echo '<tr>';
58 echo '<th>'.get_string('newpassword').':</th>';
59 echo "<td><input type=\"text\" name=\"newpassword\" size=\"20\" alt=\"".get_string("newpassword")."\" value=\"";
60 if (isset($user->newpassword)) {
61 p($user->newpassword);
63 echo "\" />";
64 if (isset($err["newpassword"])) {
65 formerr($err["newpassword"]);
66 } else if (empty($user->newpassword)) {
67 echo " (".get_string("leavetokeep").")";
69 echo "</td>";
70 echo "</tr>\n";
71 if (!$adminself && (!empty($CFG->{'auth_'.$user->auth.'_stdchangepassword'}) || $CFG->changepassword)){
72 if (get_user_preferences('auth_forcepasswordchange', NULL, $user->id)) {
73 $checked = ' checked="checked" ';
74 } else {
75 $checked = '';
77 echo '<tr>';
78 echo '<th>'.get_string('forcepasswordchange').':</th>';
79 echo '<td><input type="checkbox" name="forcepasswordchange" alt="'.get_string('forcepasswordchange').'" '.$checked.' /> '.get_string('forcepasswordchangehelp').'</td>';
80 echo '</tr>';
83 echo '<tr><td colspan="2"><hr /></td></tr>';
88 <tr>
89 <th><?php print_string("firstname") ?>:</th>
90 <td>
91 <input type="text" name="firstname" size="30" alt="<?php print_string("firstname") ?>" maxlength="20" value="<?php p($user->firstname) ?>" />
92 <?php if (isset($err["firstname"])) formerr($err["firstname"]); ?>
93 </td>
94 </tr>
95 <tr>
96 <th><?php print_string("lastname") ?>:</th>
97 <td>
98 <input type="text" name="lastname" size="30" alt="<?php print_string("lastname") ?>" maxlength="20" value="<?php p($user->lastname) ?>" />
99 <?php if (isset($err["lastname"])) formerr($err["lastname"]); ?>
100 </td>
101 </tr>
102 <tr>
103 <th><?php print_string("email") ?>:</th>
104 <td>
105 <input type="text" name="email" size="30" alt="<?php print_string("email") ?>" maxlength="100" value="<?php p($user->email) ?>" />
106 <?php if (isset($err["email"])) formerr($err["email"]); ?>
107 </td>
108 </tr>
109 <tr>
110 <th><?php print_string("emaildisplay") ?>:</th>
111 <td><?php
112 unset($choices);
113 $choices["0"] = get_string("emaildisplayno");
114 $choices["1"] = get_string("emaildisplayyes");
115 $choices["2"] = get_string("emaildisplaycourse");
116 choose_from_menu ($choices, "maildisplay", $user->maildisplay, "") ?>
117 </td>
118 </tr>
119 <tr>
120 <th><?php print_string("emailactive") ?>:</th>
121 <td><?php
122 unset($choices);
123 $choices["0"] = get_string("emailenable");
124 $choices["1"] = get_string("emaildisable");
125 choose_from_menu ($choices, "emailstop", $user->emailstop, "") ?>
126 </td>
127 </tr>
128 <tr>
129 <th><?php print_string("emailformat") ?>:</th>
130 <td><?php
131 unset($choices);
132 $choices["0"] = get_string("textformat");
133 $choices["1"] = get_string("htmlformat");
134 choose_from_menu ($choices, "mailformat", $user->mailformat, "") ?>
135 </td>
136 </tr>
137 <tr>
138 <th><?php print_string('emaildigest') ?>:</th>
139 <td><?php
140 unset($choices);
141 $choices['0'] = get_string('emaildigestoff');
142 $choices['1'] = get_string('emaildigestcomplete');
143 $choices['2'] = get_string('emaildigestsubjects');
144 choose_from_menu ($choices, 'maildigest', $user->maildigest, "") ?>
145 </td>
146 </tr>
147 <tr>
148 <th><?php print_string("autosubscribe") ?>:</th>
149 <td><?php
150 unset($choices);
151 $choices["1"] = get_string("autosubscribeyes");
152 $choices["0"] = get_string("autosubscribeno");
153 choose_from_menu ($choices, "autosubscribe", $user->autosubscribe, "") ?>
154 </td>
155 </tr>
156 <?php if (!empty($CFG->forum_trackreadposts)) { ?>
157 <tr>
158 <th><?php print_string("trackforums") ?>:</th>
159 <td><?php
160 unset($choices);
161 $choices["0"] = get_string("trackforumsno");
162 $choices["1"] = get_string("trackforumsyes");
163 choose_from_menu ($choices, "trackforums", $user->trackforums, "") ?>
164 </td>
165 </tr>
166 <?php } ?>
167 <?php if ($CFG->htmleditor) { ?>
168 <tr>
169 <th><?php print_string("textediting") ?>:</th>
170 <td><?php
171 unset($choices);
172 $choices["0"] = get_string("texteditor");
173 $choices["1"] = get_string("htmleditor");
174 choose_from_menu ($choices, "htmleditor", $user->htmleditor, "") ?>
175 </td>
176 </tr>
177 <?php } ?>
178 <tr>
179 <th><?php print_string("city") ?>:</th>
180 <td>
181 <input type="text" name="city" size="25" alt="<?php print_string("city") ?>" maxlength="20" value="<?php p($user->city) ?>" />
182 <?php if (isset($err["city"])) formerr($err["city"]); ?>
183 </td>
184 </tr>
185 <tr>
186 <th><?php print_string("country") ?>:</th>
187 <td>
188 <?php
190 if (!$user->country and $CFG->country) {
191 $user->country = $CFG->country;
194 choose_from_menu(get_list_of_countries(), "country", $user->country, get_string("selectacountry")."...", "", "");
196 <?php if (isset($err["country"])) formerr($err["country"]); ?>
197 </td>
198 </tr>
199 <tr>
200 <th><?php print_string('timezone')?>:</th>
201 <td>
202 <?php
203 $timezones = get_list_of_timezones();
204 if ($CFG->forcetimezone != 99) {
205 choose_from_menu($timezones, 'timezone', $CFG->forcetimezone, get_string('serverlocaltime'), '', '99', false, true);
206 } else {
207 choose_from_menu($timezones, 'timezone', $user->timezone, get_string('serverlocaltime'), '', '99');
210 </td>
211 </tr>
212 <tr>
213 <th><?php print_string("preferredlanguage") ?>:</th>
214 <td><?php if ($languages = get_list_of_languages()) {
215 if (!$user->lang) {
216 $user->lang = $CFG->lang;
218 choose_from_menu ($languages, "lang", $user->lang, "", "", "");
220 if (isset($err["lang"])) formerr($err["lang"]);
222 </td>
223 </tr>
224 <?php if (!empty($CFG->allowuserthemes)) { ?>
225 <tr>
226 <th><?php print_string("preferredtheme") ?>:</th>
227 <td><?php
228 $themes[''] = get_string('default');
229 $themes += get_list_of_themes();
230 choose_from_menu($themes, 'theme', $user->theme, "", "", "");
231 if (isset($err["theme"])) formerr($err["theme"]);
233 </td>
234 </tr>
235 <?php } ?>
236 <tr>
237 <th><?php print_string("userdescription") ?>:</th>
238 <td><?php
239 if (isset($err["description"])) {
240 formerr($err["description"]);
241 echo "<br />";
243 print_textarea(false, 10, 50, 50, 10, 'description', "$user->description");
244 helpbutton("text", get_string("helptext"));
246 </td>
247 </tr>
248 <tr>
249 <td colspan="2" style="text-align: center;"><input type="submit" value="<?php print_string("updatemyprofile") ?>" /></td>
250 </tr>
253 <tr>
254 <td colspan="2" align="center"> <br /><b><?php print_string("followingoptional") ?>:</b></td>
255 </tr>
258 <?php
259 $maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes);
260 if (!empty($CFG->gdversion) and $maxbytes and empty($CFG->disableuserimages)) {
262 <tr>
263 <th><?php print_string("currentpicture") ?>:</th>
264 <td>
265 <?php print_user_picture($user->id, $course->id, $user->picture, false, false, false);
266 if ($user->picture) {
267 echo '&nbsp;&nbsp;<input type="checkbox" name="deletepicture" alt="'.get_string("delete").'" value="1" />';
268 print_string("delete");
271 </td>
272 </tr>
273 <tr>
274 <th><?php print_string("newpicture") ?>:</th>
275 <td>
276 <?php
277 require_once($CFG->dirroot.'/lib/uploadlib.php');
278 upload_print_form_fragment(1,array('imagefile'),null,false,null,0,0,false);
279 helpbutton("picture", get_string("helppicture"));
280 print_string("maxsize", "", display_size($maxbytes));
281 if (isset($err["imagefile"])) formerr($err["imagefile"]);
283 </td>
284 </tr>
285 <?php } else if (empty($CFG->gdversion) and isadmin()) { ?>
286 <tr>
287 <th><?php print_string("newpicture") ?>:</th>
288 <td>
289 <?php
290 echo "<a href=\"$CFG->wwwroot/$CFG->admin/config.php\">";
291 print_string('gdnot');
292 echo "</a>";
294 </td>
295 </tr>
296 <?php } ?>
298 <tr>
299 <th><?php print_string("webpage") ?>:</th>
300 <td><input type="text" name="url" size="50" alt="<?php print_string("webpage") ?>" maxlength="255" value="<?php p($user->url) ?>" />
301 <?php if (isset($err["url"])) formerr($err["url"]); ?>
302 </td>
303 </tr>
304 <tr>
305 <th><?php print_string("icqnumber") ?>:</th>
306 <td><input type="text" name="icq" size="25" alt="<?php print_string("icqnumber") ?>" maxlength="15" value="<?php p($user->icq) ?>" />
307 <?php if (isset($err["icq"])) formerr($err["icq"]); ?>
308 </td>
309 </tr>
310 <tr>
311 <th><?php print_string("skypeid") ?>:</th>
312 <td><input type="text" name="skype" size="25" alt="<?php print_string("skypeid") ?>" maxlength="50" value="<?php p($user->skype) ?>" />
313 <?php if (isset($err["skype"])) formerr($err["skype"]); ?>
314 </td>
315 </tr>
316 <tr>
317 <th><?php print_string("aimid") ?>:</th>
318 <td><input type="text" name="aim" size="25" alt="<?php print_string("aimid") ?>" maxlength="50" value="<?php p($user->aim) ?>" />
319 <?php if (isset($err["aim"])) formerr($err["aim"]); ?>
320 </td>
321 </tr>
322 <tr>
323 <th><?php print_string("yahooid") ?>:</th>
324 <td><input type="text" name="yahoo" size="25" alt="<?php print_string("yahooid") ?>" maxlength="50" value="<?php p($user->yahoo) ?>" />
325 <?php if (isset($err["yahoo"])) formerr($err["yahoo"]); ?>
326 </td>
327 </tr>
328 <tr>
329 <th><?php print_string("msnid") ?>:</th>
330 <td><input type="text" name="msn" size="25" alt="<?php print_string("msnid") ?>" maxlength="50" value="<?php p($user->msn) ?>" />
331 <?php if (isset($err["msn"])) formerr($err["msn"]); ?>
332 </td>
333 </tr>
334 <tr>
335 <th><?php print_string("idnumber") ?>:</th>
336 <td>
337 <input type="text" name="idnumber" size="25" alt="<?php print_string("idnumber") ?>" maxlength="12" value="<?php p($user->idnumber) ?>" /> <?php p($teacheronly) ?>
338 <?php if (isset($err["idnumber"])) formerr($err["idnumber"]); ?>
339 </td>
340 </tr>
341 <?php if (isadmin()) { ?>
342 <tr>
343 <th><?php print_string("institution") ?>:</th>
344 <td><input type="text" name="institution" size="25" alt="<?php print_string("institution") ?>" maxlength="40" value="<?php p($user->institution) ?>" /> <?php p($teacheronly) ?>
345 </td>
346 </tr>
347 <tr>
348 <th><?php print_string("department") ?>:</th>
349 <td>
350 <input type="text" name="department" size="25" alt="<?php print_string("department") ?>" maxlength="30" value="<?php p($user->department) ?>" /> <?php p($teacheronly) ?>
351 </td>
352 </tr>
353 <?php } ?>
354 <tr>
355 <th><?php print_string("phone") ?> 1:</th>
356 <td>
357 <input type="text" name="phone1" size="25" alt="<?php print_string("phone") ?>" maxlength="20" value="<?php p($user->phone1) ?>" /> <?php p($teacheronly) ?>
358 <?php if (isset($err["phone1"])) formerr($err["phone1"]); ?>
359 </td>
360 </tr>
361 <tr>
362 <th><?php print_string("phone") ?> 2:</th>
363 <td>
364 <input type="text" name="phone2" size="25" alt="<?php print_string("phone") ?>" maxlength="20" value="<?php p($user->phone2) ?>" /> <?php p($teacheronly) ?>
365 <?php if (isset($err["phone2"])) formerr($err["phone2"]); ?>
366 </td>
367 </tr>
368 <tr>
369 <th><?php print_string("address") ?>:</th>
370 <td>
371 <input type="text" name="address" size="25" alt="<?php print_string("address") ?>" maxlength="70" value="<?php p($user->address) ?>" /> <?php p($teacheronly) ?>
372 <?php if (isset($err["address"])) formerr($err["address"]); ?>
373 </td>
374 </tr>
375 <tr>
376 <td colspan="2" style="text-align: center;"><input type="submit" value="<?php print_string("updatemyprofile") ?>" /></td>
377 </tr>
378 </table>
379 <input type="hidden" name="course" value="<?php p($course->id) ?>" />
380 <input type="hidden" name="id" value="<?php p($user->id) ?>" />
381 </form>