mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
"MDL-14460, fix all the other get_context_instance, merged from MOODLE_19_STABLE"
This commit is contained in:
parent
e64467bb77
commit
957f6fc9d2
@ -12,7 +12,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$strdatabaseperformance = get_string("databaseperformance");
|
||||
$stradministration = get_string("administration");
|
||||
|
@ -13,7 +13,7 @@
|
||||
$sure = optional_param('sure', 0, PARAM_BOOL);
|
||||
$reallysure = optional_param('reallysure', 0, PARAM_BOOL);
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$deletedir = $CFG->dataroot; // The directory to delete!
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
$solution = optional_param('solution', 0, PARAM_SAFEDIR); //in fact it is class name alhanumeric and _
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$site = get_site();
|
||||
|
||||
|
@ -545,7 +545,7 @@
|
||||
/// Check for valid admin user - no guest autologin
|
||||
require_login(0, false);
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
require_capability('moodle/site:config', $context);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
admin_externalpage_print_header();
|
||||
print_heading('Convert all MySQL tables from MYISAM to InnoDB');
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
admin_externalpage_setup('langedit');
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
define('LANG_SUBMIT_REPEAT', 1); // repeat displaying submit button?
|
||||
define('LANG_SUBMIT_REPEAT_EVERY', 20); // if so, after how many lines?
|
||||
|
@ -51,7 +51,7 @@ class page_admin extends page_base {
|
||||
// seems reasonable that the only people that can edit blocks on the admin pages
|
||||
// are the admins... but maybe we want a role for this?
|
||||
function user_allowed_editing() {
|
||||
return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM));
|
||||
}
|
||||
|
||||
// has to be fixed. i know there's a "proper" way to do this
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
if (!$site = get_site()) {
|
||||
redirect("index.php");
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
/// Scheduled backups are disabled by the server admin
|
||||
if (!empty($CFG->disablescheduledbackups)) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
$time = optional_param('time', 0, PARAM_INT);
|
||||
$numcourses = optional_param('numcourses', 20, PARAM_INT);
|
||||
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID)); // needed?
|
||||
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM)); // needed?
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
|
||||
|
@ -17,7 +17,7 @@ require_once('ex_simple_test.php');
|
||||
require_once('ex_reporter.php');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
/* The UNITTEST constant can be checked elsewhere if you need to know
|
||||
* when your code is being run as part of a unit test. */
|
||||
|
@ -13,7 +13,7 @@
|
||||
admin_externalpage_setup('defineroles');
|
||||
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
require_capability('moodle/role:manage', $sitecontext);
|
||||
|
||||
/// form processiong here
|
||||
|
@ -11,7 +11,7 @@
|
||||
admin_externalpage_setup('defineroles');
|
||||
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
require_capability('moodle/role:manage', $sitecontext);
|
||||
|
||||
/// form processiong here
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
// first thing to do is print the dropdown menu
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$strtimezone = get_string("timezone");
|
||||
$strsavechanges = get_string("savechanges");
|
||||
|
@ -32,7 +32,7 @@ admin_externalpage_setup('uploadpictures', $adminroot);
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
if (!$site = get_site()) {
|
||||
print_error('cannotfindsite', 'error');
|
||||
|
@ -79,7 +79,7 @@
|
||||
}
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
/// Body of the script, based on action, we delegate the work
|
||||
$action = optional_param ('action', 'main_view', PARAM_ALPHAEXT);
|
||||
|
@ -171,7 +171,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
|
||||
|
||||
// check remote login permissions
|
||||
if (! has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM, SITEID))
|
||||
if (! has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM))
|
||||
or is_mnet_remote_user($USER)
|
||||
or $USER->username == 'guest'
|
||||
or empty($USER->id)) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
// Check whether Shibboleth is configured properly
|
||||
if (empty($pluginconfig->user_attribute)) {
|
||||
error(get_string( 'shib_not_set_up_error', 'auth'));
|
||||
print_error('shib_not_set_up_error', 'auth');
|
||||
}
|
||||
|
||||
/// If we can find the Shibboleth attribute, save it in session and return to main login page
|
||||
@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
/// Go to my-moodle page instead of homepage if mymoodleredirect enabled
|
||||
if (!has_capability('moodle/site:config',get_context_instance(CONTEXT_SYSTEM, SITEID)) and !empty($CFG->mymoodleredirect) and !isguest()) {
|
||||
if (!has_capability('moodle/site:config',get_context_instance(CONTEXT_SYSTEM)) and !empty($CFG->mymoodleredirect) and !isguest()) {
|
||||
if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot.'/' or $urltogo == $CFG->wwwroot.'/index.php') {
|
||||
$urltogo = $CFG->wwwroot.'/my/';
|
||||
}
|
||||
@ -88,9 +88,9 @@
|
||||
// If we can find any (user independent) Shibboleth attributes but no user
|
||||
// attributes we probably didn't receive any user attributes
|
||||
elseif (!empty($_SERVER['HTTP_SHIB_APPLICATION_ID'])) {
|
||||
error(get_string( 'shib_no_attributes_error', 'auth' , '\''.$pluginconfig->user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\''));
|
||||
print_error('shib_no_attributes_error', 'auth' , '', '\''.$pluginconfig->user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\'');
|
||||
} else {
|
||||
error(get_string( 'shib_not_set_up_error', 'auth'));
|
||||
print_error('shib_not_set_up_error', 'auth');
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
@ -641,7 +641,7 @@
|
||||
fwrite ($bf, start_tag('ROLES', 1, true));
|
||||
$roles = backup_fetch_roles($preferences);
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
foreach ($roles as $role) {
|
||||
fwrite ($bf,start_tag('ROLE',2,true));
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
redirect("$CFG->wwwroot/$CFG->admin/report/backups/index.php", '', 'admin', 1);
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
@ -122,7 +122,7 @@
|
||||
}
|
||||
|
||||
//Print header
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$navlinks[] = array('name' => basename($file), 'link' => null, 'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
|
@ -192,7 +192,7 @@
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
@ -8127,7 +8127,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
if ($CFG->creatornewroleid) {
|
||||
role_assign($CFG->creatornewroleid, $USER->id, 0, $newcontext->id);
|
||||
} else {
|
||||
if ($legacyteachers = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if ($legacyteachers = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if ($legacyteacher = array_shift($legacyteachers)) {
|
||||
role_assign($legacyteacher->id, $USER->id, 0, $newcontext->id);
|
||||
}
|
||||
@ -8273,7 +8273,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
}
|
||||
$info = restore_read_xml_roles($xmlfile);
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
// the following code creates new roles
|
||||
// but we could use more intelligent detection, and role mapping
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
|
@ -51,7 +51,7 @@ class block_blog_menu extends block_base {
|
||||
$addentrylink = '';
|
||||
$coursearg = '';
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
if ($COURSE->id != SITEID) {
|
||||
|
||||
|
@ -80,7 +80,7 @@ class block_blog_tags extends block_base {
|
||||
$sql .= 'AND p.id = ti.itemid ';
|
||||
|
||||
// admins should be able to read all tags
|
||||
if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$sql .= 'AND (p.publishstate = \'site\' or p.publishstate=\'public\') ';
|
||||
}
|
||||
$sql .= "AND ti.timemodified > {$timewithin} ";
|
||||
|
@ -63,7 +63,7 @@ if (!empty($id)) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
}
|
||||
} else {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,7 +156,7 @@
|
||||
<td align="right">enrol_db_defaultcourseroleid:</td>
|
||||
<td>
|
||||
<?php
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$assignableroles = get_assignable_roles($sitecontext);
|
||||
$assignableroles = array('' => get_string('default')) + $assignableroles;
|
||||
|
||||
|
@ -104,7 +104,7 @@ Photo processing is deactivated until we hear from Moodle dev forum about modifi
|
||||
|
||||
<?php
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$assignableroles = get_assignable_roles($sitecontext);
|
||||
$assignableroles = array('0' => get_string('ignore')) + $assignableroles;
|
||||
|
||||
|
@ -93,7 +93,7 @@
|
||||
|
||||
/// Check that the user is not blocking us!!
|
||||
if ($contact = get_record('message_contacts', 'userid', $user->id, 'contactid', $USER->id)) {
|
||||
if ($contact->blocked and !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if ($contact->blocked and !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_heading(get_string('userisblockingyou', 'message'));
|
||||
exit;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
print_error("User ID 1 was incorrect");
|
||||
}
|
||||
|
||||
if (has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) { // Able to see any discussion
|
||||
if (has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) { // Able to see any discussion
|
||||
$userid2 = optional_param('user2', $USER->id, PARAM_INT);
|
||||
if (! $user2 = get_record("user", "id", $userid2)) { // Check
|
||||
print_error("User ID 2 was incorrect");
|
||||
|
@ -41,7 +41,7 @@
|
||||
<tr><td> </td><td colspan="2"><input type="radio" name="keywordsoption" id="keywordsoption2" value="fromme" /><label for="keywordsoption2"><?php print_string('onlyfromme', 'message') ?></label></td></tr>
|
||||
<tr><td> </td><td colspan="2"><input type="radio" checked="checked" name="keywordsoption" id="keywordsoption3" value="allmine" /><label for="keywordsoption3"><?php print_string('allmine', 'message') ?></label></td></tr>
|
||||
|
||||
<?php if (has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) { ?>
|
||||
<?php if (has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) { ?>
|
||||
<tr><td> </td><td colspan="2"><input type="radio" name="keywordsoption" id="keywordsoption4" value="allusers" /><label for="keywordsoption4"><?php print_string('allusers', 'message') ?></label></td></tr>
|
||||
<?php } ?>
|
||||
|
||||
|
@ -48,7 +48,7 @@ if (has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTE
|
||||
|
||||
/// Check that the user is not blocking us!!
|
||||
if ($contact = get_record('message_contacts', 'userid', $user->id, 'contactid', $USER->id)) {
|
||||
if ($contact->blocked and !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if ($contact->blocked and !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_heading(get_string('userisblockingyou', 'message'));
|
||||
exit;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ function glossary_add_instance($glossary) {
|
||||
$glossary->globalglossary = 0;
|
||||
}
|
||||
|
||||
if (!has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$glossary->globalglossary = 0;
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ function glossary_update_instance($glossary) {
|
||||
$glossary->globalglossary = 0;
|
||||
}
|
||||
|
||||
if (!has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (!has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
// keep previous
|
||||
unset($glossary->globalglossary);
|
||||
}
|
||||
@ -558,7 +558,7 @@ function glossary_get_entries_search($concept, $courseid) {
|
||||
|
||||
//Check if the user is an admin
|
||||
$bypassadmin = 1; //This means NO (by default)
|
||||
if (has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$bypassadmin = 0; //This means YES
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ class mod_glossary_mod_form extends moodleform_mod {
|
||||
$mform->addRule('entbypage', null, 'required', null, 'client');
|
||||
$mform->addRule('entbypage', null, 'numeric', null, 'client');
|
||||
|
||||
if (has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$mform->addElement('checkbox', 'globalglossary', get_string('isglobal', 'glossary'));
|
||||
$mform->setHelpButton('globalglossary', array('globalglossary', get_string('globalglossary', 'glossary'), 'glossary'));
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
require_login($course->id);
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $id);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
add_to_log($course->id, "hotpot", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
@ -233,7 +233,7 @@
|
||||
$select .= " AND a.userid='$USER->id'";
|
||||
}
|
||||
$usejoin = 0;
|
||||
if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_SYSTEM, SITEID)) && $usejoin) {
|
||||
if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_SYSTEM)) && $usejoin) {
|
||||
// join attempts table and details table
|
||||
$tables .= ",{$CFG->prefix}hotpot_details d";
|
||||
$fields .= ',COUNT(DISTINCT d.id) AS detailcount';
|
||||
@ -244,7 +244,7 @@
|
||||
}
|
||||
$totals = get_records_sql("SELECT $fields FROM $tables WHERE $select GROUP BY a.hotpot");
|
||||
|
||||
if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_SYSTEM, SITEID)) && empty($usejoin)) {
|
||||
if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_SYSTEM)) && empty($usejoin)) {
|
||||
foreach ($hotpots as $hotpot) {
|
||||
$totals[$hotpot->id]->detailcount = 0;
|
||||
if ($ids = get_records('hotpot_attempts', 'hotpot', $hotpot->id)) {
|
||||
|
@ -61,7 +61,7 @@ class mod_hotpot_mod_form extends moodleform_mod {
|
||||
$mform->setType('name', PARAM_TEXT);
|
||||
|
||||
// Location
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
if (has_capability('moodle/course:managefiles', $sitecontext)) {
|
||||
$site = get_site();
|
||||
if ($COURSE->id==$site->id) {
|
||||
@ -272,7 +272,7 @@ class mod_hotpot_mod_form extends moodleform_mod {
|
||||
} else {
|
||||
if ($data['location']==$COURSE->id) {
|
||||
// this is normal
|
||||
} else if ($data['location']==SITEID && has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
} else if ($data['location']==SITEID && has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
// admin can access site files
|
||||
} else {
|
||||
// location is invalid or missing, so set to default
|
||||
|
@ -32,7 +32,7 @@
|
||||
}
|
||||
|
||||
// get the roles context for this course
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
// set homeurl of couse (for error messages)
|
||||
|
@ -13,7 +13,7 @@
|
||||
if (!has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $params->course))) {
|
||||
print_error("You are not allowed to view this page!");
|
||||
}
|
||||
if (has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$params->location = optional_param('location', HOTPOT_LOCATION_COURSEFILES, PARAM_INT);
|
||||
} else {
|
||||
$params->location = HOTPOT_LOCATION_COURSEFILES;
|
||||
|
@ -64,7 +64,7 @@
|
||||
ims_print_crumbtrail($directory, $choose);
|
||||
|
||||
/// If admin, add extra buttons - redeploy & help.
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
echo " | (<a href=\"repository_deploy.php?file=$directory&all=force\">$strdeployall</a>) ";
|
||||
helpbutton("deploy", get_string("deployall", "resource"), "resource", true);
|
||||
}
|
||||
@ -96,7 +96,7 @@
|
||||
}
|
||||
else if ($item->type == 'not deployed') {
|
||||
/// Only displays non-deployed IMS CP's if admin user.
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
echo "<li><img src=\"images/ims.gif\" alt=\"IMS CP Package\" /> <em>$item->path - $strnotdeployed</em> (<a href=\"repository_deploy.php?file=$item->path\">$strdeploy</a>)</li>\n";
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@
|
||||
require_once('repository_config.php');
|
||||
|
||||
/// Security - Admin Only
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$file = required_param ('file', PARAM_PATH);
|
||||
$all = optional_param ('all', '', PARAM_ALPHA);
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
if (!empty($THEME->chameleonenabled)) {
|
||||
$chameleon_isadmin = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
$chameleon_isadmin = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
$chameleon_isteacher = false;
|
||||
if ($COURSE->id == SITEID) {
|
||||
$chameleon_courseparam = '';
|
||||
|
@ -19,7 +19,7 @@ if ($id != SITEID and !empty($CFG->allowcoursethemes) and !empty($course->theme)
|
||||
if (!has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme');
|
||||
}
|
||||
} else if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
} else if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme');
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$CFG->theme = $preview;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user