From: dongsheng Date: Thu, 24 Apr 2008 08:39:47 +0000 (+0000) Subject: MDL-14460, fix get_context_instance, merged from MOODLE_19_STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8e480396820cb0a16c3911ec0023d270d9a922e1;p=moodle.git MDL-14460, fix get_context_instance, merged from MOODLE_19_STABLE --- diff --git a/course/category.php b/course/category.php index 8ea03e539b..22904d0f90 100644 --- a/course/category.php +++ b/course/category.php @@ -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 '
'; - 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'; diff --git a/course/editcategory.php b/course/editcategory.php index cb4f284b0b..596508bf9a 100644 --- a/course/editcategory.php +++ b/course/editcategory.php @@ -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) { diff --git a/course/lib.php b/course/lib.php index 909de26771..d550855c2b 100644 --- a/course/lib.php +++ b/course/lib.php @@ -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 "\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; } diff --git a/course/pending.php b/course/pending.php index 5a4e672faf..c084411a06 100644 --- a/course/pending.php +++ b/course/pending.php @@ -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; } } diff --git a/course/search.php b/course/search.php index 215a7109e4..1dda5f1b6f 100644 --- a/course/search.php +++ b/course/search.php @@ -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); }