From: moodler Date: Sat, 7 Feb 2004 17:44:10 +0000 (+0000) Subject: By no means finished but at least no loose ends with groups editing X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=42e49dad0e2ea951ce363818e7613b0bf168794c;p=moodle.git By no means finished but at least no loose ends with groups editing --- diff --git a/course/group.php b/course/group.php index 3fb065b4c1..d68412fcdf 100644 --- a/course/group.php +++ b/course/group.php @@ -29,15 +29,11 @@ } if (isteacheredit($course->id) or (isteacher($course->id) and ismember($group->id) ) ) { - if (isset($edit)) { - if ($edit == "on") { - $USER->groupediting = true; - } else if ($edit == "off") { - $USER->groupediting = false; - } - } + $edit = isset($_GET['edit']); + $editbutton = $edit ? "" : update_group_button($course->id, $group->id); } else { - $USER->groupediting = false; + $edit = false; + $editbutton = ""; } @@ -51,7 +47,7 @@ print_header("$strgroup : $group->name", "$course->fullname", "wwwroot/course/view.php?id=$course->id\">$course->shortname -> id\">$strgroups -> $group->name", - "", "", true, update_group_button($course->id), $loggedinas); + "", "", true, $editbutton, $loggedinas); } else { print_header("$strgroup : $group->name", "$course->fullname", "wwwroot/course/view.php?id=$course->id\">$course->shortname @@ -59,25 +55,54 @@ } -/// Display the current group information - if ($USER->groupediting) { // Make an editing form for group information - print_heading($group->name); - echo '
'; - print_group_picture($group, $course->id, true, false, false); - echo '
'; - if ($group->description) { - print_simple_box($group->description, 'center', '50%'); +/// If data submitted, then process and store. + + if ($form = data_submitted()) { + + if (empty($form->name)) { + $edit = true; + $err['name'] = get_string("missingname"); + + } else { + $group->name = $form->name; + $group->description = $form->description; + if (!update_record("groups", $group)) { + notify("A strange error occurred while trying to save "); + } else { + redirect("group.php?id=$course->id&group=$group->id", get_string("changessaved")); + } + } + } + + +/// Are we editing? If so, handle it. + + if ($edit) { // We are editing a group's information + if ($usehtmleditor = can_use_richtext_editor()) { + $defaultformat = FORMAT_HTML; + } else { + $defaultformat = FORMAT_MOODLE; } - } else { // Just display the information - print_heading($group->name); - echo '
'; - print_group_picture($group, $course->id, true, false, false); - echo '
'; - if ($group->description) { - print_simple_box($group->description, 'center', '50%'); + include('group-edit.html'); + + if ($usehtmleditor) { + use_html_editor(); } + + print_footer(); + exit; + } + +/// Just display the information + + print_heading($group->name); + echo '
'; + print_group_picture($group, $course->id, true, false, false); + echo '
'; + if ($group->description) { + print_simple_box($group->description, 'center', '50%'); } echo '
'; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 696f1d8e73..f1952ecaf9 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -523,6 +523,7 @@ $string['missingemail'] = 'Missing email address'; $string['missingfirstname'] = 'Missing given name'; $string['missingfullname'] = 'Missing full name'; $string['missinglastname'] = 'Missing surname'; +$string['missingname'] = 'Missing name'; $string['missingnewpassword'] = 'Missing new password'; $string['missingpassword'] = 'Missing password'; $string['missingshortname'] = 'Missing short name';