2003-12-30 17:18:06 +00:00
|
|
|
<?php // $Id$
|
|
|
|
|
|
|
|
/// Shows current group, and allows editing of the group
|
|
|
|
/// icon and other settings related to that group
|
|
|
|
|
|
|
|
require_once('../config.php');
|
|
|
|
require_once('lib.php');
|
|
|
|
|
|
|
|
require_variable($id); // Course id
|
|
|
|
optional_variable($group); // Optionally look at other groups
|
|
|
|
optional_variable($edit); // Turn editing on and off
|
|
|
|
|
|
|
|
if (! $course = get_record('course', 'id', $id) ) {
|
|
|
|
error("That's an invalid course id");
|
|
|
|
}
|
|
|
|
|
|
|
|
require_login($course->id);
|
|
|
|
|
2004-01-12 14:48:33 +00:00
|
|
|
if ($group) {
|
|
|
|
if (isteacheredit($course->id) or $course->groupmode == VISIBLEGROUPS) {
|
2004-01-15 10:22:15 +00:00
|
|
|
if (! $group = get_record("groups", "id", $group, "courseid", $course->id)) {
|
2004-01-12 14:48:33 +00:00
|
|
|
error('Specified group could not be found!', "groups.php?id=$course->id");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
error('Sorry, you don\'t have access to view this group', "view.php?id=$course->id");
|
2003-12-30 17:18:06 +00:00
|
|
|
}
|
|
|
|
} else if (! $group = get_current_group($course->id, 'full')) {
|
|
|
|
error('You are not currently in a group!', "view.php?id=$course->id");
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$USER->groupediting = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Print the headers of the page
|
|
|
|
|
|
|
|
$strgroup = get_string('group');
|
|
|
|
$strgroups = get_string('groups');
|
|
|
|
$loggedinas = "<p class=\"logininfo\">".user_login_string($course, $USER)."</p>";
|
|
|
|
|
|
|
|
if (isteacheredit($course->id) or $course->groupmode == VISIBLEGROUPS) {
|
|
|
|
print_header("$strgroup : $group->name", "$course->fullname",
|
|
|
|
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
|
|
|
|
-> <a href=\"groups.php?id=$course->id\">$strgroups</a> -> $group->name",
|
|
|
|
"", "", true, update_group_button($course->id), $loggedinas);
|
|
|
|
} else {
|
|
|
|
print_header("$strgroup : $group->name", "$course->fullname",
|
|
|
|
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
|
|
|
|
-> $strgroup -> $group->name", "", "", true, "", $loggedinas);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Display the current group information
|
|
|
|
|
|
|
|
if ($USER->groupediting) { // Make an editing form for group information
|
|
|
|
print_heading($group->name);
|
|
|
|
echo '<div align="center">';
|
2003-12-31 13:39:59 +00:00
|
|
|
print_group_picture($group, $course->id, true, false, false);
|
2003-12-30 17:18:06 +00:00
|
|
|
echo '</div>';
|
2004-01-12 17:20:41 +00:00
|
|
|
if ($group->description) {
|
|
|
|
print_simple_box($group->description, 'center', '50%');
|
|
|
|
}
|
2003-12-30 17:18:06 +00:00
|
|
|
|
|
|
|
} else { // Just display the information
|
|
|
|
print_heading($group->name);
|
|
|
|
echo '<div align="center">';
|
2003-12-31 13:39:59 +00:00
|
|
|
print_group_picture($group, $course->id, true, false, false);
|
2003-12-30 17:18:06 +00:00
|
|
|
echo '</div>';
|
2004-01-12 17:20:41 +00:00
|
|
|
if ($group->description) {
|
|
|
|
print_simple_box($group->description, 'center', '50%');
|
|
|
|
}
|
2003-12-30 17:18:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '<br />';
|
|
|
|
|
|
|
|
if ($users = get_users_in_group($group->id)) {
|
|
|
|
foreach ($users as $user) {
|
2004-01-10 16:49:17 +00:00
|
|
|
print_user($user, $course);
|
2003-12-30 17:18:06 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
print_heading(get_string('nousersyet'));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Finish off the page
|
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
|
|
|
?>
|