diff --git a/public/plugin/Bbb/lib/bbb_plugin.class.php b/public/plugin/Bbb/lib/bbb_plugin.class.php index 66372b1fd30..eed96ce6706 100644 --- a/public/plugin/Bbb/lib/bbb_plugin.class.php +++ b/public/plugin/Bbb/lib/bbb_plugin.class.php @@ -159,6 +159,42 @@ public static function updateCourseFieldInAllCourses(string $variable, string $v $entityManager->flush(); } + public function canCurrentUserSeeGlobalConferenceLink(): bool + { + $allowedStatuses = $this->get('global_conference_allow_roles') ?? []; + + if (empty($allowedStatuses)) { + return api_is_platform_admin(); + } + + foreach ($allowedStatuses as $status) { + switch ((int) $status) { + case PLATFORM_ADMIN: + if (api_is_platform_admin()) { + return true; + } + break; + case COURSEMANAGER: + if (api_is_teacher()) { + return true; + } + break; + case STUDENT: + if (api_is_student()) { + return true; + } + break; + case STUDENT_BOSS: + if (api_is_student_boss()) { + return true; + } + break; + } + } + + return false; + } + public function get_name(): string { return 'Bbb'; diff --git a/public/plugin/Bbb/listing.php b/public/plugin/Bbb/listing.php index 716b7558006..3f8b862b591 100644 --- a/public/plugin/Bbb/listing.php +++ b/public/plugin/Bbb/listing.php @@ -20,6 +20,7 @@ require_once __DIR__.'/config.php'; $plugin = BbbPlugin::create(); +$canSeeShareableConferenceLink = $plugin->canCurrentUserSeeGlobalConferenceLink(); $tool_name = $plugin->get_lang('Videoconference'); $em = Database::getManager(); $meetingRepository = $em->getRepository(ConferenceMeeting::class); @@ -446,6 +447,7 @@ $tpl->assign('message', $message); $tpl->assign('form', $formToString); $tpl->assign('enter_conference_links', $urlList); +$tpl->assign('can_see_share_link', $canSeeShareableConferenceLink); $content = $tpl->fetch('Bbb/view/listing.tpl'); diff --git a/public/plugin/Bbb/view/listing.tpl b/public/plugin/Bbb/view/listing.tpl index 4a827c5d873..c42faa1283d 100644 --- a/public/plugin/Bbb/view/listing.tpl +++ b/public/plugin/Bbb/view/listing.tpl @@ -12,107 +12,117 @@ {% autoescape false %} -
-{% if bbb_status == true %} -
+
+ {% if bbb_status %} +
{{ form }} - {% if show_join_button == true %} - {{ enter_conference_links.0 }} -
- {{ 'UrlMeetingToShare'| get_plugin_lang('BBBPlugin') }} -
-
-
- - -
-
-
-

- - {{ 'XUsersOnLine'| get_plugin_lang('BBBPlugin') | format(users_online) }} - -

+ {% if show_join_button and can_see_share_link %} + + {{ 'EnterConference'|get_plugin_lang('BBBPlugin') }} + - {% if max_users_limit > 0 %} - {% if conference_manager == true %} -

{{ 'MaxXUsersWarning' | get_plugin_lang('BBBPlugin') | format(max_users_limit) }}

- {% elseif users_online >= max_users_limit/2 %} -

{{ 'MaxXUsersWarning' | get_plugin_lang('BBBPlugin') | format(max_users_limit) }}

- {% endif %} - {% endif %} +

+ {{ 'UrlMeetingToShare'|get_plugin_lang('BBBPlugin') }} +

+ +
+ +
+ +

+ + {{ 'XUsersOnLine'| get_plugin_lang('BBBPlugin') | format(users_online) }} + +

+ + {% if max_users_limit > 0 %} +

+ {{ 'MaxXUsersWarning' | get_plugin_lang('BBBPlugin') | format(max_users_limit) }} +

+ {% endif %} {% elseif max_users_limit > 0 %} - {% if conference_manager == true %} -

{{ 'MaxXUsersReachedManager' | get_plugin_lang('BBBPlugin') | format(max_users_limit) }}

+

+ {% if conference_manager %} + {{ 'MaxXUsersReachedManager' | get_plugin_lang('BBBPlugin') | format(max_users_limit) }} {% elseif users_online > 0 %} -

{{ 'MaxXUsersReached' | get_plugin_lang('BBBPlugin') | format(max_users_limit) }}

+ {{ 'MaxXUsersReached' | get_plugin_lang('BBBPlugin') | format(max_users_limit) }} {% endif %} +

{% endif %}
-
- - - - - - - {% if allow_to_edit %} - - {% endif %} - - {% for meeting in meetings %} - - - {% if meeting.visibility == 0 %} - - {% else %} - - {% endif %} - + {% endfor %} + +
{{ 'CreatedAt'| get_plugin_lang('BBBPlugin') }}{{ 'Status'| get_lang }}{{ 'Records'| get_plugin_lang('BBBPlugin') }}{{ 'Actions'| get_lang }}
{{ meeting.created_at }}{{ meeting.created_at }} - {% if meeting.status == 1 %} - {{ 'MeetingOpened'|get_plugin_lang('BBBPlugin') }} - {% else %} - {{ 'MeetingClosed'|get_plugin_lang('BBBPlugin') }} +
+

+ {{ 'RecordList'| get_plugin_lang('BBBPlugin') }} +

+
+ + + + + + + {% if allow_to_edit %} + {% endif %} - - + + + {% for meeting in meetings %} + + + + - {% if allow_to_edit %} - + {% if allow_to_edit %} + - {% endif %} - - - {% endfor %} -
{{ 'CreatedAt'| get_plugin_lang('BBBPlugin') }}{{ 'Status'| get_lang }}{{ 'Records'| get_plugin_lang('BBBPlugin') }}{{ 'Actions'| get_lang }} - {% if meeting.record == 1 %} - {# Record list #} +
+ {{ meeting.created_at }} + + {% if meeting.status == 1 %} + + {{ 'MeetingOpened'|get_plugin_lang('BBBPlugin') }} + + {% else %} + + {{ 'MeetingClosed'|get_plugin_lang('BBBPlugin') }} + + {% endif %} + + {% if meeting.record == 1 %} {{ meeting.show_links }} - {% else %} - {{ 'NoRecording'|get_plugin_lang('BBBPlugin') }} - {% endif %} - - {% if meeting.status == 1 %} - + {% else %} + {{ 'NoRecording'|get_plugin_lang('BBBPlugin') }} + {% endif %} + + {% if meeting.status == 1 %} + {{ 'CloseMeeting'|get_plugin_lang('BBBPlugin') }} - {% endif %} - {{ meeting.action_links }} + {% endif %} + {{ meeting.action_links }}
+ {% endif %} +
+
-{% else %} -
- {{ 'ServerIsNotRunning' | get_plugin_lang('BBBPlugin') }} + {% else %} +
+ {{ 'ServerIsNotRunning' | get_plugin_lang('BBBPlugin') }}
-{% endif %} + {% endif %}
{% endautoescape %}