MDL-14460, fix get_context_instance, merged from MOODLE_19_STABLE
This commit is contained in:
+2
-2
@@ -45,7 +45,7 @@
|
||||
}
|
||||
$navbaritem = update_category_button($category->id);
|
||||
$creatorediting = !empty($USER->categoryediting);
|
||||
$adminediting = (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $creatorediting);
|
||||
$adminediting = (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and $creatorediting);
|
||||
|
||||
} else {
|
||||
if (!$category->visible) {
|
||||
@@ -482,7 +482,7 @@
|
||||
}
|
||||
|
||||
echo '<div class="buttons">';
|
||||
if (has_capability('moodle/category:update', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $numcourses > 1) { /// Print button to re-sort courses by name
|
||||
if (has_capability('moodle/category:update', get_context_instance(CONTEXT_SYSTEM)) and $numcourses > 1) { /// Print button to re-sort courses by name
|
||||
unset($options);
|
||||
$options['id'] = $category->id;
|
||||
$options['resort'] = 'name';
|
||||
|
||||
@@ -113,7 +113,7 @@ if ($id && !$categoryadd && !$categoryupdate && false) {
|
||||
}
|
||||
$navbaritem = update_category_button($category->id);
|
||||
$creatorediting = !empty($USER->categoryediting);
|
||||
$adminediting = (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $creatorediting);
|
||||
$adminediting = (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and $creatorediting);
|
||||
|
||||
} else {
|
||||
if (!$category->visible) {
|
||||
|
||||
+3
-3
@@ -1639,7 +1639,7 @@ function print_whole_category_list($category=NULL, $displaylist=NULL, $parentsli
|
||||
}
|
||||
|
||||
if ($category) {
|
||||
if ($category->visible or has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if ($category->visible or has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_category_info($category, $depth, $files);
|
||||
} else {
|
||||
return; // Don't bother printing children of invisible categories
|
||||
@@ -1819,7 +1819,7 @@ function print_courses($category) {
|
||||
echo "</ul>\n";
|
||||
} else {
|
||||
print_heading(get_string("nocoursesyet"));
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
if (has_capability('moodle/course:create', $context)) {
|
||||
$options = array();
|
||||
$options['category'] = $category->id;
|
||||
@@ -2664,7 +2664,7 @@ function course_allowed_module($course,$mod) {
|
||||
|
||||
// Admins and admin-like people who can edit everything can also add anything.
|
||||
// This is a bit wierd, really. I debated taking it out but it's enshrined in help for the setting.
|
||||
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:approvecourse', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:approvecourse', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$approve = optional_param('approve', 0, PARAM_INT);
|
||||
$reject = optional_param('reject', 0, PARAM_INT);
|
||||
@@ -67,7 +67,7 @@
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
error(get_string('courseapprovedfailed'));
|
||||
print_error('courseapprovedfailed');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -33,7 +33,7 @@
|
||||
require_login();
|
||||
}
|
||||
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if ($edit !== -1) {
|
||||
$USER->categoryediting = $edit;
|
||||
// If the edit mode we are leaving has higher per page than the one we are entering,
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
/// Editing functions
|
||||
|
||||
if (has_capability('moodle/course:visibility', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/course:visibility', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
|
||||
/// Hide or show a course
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
|
||||
}
|
||||
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID)) && $perpage != 99999) {
|
||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM)) && $perpage != 99999) {
|
||||
$perpage = 30;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
|
||||
$searchform = print_course_search($search, true, "navbar");
|
||||
|
||||
if (!empty($courses) && has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!empty($courses) && has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$searchform .= update_categories_search_button($search,$page,$perpage);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user