#203 Don't show 'Awarded on' date to managers

This commit is contained in:
Mark Nelson 2018-06-19 19:10:08 +08:00
parent c18c84b0df
commit de2709ae54
3 changed files with 20 additions and 13 deletions

View file

@ -67,7 +67,8 @@ class mobile {
$issues = $DB->get_records('customcert_issues', ['userid' => $USER->id, 'customcertid' => $certificate->id]);
$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)) {
$candownload = false;
}
@ -100,6 +101,7 @@ class mobile {
'groups' => array_values($groups),
'hasissues' => !empty($issues),
'issues' => array_values($issues),
'canmanage' => $canmanage,
'candownload' => $candownload,
'fileurl' => $fileurl,
'showreport' => $showreport,

View file

@ -90,16 +90,18 @@
</a>
<%/showreport%>
<%#hasissues%>
<ion-list>
<ion-list-header class="text-center">
{{ 'plugin.mod_customcert.receiveddate' | translate }}
</ion-list-header>
<%#issues%>
<ion-item class="text-center">
{{ <% timecreated %> | coreToLocaleString }}
</ion-item>
<%/issues%>
</ion-list>
<%^canmanage%>
<ion-list>
<ion-list-header class="text-center">
{{ 'plugin.mod_customcert.receiveddate' | translate }}
</ion-list-header>
<%#issues%>
<ion-item class="text-center">
{{ <% timecreated %> | coreToLocaleString }}
</ion-item>
<%/issues%>
</ion-list>
<%/canmanage%>
<%/hasissues%>
<%#candownload%>
<ion-item>

View file

@ -37,12 +37,14 @@ require_login($course, false, $cm);
$context = context_module::instance($cm->id);
require_capability('mod/customcert:view', $context);
$canmanage = has_capability('mod/customcert:manage', $context);
// Initialise $PAGE.
$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/customcert:manage', $context)) {
if ($customcert->requiredtime && !$canmanage) {
if (\mod_customcert\certificate::get_course_time($course->id) < ($customcert->requiredtime * 60)) {
$a = new stdClass;
$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.
$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->class = 'generaltable';
$table->head = array(get_string('receiveddate', 'customcert'));