#85 Added new capability for viewing the course report
This commit is contained in:
parent
07f506293d
commit
b2b820cc9a
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(
|
'mod/customcert:viewallcertificates' => array(
|
||||||
'captype' => 'read',
|
'captype' => 'read',
|
||||||
'contextlevel' => CONTEXT_SYSTEM,
|
'contextlevel' => CONTEXT_SYSTEM,
|
||||||
|
|
|
@ -36,6 +36,7 @@ $string['customcertreport'] = 'Custom certificate report';
|
||||||
$string['customcert:addinstance'] = 'Add a new custom certificate instance';
|
$string['customcert:addinstance'] = 'Add a new custom certificate instance';
|
||||||
$string['customcert:manage'] = 'Manage a custom certificate';
|
$string['customcert:manage'] = 'Manage a custom certificate';
|
||||||
$string['customcert:view'] = 'View a custom certificate';
|
$string['customcert:view'] = 'View a custom certificate';
|
||||||
|
$string['customcert:viewreport'] = 'View course report';
|
||||||
$string['customcert:viewallcertificates'] = 'View all certificates';
|
$string['customcert:viewallcertificates'] = 'View all certificates';
|
||||||
$string['customcert:verifycertificate'] = 'Verify a certificate';
|
$string['customcert:verifycertificate'] = 'Verify a certificate';
|
||||||
$string['deletecertpage'] = 'Delete certificate page';
|
$string['deletecertpage'] = 'Delete certificate page';
|
||||||
|
|
|
@ -44,7 +44,7 @@ require_login($course, false, $cm);
|
||||||
|
|
||||||
// Check capabilities.
|
// Check capabilities.
|
||||||
$context = context_module::instance($cm->id);
|
$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.
|
// Check if we requested to download another user's certificate.
|
||||||
if ($downloadcert) {
|
if ($downloadcert) {
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
|
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
|
||||||
|
|
||||||
$plugin->version = 2016120508; // The current module version (Date: YYYYMMDDXX).
|
$plugin->version = 2016120509; // The current module version (Date: YYYYMMDDXX).
|
||||||
$plugin->requires = 2016120500; // Requires this Moodle version (3.2).
|
$plugin->requires = 2016120500; // Requires this Moodle version (3.2).
|
||||||
$plugin->cron = 0; // Period for cron to check this module (secs).
|
$plugin->cron = 0; // Period for cron to check this module (secs).
|
||||||
$plugin->component = 'mod_customcert';
|
$plugin->component = 'mod_customcert';
|
||||||
|
|
||||||
$plugin->maturity = MATURITY_STABLE;
|
$plugin->maturity = MATURITY_STABLE;
|
||||||
$plugin->release = "3.2 release (Build: 2016120508)"; // User-friendly version number.
|
$plugin->release = "3.2 release (Build: 2016120509)"; // 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.
|
// Generate the link to the report if there are issues to display.
|
||||||
$reportlink = '';
|
$reportlink = '';
|
||||||
if (has_capability('mod/customcert:manage', $context)) {
|
if (has_capability('mod/customcert:viewreport', $context)) {
|
||||||
// Get the total number of issues.
|
// Get the total number of issues.
|
||||||
$numissues = \mod_customcert\certificate::get_number_of_issues($customcert->id, $cm, $groupmode);
|
$numissues = \mod_customcert\certificate::get_number_of_issues($customcert->id, $cm, $groupmode);
|
||||||
$href = new moodle_urL('/mod/customcert/report.php', array('id' => $cm->id));
|
$href = new moodle_urL('/mod/customcert/report.php', array('id' => $cm->id));
|
||||||
|
|
Loading…
Reference in a new issue