#85 Added new capability for viewing the course report
This commit is contained in:
parent
1a134d7319
commit
052b7b874f
5 changed files with 16 additions and 4 deletions
|
@ -60,6 +60,17 @@ $capabilities = array(
|
|||
)
|
||||
),
|
||||
|
||||
'mod/customcert:viewreport' => array(
|
||||
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_MODULE,
|
||||
'archetypes' => array(
|
||||
'teacher' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'manager' => CAP_ALLOW
|
||||
)
|
||||
),
|
||||
|
||||
'mod/customcert:viewallcertificates' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
|
|
|
@ -36,6 +36,7 @@ $string['customcertreport'] = 'Custom certificate report';
|
|||
$string['customcert:addinstance'] = 'Add a new custom certificate instance';
|
||||
$string['customcert:manage'] = 'Manage a custom certificate';
|
||||
$string['customcert:view'] = 'View a custom certificate';
|
||||
$string['customcert:viewreport'] = 'View course report';
|
||||
$string['customcert:viewallcertificates'] = 'View all certificates';
|
||||
$string['customcert:verifycertificate'] = 'Verify a certificate';
|
||||
$string['deletecertpage'] = 'Delete certificate page';
|
||||
|
|
|
@ -44,7 +44,7 @@ require_login($course, false, $cm);
|
|||
|
||||
// Check capabilities.
|
||||
$context = context_module::instance($cm->id);
|
||||
require_capability('mod/customcert:manage', $context);
|
||||
require_capability('mod/customcert:viewreport', $context);
|
||||
|
||||
// Check if we requested to download another user's certificate.
|
||||
if ($downloadcert) {
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
|
||||
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
|
||||
|
||||
$plugin->version = 2017050502; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2017050503; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2017050500; // Requires this Moodle version (3.3).
|
||||
$plugin->cron = 0; // Period for cron to check this module (secs).
|
||||
$plugin->component = 'mod_customcert';
|
||||
|
||||
$plugin->maturity = MATURITY_STABLE;
|
||||
$plugin->release = "3.3 release (Build: 2017050502)"; // User-friendly version number.
|
||||
$plugin->release = "3.3 release (Build: 2017050503)"; // User-friendly version number.
|
||||
|
|
2
view.php
2
view.php
|
@ -68,7 +68,7 @@ if (empty($action)) {
|
|||
|
||||
// Generate the link to the report if there are issues to display.
|
||||
$reportlink = '';
|
||||
if (has_capability('mod/customcert:manage', $context)) {
|
||||
if (has_capability('mod/customcert:viewreport', $context)) {
|
||||
// Get the total number of issues.
|
||||
$numissues = \mod_customcert\certificate::get_number_of_issues($customcert->id, $cm, $groupmode);
|
||||
$href = new moodle_urL('/mod/customcert/report.php', array('id' => $cm->id));
|
||||
|
|
Loading…
Reference in a new issue