mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
Rename CONTEXT_USERID --> CONTEXT_USER for consistency
This commit is contained in:
parent
f00b7f8d8e
commit
4b10f08b88
@ -63,7 +63,7 @@
|
||||
|
||||
/// Print the header and tabs
|
||||
|
||||
if ($context->aggregatelevel == CONTEXT_USERID) {
|
||||
if ($context->aggregatelevel == CONTEXT_USER) {
|
||||
/// course header
|
||||
if ($courseid!= SITEID) {
|
||||
print_header("$fullname", "$fullname",
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
|
||||
// we got a few tabs there
|
||||
if ($context->aggregatelevel == CONTEXT_USERID) {
|
||||
if ($context->aggregatelevel == CONTEXT_USER) {
|
||||
|
||||
/// course header
|
||||
if ($courseid!= SITEID) {
|
||||
|
@ -13,7 +13,7 @@ if ($currenttab != 'update') {
|
||||
case CONTEXT_PERSONAL:
|
||||
break;
|
||||
|
||||
case CONTEXT_USERID:
|
||||
case CONTEXT_USER:
|
||||
print_header();
|
||||
break;
|
||||
|
||||
|
@ -115,7 +115,7 @@ switch ($filtertype) {
|
||||
/// check if user is editting teacher, or if spg, is member
|
||||
break;
|
||||
case 'user':
|
||||
$context = get_context_instance(CONTEXT_USERID, $userid);
|
||||
$context = get_context_instance(CONTEXT_USER, $userid);
|
||||
if ($CFG->bloglevel < BLOG_USER_LEVEL) {
|
||||
error ('Blogs is not enabled');
|
||||
}
|
||||
@ -160,4 +160,4 @@ add_to_log($courseid, 'blog', 'view', 'index.php?filtertype='.$filtertype.'&
|
||||
include($CFG->dirroot .'/blog/footer.php');
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $id);
|
||||
$personalcontext = get_context_instance(CONTEXT_USERID, $user->id);
|
||||
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
|
||||
// if in either context, we can read report, then we can proceed
|
||||
if (!(has_capability('moodle/site:viewreports', $coursecontext) or ($course->showreports and $USER->id == $user->id) or has_capability('moodle/user:viewuseractivitiesreport', $personalcontext))) {
|
||||
|
@ -23,7 +23,7 @@ define('CAP_PROHIBIT', -1000);
|
||||
// context definitions
|
||||
define('CONTEXT_SYSTEM', 10);
|
||||
define('CONTEXT_PERSONAL', 20);
|
||||
define('CONTEXT_USERID', 30);
|
||||
define('CONTEXT_USER', 30);
|
||||
define('CONTEXT_COURSECAT', 40);
|
||||
define('CONTEXT_COURSE', 50);
|
||||
define('CONTEXT_GROUP', 60);
|
||||
@ -381,7 +381,7 @@ function has_capability($capability, $context=NULL, $userid=NULL, $doanything=tr
|
||||
break;
|
||||
|
||||
default:
|
||||
// CONTEXT_SYSTEM: CONTEXT_PERSONAL: CONTEXT_USERID:
|
||||
// CONTEXT_SYSTEM: CONTEXT_PERSONAL: CONTEXT_USER:
|
||||
// Do nothing.
|
||||
break;
|
||||
}
|
||||
@ -428,7 +428,7 @@ function capability_search($capability, $context, $capabilities) {
|
||||
$permission = capability_search($capability, $parentcontext, $capabilities);
|
||||
break;
|
||||
|
||||
case CONTEXT_USERID:
|
||||
case CONTEXT_USER:
|
||||
$parentcontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$permission = capability_search($capability, $parentcontext, $capabilities);
|
||||
break;
|
||||
@ -746,7 +746,7 @@ function capability_prohibits($capability, $context, $sum='', $array='') {
|
||||
return capability_prohibits($capability, $parent);
|
||||
break;
|
||||
|
||||
case CONTEXT_USERID:
|
||||
case CONTEXT_USER:
|
||||
$parent = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
return capability_prohibits($capability, $parent);
|
||||
break;
|
||||
@ -1690,7 +1690,7 @@ function print_context_name($context) {
|
||||
$name = get_string('personal');
|
||||
break;
|
||||
|
||||
case CONTEXT_USERID:
|
||||
case CONTEXT_USER:
|
||||
if ($user = get_record('user', 'id', $context->instanceid)) {
|
||||
$name = get_string('user').': '.fullname($user);
|
||||
}
|
||||
@ -1777,8 +1777,8 @@ function fetch_context_capabilities($context) {
|
||||
$SQL = "select * from {$CFG->prefix}capabilities where contextlevel = ".CONTEXT_PERSONAL;
|
||||
break;
|
||||
|
||||
case CONTEXT_USERID:
|
||||
$SQL = "select * from {$CFG->prefix}capabilities where contextlevel = ".CONTEXT_USERID;
|
||||
case CONTEXT_USER:
|
||||
$SQL = "select * from {$CFG->prefix}capabilities where contextlevel = ".CONTEXT_USER;
|
||||
break;
|
||||
|
||||
case CONTEXT_COURSECAT: // all
|
||||
@ -1905,7 +1905,7 @@ function get_parent_contexts($context) {
|
||||
}
|
||||
break;
|
||||
|
||||
case CONTEXT_USERID:
|
||||
case CONTEXT_USER:
|
||||
if (!$parent = get_context_instance(CONTEXT_SYSTEM, SITEID)) {
|
||||
return array();
|
||||
} else {
|
||||
@ -2064,7 +2064,7 @@ function get_component_string($component, $contextlevel) {
|
||||
$string = get_string('personal');
|
||||
break;
|
||||
|
||||
case CONTEXT_USERID:
|
||||
case CONTEXT_USER:
|
||||
$string = get_string('users');
|
||||
break;
|
||||
|
||||
|
@ -735,7 +735,7 @@ $moodle_capabilities = array(
|
||||
// since the next level up is site. These are more for the parent role
|
||||
'moodle/user:readuserposts' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_USERID,
|
||||
'contextlevel' => CONTEXT_USER,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'student' => CAP_ALLOW,
|
||||
@ -748,7 +748,7 @@ $moodle_capabilities = array(
|
||||
|
||||
'moodle/user:readuserblogs' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_USERID,
|
||||
'contextlevel' => CONTEXT_USER,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'student' => CAP_ALLOW,
|
||||
@ -761,7 +761,7 @@ $moodle_capabilities = array(
|
||||
|
||||
'moodle/user:viewuseractivitiesreport' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_USERID,
|
||||
'contextlevel' => CONTEXT_USER,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'student' => CAP_PREVENT,
|
||||
@ -774,7 +774,7 @@ $moodle_capabilities = array(
|
||||
|
||||
'moodle/user:editprofile' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_USERID,
|
||||
'contextlevel' => CONTEXT_USER,
|
||||
'legacy' => array(
|
||||
'guest' => CAP_PREVENT,
|
||||
'student' => CAP_PREVENT,
|
||||
|
@ -89,14 +89,14 @@
|
||||
|
||||
$toprow[] = new tabobject('profile', $CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$course->id, get_string('profile'));
|
||||
|
||||
$personalcontext = get_context_instance(CONTEXT_USERID, $user->id);
|
||||
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
/// Can only edit profile if it belongs to user or current user is admin and not editing primary admin
|
||||
|
||||
if (($mainadmin = get_admin()) === false) {
|
||||
$mainadmin->id = 0; /// Weird - no primary admin!
|
||||
}
|
||||
if ((!empty($USER->id) and ($USER->id == $user->id) and !isguest()) or
|
||||
(has_capability('moodle/user:editprofile', get_context_instance(CONTEXT_USERID, $user->id)) and ($user->id != $mainadmin->id)) ) {
|
||||
(has_capability('moodle/user:editprofile', get_context_instance(CONTEXT_USER, $user->id)) and ($user->id != $mainadmin->id)) ) {
|
||||
|
||||
if(empty($CFG->loginhttps)) {
|
||||
$wwwroot = $CFG->wwwroot;
|
||||
@ -176,7 +176,7 @@
|
||||
/// this needs permission checkings
|
||||
|
||||
if (!empty($showroles)) { // this variable controls whether this roles is showed, or not, so only user/view page should set this flag
|
||||
$usercontext = get_context_instance(CONTEXT_USERID, $user->id);
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
$toprow[] = new tabobject('roles', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$usercontext->id.'&userid='.$user->id.'&courseid='.$course->id
|
||||
,get_string('roles'));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user