Feature request (Quiz Attempt)

Feature request (Quiz Attempt)

Bởi Aditya Dubay -
Số lượng các câu trả lời: 5

Hi,

I am using Moodle 3.3.2

I wish a feature in quiz attempt.

I want a unique number like "Reference number" of each quiz attempt must be displayed on attempt summary page as well as with attempts when we download attempts.

For example course short name is "dca", course id is "25", quiz short name is "fcit", quiz id is "36" and attempt id is "234" so it generate reference number like "dca25fcit36234"

Is it possible to create something like this?

 

Trung bình điểm đánh giá: -
Để phản hồi tới Aditya Dubay

Re: Feature request (Quiz Attempt)

Bởi Aditya Dubay -
No reply yet buồn
Để phản hồi tới Aditya Dubay

Re: Feature request (Quiz Attempt)

Bởi Tim Hunt -
Hình của Core developers Hình của Documentation writers Hình của Particularly helpful Moodlers Hình của Peer reviewers Hình của Plugin developers

Of course it is possible, but the only easy way is by changing core code in the quiz reports.

Or, you could make your own quiz report plugin.

Để phản hồi tới Tim Hunt

Re: Feature request (Quiz Attempt)

Bởi Aditya Dubay -

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 {

}

Để phản hồi tới Aditya Dubay

Re: Feature request (Quiz Attempt)

Bởi Tim Hunt -
Hình của Core developers Hình của Documentation writers Hình của Particularly helpful Moodlers Hình của Peer reviewers Hình của Plugin developers

You can do that more elegantly using this technique: https://docs.moodle.org/dev/Overriding_a_renderer

You cannot expect Moodle core to add a feature of displaying 'Reference numbers' in a weird format that is specific to your university. Things can only go into Moodle core if they are generic.