Skip to content

Commit

Permalink
MDL-14460, fix get_context_instance, see tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
dongsheng committed Apr 23, 2008
1 parent fd968fb commit 09ee7b0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion course/import/activities/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
if ($fromcourse) {
$fromcontext = get_context_instance(CONTEXT_COURSE, $fromcourse);
}
$syscontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
$syscontext = get_context_instance(CONTEXT_SYSTEM);

if (!has_capability('moodle/course:manageactivities', $tocontext)) {
print_error("You need do not have the required permissions to import activities to this course");
Expand Down
2 changes: 1 addition & 1 deletion course/import/activities/mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->dirroot.'/backup/restorelib.php');

$syscontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
$syscontext = get_context_instance(CONTEXT_SYSTEM);

// if we're not a course creator , we can only import from our own courses.
if (has_capability('moodle/course:create', $syscontext)) {
Expand Down
4 changes: 2 additions & 2 deletions course/report/log/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
$showcourses = 1;
}

$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
$sitecontext = get_context_instance(CONTEXT_SYSTEM);

// Context for remote data is always SITE
// Groups for remote data are always OFF
Expand Down Expand Up @@ -286,7 +286,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
$showcourses = 1;
}

$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
$context = get_context_instance(CONTEXT_COURSE, $course->id);

/// Setup for group handling.
Expand Down
4 changes: 2 additions & 2 deletions course/report/stats/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ function report_stats_mode_menu($course, $mode, $time, $url) {
$reportoptions = stats_get_report_options($course->id, $mode);
$timeoptions = report_stats_timeoptions($mode);
if (empty($timeoptions)) {
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
*/

$options = array();
$options[STATS_MODE_GENERAL] = get_string('statsmodegeneral');
$options[STATS_MODE_DETAILED] = get_string('statsmodedetailed');
if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM))) {
$options[STATS_MODE_RANKED] = get_string('reports');
}

Expand Down
2 changes: 1 addition & 1 deletion filter/algebra/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function string_file_picture_algebra($imagefile, $tex= "", $height="", $width=""
}
$style .= '"';
if ($imagefile) {
if (!file_exists("$CFG->dataroot/filter/algebra/$imagefile") && has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
if (!file_exists("$CFG->dataroot/filter/algebra/$imagefile") && has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
$output .= "<a href=\"$CFG->wwwroot/filter/algebra/algebradebug.php\">";
} else {
$output .= "<a target=\"popup\" title=\"TeX\" href=";
Expand Down
2 changes: 1 addition & 1 deletion filter/tex/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function string_file_picture_tex($imagefile, $tex= "", $height="", $width="", $a
}
$style .= '"';
if ($imagefile) {
if (!file_exists("$CFG->dataroot/filter/tex/$imagefile") && has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
if (!file_exists("$CFG->dataroot/filter/tex/$imagefile") && has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
$output .= "<a href=\"$CFG->wwwroot/filter/tex/texdebug.php\">";
} else {
$output .= "<a target=\"popup\" title=\"TeX\" href=";
Expand Down

0 comments on commit 09ee7b0

Please sign in to comment.