diff --git a/course/category.php b/course/category.php index f25e5e05623..6bd757a899d 100644 --- a/course/category.php +++ b/course/category.php @@ -21,7 +21,9 @@ if (!$site = get_site()) { error("Site isn't defined!"); } - + + $context = get_context_instance(CONTEXT_COURSECAT, $id); + if ($CFG->forcelogin) { require_login(); } @@ -104,6 +106,9 @@ "$strcategories -> $category->name", "", "", true, $navbaritem); } +/// Print link to roles + print(''.get_string('roles').''); + /// Print the category selector $displaylist = array(); diff --git a/grade/exceptions.php b/grade/exceptions.php index 3ac4a6e9060..90657b3eeff 100644 --- a/grade/exceptions.php +++ b/grade/exceptions.php @@ -132,12 +132,19 @@ exit; function grade_get_grade_item_exceptions($id) { - global $CFG; - global $course; - $sql = "SELECT ge.id, ge.userid FROM {$CFG->prefix}grade_exceptions ge, {$CFG->prefix}user_students us WHERE us.course=$course->id AND grade_itemid=$id AND ge.userid = us.userid AND us.course=ge.courseid"; - $grade_exceptions = get_records_sql($sql); - return $grade_exceptions; + global $CFG, $course; + + $contextlists = get_related_contexts_string(get_context_instance(CONTEXT_COURSE, $course->id)); + + $sql = "SELECT ge.id, ge.userid + FROM {$CFG->prefix}grade_exceptions ge, + {$CFG->prefix}role_assignments ra + WHERE grade_itemid = $id + AND ge.userid = ra.userid + AND ra.contextid $contextlists"; + + return get_records_sql($sql); } ?> diff --git a/lib/accesslib.php b/lib/accesslib.php index 89c30a18e23..a961b709f2f 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -1984,10 +1984,11 @@ function fetch_context_independent_capabilities() { * context. * @param obj $context * @param int $roleid + * @param bool self - if set to true, resolve till this level, else stop at immediate parent level * @return array */ function role_context_capabilities($roleid, $context, $cap='') { - global $CFG; + global $CFG; $contexts = get_parent_contexts($context); $contexts[] = $context->id; @@ -1999,11 +2000,14 @@ function role_context_capabilities($roleid, $context, $cap='') { $search = ''; } - $SQL = "SELECT rc.* FROM {$CFG->prefix}role_capabilities rc, {$CFG->prefix}context c - where rc.contextid in $contexts - and rc.roleid = $roleid - and rc.contextid = c.id $search - ORDER BY c.aggregatelevel DESC, rc.capability DESC"; + $SQL = "SELECT rc.* + FROM {$CFG->prefix}role_capabilities rc, + {$CFG->prefix}context c + WHERE rc.contextid in $contexts + AND rc.roleid = $roleid + AND rc.contextid = c.id $search + ORDER BY c.aggregatelevel DESC, + rc.capability DESC"; $capabilities = array(); diff --git a/lib/db/access.php b/lib/db/access.php index 13fa9c6299e..c590a5dcb88 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -976,7 +976,20 @@ $moodle_capabilities = array( 'admin' => CAP_ALLOW ) ), - + + 'moodle/course:useremail' => array( + 'captype' => 'write', + 'contextlevel' => CONTEXT_COURSE, + 'legacy' => array( + 'guest' => CAP_PREVENT, + 'student' => CAP_PREVENT, + 'teacher' => CAP_PREVENT, + 'editingteacher' => CAP_ALLOW, + 'coursecreator' => CAP_PREVENT, + 'admin' => CAP_ALLOW + ) + ), + 'moodle/course:viewhiddensections' => array( 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index b48f0e43bee..d8bac089787 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -428,15 +428,7 @@ function remove_teacher($userid, $courseid=0) { } } - /// Next if the teacher is not registered as a student, but is - /// a member of a group, remove them from the group. - if (!isstudent($courseid, $userid)) { - if ($groups = get_groups($courseid, $userid)) { - foreach ($groups as $group) { - delete_records('groups_members', 'groupid', $group->id, 'userid', $userid); - } - } - } + /// No need to remove from groups now foreach ($roles as $role) { // Unassign them from all the teacher roles $newreturn = role_unassign($role->id, $userid, 0, $context->id); diff --git a/lib/editor/htmlarea/popups/insert_image.php b/lib/editor/htmlarea/popups/insert_image.php index ecbfd127c41..b4c1d0c0af0 100644 --- a/lib/editor/htmlarea/popups/insert_image.php +++ b/lib/editor/htmlarea/popups/insert_image.php @@ -262,12 +262,12 @@ form { margin-bottom: 0px; margin-top: 0px; }
- wwwroot."/lib/editor/htmlarea/coursefiles.php?usecheckboxes=1&id=".$course->id."\" style=\"width: 100%; height: 200px;\">": "";?> |
@@ -279,7 +279,7 @@ form { margin-bottom: 0px; margin-top: 0px; }
-
+
|