]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14460, fix get_context_instance, merged from MOODLE_19_STABLE
authordongsheng <dongsheng>
Thu, 24 Apr 2008 08:39:47 +0000 (08:39 +0000)
committerdongsheng <dongsheng>
Thu, 24 Apr 2008 08:39:47 +0000 (08:39 +0000)
course/category.php
course/editcategory.php
course/lib.php
course/pending.php
course/search.php

index 8ea03e539b029b846df4a31b878ac37616b04699..22904d0f90e1787351ac2ef491f79a3bf4a529b2 100644 (file)
@@ -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) {
     }
 
     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';
index cb4f284b0bf63f9960b099fef66e62be6672f0f0..596508bf9af51a9cb2157e81611a62771b772532 100644 (file)
@@ -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) {
index 909de26771d4d0f8b41af45d04d9d35a542df48f..d550855c2b860d267163637591afed44aa36049a 100644 (file)
@@ -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;
     }
 
index 5a4e672faf79a507240beeb812fc69e136d19a8f..c084411a06207779ac3c8f2420c7225bbe54e572 100644 (file)
@@ -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;
             }
         }
index 215a7109e490e0bf19f09773e5be604c27d815c2..1dda5f1b6f0816339f7b66e0f21eba2f10e4e1ca 100644 (file)
@@ -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;
     }
 
 
     $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);
     }