User pictures can now be deleted - interface is improved a little

This commit is contained in:
moodler
2004-05-01 14:34:21 +00:00
parent 2859efacea
commit ec67cbf237
3 changed files with 24 additions and 4 deletions
+1
View File
@@ -217,6 +217,7 @@ $string['currentcourseadding'] = 'Current course, adding data to it';
$string['currentcoursedeleting'] = 'Current course, deleting it first';
$string['currentlanguage'] = 'Current language';
$string['currentlocaltime'] = 'your current local time';
$string['currentpicture'] = 'Current picture';
$string['currentrelease'] = 'Current release information';
$string['currentversion'] = 'Current version';
$string['databasechecking'] = 'Upgrading Moodle database from version $a->oldversion to $a->newversion...';
+12 -3
View File
@@ -174,9 +174,7 @@ if (isadmin()) {
</td>
</tr>
<tr>
<td colspan=2><br /><b><?php print_string("followingoptional") ?>:</b>&nbsp;&nbsp;&nbsp;
<?php print_user_picture($user->id, $course->id, $user->picture, false, false, false); ?>
</td>
<td colspan=2><br /><b><?php print_string("followingoptional") ?>:</b></td>
</tr>
@@ -184,6 +182,17 @@ if (isadmin()) {
$maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes);
if (!empty($CFG->gdversion) and $maxbytes and empty($CFG->disableuserimages)) {
?>
<tr valign=top>
<td><p><?php print_string("currentpicture") ?>:</td>
<td>
<?php print_user_picture($user->id, $course->id, $user->picture, false, false, false);
if ($user->picture) {
echo '&nbsp;&nbsp;<input type="checkbox" name="deletepicture" value="1">';
print_string("delete");
}
?>
</td>
</tr>
<tr valign=top>
<td><p><?php print_string("newpicture") ?>:</td>
<td>
+11 -1
View File
@@ -70,6 +70,11 @@
if ($filename = valid_uploaded_file($_FILES['imagefile'])) {
$usernew->picture = save_profile_image($user->id, $filename);
set_field('user', 'picture', $usernew->picture, 'id', $user->id); /// Note picture in DB
} else {
if (!empty($usernew->deletepicture)) {
set_field('user', 'picture', 0, 'id', $user->id); /// Delete picture
$usernew->picture = 0;
}
}
$user = $usernew;
@@ -80,7 +85,12 @@
if ($filename = valid_uploaded_file($_FILES['imagefile'])) {
$usernew->picture = save_profile_image($user->id, $filename);
} else {
$usernew->picture = $user->picture;
if (!empty($usernew->deletepicture)) {
set_field('user', 'picture', 0, 'id', $user->id); /// Delete picture
$usernew->picture = 0;
} else {
$usernew->picture = $user->picture;
}
}
$usernew->timemodified = time();