From 1936c10e54f39b8299dbcf5c06d9caeaef3c8807 Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 12 Nov 2006 08:55:13 +0000 Subject: [PATCH] fixed obsoleted use of course->category to find site course - now used SITEID instead MDL-1899 --- calendar/preferences.php | 4 ++-- course/lib.php | 4 ++-- course/report/log/lib.php | 6 +++--- course/user.php | 2 +- lib/accesslib.php | 2 +- lib/weblib.php | 2 +- mod/assignment/lib.php | 2 +- mod/forum/discuss.php | 2 +- mod/forum/index.php | 6 +++--- mod/forum/markposts.php | 2 +- mod/forum/settracking.php | 2 +- mod/forum/subscribe.php | 2 +- mod/forum/user.php | 2 +- mod/glossary/export.php | 2 +- mod/glossary/showentry.php | 4 ++-- mod/glossary/view.php | 2 +- mod/hotpot/index.php | 2 +- mod/hotpot/report.php | 2 +- mod/hotpot/review.php | 2 +- mod/hotpot/view.php | 2 +- mod/lams/index.php | 2 +- mod/lams/view.php | 2 +- mod/lesson/index.php | 2 +- mod/lesson/locallib.php | 2 +- mod/resource/index.php | 2 +- mod/resource/lib.php | 2 +- mod/resource/type/ims/deploy.php | 2 +- mod/scorm/player.php | 2 +- mod/scorm/report.php | 2 +- mod/scorm/view.php | 2 +- mod/survey/report.php | 2 +- mod/workshop/assessments.php | 2 +- user/edit.php | 2 +- user/extendenrol.php | 2 +- user/index.php | 4 ++-- user/view.php | 6 +++--- 36 files changed, 46 insertions(+), 46 deletions(-) diff --git a/calendar/preferences.php b/calendar/preferences.php index b393fab519..e168acf839 100644 --- a/calendar/preferences.php +++ b/calendar/preferences.php @@ -10,7 +10,7 @@ } } - if ($course->category) { + if ($course->id != SITEID) { require_login($course->id); } @@ -56,7 +56,7 @@ $strcalendar = get_string('calendar', 'calendar'); $strpreferences = get_string('preferences', 'calendar'); - if ($course->category) { + if ($course->id != SITEID) { $navigation = "wwwroot/course/view.php?id=$course->id\">$course->shortname -> $strcalendar -> $strpreferences"; } else { diff --git a/course/lib.php b/course/lib.php index b0cb1f681d..d3c35d9cd4 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1513,7 +1513,7 @@ function print_courses($category, $width="100%", $hidesitecourse = false) { if ($courses) { foreach ($courses as $course) { - if ($hidesitecourse && !$course->category) { + if ($hidesitecourse and ($course->id == SITEID)) { continue; } print_course($course, $width); @@ -1598,7 +1598,7 @@ function print_my_moodle() { if ($courses = get_my_courses($USER->id)) { foreach ($courses as $course) { - if (!$course->category) { + if ($course->id == SITEID) { continue; } print_course($course, "100%"); diff --git a/course/report/log/lib.php b/course/report/log/lib.php index df7f124283..ce88756af0 100644 --- a/course/report/log/lib.php +++ b/course/report/log/lib.php @@ -31,7 +31,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today' // Get all the possible users $users = array(); - if ($course->category) { + if ($course->id != SITEID) { if ($selectedgroup) { // If using a group, only get users in that group. $courseusers = get_group_users($selectedgroup, 'u.lastname ASC', '', 'u.id, u.firstname, u.lastname, u.idnumber'); } else { @@ -103,7 +103,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today' } } - if (has_capability('moodle/site:viewreports', $sitecontext) && !$course->category) { + if (has_capability('moodle/site:viewreports', $sitecontext) && ($course->id == SITEID)) { $activities["site_errors"] = get_string("siteerrors"); if ($modid === "site_errors") { $selectedactivity = "site_errors"; @@ -162,7 +162,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today' } else { // echo ''; $courses = array(); - $courses[$course->id] = $course->fullname . ((empty($course->category)) ? ' (Site) ' : ''); + $courses[$course->id] = $course->fullname . (($course->id == SITEID) ? ' (Site) ' : ''); choose_from_menu($courses,"id",$course->id,false); if (has_capability('moodle/site:viewreports', $sitecontext)) { $a->url = "$CFG->wwwroot/course/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser" diff --git a/course/user.php b/course/user.php index 5ad148a3f0..8023768be5 100644 --- a/course/user.php +++ b/course/user.php @@ -42,7 +42,7 @@ $strmode = get_string($mode); $fullname = fullname($user, true); - if ($course->category) { + if ($course->id != SITEID) { print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname", "id\">$course->shortname -> id\">$strparticipants -> diff --git a/lib/accesslib.php b/lib/accesslib.php index 43ec20b51f..9efcbad8bd 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -2527,7 +2527,7 @@ function get_parent_contexts($context) { if (!$course = get_record('course','id',$context->instanceid)) { return array(); } - if (!empty($course->category)) { + if ($course->id != SITEID) { $parent = get_context_instance(CONTEXT_COURSECAT, $course->category); return array_merge(array($parent->id), get_parent_contexts($parent)); } else { diff --git a/lib/weblib.php b/lib/weblib.php index 7a78e18712..500494cf90 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -3118,7 +3118,7 @@ function print_user($user, $course, $messageselect=false, $return=false) { if (!empty($user->role) and ($user->role <> $course->teacher)) { $output .= $string->role .': '. $user->role .'
'; } - if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category and !isguest()) or + if ($user->maildisplay == 1 or ($user->maildisplay == 2 and ($course->id != SITEID) and !isguest()) or has_capability('moodle/course:viewhiddenuserfields', $context)) { $output .= $string->email .': '. $user->email .'
'; } diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 850e644911..f3d04e6102 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -77,7 +77,7 @@ class assignment_base { $this->strsubmissions = get_string('submissions', 'assignment'); $this->strlastmodified = get_string('lastmodified'); - if ($this->course->category) { + if ($this->course->id != SITEID) { $this->navigation = "framename}\" href=\"$CFG->wwwroot/course/view.php?id={$this->course->id}\">{$this->course->shortname} -> ". "framename}\" href=\"index.php?id={$this->course->id}\">$this->strassignments ->"; } else { diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php index 3bc475a1d6..1d93cda5c8 100644 --- a/mod/forum/discuss.php +++ b/mod/forum/discuss.php @@ -150,7 +150,7 @@ $searchform = forum_search_form($course); - if ($course->category) { + if ($course->id != SITEID) { print_header("$course->shortname: ".format_string($discussion->name), "$course->fullname", "id\">$course->shortname -> $navmiddle $navtail", "", "", true, $searchform, navmenu($course, $cm)); diff --git a/mod/forum/index.php b/mod/forum/index.php index 8362796795..1fb0268100 100644 --- a/mod/forum/index.php +++ b/mod/forum/index.php @@ -118,7 +118,7 @@ } break; default: - if (!$course->category or empty($forum->section)) { // Site level or section 0 + if (($course->id == SITEID) or empty($forum->section)) { // Site level or section 0 $generalforums[] = $forum; if (isset($forum->keyreference)) { unset($learningforums[$forum->keyreference]); @@ -308,7 +308,7 @@ /// Now let's process the learning forums - if ($course->category) { // Only real courses have learning forums + if ($course->id != SITEID) { // Only real courses have learning forums // Add extra field for section number, at the front array_unshift($learningtable->head, ""); array_unshift($learningtable->align, "center"); @@ -446,7 +446,7 @@ /// Output the page - if ($course->category) { + if ($course->id != SITEID) { print_header("$course->shortname: $strforums", "$course->fullname", "id\">$course->shortname -> $strforums", "", "", true, $searchform, navmenu($course)); diff --git a/mod/forum/markposts.php b/mod/forum/markposts.php index 45cb80f335..7537506971 100644 --- a/mod/forum/markposts.php +++ b/mod/forum/markposts.php @@ -33,7 +33,7 @@ } $strforums = get_string('modulenameplural', 'forum'); - if ($course->category) { + if ($course->id != SITEID) { print_header($course->shortname, $course->fullname, "id\">$course->shortname -> id\">$strforums -> diff --git a/mod/forum/settracking.php b/mod/forum/settracking.php index 111452b0da..20754c3a98 100644 --- a/mod/forum/settracking.php +++ b/mod/forum/settracking.php @@ -31,7 +31,7 @@ } $strforums = get_string('modulenameplural', 'forum'); - if ($course->category) { + if ($course->id != SITEID) { print_header($course->shortname, $course->fullname, "id\">$course->shortname -> id\">$strforums -> diff --git a/mod/forum/subscribe.php b/mod/forum/subscribe.php index 7768f31ea4..0d96a41a1f 100644 --- a/mod/forum/subscribe.php +++ b/mod/forum/subscribe.php @@ -51,7 +51,7 @@ } $strforums = get_string('modulenameplural', 'forum'); - if ($course->category) { + if ($course->id != SITEID) { print_header($course->shortname, $course->fullname, "id\">$course->shortname -> id\">$strforums -> diff --git a/mod/forum/user.php b/mod/forum/user.php index 1f6d529b31..9391a1f983 100644 --- a/mod/forum/user.php +++ b/mod/forum/user.php @@ -36,7 +36,7 @@ $strmode = get_string($mode, 'forum'); $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $syscontext)); - if ($course->category) { + if ($course->id != SITEID) { print_header("$course->shortname: $fullname: $strmode", "$course->fullname", "wwwroot/course/view.php?id=$course->id\">$course->shortname -> wwwroot/user/index.php?id=$course->id\">$strparticipants -> diff --git a/mod/glossary/export.php b/mod/glossary/export.php index ce3528f0d1..4497f5d154 100644 --- a/mod/glossary/export.php +++ b/mod/glossary/export.php @@ -38,7 +38,7 @@ $strexportfile = get_string("exportfile", "glossary"); $navigation = ""; - if ($course->category) { + if ($course->id != SITEID) { $navigation = "id\">$course->shortname ->"; require_login($course->id); } diff --git a/mod/glossary/showentry.php b/mod/glossary/showentry.php index ced02327f3..febbd5b579 100644 --- a/mod/glossary/showentry.php +++ b/mod/glossary/showentry.php @@ -40,7 +40,7 @@ if (!empty($courseid)) { $course = get_record("course", "id", $courseid); - if ($course->category) { + if ($course->id != SITEID) { require_login($courseid); } @@ -48,7 +48,7 @@ $strsearch = get_string("search"); $CFG->framename = "newwindow"; - if ($course->category) { + if ($course->id != SITEID) { print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), "$course->fullname", "wwwroot/course/view.php?id=$course->id\">$course->shortname -> $strglossaries -> $strsearch", "", "", true, " ", " "); } else { diff --git a/mod/glossary/view.php b/mod/glossary/view.php index 5e5b49c66d..496855a4c0 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -114,7 +114,7 @@ } /// Processing standard security processes $navigation = ""; - if ($course->category) { + if ($course->id != SITEID) { $navigation = "id\">$course->shortname ->"; require_login($course->id); } diff --git a/mod/hotpot/index.php b/mod/hotpot/index.php index 14acf5571d..3ff0c2d019 100644 --- a/mod/hotpot/index.php +++ b/mod/hotpot/index.php @@ -37,7 +37,7 @@ $title = "$course->shortname: $strmodulenameplural"; $heading = "$course->fullname"; $navigation = "$strmodulenameplural"; - if ($course->category) { + if ($course->id != SITEID) { $navigation = "id\">$course->shortname -> $navigation"; } print_header($title, $heading, $navigation, "", "", true, "", navmenu($course)); diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php index c4899b224b..0dfb8deb40 100644 --- a/mod/hotpot/report.php +++ b/mod/hotpot/report.php @@ -411,7 +411,7 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) { } else { $navigation .= get_string("report", "quiz"); } - if ($course->category) { + if ($course->id != SITEID) { $navigation = "id\">$course->shortname -> $navigation"; } $button = update_module_button($cm->id, $course->id, $strmodulename); diff --git a/mod/hotpot/review.php b/mod/hotpot/review.php index ad0172a665..7e114feac7 100644 --- a/mod/hotpot/review.php +++ b/mod/hotpot/review.php @@ -53,7 +53,7 @@ $title = "$course->shortname: $hotpot->name"; $heading = "$course->fullname"; $navigation = "id\">$strmodulenameplural -> ".get_string("review", "quiz"); - if ($course->category) { + if ($course->id != SITEID) { $navigation = "id\">$course->shortname -> $navigation"; } $button = update_module_button($cm->id, $course->id, $strmodulename); diff --git a/mod/hotpot/view.php b/mod/hotpot/view.php index b65ce8dd49..713b8d3b1d 100644 --- a/mod/hotpot/view.php +++ b/mod/hotpot/view.php @@ -44,7 +44,7 @@ $heading = "$course->fullname"; $target = empty($CFG->framename) ? '' : ' target="'.$CFG->framename.'"'; $navigation = ''.get_string("modulenameplural", "hotpot")." -> $hotpot->name"; - if ($course->category) { + if ($course->id != SITEID) { $navigation = ''.$course->shortname.' -> '.$navigation; } $button = update_module_button($cm->id, $course->id, get_string("modulename", "hotpot").'" style="font-size:0.75em;'); diff --git a/mod/lams/index.php b/mod/lams/index.php index 6dcb593520..62399df417 100644 --- a/mod/lams/index.php +++ b/mod/lams/index.php @@ -24,7 +24,7 @@ /// Print the header - if ($course->category) { + if ($course->id != SITEID) { $navigation = "id\">$course->shortname ->"; } diff --git a/mod/lams/view.php b/mod/lams/view.php index a078017ace..6e7c8cf3d4 100644 --- a/mod/lams/view.php +++ b/mod/lams/view.php @@ -28,7 +28,7 @@ add_to_log($course->id, "lams", "view", "view.php?id=$cm->id", "$lams->id"); /// Print the page header -//if ($course->category) { +//if ($course->id != SITEID) { // $navigation = "id\">$course->shortname ->"; //} print_header_simple(format_string($lams->name), "", diff --git a/mod/lesson/index.php b/mod/lesson/index.php index 70d8c378a7..497ad70696 100644 --- a/mod/lesson/index.php +++ b/mod/lesson/index.php @@ -29,7 +29,7 @@ /// Print the header - if ($course->category) { + if ($course->id != SITEID) { $navigation = "id\">$course->shortname ->"; } else { $navigation = ''; diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index af6a83e3e0..92e9e8db0a 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -272,7 +272,7 @@ function lesson_print_header($cm, $course, $lesson, $currenttab = '') { } /// Header setup - if ($course->category) { + if ($course->id != SITEID) { $navigation = "wwwroot/course/view.php?id=$course->id\" title=\"$course->fullname\">$course->shortname ->"; } else { $navigation = ''; diff --git a/mod/resource/index.php b/mod/resource/index.php index 221ce1020d..daef0b5ac5 100644 --- a/mod/resource/index.php +++ b/mod/resource/index.php @@ -12,7 +12,7 @@ error("Course ID is incorrect"); } - if ($course->category) { + if ($course->id != SITEID) { require_login($course->id); $navigation = "id\">$course->shortname ->"; } else { diff --git a/mod/resource/lib.php b/mod/resource/lib.php index 761402298d..fa2fdd3656 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -113,7 +113,7 @@ function resource_base($cmid=0) { $this->strresource = get_string("modulename", "resource"); $this->strresources = get_string("modulenameplural", "resource"); - if ($this->course->category) { + if ($this->course->id != SITEID) { $this->navigation = "framename}\" href=\"$CFG->wwwroot/course/view.php?id={$this->course->id}\">{$this->course->shortname} -> ". "framename}\" href=\"index.php?id={$this->course->id}\">$this->strresources ->"; } else { diff --git a/mod/resource/type/ims/deploy.php b/mod/resource/type/ims/deploy.php index bca2c9619d..24c317a2c8 100644 --- a/mod/resource/type/ims/deploy.php +++ b/mod/resource/type/ims/deploy.php @@ -54,7 +54,7 @@ /// Instantiate a resource_ims object and modify its navigation $resource_obj = new resource_ims ($cmid); - if ($resource_obj->course->category) { + if ($resource_obj->course->id != SITEID) { $resource_obj->navigation = "framename}\" href=\"$CFG->wwwroot/course/view.php?id={$course->id}\">{$course->shortname} -> ". "framename}\" href=\"$CFG->wwwroot/mod/resource/index.php?id={$course->id}\">$resource_obj->strresources -> "; } else { diff --git a/mod/scorm/player.php b/mod/scorm/player.php index 7116d533d0..6f8b81f02f 100755 --- a/mod/scorm/player.php +++ b/mod/scorm/player.php @@ -45,7 +45,7 @@ $strscorm = get_string('modulename', 'scorm'); $strpopup = get_string('popup','scorm'); - if ($course->category != 0) { + if ($course->id != SITEID) { $navigation = "framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname ->"; if ($scorms = get_all_instances_in_course('scorm', $course)) { // The module SCORM/AICC activity with the first id is the course diff --git a/mod/scorm/report.php b/mod/scorm/report.php index ed12a39b6c..a9f4c9058c 100755 --- a/mod/scorm/report.php +++ b/mod/scorm/report.php @@ -57,7 +57,7 @@ /// Print the page header if (empty($noheader)) { - if ($course->category) { + if ($course->id != SITEID) { $navigation = "id\">$course->shortname ->"; } else { $navigation = ''; diff --git a/mod/scorm/view.php b/mod/scorm/view.php index 03908ee18d..45460c5cee 100755 --- a/mod/scorm/view.php +++ b/mod/scorm/view.php @@ -42,7 +42,7 @@ $strscorms = get_string("modulenameplural", "scorm"); $strscorm = get_string("modulename", "scorm"); - if ($course->category != 0) { + if ($course->id != SITEID) { $navigation = "framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname ->"; if ($scorms = get_all_instances_in_course('scorm', $course)) { // The module SCORM activity with the least id is the course diff --git a/mod/survey/report.php b/mod/survey/report.php index 4e1b968f45..e6691a3d10 100644 --- a/mod/survey/report.php +++ b/mod/survey/report.php @@ -56,7 +56,7 @@ add_to_log($course->id, "survey", "view report", "report.php?id=$cm->id", "$survey->id", $cm->id); - if ($course->category) { + if ($course->id != SITEID) { $navigation = "id\">$course->shortname -> id\">$strsurveys -> id\">".format_string($survey->name,true)." -> "; diff --git a/mod/workshop/assessments.php b/mod/workshop/assessments.php index 4d5dc1f568..73fc894cfa 100644 --- a/mod/workshop/assessments.php +++ b/mod/workshop/assessments.php @@ -66,7 +66,7 @@ $context = get_context_instance(CONTEXT_MODULE, $cm->id); $navigation = ""; - if ($course->category) { + if ($course->id != SITEID) { $navigation = "id\">$course->shortname ->"; } diff --git a/user/edit.php b/user/edit.php index 7f0033ddc0..9e126685c6 100644 --- a/user/edit.php +++ b/user/edit.php @@ -309,7 +309,7 @@ } else { $userfullname = fullname($user, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id))); } - if ($course->category) { + if ($course->id != SITEID) { print_header("$course->shortname: $streditmyprofile", "$course->fullname: $streditmyprofile", "wwwroot/course/view.php?id=$course->id\">$course->shortname -> id\">$strparticipants diff --git a/user/extendenrol.php b/user/extendenrol.php index 56e9d400d4..5ce00eb527 100644 --- a/user/extendenrol.php +++ b/user/extendenrol.php @@ -30,7 +30,7 @@ if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) { /// Print headers -if ($course->category) { +if ($course->id != SITEID) { print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname, "id\">$course->shortname -> ". get_string('extendenrol'), "", "", true, " ", navmenu($course)); diff --git a/user/index.php b/user/index.php index ee860636a9..d4373545bc 100644 --- a/user/index.php +++ b/user/index.php @@ -60,7 +60,7 @@ print_error('nopermissions'); } - if (!$course->category) { + if ($course->id == SITEID) { if (!has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_SYSTEM, SITEID))) { print_header("$course->shortname: ".get_string('participants'), $course->fullname, get_string('participants'), "", "", true, " ", navmenu($course)); @@ -120,7 +120,7 @@ /// Print headers - if ($course->category) { + if ($course->id != SITEID) { print_header("$course->shortname: ".get_string('participants'), $course->fullname, "id\">$course->shortname -> ". get_string('participants'), "", "", true, " ", navmenu($course)); diff --git a/user/view.php b/user/view.php index 0934815d1a..b156472ccf 100644 --- a/user/view.php +++ b/user/view.php @@ -115,7 +115,7 @@ /// We've established they can see the user's name at least, so what about the rest? - if ($course->category) { + if ($course->id != SITEID) { print_header("$strpersonalprofile: $fullname", "$strpersonalprofile: $fullname", "id\">$course->shortname -> id\">$strparticipants -> $fullname", @@ -126,7 +126,7 @@ } - if ($course->category and ! isguest() ) { // Need to have access to a course to see that info + if (($course->id != SITEID) and ! isguest() ) { // Need to have access to a course to see that info if (!has_capability('moodle/course:view', $coursecontext)) { print_heading(get_string('notenrolled', '', $fullname)); print_footer($course); @@ -210,7 +210,7 @@ } if ($user->maildisplay == 1 or - ($user->maildisplay == 2 and $course->category and !isguest()) or + ($user->maildisplay == 2 and ($course->id != SITEID) and !isguest()) or isteacher($course->id)) { $emailswitch = ''; -- 2.39.5