} else if ($course->showgrades and has_capability('moodle/grade:viewall', $personalcontext)) {
// ok - can view grades of this user - parent most probably
$modes[] = 'grade';
+
+ } else if ($course->showgrades and $anyreport) {
+ // ok - can view grades of this user - parent most probably
+ $modes[] = 'grade';
}
if (empty($modes)) {
)
),
+ // designed for parent role - not used in legacy roles
'moodle/user:viewuseractivitiesreport' => array(
+ 'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'legacy' => array(
- 'teacher' => CAP_ALLOW,
- 'editingteacher' => CAP_ALLOW,
- 'admin' => CAP_ALLOW
)
),
$context = get_context_instance(CONTEXT_COURSE, $course->id);
if (isset($user->context->id)) {
- $usercontext = get_context_instance_by_id($user->context->id);
+ $usercontext = $user->context;
+ } else {
+ $usercontext = get_context_instance(CONTEXT_USER, $user->id);
}
if (empty($string)) { // Cache all the strings for the rest of the page
$output .= '<a href="'.$CFG->wwwroot.'/notes/index.php?course=' . $course->id. '&user='.$user->id.'">'.get_string('notes','notes').'</a><br />';
}
- if (has_capability('moodle/user:viewuseractivitiesreport', $context) || (isset($usercontext) && has_capability('moodle/user:viewuseractivitiesreport', $usercontext))) {
- $timemidnight = usergetmidnight(time());
+ if (has_capability('moodle/site:viewreports', $context) or has_capability('moodle/user:viewuseractivitiesreport', $usercontext)) {
$output .= '<a href="'. $CFG->wwwroot .'/course/user.php?id='. $course->id .'&user='. $user->id .'">'. $string->activity .'</a><br />';
}
if (has_capability('moodle/role:assign', $context) and get_user_roles($context, $user->id, false)) { // I can unassing and user has some role
// ok - can view grades of this user - parent most probably
$gradeaccess = true;
+ } else if ($course->showgrades and $anyreport) {
+ // ok - can view grades of this user - parent most probably
+ $gradeaccess = true;
+
} else {
$gradeaccess = false;
}
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2008113001; // YYYYMMDD = date of the last version bump
+ $version = 2008120100; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20081128)'; // Human-friendly version name