Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions attendees.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
$userids = array_unique($userids);
if (!empty($userids)) {
// Fetch only the fields we need (id and username).
$users = $DB->get_records_list('user', 'id', $userids, '', 'id, username');
$users = $DB->get_records_list('user', 'id', $userids, '', 'id, username, idnumber');
}
}
// Load cancellations.
Expand Down Expand Up @@ -257,13 +257,20 @@
$table = new html_table();
$table->head = [get_string('name')];
$table->align = ['left'];
$table->size = ['70%'];
$table->size = ['50%'];

$showusername = facetoface_should_attendees_show_usernames();
if ($showusername) {
$table->head[] = get_string('username');
$table->align[] = 'left';
$table->size[] = '30%';
$table->size[] = '25%';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This size feels like it should respect which columns are active.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, now that we have a few columns this value should be calculated dynamically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set the size to be auto so that width is calculated dynamically.

1 2 3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great this is looking much better

}

$showidnumber = facetoface_should_attendees_show_idnumbers();
if ($showidnumber) {
$table->head[] = get_string('idnumber');
$table->align[] = 'left';
$table->size[] = '25%';
}

if ($takeattendance) {
Expand Down Expand Up @@ -298,6 +305,13 @@
$data[] = format_string($username);
}

// Show ID number.
if ($showidnumber) {
$user = $users[$attendee->id] ?? null;
$idnumber = $user ? $user->idnumber : '';
$data[] = format_string($idnumber);
}

if ($takeattendance) {
// Show current status.
$data[] = get_string('status_' . facetoface_get_status($attendee->statuscode), 'facetoface');
Expand Down
2 changes: 2 additions & 0 deletions lang/en/facetoface.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@
$string['setting:attendeesexportfields_caption'] = 'Attendees export fields';
$string['setting:attendeesshowusernames'] = 'If enabled, attendee usernames will appear alongside full names in the table, provided the necessary identity settings are properly configured.';
$string['setting:attendeesshowusernames_caption'] = 'Show usernames in attendees table.';
$string['setting:attendeesshowidnumbers'] = 'If enabled, attendee ID numbers will appear alongside full names in the table, provided the necessary identity settings are properly configured.';
$string['setting:attendeesshowidnumbers_caption'] = 'Show ID numbers in attendees table.';
$string['setting:cancelrestriction'] = 'Minimum time before a session that students can cancel their booking. Within this period, cancellations are not allowed.';
$string['setting:cancelrestriction_caption'] = 'Cancellation restriction';
$string['setting:defaultcancellationinstrmngr'] = 'Default cancellation message sent to managers.';
Expand Down
22 changes: 22 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,7 @@ function facetoface_download_attendees($facetofacename, $session, $attendees, $f
$timeformat = str_replace(' ', '_', get_string('strftimedate', 'langconfig'));
$downloadfilename = clean_filename($facetofacename . '_' . userdate($timenow, $timeformat));
$showusername = facetoface_should_attendees_show_usernames();
$showidnumber = facetoface_should_attendees_show_idnumbers();

$dateformat = 0;
if ('ods' === $format) {
Expand Down Expand Up @@ -1491,6 +1492,10 @@ function facetoface_download_attendees($facetofacename, $session, $attendees, $f
if ($showusername) {
$worksheet->write_string($row, $column++, get_string('username'), ['bold' => 1, 'border' => 1]);
}
// ID number.
if ($showidnumber) {
$worksheet->write_string($row, $column++, get_string('idnumber'), ['bold' => 1, 'border' => 1]);
}
// Current status.
$worksheet->write_string($row, $column++, get_string('currentstatus', 'facetoface'), ['bold' => 1, 'border' => 1]);

Expand Down Expand Up @@ -1573,6 +1578,9 @@ function facetoface_download_attendees($facetofacename, $session, $attendees, $f
if ($showusername) {
$worksheet->write_string($row, $column++, $user->username, ['border' => 1, 'v_align' => 'top']);
}
if ($showidnumber) {
$worksheet->write_string($row, $column++, $user->idnumber ?? '', ['border' => 1, 'v_align' => 'top']);
}
$worksheet->write_string(
$row,
$column++,
Expand Down Expand Up @@ -4780,6 +4788,20 @@ function facetoface_should_attendees_show_usernames(): bool {
return $attendeesshowusernames && $showidentity && !$protectusernames;
}

/**
* Check if id numbers should be shown in the attendees table.
*
* @return bool true if id numbers can be displayed, false otherwise
*/
function facetoface_should_attendees_show_idnumbers(): bool {
global $CFG;

$attendeesshowidnumbers = get_config('facetoface', 'attendeesshowidnumbers');
$showidentity = !empty($CFG->showuseridentity) && in_array('idnumber', explode(',', $CFG->showuseridentity));

return $attendeesshowidnumbers && $showidentity;
}

/**
* Facetoface assignment candidates
*
Expand Down
7 changes: 7 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@
0
));

$settings->add(new admin_setting_configcheckbox(
'facetoface/attendeesshowidnumbers',
get_string('setting:attendeesshowidnumbers_caption', 'mod_facetoface'),
get_string('setting:attendeesshowidnumbers', 'mod_facetoface'),
0
));

$settings->add(new admin_setting_heading(
'facetoface/manageremail_header',
get_string('manageremailheading', 'facetoface'),
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2025112600;
$plugin->release = 2025112600;
$plugin->version = 2025121500;
$plugin->release = 2025121500;
$plugin->requires = 2023100900; // Requires 4.3.
$plugin->component = 'mod_facetoface';
$plugin->maturity = MATURITY_STABLE;
Expand Down
Loading