From 7c183f44d464860d27a63ce7e97a0d155f529e68 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Fri, 2 Dec 2011 22:18:34 +1300 Subject: [PATCH] MDL-28728 SCORM - only show delete button if data exists for this user in this scorm --- mod/scorm/locallib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 2a3c4b2698c..613266de5a3 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -1110,7 +1110,9 @@ function scorm_get_attempt_status($user, $scorm, $cm='') { } if (!empty($cm)) { $context = context_module::instance($cm->id); - if (has_capability('mod/scorm:deleteownresponses', $context)) { + if (has_capability('mod/scorm:deleteownresponses', $context) && + $DB->record_exists('scorm_scoes_track', array('userid' => $user->id, 'scormid' => $scorm->id))) { + //check to see if any data is stored for this user: $deleteurl = new moodle_url($PAGE->url, array('action'=>'delete', 'sesskey' => sesskey())); $result .= $OUTPUT->single_button($deleteurl, get_string('deleteallattempts', 'scorm')); }