Skip to content

Commit

Permalink
fixed obsoleted use of course->category to find site course - now use…
Browse files Browse the repository at this point in the history
…d SITEID instead MDL-1899
  • Loading branch information
skodak committed Nov 12, 2006
1 parent da1320d commit 1936c10
Show file tree
Hide file tree
Showing 36 changed files with 46 additions and 46 deletions.
4 changes: 2 additions & 2 deletions calendar/preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
}

if ($course->category) {
if ($course->id != SITEID) {
require_login($course->id);
}

Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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%");
Expand Down
6 changes: 3 additions & 3 deletions course/report/log/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion course/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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> ->
Expand Down
2 changes: 1 addition & 1 deletion lib/accesslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 />';
}
Expand Down
2 changes: 1 addition & 1 deletion mod/assignment/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function assignment_base($cmid=0, $assignment=NULL, $cm=NULL, $course=NULL) {
$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 {
Expand Down
2 changes: 1 addition & 1 deletion mod/forum/discuss.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions mod/forum/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion mod/forum/markposts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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> ->
Expand Down
2 changes: 1 addition & 1 deletion mod/forum/settracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -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> ->
Expand Down
2 changes: 1 addition & 1 deletion mod/forum/subscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -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> ->
Expand Down
2 changes: 1 addition & 1 deletion mod/forum/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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> ->
Expand Down
2 changes: 1 addition & 1 deletion mod/glossary/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions mod/glossary/showentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@

if (!empty($courseid)) {
$course = get_record("course", "id", $courseid);
if ($course->category) {
if ($course->id != SITEID) {
require_login($courseid);
}

$strglossaries = get_string("modulenameplural", "glossary");
$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, "&nbsp;", "&nbsp;");
} else {
Expand Down
2 changes: 1 addition & 1 deletion mod/glossary/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion mod/hotpot/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion mod/hotpot/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion mod/hotpot/review.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion mod/hotpot/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;');
Expand Down
2 changes: 1 addition & 1 deletion mod/lams/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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> ->";
}

Expand Down
2 changes: 1 addition & 1 deletion mod/lams/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

/// 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), "",
Expand Down
2 changes: 1 addition & 1 deletion mod/lesson/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
2 changes: 1 addition & 1 deletion mod/lesson/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
2 changes: 1 addition & 1 deletion mod/resource/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion mod/resource/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion mod/resource/type/ims/deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion mod/scorm/player.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mod/scorm/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
2 changes: 1 addition & 1 deletion mod/scorm/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mod/survey/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -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> -> ";
Expand Down
2 changes: 1 addition & 1 deletion mod/workshop/assessments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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> ->";
}

Expand Down
2 changes: 1 addition & 1 deletion user/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion user/extendenrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

/// 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, "&nbsp;", navmenu($course));
Expand Down
4 changes: 2 additions & 2 deletions user/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, "&nbsp;", navmenu($course));
Expand Down Expand Up @@ -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, "&nbsp;", navmenu($course));
Expand Down
Loading

0 comments on commit 1936c10

Please sign in to comment.