#55 Fixed references to capabilities from mod_certificate

This commit is contained in:
Mark Nelson 2016-11-29 13:30:16 +08:00
parent 5dfbad3b69
commit 0757213295
3 changed files with 3 additions and 3 deletions

View file

@ -317,7 +317,7 @@ class certificate {
$conditionsparams = array();
// Get all users that can manage this certificate to exclude them from the report.
$certmanagers = array_keys(get_users_by_capability($context, 'mod/certificate:manage', 'u.id'));
$certmanagers = array_keys(get_users_by_capability($context, 'mod/customcert:manage', 'u.id'));
$certmanagers = array_merge($certmanagers, array_keys(get_admins()));
list($sql, $params) = $DB->get_in_or_equal($certmanagers, SQL_PARAMS_NAMED, 'cert');
$conditionssql .= "AND NOT u.id $sql \n";

View file

@ -234,7 +234,7 @@ function customcert_pluginfile($course, $cm, $context, $filearea, $args, $forced
if ($filearea === 'image') {
if ($context->contextlevel == CONTEXT_MODULE) {
require_login($course, false, $cm);
} else if ($context->contextlevel == CONTEXT_SYSTEM && !has_capability('mod/certificate:manage', $context)) {
} else if ($context->contextlevel == CONTEXT_SYSTEM && !has_capability('mod/customcert:manage', $context)) {
return false;
}

View file

@ -42,7 +42,7 @@ $pageurl = new moodle_url('/mod/customcert/view.php', array('id' => $cm->id));
\mod_customcert\page_helper::page_setup($pageurl, $context, format_string($customcert->name));
// Check if the user can view the certificate based on time spent in course.
if ($customcert->requiredtime && !has_capability('mod/certificate:manage', $context)) {
if ($customcert->requiredtime && !has_capability('mod/customcert:manage', $context)) {
if (\mod_customcert\certificate::get_course_time($course->id) < ($customcert->requiredtime * 60)) {
$a = new stdClass;
$a->requiredtime = $customcert->requiredtime;