]> git.mjollnir.org Git - moodle.git/commitdiff
Interface for editing groups
authormoodler <moodler>
Tue, 10 Feb 2004 14:25:20 +0000 (14:25 +0000)
committermoodler <moodler>
Tue, 10 Feb 2004 14:25:20 +0000 (14:25 +0000)
course/group-edit.html [new file with mode: 0644]
course/group.php

diff --git a/course/group-edit.html b/course/group-edit.html
new file mode 100644 (file)
index 0000000..137f1b3
--- /dev/null
@@ -0,0 +1,42 @@
+<form method="post" enctype="multipart/form-data" action="group.php">
+<table cellpadding=9 cellspacing="0" align="center">
+<tr valign="top">
+    <td align="right"><p><?php print_string("name") ?>:</td>
+    <td><input type="text" name="name" size=30 value="<?php p($group->name) ?>">
+    <?php if (isset($err["name"])) formerr($err["name"]); ?>
+    </td>
+</tr>
+<tr valign=top>
+    <td align="right"><P><?php print_string("description") ?>:</td>
+    <td><?php 
+        print_textarea($usehtmleditor, 10, 50, 660, 200, "description", $group->description);
+        helpbutton("text", get_string("helptext"));
+        if (isset($err["description"])) formerr($err["description"]); 
+    ?>
+    </td>
+</tr>
+
+<?php 
+    $maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes);
+    if (!empty($CFG->gdversion) and $maxbytes) {  
+?>
+<tr valign=top>
+    <td align="right"><p><?php print_string("newpicture") ?>:</td>
+    <td>
+    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxbytes ?>">
+    <input type="file" name="imagefile" size=40>
+    <?php helpbutton("picture", get_string("helppicture"));
+       print_string("maxsize", "", display_size($maxbytes)); 
+       if (isset($err["imagefile"])) formerr($err["imagefile"]);
+    ?>
+    </td>
+</tr>
+<?php }  ?>
+<tr>
+    <td></td>
+    <td><input type="submit" value="<?php print_string("savechanges") ?>"></td>
+</table>
+
+<input type="hidden" name="group" value="<?php p($group->id) ?>"> 
+<input type="hidden" name="id" value="<?php p($course->id) ?>"> 
+</form>
index d68412fcdf285909451ffc0c49323f20cd13a815..912a9a00fee5facafb2c3da41bedfa6ee4615e5d 100644 (file)
             $err['name'] = get_string("missingname");
 
         } else {
+            if (!empty($_FILES['imagefile'])) {
+                require_once("$CFG->libdir/gdlib.php");
+                if ($filename = valid_uploaded_file($_FILES['imagefile'])) { 
+                    $group->picture = save_profile_image($group->id, $filename, 'groups');
+                }
+            }
             $group->name = $form->name;
             $group->description = $form->description;
             if (!update_record("groups", $group)) {