feat: Add user details display to report
Introduces a user details table for displaying username, first name, last name, and email in the report. Updates language strings to support new user details headings and labels for the table fields. Increments the plugin version for release tracking.
This commit is contained in:
parent
1dac3d1e99
commit
1af48be553
3 changed files with 20 additions and 6 deletions
17
details.php
17
details.php
|
@ -29,21 +29,28 @@ if ($mform->is_cancelled()) {
|
|||
$courses = enrol_get_users_courses($user->id, true);
|
||||
$questions = $DB->get_records('question');
|
||||
|
||||
// User details
|
||||
|
||||
echo $OUTPUT->heading(get_string('userdetails', 'report_usergrades'), 3);
|
||||
|
||||
$user_table = new html_table();
|
||||
$user_table->head = array(get_string('field'), get_string('value'));
|
||||
|
||||
$user_table->data[] = array(get_string('username'), $user->username);
|
||||
$user_table->data[] = array(get_string('firstname'), $user->firstname);
|
||||
$user_table->data[] = array(get_string('lastname'), $user->lastname);
|
||||
$user_table->data[] = array(get_string('email'), $user->email);
|
||||
|
||||
foreach ($courses as $course) {
|
||||
// Basic information about the course
|
||||
echo $OUTPUT->heading($course->fullname, 3);
|
||||
|
||||
// Fetch all quizzes in the course
|
||||
$quizzes = $DB->get_records('quiz', array('course' => $course->id));
|
||||
|
||||
if ($quizzes) {
|
||||
echo $OUTPUT->heading(get_string('quizzes', 'report_usergrades'), 4);
|
||||
|
||||
foreach ($quizzes as $quiz) {
|
||||
// Fetch the quiz questions
|
||||
$quiz_questions = $DB->get_records('quiz_slots', array('quizid' => $quiz->id));
|
||||
|
||||
// Fetch the quiz attempts
|
||||
$quiz_attempts = $DB->get_records('quiz_attempts', array('quiz' => $quiz->id, 'userid' => $user->id));
|
||||
|
||||
if ($quiz_attempts) {
|
||||
|
|
|
@ -12,3 +12,10 @@ $string['attempt'] = 'Attempt';
|
|||
$string['question'] = 'Question';
|
||||
$string['response'] = 'Response';
|
||||
$string['totalgrade'] = 'Total Grade';
|
||||
$string['userdetails'] = 'User Details';
|
||||
$string['username'] = 'Username';
|
||||
$string['firstname'] = 'First Name';
|
||||
$string['lastname'] = 'Last Name';
|
||||
$string['email'] = 'Email';
|
||||
$string['field'] = 'Field';
|
||||
$string['value'] = 'Value';
|
|
@ -2,7 +2,7 @@
|
|||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'report_usergrades';
|
||||
$plugin->version = 2024112100;
|
||||
$plugin->version = 2024112101;
|
||||
$plugin->requires = 2022041900;
|
||||
$plugin->maturity = MATURITY_ALPHA;
|
||||
$plugin->release = 'v1.0';
|
||||
|
|
Loading…
Reference in a new issue