From: tjhunt Date: Tue, 11 Nov 2008 07:23:25 +0000 (+0000) Subject: role assign: MDL-13325 when assigning roles inside front page activites, list all... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7906379c9ac6489a1e935048813e644f8b795fb8;p=moodle.git role assign: MDL-13325 when assigning roles inside front page activites, list all users as potential users. --- diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 33e12c63d5..9bcfb2a3d5 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -122,7 +122,7 @@ /// Create the user selector objects. $options = array('context' => $context, 'roleid' => $roleid); - if ($context->contextlevel > CONTEXT_COURSE) { + if ($context->contextlevel > CONTEXT_COURSE && !is_inside_frontpage($context)) { $potentialuserselector = new potential_assignees_below_course('addselect', $options); } else { $potentialuserselector = new potential_assignees_course_and_above('addselect', $options); diff --git a/lib/accesslib.php b/lib/accesslib.php index 5ac5641c1b..d538e3c843 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -3328,7 +3328,7 @@ function print_context_name($context, $withprefix = true, $short = false) { case CONTEXT_COURSE: // 1 to 1 to course cat if ($context->instanceid == SITEID) { - $name = get_string('frontpage', 'admin'); + $name = get_string('page', 'admin'); } else { if ($course = $DB->get_record('course', array('id'=>$context->instanceid))) { if ($withprefix){ @@ -3670,6 +3670,16 @@ function get_parent_contextid($context) { return array_shift($parentcontexts); } +/** + * @param object $context a context object. + * @return true if this context is the front page context, or a context inside it, + * otherwise false. + */ +function is_inside_frontpage($context) { + $frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID); + return strpos($context->path . '/', $frontpagecontext->path . '/') === 0; +} + /** * Recursive function which, given a context, find all its children context ids. *