Skip to content

Commit

Permalink
MDL-23048 reworked frontpage exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Jul 13, 2010
1 parent a942f75 commit 24d5b99
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions admin/roles/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@

$url = new moodle_url('/admin/roles/assign.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);
$url->param('courseid', $course->id);
$url->param('userid', $user->id);
} else if(!($context->contextlevel == CONTEXT_COURSECAT)) { //course categories contexts shouldn't be main frontpage site.
} else {
$course = $SITE;
}
}
Expand All @@ -55,11 +58,7 @@
$PAGE->set_context($context);

$contextname = print_context_name($context);
$isfrontpage = false;
if ($course) {
$courseid = $course->id;
$isfrontpage = ($course->id == SITEID);
}
$courseid = $course->id;

// These are needed early because of tabs.php
list($assignableroles, $assigncounts, $nameswithcounts) = get_assignable_roles($context, ROLENAME_BOTH, true);
Expand Down Expand Up @@ -149,12 +148,8 @@
admin_externalpage_setup('assignroles', '', array('contextid' => $contextid, 'roleid' => $roleid));
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:
Expand Down

0 comments on commit 24d5b99

Please sign in to comment.