mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
fixed obsoleted use of course->category to find site course - now used SITEID instead MDL-1899
This commit is contained in:
parent
da1320dab6
commit
1936c10e54
@ -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 = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"view.php\">$strcalendar</a> -> $strpreferences";
|
||||
} else {
|
||||
|
@ -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%");
|
||||
|
@ -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 '<input type="hidden" name="id" value="'.$course->id.'" />';
|
||||
$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"
|
||||
|
@ -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",
|
||||
"<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"../user/index.php?id=$course->id\">$strparticipants</a> ->
|
||||
|
@ -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 {
|
||||
|
@ -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 .'<br />';
|
||||
}
|
||||
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 .': <a href="mailto:'. $user->email .'">'. $user->email .'</a><br />';
|
||||
}
|
||||
|
@ -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 = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/course/view.php?id={$this->course->id}\">{$this->course->shortname}</a> -> ".
|
||||
"<a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">$this->strassignments</a> ->";
|
||||
} else {
|
||||
|
@ -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",
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
$navmiddle $navtail", "", "", true, $searchform, navmenu($course, $cm));
|
||||
|
@ -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",
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $strforums",
|
||||
"", "", true, $searchform, navmenu($course));
|
||||
|
@ -33,7 +33,7 @@
|
||||
}
|
||||
|
||||
$strforums = get_string('modulenameplural', 'forum');
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
|
@ -31,7 +31,7 @@
|
||||
}
|
||||
|
||||
$strforums = get_string('modulenameplural', 'forum');
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
|
@ -51,7 +51,7 @@
|
||||
}
|
||||
|
||||
$strforums = get_string('modulenameplural', 'forum');
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
|
@ -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",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> ->
|
||||
|
@ -38,7 +38,7 @@
|
||||
$strexportfile = get_string("exportfile", "glossary");
|
||||
|
||||
$navigation = "";
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
require_login($course->id);
|
||||
}
|
||||
|
@ -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",
|
||||
"<a target=\"newwindow\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $strglossaries -> $strsearch", "", "", true, " ", " ");
|
||||
} else {
|
||||
|
@ -114,7 +114,7 @@
|
||||
}
|
||||
/// Processing standard security processes
|
||||
$navigation = "";
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
require_login($course->id);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
$title = "$course->shortname: $strmodulenameplural";
|
||||
$heading = "$course->fullname";
|
||||
$navigation = "$strmodulenameplural";
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
|
||||
}
|
||||
print_header($title, $heading, $navigation, "", "", true, "", navmenu($course));
|
||||
|
@ -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 = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
|
||||
}
|
||||
$button = update_module_button($cm->id, $course->id, $strmodulename);
|
||||
|
@ -53,7 +53,7 @@
|
||||
$title = "$course->shortname: $hotpot->name";
|
||||
$heading = "$course->fullname";
|
||||
$navigation = "<a href=\"index.php?id=$course->id\">$strmodulenameplural</a> -> ".get_string("review", "quiz");
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
|
||||
}
|
||||
$button = update_module_button($cm->id, $course->id, $strmodulename);
|
||||
|
@ -44,7 +44,7 @@
|
||||
$heading = "$course->fullname";
|
||||
$target = empty($CFG->framename) ? '' : ' target="'.$CFG->framename.'"';
|
||||
$navigation = '<a'.$target.' href="'.$CFG->wwwroot.'/mod/hotpot/index.php?id='.$course->id.'">'.get_string("modulenameplural", "hotpot")."</a> -> $hotpot->name";
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = '<a'.$target.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> -> '.$navigation;
|
||||
}
|
||||
$button = update_module_button($cm->id, $course->id, get_string("modulename", "hotpot").'" style="font-size:0.75em;');
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
/// Print the header
|
||||
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
}
|
||||
|
||||
|
@ -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 = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
|
||||
//}
|
||||
print_header_simple(format_string($lams->name), "",
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
/// Print the header
|
||||
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
} else {
|
||||
$navigation = '';
|
||||
|
@ -272,7 +272,7 @@ function lesson_print_header($cm, $course, $lesson, $currenttab = '') {
|
||||
}
|
||||
|
||||
/// Header setup
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\" title=\"$course->fullname\">$course->shortname</a> ->";
|
||||
} else {
|
||||
$navigation = '';
|
||||
|
@ -12,7 +12,7 @@
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
require_login($course->id);
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
} else {
|
||||
|
@ -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 = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/course/view.php?id={$this->course->id}\">{$this->course->shortname}</a> -> ".
|
||||
"<a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">$this->strresources</a> ->";
|
||||
} else {
|
||||
|
@ -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 = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/course/view.php?id={$course->id}\">{$course->shortname}</a> -> ".
|
||||
"<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/mod/resource/index.php?id={$course->id}\">$resource_obj->strresources</a> -> ";
|
||||
} else {
|
||||
|
@ -45,7 +45,7 @@
|
||||
$strscorm = get_string('modulename', 'scorm');
|
||||
$strpopup = get_string('popup','scorm');
|
||||
|
||||
if ($course->category != 0) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
if ($scorms = get_all_instances_in_course('scorm', $course)) {
|
||||
// The module SCORM/AICC activity with the first id is the course
|
||||
|
@ -57,7 +57,7 @@
|
||||
|
||||
/// Print the page header
|
||||
if (empty($noheader)) {
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
} else {
|
||||
$navigation = '';
|
||||
|
@ -42,7 +42,7 @@
|
||||
$strscorms = get_string("modulenameplural", "scorm");
|
||||
$strscorm = get_string("modulename", "scorm");
|
||||
|
||||
if ($course->category != 0) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
if ($scorms = get_all_instances_in_course('scorm', $course)) {
|
||||
// The module SCORM activity with the least id is the course
|
||||
|
@ -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 = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"index.php?id=$course->id\">$strsurveys</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">".format_string($survey->name,true)."</a> -> ";
|
||||
|
@ -66,7 +66,7 @@
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$navigation = "";
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
}
|
||||
|
||||
|
@ -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",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
|
||||
-> <a href=\"index.php?id=$course->id\">$strparticipants</a>
|
||||
|
@ -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,
|
||||
"<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".
|
||||
get_string('extendenrol'), "", "", true, " ", navmenu($course));
|
||||
|
@ -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,
|
||||
"<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".
|
||||
get_string('participants'), "", "", true, " ", navmenu($course));
|
||||
|
@ -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",
|
||||
"<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"index.php?id=$course->id\">$strparticipants</a> -> $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 = '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user