Skip to content

Commit

Permalink
Admin: Add configuration setting 'session_visibility_after_end_date_o…
Browse files Browse the repository at this point in the history
…ptions_configuration' to limit the visible session-visibility options - refs #5543
  • Loading branch information
juancp-contidosdixitais authored and ywarnier committed Oct 18, 2024
1 parent 14e699f commit c8748f8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
25 changes: 20 additions & 5 deletions main/inc/lib/sessionmanager.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -8085,16 +8085,31 @@ public static function setForm(FormValidator $form, array $sessionInfo = [])

$form->addElement('checkbox', 'show_description', null, get_lang('ShowDescription'));

$visibilityOptions = [
SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'),
SESSION_VISIBLE => get_lang('SessionAccessible'),
SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible')),
];

$visibilityOptionsConfiguration = api_get_configuration_value('session_visibility_after_end_date_options_configuration');
if (!empty($visibilityOptionsConfiguration)) {
foreach ($visibilityOptionsConfiguration['visibility_options_to_hide'] as $option) {
$option = trim($option);
if (defined($option)) {
$constantValue = constant($option);
if (isset($visibilityOptions[$constantValue])) {
unset($visibilityOptions[$constantValue]);
}
}
}
}

$visibilityGroup = [];
$visibilityGroup[] = $form->createElement(
'select',
'session_visibility',
null,
[
SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'),
SESSION_VISIBLE => get_lang('SessionAccessible'),
SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible')),
]
$visibilityOptions
);
$form->addGroup(
$visibilityGroup,
Expand Down
8 changes: 8 additions & 0 deletions main/install/configuration.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2381,6 +2381,14 @@
// they are only accessible during the active duration).
//$_configuration['session_coach_access_after_duration_end'] = false;

// Hide visibility options for session visibility after end date.
// Admitted options: SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_INVISIBLE
/*$_configuration['session_visibility_after_end_date_options_configuration'] = [
'visibility_options_to_hide' => [
'SESSION_VISIBLE_READ_ONLY '
]
];*/

// Restrict the list of students to subscribe in the course session. And disable
// registration for users in all courses from Resume Session page
//$_configuration['session_course_users_subscription_limited_to_session_users'] = false;
Expand Down

0 comments on commit c8748f8

Please sign in to comment.