]> git.mjollnir.org Git - moodle.git/commitdiff
User pictures can now be deleted - interface is improved a little
authormoodler <moodler>
Sat, 1 May 2004 14:34:21 +0000 (14:34 +0000)
committermoodler <moodler>
Sat, 1 May 2004 14:34:21 +0000 (14:34 +0000)
lang/en/moodle.php
user/edit.html
user/edit.php

index 9885ad9cf21c260d179dc1c08dbb09b9853d58cb..5d4a43f6445d6d1c0dd4e14a670f4e8849ed7602 100644 (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...';
index 7c7ee543d8c05ce8390636cbc78f4aab4dd95d0e..8da7f1360c745797a8085b021204dd64a09b48bb 100644 (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>
index 49e42ed75dbd1d1a75eaab95dce4550fc99a79a2..3bbf1691b3b0ffb198c30e3854ae00a51d53f354 100644 (file)
             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;
             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();