Hi Tim,
Thanks for reply.
We added below code in view.php of quiz module and it works fine, but, we still want this as core functionality of moodle or as plugin. We try to make plugin but we are not able to do.
//to get the quize id in particular page
$cm = $PAGE->cm;
$quiz_details = $DB->get_record('quiz', array('id' => $cm->instance));
$quiz_id = $quiz_details->id;
// check the details in course attemp that exam avilabe or not
$userid = $USER->id;
// connection goes here
$dbhost = $CFG->dbhost;
$dbname = $CFG->dbname;
$dbuser = $CFG->dbuser;
$dbpass = $CFG->dbpass;
$conn = new mysqli($dbhost, $dbuser, $dbpass,$dbname);
$sql_check_attempt = $conn->query("SELECT * FROM mdl_quiz_attempts
WHERE `userid` = '$userid' AND `quiz` = '$quiz_id' AND `state` = 'finished'");
$count_row = $sql_check_attempt->num_rows;
if ($count_row>0) {
while ($row = $sql_check_attempt->fetch_assoc()) {
$quiz_id = $row['quiz'];
$uniqueid = $row['uniqueid'];
}
echo "<span style='color:red; font-weight:bold;'> Reference Number : "
.$quiz_id.$uniqueid.$userid.
"</span>";
} else {
}