2007-01-03 08:17:56 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* The main group management user interface.
|
|
|
|
*
|
|
|
|
* @copyright © 2006 The Open University
|
|
|
|
* @author N.D.Freear AT open.ac.uk
|
|
|
|
* @author J.White AT open.ac.uk
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
|
|
|
* @package groups
|
|
|
|
*/
|
|
|
|
require_once('../config.php');
|
|
|
|
require_once('lib.php');
|
|
|
|
require_once($CFG->libdir.'/moodlelib.php');
|
2007-01-22 06:06:08 +00:00
|
|
|
require_once($CFG->libdir.'/json/JSON.php');
|
2007-01-19 04:57:46 +00:00
|
|
|
|
2007-02-02 06:36:34 +00:00
|
|
|
require_js('yui_yahoo');
|
|
|
|
require_js('yui_dom');
|
2007-08-03 03:03:05 +00:00
|
|
|
require_js('yui_utilities');
|
2007-02-02 06:36:34 +00:00
|
|
|
require_js('yui_connection');
|
|
|
|
require_js($CFG->wwwroot.'/group/lib/clientlib.js');
|
|
|
|
|
2007-01-03 08:17:56 +00:00
|
|
|
$success = true;
|
2007-02-09 16:04:50 +00:00
|
|
|
|
2007-01-23 06:20:47 +00:00
|
|
|
$courseid = required_param('id', PARAM_INT);
|
2007-02-09 16:04:50 +00:00
|
|
|
$groupingid = optional_param('grouping', GROUP_NOT_IN_GROUPING, PARAM_INT);
|
2007-01-03 08:17:56 +00:00
|
|
|
$groupid = optional_param('group', false, PARAM_INT);
|
|
|
|
$userid = optional_param('user', false, PARAM_INT);
|
|
|
|
$action = groups_param_action();
|
|
|
|
|
2007-07-07 14:18:30 +12:00
|
|
|
if (empty($CFG->enablegroupings)) {
|
|
|
|
// NO GROUPINGS YET!
|
|
|
|
$groupingid = GROUP_NOT_IN_GROUPING;
|
|
|
|
}
|
|
|
|
|
2007-01-24 03:03:10 +00:00
|
|
|
if ($groupid) {
|
|
|
|
$groupingsforgroup = groups_get_groupings_for_group($groupid);
|
|
|
|
if ($groupingsforgroup) {
|
|
|
|
// NOTE
|
|
|
|
// We currently assume that a group can only belong to one grouping.
|
|
|
|
// FIXME
|
|
|
|
// The UI will have to be fixed if we want to support more than one
|
|
|
|
// groupings per group in the future.
|
|
|
|
//
|
|
|
|
// vy-shane AT moodle DOT com
|
|
|
|
$groupingid = array_shift($groupingsforgroup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-03 08:17:56 +00:00
|
|
|
// Get the course information so we can print the header and
|
|
|
|
// check the course id is valid
|
|
|
|
$course = groups_get_course_info($courseid);
|
|
|
|
if (! $course) {
|
|
|
|
$success = false;
|
2007-01-17 13:56:09 +00:00
|
|
|
print_error('invalidcourse'); //'The course ID is invalid'
|
2007-01-03 08:17:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($success) {
|
|
|
|
// Make sure that the user has permissions to manage groups.
|
|
|
|
require_login($courseid);
|
|
|
|
|
|
|
|
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
|
|
|
if (! has_capability('moodle/course:managegroups', $context)) {
|
|
|
|
redirect(); //"group.php?id=$course->id"); // Not allowed to see all groups
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the session key so we can check this later
|
|
|
|
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
|
|
|
|
|
2007-01-19 04:57:46 +00:00
|
|
|
|
2007-01-03 08:17:56 +00:00
|
|
|
switch ($action) {
|
2007-02-19 16:38:18 +00:00
|
|
|
case false: //OK, display form.
|
|
|
|
break;
|
|
|
|
|
2007-01-19 04:57:46 +00:00
|
|
|
case 'ajax_getgroupsingrouping':
|
2007-02-09 16:04:50 +00:00
|
|
|
if (GROUP_NOT_IN_GROUPING == $groupingid) {
|
|
|
|
$groupids = groups_get_groups_not_in_any_grouping($courseid);
|
|
|
|
} else {
|
|
|
|
$groupids = groups_get_groups_in_grouping($groupingid);
|
|
|
|
}
|
|
|
|
$group_names = groups_groupids_to_group_names($groupids);
|
2007-01-19 04:57:46 +00:00
|
|
|
$json = new Services_JSON();
|
2007-02-09 16:04:50 +00:00
|
|
|
echo $json->encode($group_names);
|
2007-01-19 04:57:46 +00:00
|
|
|
die; // Client side JavaScript takes it from here.
|
|
|
|
|
|
|
|
case 'ajax_getmembersingroup':
|
|
|
|
$members = array();
|
|
|
|
|
2007-01-22 06:06:08 +00:00
|
|
|
if ($memberids = groups_get_members($groupid)) {
|
2007-02-09 16:04:50 +00:00
|
|
|
$member_names = groups_userids_to_user_names($memberids, $courseid);
|
2007-01-22 06:06:08 +00:00
|
|
|
$json = new Services_JSON();
|
2007-02-09 16:04:50 +00:00
|
|
|
echo $json->encode($member_names);
|
2007-01-19 04:57:46 +00:00
|
|
|
}
|
|
|
|
die; // Client side JavaScript takes it from here.
|
|
|
|
|
|
|
|
case 'showgroupingsettingsform':
|
|
|
|
redirect(groups_grouping_edit_url($courseid, $groupingid, false));
|
|
|
|
break;
|
|
|
|
case 'showgroupingpermsform':
|
|
|
|
break;
|
|
|
|
case 'deletegrouping':
|
2007-02-19 16:38:18 +00:00
|
|
|
redirect(groups_grouping_edit_url($courseid, $groupingid, $html=false, $param='delete=1'));
|
2007-01-19 04:57:46 +00:00
|
|
|
break;
|
|
|
|
case 'showcreategroupingform':
|
|
|
|
redirect(groups_grouping_edit_url($courseid, null, false));
|
|
|
|
break;
|
|
|
|
case 'printerfriendly':
|
2007-07-07 14:18:30 +12:00
|
|
|
redirect('printgrouping.php?courseid='. $courseid .'&groupingid='. $groupingid);
|
2007-01-19 04:57:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'showgroupsettingsform':
|
|
|
|
redirect(groups_group_edit_url($courseid, $groupid, $groupingid, false));
|
|
|
|
break;
|
|
|
|
case 'deletegroup':
|
2007-02-19 16:38:18 +00:00
|
|
|
redirect(groups_group_edit_url($courseid, $groupid, $groupingid, $html=false, $param='delete=1'));
|
2007-01-19 04:57:46 +00:00
|
|
|
break;
|
|
|
|
case 'removegroup':
|
|
|
|
break;
|
|
|
|
case 'showcreategroupform':
|
2007-03-26 08:00:21 +00:00
|
|
|
// Allow groups to be created outside of groupings
|
|
|
|
/*
|
2007-01-19 04:57:46 +00:00
|
|
|
if (GROUP_NOT_IN_GROUPING == $groupingid) {
|
|
|
|
print_error('errornotingrouping', 'group', groups_home_url($courseid), get_string('notingrouping', 'group'));
|
|
|
|
}
|
2007-03-26 08:00:21 +00:00
|
|
|
*/
|
2007-01-19 04:57:46 +00:00
|
|
|
redirect(groups_group_edit_url($courseid, null, $groupingid, false));
|
|
|
|
break;
|
2007-03-27 04:03:51 +00:00
|
|
|
case 'showcreateorphangroupform':
|
|
|
|
redirect(groups_group_edit_url($courseid, null, null, false));
|
|
|
|
break;
|
2007-02-23 17:48:05 +00:00
|
|
|
case 'addgroupstogroupingform':
|
2007-01-19 04:57:46 +00:00
|
|
|
break;
|
|
|
|
case 'updategroups': //Currently reloading.
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'removemembers':
|
|
|
|
break;
|
|
|
|
case 'showaddmembersform':
|
|
|
|
redirect(groups_members_add_url($courseid, $groupid, $groupingid, false));
|
|
|
|
break;
|
|
|
|
case 'updatemembers': //Currently reloading.
|
|
|
|
break;
|
2007-02-19 16:38:18 +00:00
|
|
|
|
|
|
|
default: //ERROR.
|
|
|
|
if (debugging()) {
|
|
|
|
error('Error, unknown button/action. Probably a user-interface bug!', groups_home_url($courseid));
|
2007-01-19 04:57:46 +00:00
|
|
|
break;
|
2007-02-19 16:38:18 +00:00
|
|
|
}
|
2007-01-03 08:17:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Print the page and form
|
|
|
|
$strgroups = get_string('groups');
|
|
|
|
$strparticipants = get_string('participants');
|
|
|
|
|
|
|
|
print_header("$course->shortname: $strgroups home", //TODO: home
|
2007-02-28 06:25:22 +00:00
|
|
|
$course->fullname,
|
2007-01-03 08:17:56 +00:00
|
|
|
"<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
|
|
|
|
"-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
|
|
|
|
"-> $strgroups", '', '', true, '', user_login_string($course, $USER));
|
|
|
|
|
|
|
|
$usehtmleditor = false;
|
2007-03-27 04:03:51 +00:00
|
|
|
//TODO: eventually we'll implement all buttons, meantime hide the ones we haven't finished.
|
|
|
|
$shownotdone = false;
|
|
|
|
$disabled = 'disabled="disabled"';
|
|
|
|
|
|
|
|
// Pre-disable buttons based on URL variables
|
2007-03-30 05:14:29 +00:00
|
|
|
if (!empty($groupingid) && $groupingid > -1) {
|
2007-03-27 04:03:51 +00:00
|
|
|
$showeditgroupsettingsform_disabled = '';
|
|
|
|
$showeditgroupingsettingsform_disabled = '';
|
|
|
|
$deletegroup_disabled = '';
|
|
|
|
$deletegrouping_disabled = '';
|
|
|
|
$printerfriendly_disabled = '';
|
|
|
|
$showcreategroupform_disabled = '';
|
|
|
|
} else {
|
|
|
|
$showeditgroupsettingsform_disabled = $disabled;
|
|
|
|
$showeditgroupingsettingsform_disabled = $disabled;
|
|
|
|
$deletegroup_disabled = $disabled;
|
|
|
|
$deletegrouping_disabled = $disabled;
|
|
|
|
$printerfriendly_disabled = $disabled;
|
|
|
|
$showcreategroupform_disabled = $disabled;
|
|
|
|
}
|
|
|
|
|
2007-04-03 06:41:58 +00:00
|
|
|
if ($groupingid == -1 && groups_count_groups_in_grouping(GROUP_NOT_IN_GROUPING, $courseid) > 0) {
|
2007-03-30 05:14:29 +00:00
|
|
|
$printerfriendly_disabled = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($groupid)) {
|
2007-03-27 04:03:51 +00:00
|
|
|
$showaddmembersform_disabled = '';
|
|
|
|
$showeditgroupsettingsform_disabled = '';
|
|
|
|
$deletegroup_disabled = '';
|
|
|
|
} else {
|
|
|
|
$deletegroup_disabled = $disabled;
|
|
|
|
$showeditgroupsettingsform_disabled = $disabled;
|
|
|
|
$showaddmembersform_disabled = $disabled;
|
|
|
|
}
|
2007-01-19 04:57:46 +00:00
|
|
|
|
2007-02-28 06:25:22 +00:00
|
|
|
print_heading(format_string($course->shortname) .' '.$strgroups, 'center', 3);
|
2007-03-26 06:42:38 +00:00
|
|
|
echo '<form id="groupeditform" action="index.php" method="post">'."\n";
|
|
|
|
echo '<div>'."\n";
|
|
|
|
echo '<input type="hidden" name="id" value="' . $courseid . '" />'."\n";
|
2007-01-03 08:17:56 +00:00
|
|
|
|
2007-03-26 06:42:38 +00:00
|
|
|
/*
|
2007-01-03 08:17:56 +00:00
|
|
|
<input type="hidden" name="groupid" value="<?php p($selectedgroup) ?>" />
|
|
|
|
<input type="hidden" name="sesskey" value="<?php p($sesskey) ?>" />
|
|
|
|
<input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
|
2007-03-26 06:42:38 +00:00
|
|
|
*/
|
2007-04-05 10:55:04 +00:00
|
|
|
echo '<table cellpadding="6" class="generaltable generalbox groupmanagementtable boxaligncenter" summary="">'."\n";
|
2007-03-26 06:42:38 +00:00
|
|
|
echo '<tr>'."\n";
|
2007-07-07 14:18:30 +12:00
|
|
|
|
|
|
|
if (empty($CFG->enablegroupings)) {
|
|
|
|
// NO GROUPIGS YET!
|
|
|
|
$sel_groupingid = -1;
|
|
|
|
} else {
|
2007-03-26 06:42:38 +00:00
|
|
|
echo '<td class="generalboxcontent">'."\n";
|
2007-04-05 10:55:04 +00:00
|
|
|
echo '<p><label for="groupings">' . get_string('groupings', 'group') . '<span id="dummygrouping"> </span></label></p>'."\n";
|
2007-03-26 06:42:38 +00:00
|
|
|
echo '<select name="grouping" id="groupings" size="15" class="select"';
|
2007-04-05 10:55:04 +00:00
|
|
|
echo ' onchange="groupsCombo.refreshGroups(this.options[this.selectedIndex].value);"';
|
|
|
|
//NOTE: onclick/onmouseout is for long names in IE6 (Firefox/IE7 display OPTION title).
|
|
|
|
echo ' onclick="window.status=this.options[this.selectedIndex].title;" onmouseout="window.status=\'\';">'."\n";
|
2007-01-03 08:17:56 +00:00
|
|
|
|
|
|
|
$groupingids = groups_get_groupings($courseid);
|
2007-02-23 17:48:05 +00:00
|
|
|
if (groups_count_groups_in_grouping(GROUP_NOT_IN_GROUPING, $courseid) > 0) {
|
|
|
|
//NOTE, only show the pseudo-grouping if it has groups.
|
|
|
|
$groupingids[] = GROUP_NOT_IN_GROUPING;
|
|
|
|
}
|
2007-04-03 06:41:58 +00:00
|
|
|
|
|
|
|
$sel_groupingid = -1;
|
2007-01-03 08:17:56 +00:00
|
|
|
|
|
|
|
if ($groupingids) {
|
|
|
|
// Put the groupings into a hash and sort them
|
|
|
|
foreach($groupingids as $id) {
|
2007-02-09 16:04:50 +00:00
|
|
|
$listgroupings[$id] = groups_get_grouping_displayname($id, $courseid);
|
2007-01-03 08:17:56 +00:00
|
|
|
}
|
|
|
|
natcasesort($listgroupings);
|
|
|
|
|
|
|
|
// Print out the HTML
|
|
|
|
$count = 1;
|
|
|
|
foreach($listgroupings as $id => $name) {
|
|
|
|
$select = '';
|
|
|
|
if ($groupingid == $id) { //|| $count <= 1) ??
|
|
|
|
$select = ' selected="selected"';
|
|
|
|
$sel_groupingid = $id;
|
|
|
|
}
|
2007-04-05 10:55:04 +00:00
|
|
|
echo "<option value=\"$id\"$select title=\"$name\">$name</option>\n";
|
2007-01-03 08:17:56 +00:00
|
|
|
$count++;
|
|
|
|
}
|
2007-04-03 06:41:58 +00:00
|
|
|
} else {
|
|
|
|
echo '<option> </option>';
|
2007-01-03 08:17:56 +00:00
|
|
|
}
|
2007-04-03 06:41:58 +00:00
|
|
|
|
2007-03-26 06:42:38 +00:00
|
|
|
echo '</select>'."\n";
|
|
|
|
|
2007-03-27 04:03:51 +00:00
|
|
|
|
2007-03-26 06:42:38 +00:00
|
|
|
echo '<p><input type="submit" name="act_updategroups" id="updategroups" value="'
|
|
|
|
. get_string('showgroupsingrouping', 'group') . '" /></p>'."\n";
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" ' . $showeditgroupingsettingsform_disabled . ' name="act_showgroupingsettingsform" id="showeditgroupingsettingsform" value="'
|
2007-03-26 06:42:38 +00:00
|
|
|
. get_string('editgroupingsettings', 'group') . '" /></p>'."\n";
|
|
|
|
|
|
|
|
if ($shownotdone) {
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" '.$disabled.' name="act_showgroupingpermsform" '
|
2007-03-26 06:42:38 +00:00
|
|
|
. 'id="showeditgroupingpermissionsform" value="'
|
|
|
|
. get_string('editgroupingpermissions', 'group') . '" /></p>'."\n";
|
|
|
|
}
|
|
|
|
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" ' . $deletegrouping_disabled . ' name="act_deletegrouping" id="deletegrouping" value="'
|
2007-03-26 06:42:38 +00:00
|
|
|
. get_string('deletegrouping', 'group') . '" /></p>'."\n";
|
|
|
|
echo '<p><input type="submit" name="act_showcreategroupingform" id="showcreategroupingform" value="'
|
|
|
|
. get_string('creategrouping', 'group') . '" /></p>'."\n";
|
|
|
|
|
|
|
|
if ($shownotdone) {
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" '.$disabled.' name="act_createautomaticgroupingform" '
|
2007-03-26 06:42:38 +00:00
|
|
|
. 'id="showcreateautomaticgroupingform" value="'
|
|
|
|
. get_string('createautomaticgrouping', 'group') . '" /></p>'."\n";
|
|
|
|
}
|
|
|
|
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" ' . $printerfriendly_disabled . ' name="act_printerfriendly" id="printerfriendly" value="'
|
2007-03-26 06:42:38 +00:00
|
|
|
. get_string('printerfriendly', 'group') . '" /></p>'."\n";
|
2007-07-07 14:18:30 +12:00
|
|
|
echo "</td>\n";
|
|
|
|
}
|
|
|
|
echo "<td>\n";
|
|
|
|
if (empty($CFG->enablegroupings)) {
|
|
|
|
// NO GROUPINGS YET!
|
|
|
|
echo '<p><label for="groups"><span id="groupslabel">'.get_string('groups').':</span><span id="thegrouping"> </span></label></p>'."\n";
|
|
|
|
} else {
|
2007-04-05 10:55:04 +00:00
|
|
|
echo '<p><label for="groups"><span id="groupslabel">'.get_string('groupsinselectedgrouping', 'group').' </span><span id="thegrouping">'.get_string('grouping', 'group').'</span></label></p>'."\n";
|
2007-07-07 14:18:30 +12:00
|
|
|
}
|
2007-04-05 10:55:04 +00:00
|
|
|
echo '<select name="group" id="groups" size="15" class="select" onchange="membersCombo.refreshMembers(this.options[this.selectedIndex].value);"'."\n";
|
|
|
|
echo ' onclick="window.status=this.options[this.selectedIndex].title;" onmouseout="window.status=\'\';">'."\n";
|
2007-03-26 06:42:38 +00:00
|
|
|
|
2007-01-03 08:17:56 +00:00
|
|
|
if (GROUP_NOT_IN_GROUPING == $sel_groupingid) {
|
|
|
|
$groupids = groups_get_groups_not_in_any_grouping($courseid); //$sel_groupingid
|
|
|
|
} else {
|
|
|
|
$groupids = groups_get_groups_in_grouping($sel_groupingid);
|
|
|
|
}
|
|
|
|
if ($groupids) {
|
2007-01-24 03:03:10 +00:00
|
|
|
// Put the groups into a hash and sort them
|
2007-02-09 16:04:50 +00:00
|
|
|
$group_names = groups_groupids_to_group_names($groupids);
|
2007-01-03 08:17:56 +00:00
|
|
|
|
|
|
|
// Print out the HTML
|
|
|
|
$count = 1;
|
2007-02-09 16:04:50 +00:00
|
|
|
foreach ($group_names as $group) {
|
2007-01-03 08:17:56 +00:00
|
|
|
$select = '';
|
2007-02-09 16:04:50 +00:00
|
|
|
if ($groupid == $group->id) { //|| $count <= 1) ??
|
2007-01-03 08:17:56 +00:00
|
|
|
$select = ' selected="selected"';
|
2007-02-09 16:04:50 +00:00
|
|
|
$sel_groupid = $group->id;
|
2007-01-03 08:17:56 +00:00
|
|
|
}
|
2007-04-05 10:55:04 +00:00
|
|
|
echo "<option value=\"{$group->id}\"$select title=\"{$group->name}\">{$group->name}</option>\n";
|
2007-01-03 08:17:56 +00:00
|
|
|
$count++;
|
|
|
|
}
|
2007-03-26 06:42:38 +00:00
|
|
|
} else {
|
|
|
|
// Print an empty option to avoid the XHTML error of having an empty select element
|
|
|
|
echo '<option> </option>';
|
2007-01-03 08:17:56 +00:00
|
|
|
}
|
2007-03-26 06:42:38 +00:00
|
|
|
|
|
|
|
echo '</select>'."\n";
|
|
|
|
echo '<p><input type="submit" name="act_updatemembers" id="updatemembers" value="'
|
|
|
|
. get_string('showmembersforgroup', 'group') . '" /></p>'."\n";
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" '. $showeditgroupsettingsform_disabled . ' name="act_showgroupsettingsform" id="showeditgroupsettingsform" value="'
|
2007-03-26 06:42:38 +00:00
|
|
|
. get_string('editgroupsettings', 'group') . '" /></p>'."\n";
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" '. $deletegroup_disabled . ' name="act_deletegroup" onclick="onDeleteGroup()" id="deletegroup" value="'
|
2007-03-26 06:42:38 +00:00
|
|
|
. get_string('deleteselectedgroup', 'group') . '" /></p>'."\n";
|
2007-08-03 03:03:05 +00:00
|
|
|
|
2007-03-26 06:42:38 +00:00
|
|
|
if ($shownotdone) {
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" '.$disabled.' name="act_removegroup" '
|
2007-03-26 06:42:38 +00:00
|
|
|
. 'id="removegroup" value="' . get_string('removegroupfromselectedgrouping', 'group') . '" /></p>'."\n";
|
|
|
|
}
|
2007-07-07 14:18:30 +12:00
|
|
|
|
|
|
|
if (empty($CFG->enablegroupings)) {
|
|
|
|
// NO GROUPIGS YET!
|
|
|
|
echo '<p><input type="submit" name="act_showcreateorphangroupform" id="showcreateorphangroupform" value="'
|
|
|
|
. get_string('creategroup', 'group') . '" /></p>'."\n";
|
|
|
|
echo '<p><input type="submit" name="act_printerfriendly" id="printerfriendly" value="'
|
|
|
|
. get_string('printerfriendly', 'group') . '" /></p>'."\n";
|
|
|
|
} else {
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" ' . $showcreategroupform_disabled . ' name="act_showcreategroupform" id="showcreategroupform" value="'
|
2007-03-26 06:42:38 +00:00
|
|
|
. get_string('creategroupinselectedgrouping', 'group') . '" /></p>'."\n";
|
2007-03-27 04:03:51 +00:00
|
|
|
|
|
|
|
echo '<p><input type="submit" name="act_showcreateorphangroupform" id="showcreateorphangroupform" value="'
|
|
|
|
. get_string('createorphangroup', 'group') . '" /></p>'."\n";
|
|
|
|
|
2007-03-26 06:42:38 +00:00
|
|
|
if ($shownotdone) {
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" '.$disabled.' name="act_addgroupstogroupingform" '
|
2007-03-26 06:42:38 +00:00
|
|
|
. 'id="showaddgroupstogroupingform" value="' . get_string('addgroupstogrouping', 'group') . '" /></p>'."\n";
|
|
|
|
}
|
2007-07-07 14:18:30 +12:00
|
|
|
}
|
|
|
|
|
2007-03-26 06:42:38 +00:00
|
|
|
echo '</td>'."\n";
|
|
|
|
echo '<td>'."\n";
|
2007-07-07 14:18:30 +12:00
|
|
|
echo '<p><label for="members"><span id="memberslabel">'.get_string('membersofselectedgroup', 'group').' </span><span id="thegroup"> </span></label></p>'."\n";
|
2007-04-05 10:55:04 +00:00
|
|
|
//NOTE: the SELECT was, multiple="multiple" name="user[]" - not used and breaks onclick.
|
|
|
|
echo '<select name="user" id="members" size="15" class="select"'."\n";
|
|
|
|
echo ' onclick="window.status=this.options[this.selectedIndex].title;" onmouseout="window.status=\'\';">'."\n";
|
2007-03-26 06:42:38 +00:00
|
|
|
|
2007-01-03 08:17:56 +00:00
|
|
|
if (isset($sel_groupid)) {
|
|
|
|
$userids = groups_get_members($sel_groupid);
|
|
|
|
}
|
2007-02-09 16:04:50 +00:00
|
|
|
if (isset($userids)) { //&& is_array($userids)
|
2007-01-03 08:17:56 +00:00
|
|
|
// Put the groupings into a hash and sort them
|
2007-02-19 16:38:18 +00:00
|
|
|
$user_names = groups_userids_to_user_names($userids, $courseid);
|
2007-03-30 06:32:10 +00:00
|
|
|
if(empty($user_names)) {
|
|
|
|
echo '<option> </option>';
|
|
|
|
} else {
|
|
|
|
foreach ($user_names as $user) {
|
2007-04-05 10:55:04 +00:00
|
|
|
echo "<option value=\"{$user->id}\" title=\"{$user->name}\">{$user->name}</option>\n";
|
2007-03-30 06:32:10 +00:00
|
|
|
}
|
2007-01-03 08:17:56 +00:00
|
|
|
}
|
2007-03-26 06:42:38 +00:00
|
|
|
} else {
|
|
|
|
// Print an empty option to avoid the XHTML error of having an empty select element
|
|
|
|
echo '<option> </option>';
|
2007-01-03 08:17:56 +00:00
|
|
|
}
|
2007-03-26 06:42:38 +00:00
|
|
|
|
|
|
|
echo '</select>'."\n";
|
|
|
|
|
|
|
|
if ($shownotdone) {
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" '.$disabled.' name="act_removemembers" '
|
2007-03-26 06:42:38 +00:00
|
|
|
. 'id="removemembers" value="' . get_string('removeselectedusers', 'group') . '"/></p>'."\n";
|
|
|
|
}
|
|
|
|
|
2007-03-27 04:03:51 +00:00
|
|
|
echo '<p><input type="submit" ' . $showaddmembersform_disabled . ' name="act_showaddmembersform" '
|
2007-03-26 06:42:38 +00:00
|
|
|
. 'id="showaddmembersform" value="' . get_string('adduserstogroup', 'group'). '" /></p>'."\n";
|
|
|
|
echo '</td>'."\n";
|
|
|
|
echo '</tr>'."\n";
|
|
|
|
echo '</table>'."\n";
|
|
|
|
|
|
|
|
//<input type="hidden" name="rand" value="om" />
|
|
|
|
echo '</div>'."\n";
|
|
|
|
echo '</form>'."\n";
|
|
|
|
|
2007-01-19 09:23:22 +00:00
|
|
|
echo '<script type="text/javascript">'."\n";
|
2007-01-19 04:57:46 +00:00
|
|
|
echo '//<![CDATA['."\n";
|
|
|
|
echo 'var groupsCombo = new UpdatableGroupsCombo("'.$CFG->wwwroot.'", '.$course->id.');'."\n";
|
|
|
|
echo 'var membersCombo = new UpdatableMembersCombo("'.$CFG->wwwroot.'", '.$course->id.');'."\n";
|
|
|
|
echo '//]]>'."\n";
|
|
|
|
echo '</script>'."\n";
|
|
|
|
|
2007-01-03 08:17:56 +00:00
|
|
|
print_footer($course);
|
|
|
|
}
|
|
|
|
|
2007-02-02 06:36:34 +00:00
|
|
|
?>
|