diff --git a/classes/output/mobile.php b/classes/output/mobile.php
index 1481800..2c345a8 100644
--- a/classes/output/mobile.php
+++ b/classes/output/mobile.php
@@ -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,
diff --git a/templates/mobile_view_activity_page.mustache b/templates/mobile_view_activity_page.mustache
index 5a73343..b1c0fb9 100644
--- a/templates/mobile_view_activity_page.mustache
+++ b/templates/mobile_view_activity_page.mustache
@@ -90,16 +90,18 @@
<%/showreport%>
<%#hasissues%>
-
-
- {{ 'plugin.mod_customcert.receiveddate' | translate }}
-
- <%#issues%>
-
- {{ <% timecreated %> | coreToLocaleString }}
-
- <%/issues%>
-
+ <%^canmanage%>
+
+
+ {{ 'plugin.mod_customcert.receiveddate' | translate }}
+
+ <%#issues%>
+
+ {{ <% timecreated %> | coreToLocaleString }}
+
+ <%/issues%>
+
+ <%/canmanage%>
<%/hasissues%>
<%#candownload%>
diff --git a/view.php b/view.php
index 408d8d1..7570d7d 100644
--- a/view.php
+++ b/view.php
@@ -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'));