#203 Don't show 'Awarded on' date to managers
This commit is contained in:
parent
c18c84b0df
commit
de2709ae54
3 changed files with 20 additions and 13 deletions
|
@ -67,7 +67,8 @@ class mobile {
|
||||||
$issues = $DB->get_records('customcert_issues', ['userid' => $USER->id, 'customcertid' => $certificate->id]);
|
$issues = $DB->get_records('customcert_issues', ['userid' => $USER->id, 'customcertid' => $certificate->id]);
|
||||||
|
|
||||||
$candownload = true;
|
$candownload = true;
|
||||||
if ($certificate->requiredtime && !has_capability('mod/customcert:manage', $context)) {
|
$canmanage = has_capability('mod/customcert:manage', $context);
|
||||||
|
if ($certificate->requiredtime && !$canmanage) {
|
||||||
if (\mod_customcert\certificate::get_course_time($certificate->course) < ($certificate->requiredtime * 60)) {
|
if (\mod_customcert\certificate::get_course_time($certificate->course) < ($certificate->requiredtime * 60)) {
|
||||||
$candownload = false;
|
$candownload = false;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +101,7 @@ class mobile {
|
||||||
'groups' => array_values($groups),
|
'groups' => array_values($groups),
|
||||||
'hasissues' => !empty($issues),
|
'hasissues' => !empty($issues),
|
||||||
'issues' => array_values($issues),
|
'issues' => array_values($issues),
|
||||||
|
'canmanage' => $canmanage,
|
||||||
'candownload' => $candownload,
|
'candownload' => $candownload,
|
||||||
'fileurl' => $fileurl,
|
'fileurl' => $fileurl,
|
||||||
'showreport' => $showreport,
|
'showreport' => $showreport,
|
||||||
|
|
|
@ -90,6 +90,7 @@
|
||||||
</a>
|
</a>
|
||||||
<%/showreport%>
|
<%/showreport%>
|
||||||
<%#hasissues%>
|
<%#hasissues%>
|
||||||
|
<%^canmanage%>
|
||||||
<ion-list>
|
<ion-list>
|
||||||
<ion-list-header class="text-center">
|
<ion-list-header class="text-center">
|
||||||
{{ 'plugin.mod_customcert.receiveddate' | translate }}
|
{{ 'plugin.mod_customcert.receiveddate' | translate }}
|
||||||
|
@ -100,6 +101,7 @@
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<%/issues%>
|
<%/issues%>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
<%/canmanage%>
|
||||||
<%/hasissues%>
|
<%/hasissues%>
|
||||||
<%#candownload%>
|
<%#candownload%>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
|
|
7
view.php
7
view.php
|
@ -37,12 +37,14 @@ require_login($course, false, $cm);
|
||||||
$context = context_module::instance($cm->id);
|
$context = context_module::instance($cm->id);
|
||||||
require_capability('mod/customcert:view', $context);
|
require_capability('mod/customcert:view', $context);
|
||||||
|
|
||||||
|
$canmanage = has_capability('mod/customcert:manage', $context);
|
||||||
|
|
||||||
// Initialise $PAGE.
|
// Initialise $PAGE.
|
||||||
$pageurl = new moodle_url('/mod/customcert/view.php', array('id' => $cm->id));
|
$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/customcert:manage', $context)) {
|
if ($customcert->requiredtime && !$canmanage) {
|
||||||
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;
|
||||||
|
@ -85,7 +87,8 @@ if (empty($action)) {
|
||||||
|
|
||||||
// If the current user has been issued a customcert generate HTML to display the details.
|
// If the current user has been issued a customcert generate HTML to display the details.
|
||||||
$issuelist = '';
|
$issuelist = '';
|
||||||
if ($issues = $DB->get_records('customcert_issues', array('userid' => $USER->id, 'customcertid' => $customcert->id))) {
|
$issues = $DB->get_records('customcert_issues', array('userid' => $USER->id, 'customcertid' => $customcert->id));
|
||||||
|
if ($issues && !$canmanage) {
|
||||||
$table = new html_table();
|
$table = new html_table();
|
||||||
$table->class = 'generaltable';
|
$table->class = 'generaltable';
|
||||||
$table->head = array(get_string('receiveddate', 'customcert'));
|
$table->head = array(get_string('receiveddate', 'customcert'));
|
||||||
|
|
Loading…
Reference in a new issue