MOBILE-3873 bbb: Let moderators end the meeting

main
Dani Palou 2021-12-01 11:17:59 +01:00
parent 30fdefd1db
commit 93ea867dec
5 changed files with 85 additions and 2 deletions

View File

@ -433,9 +433,12 @@
"addon.mod_assign_submission_file.pluginname": "assignsubmission_file",
"addon.mod_assign_submission_onlinetext.pluginname": "assignsubmission_onlinetext",
"addon.mod_assign_submission_onlinetext.wordlimitexceeded": "assignsubmission_onlinetext",
"addon.mod_bigbluebuttonbn.end_session_confirm": "bigbluebuttonbn",
"addon.mod_bigbluebuttonbn.end_session_confirm_title": "bigbluebuttonbn",
"addon.mod_bigbluebuttonbn.mod_form_field_closingtime": "bigbluebuttonbn",
"addon.mod_bigbluebuttonbn.mod_form_field_openingtime": "bigbluebuttonbn",
"addon.mod_bigbluebuttonbn.userlimitreached": "bigbluebuttonbn",
"addon.mod_bigbluebuttonbn.view_conference_action_end": "bigbluebuttonbn",
"addon.mod_bigbluebuttonbn.view_conference_action_join": "bigbluebuttonbn",
"addon.mod_bigbluebuttonbn.view_error_unable_join_student": "bigbluebuttonbn",
"addon.mod_bigbluebuttonbn.view_groups_selection_warning": "bigbluebuttonbn",

View File

@ -120,6 +120,11 @@
{{ 'addon.mod_bigbluebuttonbn.view_conference_action_join' | translate }}
</ion-button>
<ion-button *ngIf="meetingInfo.statusrunning && meetingInfo.ismoderator" color="light" class="ion-margin" expand="block"
(click)="endMeeting()">
{{ 'addon.mod_bigbluebuttonbn.view_conference_action_end' | translate }}
</ion-button>
<ion-card *ngIf="!meetingInfo.canjoin" class="core-warning-card">
<ion-item class="ion-text-wrap">
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>

View File

@ -45,6 +45,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
@Optional() courseContentsPage?: CoreCourseContentsPage,
) {
super('AddonModBBBIndexComponent', content, courseContentsPage);
(<any>window).ths = this;
}
/**
@ -118,9 +119,15 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
return;
}
await AddonModBBB.invalidateAllGroupsMeetingInfo(this.bbb.id);
this.loaded = false;
await this.fetchMeetingInfo();
try {
await AddonModBBB.invalidateAllGroupsMeetingInfo(this.bbb.id);
await this.fetchMeetingInfo();
} finally {
this.loaded = true;
}
}
/**
@ -177,4 +184,38 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
}
}
/**
* End the meeting.
*
* @return Promise resolved when done.
*/
async endMeeting(): Promise<void> {
if (!this.bbb) {
return;
}
try {
await CoreDomUtils.showConfirm(
Translate.instant('addon.mod_bigbluebuttonbn.end_session_confirm'),
Translate.instant('addon.mod_bigbluebuttonbn.end_session_confirm_title'),
Translate.instant('core.yes'),
);
} catch {
// User canceled.
return;
}
const modal = await CoreDomUtils.showModalLoading();
try {
await AddonModBBB.endMeeting(this.bbb.id, this.groupId);
this.updateMeetingInfo();
} catch (error) {
CoreDomUtils.showErrorModal(error);
} finally {
modal.dismiss();
}
}
}

View File

@ -1,7 +1,10 @@
{
"end_session_confirm": "Are you sure you want to end the virtual classroom session?",
"end_session_confirm_title": "Really end session?",
"mod_form_field_closingtime": "Join closed",
"mod_form_field_openingtime": "Join open",
"userlimitreached": "The number of users allowed in a meeting has been reached.",
"view_conference_action_end": "End session",
"view_conference_action_join": "Join session",
"view_error_unable_join_student": "Unable to connect to the BigBlueButton server. Please contact your Teacher or the Administrator.",
"view_groups_selection_warning": "There is a conference room for each group and you have access to more than one. Be sure to select the correct one.",

View File

@ -32,6 +32,29 @@ export class AddonModBBBService {
static readonly COMPONENT = 'mmaModBigBlueButtonBN';
/**
* End a meeting.
*
* @param id BBB ID.
* @param groupId Group ID, 0 means that the function will determine the user group.
* @param siteId Site ID. If not defined, current site.
* @return Promise resolved when done.
*/
async endMeeting(
id: number,
groupId: number = 0,
siteId?: string,
): Promise<void> {
const site = await CoreSites.getSite(siteId);
const params: AddonModBBBEndMeetingWSParams = {
bigbluebuttonbnid: id,
groupid: groupId,
};
await site.write('mod_bigbluebuttonbn_end_meeting', params);
}
/**
* Get a BBB activity.
*
@ -349,3 +372,11 @@ export type AddonModBBBGetJoinUrlWSResponse = {
export type AddonModBBBViewBigBlueButtonBNWSParams = {
bigbluebuttonbnid: number; // Bigbluebuttonbn instance id.
};
/**
* Params of mod_bigbluebuttonbn_end_meeting WS.
*/
export type AddonModBBBEndMeetingWSParams = {
bigbluebuttonbnid: number; // Bigbluebuttonbn instance id.
groupid?: number; // Bigbluebuttonbn group id.
};