Skip to content

Commit

Permalink
Merge pull request #163 from catalyst/161-fix-table-403
Browse files Browse the repository at this point in the history
fix: update list to only show session id if user has capabilities to upload
  • Loading branch information
matthewhilton authored May 23, 2024
2 parents 732af99 + 1b644c9 commit b0bf8c1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
19 changes: 16 additions & 3 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ class mod_facetoface_renderer extends plugin_renderer_base {
/**
* Builds session list table given an array of sessions
*/
public function print_session_list_table($customfields, $sessions, $viewattendees, $editsessions, $signuplinks = true) {
public function print_session_list_table(
$customfields,
$sessions,
$viewattendees,
$editsessions,
$signuplinks = true,
$uploadbookings = false
) {
$output = '';

$tableheader = [];
Expand All @@ -42,7 +49,11 @@ public function print_session_list_table($customfields, $sessions, $viewattendee
$tableheader[] = format_string($field->name);
}
}
$tableheader[] = get_string('sessionnumber', 'facetoface');

if ($uploadbookings) {
$tableheader[] = get_string('sessionnumber', 'facetoface');
}

$tableheader[] = get_string('date', 'facetoface');
$tableheader[] = get_string('time', 'facetoface');
if ($viewattendees) {
Expand Down Expand Up @@ -90,7 +101,9 @@ public function print_session_list_table($customfields, $sessions, $viewattendee
}
}

$sessionrow[] = html_writer::tag('span', $session->id, ['class' => 'mr-3']);
if ($uploadbookings) {
$sessionrow[] = html_writer::tag('span', $session->id, ['class' => 'mr-3']);
}

// Dates/times.
$allsessiondates = '';
Expand Down
18 changes: 16 additions & 2 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,14 @@ function print_session_list($courseid, $facetoface, $location) {
print_string('noupcoming', 'facetoface');
} else {
$upcomingarray = array_merge($upcomingarray, $upcomingtbdarray);
echo $f2frenderer->print_session_list_table($customfields, $upcomingarray, $viewattendees, $editsessions, !$bulksignup);
echo $f2frenderer->print_session_list_table(
$customfields,
$upcomingarray,
$viewattendees,
$editsessions,
!$bulksignup,
$uploadbookings
);
}

if ($editsessions) {
Expand All @@ -245,7 +252,14 @@ function print_session_list($courseid, $facetoface, $location) {
// Previous sessions.
if (!empty($previousarray)) {
echo $OUTPUT->heading(get_string('previoussessions', 'facetoface'));
echo $f2frenderer->print_session_list_table($customfields, $previousarray, $viewattendees, $editsessions);
echo $f2frenderer->print_session_list_table(
$customfields,
$previousarray,
$viewattendees,
$editsessions,
true,
$uploadbookings
);
}
}

Expand Down

0 comments on commit b0bf8c1

Please sign in to comment.