#55 Fixed references to capabilities from mod_certificate
This commit is contained in:
parent
a3c67401fd
commit
c5859e433f
3 changed files with 3 additions and 3 deletions
|
@ -317,7 +317,7 @@ class certificate {
|
||||||
$conditionsparams = array();
|
$conditionsparams = array();
|
||||||
|
|
||||||
// Get all users that can manage this certificate to exclude them from the report.
|
// 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()));
|
$certmanagers = array_merge($certmanagers, array_keys(get_admins()));
|
||||||
list($sql, $params) = $DB->get_in_or_equal($certmanagers, SQL_PARAMS_NAMED, 'cert');
|
list($sql, $params) = $DB->get_in_or_equal($certmanagers, SQL_PARAMS_NAMED, 'cert');
|
||||||
$conditionssql .= "AND NOT u.id $sql \n";
|
$conditionssql .= "AND NOT u.id $sql \n";
|
||||||
|
|
2
lib.php
2
lib.php
|
@ -234,7 +234,7 @@ function customcert_pluginfile($course, $cm, $context, $filearea, $args, $forced
|
||||||
if ($filearea === 'image') {
|
if ($filearea === 'image') {
|
||||||
if ($context->contextlevel == CONTEXT_MODULE) {
|
if ($context->contextlevel == CONTEXT_MODULE) {
|
||||||
require_login($course, false, $cm);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
view.php
2
view.php
|
@ -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));
|
\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.
|
// 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)) {
|
if (\mod_customcert\certificate::get_course_time($course->id) < ($customcert->requiredtime * 60)) {
|
||||||
$a = new stdClass;
|
$a = new stdClass;
|
||||||
$a->requiredtime = $customcert->requiredtime;
|
$a->requiredtime = $customcert->requiredtime;
|
||||||
|
|
Loading…
Reference in a new issue