if (!$canview) { print_error('nopermissions', 'error', '', get_string('checkpermissions', 'role')); } /// These are needed early because of tabs.php $assignableroles = get_assignable_roles($context, ROLENAME_BOTH); $overridableroles = get_overridable_roles($context, ROLENAME_BOTH); /// Get the user_selector we will need. /// Teachers within a course just get to see the same list of people they can /// assign roles to. Admins (people with moodle/role:manage) can run this report for any user. $options = array('context' => $context, 'roleid' => 0); if ($context->contextlevel > CONTEXT_COURSE && !is_inside_frontpage($context) && !has_capability('moodle/role:manage', $context)) { $userselector = new potential_assignees_below_course('reportuser', $options); } else { $userselector = new potential_assignees_course_and_above('reportuser', $options); } $userselector->set_multiselect(false); $userselector->set_rows(10); /// Work out an appropriate page title. $title = get_string('checkpermissionsin', 'role', $contextname); $straction = get_string('checkpermissions', 'role'); // Used by tabs.php /// Print the header and tabs if ($context->contextlevel == CONTEXT_USER) { $user = get_record('user', 'id', $userid); $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context)); /// course header $navlinks = array(); if ($courseid != SITEID) { if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $courseid))) { $navlinks[] = array('name' => get_string('participants'), 'link' => "{$CFG->wwwroot}/user/index.php?id={$courseid}", 'type' => 'misc'); }