芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/public_html/cepali/group/members.php
. /** * Add/remove members from group. * * @copyright 2006 The Open University and others, N.D.Freear AT open.ac.uk, J.White AT open.ac.uk and others * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @package core_group */ require_once(__DIR__ . '/../config.php'); require_once(__DIR__ . '/lib.php'); require_once($CFG->dirroot . '/user/selector/lib.php'); require_once($CFG->dirroot . '/course/lib.php'); require_once($CFG->libdir . '/filelib.php'); $groupid = required_param('group', PARAM_INT); $cancel = optional_param('cancel', false, PARAM_BOOL); $group = $DB->get_record('groups', array('id'=>$groupid), '*', MUST_EXIST); $course = $DB->get_record('course', array('id'=>$group->courseid), '*', MUST_EXIST); $PAGE->set_url('/group/members.php', array('group'=>$groupid)); $PAGE->set_pagelayout('admin'); require_login($course); $context = context_course::instance($course->id); require_capability('moodle/course:managegroups', $context); $returnurl = $CFG->wwwroot.'/group/index.php?id='.$course->id.'&group='.$group->id; if ($cancel) { redirect($returnurl); } $groupmembersselector = new group_members_selector('removeselect', array('groupid' => $groupid, 'courseid' => $course->id)); $potentialmembersselector = new group_non_members_selector('addselect', array('groupid' => $groupid, 'courseid' => $course->id)); if (optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) { $userstoadd = $potentialmembersselector->get_selected_users(); if (!empty($userstoadd)) { foreach ($userstoadd as $user) { if (!groups_add_member($groupid, $user->id)) { print_error('erroraddremoveuser', 'group', $returnurl); } $groupmembersselector->invalidate_selected_users(); $potentialmembersselector->invalidate_selected_users(); } } } if (optional_param('remove', false, PARAM_BOOL) && confirm_sesskey()) { $userstoremove = $groupmembersselector->get_selected_users(); if (!empty($userstoremove)) { foreach ($userstoremove as $user) { if (!groups_remove_member_allowed($groupid, $user->id)) { print_error('errorremovenotpermitted', 'group', $returnurl, $user->fullname); } if (!groups_remove_member($groupid, $user->id)) { print_error('erroraddremoveuser', 'group', $returnurl); } $groupmembersselector->invalidate_selected_users(); $potentialmembersselector->invalidate_selected_users(); } } } // Print the page and form $strgroups = get_string('groups'); $strparticipants = get_string('participants'); $stradduserstogroup = get_string('adduserstogroup', 'group'); $strusergroupmembership = get_string('usergroupmembership', 'group'); $groupname = format_string($group->name); $PAGE->requires->js('/group/clientlib.js'); $PAGE->navbar->add($strparticipants, new moodle_url('/user/index.php', array('id'=>$course->id))); $PAGE->navbar->add($strgroups, new moodle_url('/group/index.php', array('id'=>$course->id))); $PAGE->navbar->add($stradduserstogroup); /// Print header $PAGE->set_title("$course->shortname: $strgroups"); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('adduserstogroup', 'group').": $groupname", 3); // Store the rows we want to display in the group info. $groupinforow = array(); // Check if there is a description to display. if (!empty($group->description)) { $grouprenderer = $PAGE->get_renderer('core_group'); $groupdetailpage = new \core_group\output\group_details($groupid); echo $grouprenderer->group_details($groupdetailpage); } /// Print the editing form ?>
display(); ?>
display(); ?>
print_user_summaries($course->id); //this must be after calling display() on the selectors so their setup JS executes first $PAGE->requires->js_init_call('init_add_remove_members_page', null, false, $potentialmembersselector->get_js_module()); echo $OUTPUT->footer();