mirror of
https://github.com/moodle/moodle.git
synced 2025-06-03 14:46:35 +02:00
MDL-23048 applying the same frontpage logic on all permissions pages
This commit is contained in:
parent
946191f09c
commit
8a27af4112
@ -33,7 +33,10 @@ list($context, $course, $cm) = get_context_info_array($contextid);
|
||||
|
||||
$url = new moodle_url('/admin/roles/check.php', array('contextid' => $contextid));
|
||||
|
||||
if (!$course) {
|
||||
if ($course) {
|
||||
$isfrontpage = ($course->id == SITEID);
|
||||
} else {
|
||||
$isfrontpage = false;
|
||||
if ($context->contextlevel == CONTEXT_USER) {
|
||||
$course = $DB->get_record('course', array('id'=>optional_param('courseid', SITEID, PARAM_INT)), '*', MUST_EXIST);
|
||||
$user = $DB->get_record('user', array('id'=>$context->instanceid), '*', MUST_EXIST);
|
||||
@ -54,7 +57,6 @@ $PAGE->set_context($context);
|
||||
|
||||
$courseid = $course->id;
|
||||
$contextname = print_context_name($context);
|
||||
$isfrontpage = ($course->id == SITEID);
|
||||
|
||||
// Get the user_selector we will need.
|
||||
// Teachers within a course just get to see the same list of people they can
|
||||
@ -79,12 +81,8 @@ switch ($context->contextlevel) {
|
||||
admin_externalpage_setup('checkpermissions', '', array('contextid' => $contextid));
|
||||
break;
|
||||
case CONTEXT_USER:
|
||||
if ($isfrontpage) {
|
||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||
$PAGE->set_heading($fullname);
|
||||
} else {
|
||||
$PAGE->set_heading($course->fullname);
|
||||
}
|
||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||
$PAGE->set_heading($fullname);
|
||||
$showroles = 1;
|
||||
break;
|
||||
case CONTEXT_COURSECAT:
|
||||
|
@ -34,7 +34,10 @@ list($context, $course, $cm) = get_context_info_array($contextid);
|
||||
|
||||
$url = new moodle_url('/admin/roles/override.php', array('contextid' => $contextid, 'roleid' => $roleid));
|
||||
|
||||
if (!$course) {
|
||||
if ($course) {
|
||||
$isfrontpage = ($course->id == SITEID);
|
||||
} else {
|
||||
$isfrontpage = false;
|
||||
if ($context->contextlevel == CONTEXT_USER) {
|
||||
$course = $DB->get_record('course', array('id'=>optional_param('courseid', SITEID, PARAM_INT)), '*', MUST_EXIST);
|
||||
$user = $DB->get_record('user', array('id'=>$context->instanceid), '*', MUST_EXIST);
|
||||
@ -54,7 +57,6 @@ $PAGE->set_url($url);
|
||||
$PAGE->set_context($context);
|
||||
|
||||
$courseid = $course->id;
|
||||
$isfrontpage = ($course->id == SITEID);
|
||||
|
||||
$returnurl = new moodle_url('/admin/roles/permissions.php', array('contextid' => $context->id));
|
||||
|
||||
@ -85,12 +87,8 @@ switch ($context->contextlevel) {
|
||||
print_error('cannotoverridebaserole', 'error');
|
||||
break;
|
||||
case CONTEXT_USER:
|
||||
if ($isfrontpage) {
|
||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||
$PAGE->set_heading($fullname);
|
||||
} else {
|
||||
$PAGE->set_heading($course->fullname);
|
||||
}
|
||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||
$PAGE->set_heading($fullname);
|
||||
$showroles = 1;
|
||||
break;
|
||||
case CONTEXT_COURSECAT:
|
||||
|
@ -42,7 +42,10 @@ list($context, $course, $cm) = get_context_info_array($contextid);
|
||||
|
||||
$url = new moodle_url('/admin/roles/permissions.php', array('contextid' => $contextid));
|
||||
|
||||
if (!$course) {
|
||||
if ($course) {
|
||||
$isfrontpage = ($course->id == SITEID);
|
||||
} else {
|
||||
$isfrontpage = false;
|
||||
if ($context->contextlevel == CONTEXT_USER) {
|
||||
$course = $DB->get_record('course', array('id'=>optional_param('courseid', SITEID, PARAM_INT)), '*', MUST_EXIST);
|
||||
$user = $DB->get_record('user', array('id'=>$context->instanceid), '*', MUST_EXIST);
|
||||
@ -59,7 +62,6 @@ require_capability('moodle/role:review', $context);
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_context($context);
|
||||
$courseid = $course->id;
|
||||
$isfrontpage = ($course->id == SITEID);
|
||||
|
||||
|
||||
// These are needed early because of tabs.php
|
||||
@ -84,12 +86,8 @@ switch ($context->contextlevel) {
|
||||
print_error('cannotoverridebaserole', 'error');
|
||||
break;
|
||||
case CONTEXT_USER:
|
||||
if ($isfrontpage) {
|
||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||
$PAGE->set_heading($fullname);
|
||||
} else {
|
||||
$PAGE->set_heading($course->fullname);
|
||||
}
|
||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
|
||||
$PAGE->set_heading($fullname);
|
||||
$showroles = 1;
|
||||
break;
|
||||
case CONTEXT_COURSECAT:
|
||||
|
Loading…
x
Reference in New Issue
Block a user